public static function BuildStandardSearch($page, $list = 1) { $tpl = new Template("lib/JPF/templates/Search.tpl"); $tpl->DefineBlock("SEARCHBLOCK"); $tpl->setVars("SEARCHBLOCK", "SEARCHPAGE", $page); $tpl->setVars("SEARCHBLOCK", "LIST", $list); $parsed = $tpl->ParseBlock("SEARCHBLOCK"); return $parsed; }
public static function getTest() { $navpanel = (require self::$appDir . '/config/navpanel.php'); $template = new Template('layout'); $template->setVars(['navpanel' => $navpanel]); $template->setVars(['contents' => file_get_contents(self::$appDir . '/views/static/test.html')]); self::$appOutput = $template->getContents(); self::out(); }
public function BuildStandardFileEditor() { $tpl = new Template("Lib/JPF/templates/FileEditor.tpl"); $tpl->DefineBlock("FORMBLOCK"); $tpl->DefineBlock("TXTAREA"); $content = file_get_contents($this->file); $tpl->setVars("TXTAREA", "CONTENT", $content); $txtarea = $tpl->ParseBlock("TXTAREA"); $tpl->setVars("FORMBLOCK", "CONTENT", $txtarea); return $tpl->ParseBlock("FORMBLOCK"); }
public static function getExamplejson() { $template = new Template('example', 'json'); $template->setVars(['EXAMPLE_VALUE' => 'This is an example of substituted value']); self::$appOutput = $template->getContents(); self::out(); }
function BuildStandardLogin() { $tpl = new Template("Lib/JPF/templates/Login.tpl"); $tpl->DefineBlock("LOGINBLOCK"); $tpl->setVars("LOGINBLOCK", "POSTPAGE", "LoginPost.php"); $hiddenHTM = $this->BuildSessionVars(); $parsed = $tpl->ParseBlock("LOGINBLOCK"); $parsed = $parsed . $hiddenHTM; return $parsed; }
public function __construct($username, $database) { $this->username = $username; $this->database = $database; $this->html = ''; $this->commands = array(); $menu = array('hosts' => array('label' => _('Hosts'), 'link' => 'page=hosts'), 'vms' => array('label' => _('Virtual Machines'), 'link' => 'page=vms')); $tpl = new Template('block_menu.html'); foreach ($menu as $data) { $tpl->setVars(array('label' => htmlentities($data['label']), 'link' => $data['link'])); $tpl->parse('menuitem'); } $tpl->setVar('label_logout', _('Logout')); $this->html = $tpl->get(); }
$config_values = file_get_contents('config.json'); $data = json_decode($config_values); $config_data = get_object_vars($data); $config_env_data = get_object_vars($config_data['production']); $cdata = get_object_vars($config_env_data['EnvironmentConfig']); if ($_GET["auth"] != $cdata['friendmail']) { header('X-PHP-Response-Code: 404', true, 404); exit; } require 'libs/PHPMailer/PHPMailerAutoload.php'; require 'libs/Template.php'; $config = array('host' => $cdata['host'], 'username' => $cdata['username'], 'password' => $cdata['password'], 'subject' => $cdata['subject']); $request_body = file_get_contents('php://input'); $data = json_decode($request_body); $view = new Template(); $view->setVars(get_object_vars($data)); $to = get_object_vars($data); $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = $config['host']; $mail->SMTPAuth = true; $mail->Username = $config['username']; $mail->Password = $config['password']; $mail->SMTPSecure = 'tls'; $mail->WordWrap = 100; $mail->isHTML(true); $mail->Subject = $config['subject']; $mail->CharSet = 'UTF-8'; $mail->SetFrom("*****@*****.**"); $mail->Body = $view->render('sendfriend-template.tpl'); $mail->addAddress($to['friendemail']);
private function nohosts() { $tpl = new Template('page_hosts_nohosts.html'); $tpl->setVars(array('label_hosts' => _('Hosts'), 'text_nohosts' => _('You do not have any hosts defined. Please use the button below to add an ESX host.'), 'label_addhost' => _('Add host'))); $this->html['content'] = $tpl->get(); }
private function singlevm($host, $vm) { global $config; $hostobj = $this->database->gethost($host); $this->title = sprintf(_('Virtual machine %s'), $vm); if (!isset($_SESSION['hosts'][$host]['vm'][$vm])) { return $this->vmlist(); } $ipaddresses = array(); if (isset($_SESSION['hosts'][$host]['vm'][$vm]['guest']->net) && isset($_SESSION['hosts'][$host]['vm'][$vm]['guest']->net->ipConfig)) { foreach ($_SESSION['hosts'][$host]['vm'][$vm]['guest']->net->ipConfig as $ipconfig) { if (isset($ipconfig->ipAddress)) { $ipaddresses[] = $ipconfig->ipAddress; } } } if (isset($guest->ipAddress)) { $ipaddresses[] = $guest->ipAddress; } $tpl = new Template('page_vms_singlevm.html'); /* Summary */ $tpl->setVars(array('label_summary' => _('Summary'), 'label_guestos' => _('Guest OS'), 'guestos' => $_SESSION['hosts'][$host]['vm'][$vm]['config']->guestFullName, 'label_vmversion' => _('VM version'), 'vmversion' => $_SESSION['hosts'][$host]['vm'][$vm]['config']->version, 'label_cpu' => _('CPU'), 'cpu' => sprintf(_('%d vCPU'), $_SESSION['hosts'][$host]['vm'][$vm]['config']->hardware->numCPU), 'label_memory' => _('Memory'), 'memory' => readable_bytes($_SESSION['hosts'][$host]['vm'][$vm]['config']->hardware->memoryMB . 'MB'), 'label_tools' => _('VMware tools'), 'tools' => VirtualMachineToolsRunningStatus($_SESSION['hosts'][$host]['vm'][$vm]['guest']->toolsRunningStatus), 'label_ipaddresses' => _('IP addresses'), 'ipaddresses' => implode(', ', $ipaddresses), 'label_dnsname' => _('DNS name'), 'dnsname' => isset($_SESSION['hosts'][$host]['vm'][$vm]['guest']->hostName) ? $_SESSION['hosts'][$host]['vm'][$vm]['guest']->hostName : '', 'label_state' => _('State'), 'state' => VirtualMachinePowerState($_SESSION['hosts'][$host]['vm'][$vm]['runtime']->powerState), 'label_host' => _('Host'), 'host' => $host, 'label_vm' => sprintf(_('Virtual Machine %s'), $vm), 'name' => $vm)); /* Actions */ $tpl->setVar('label_actions', _('Actions')); if ($_SESSION['hosts'][$host]['vm'][$vm]['runtime']->powerState == 'poweredOn') { $tpl->setVar('label_poweroff', _('Power off')); $tpl->parse('poweroff'); $tpl->setVar('label_suspend', _('Suspend')); $tpl->parse('suspend'); $tpl->setVar('label_reset', _('Reset')); $tpl->parse('reset'); if ($_SESSION['hosts'][$host]['vm'][$vm]['guest']->toolsRunningStatus == 'guestToolsRunning') { $tpl->setVar('label_shutdown', _('Shutdown guest')); $tpl->parse('shutdown'); } else { $tpl->hideBlock('shutdown'); } if ($GLOBALS['config']['console'] && $hostobj['console'] && preg_match('/(Linux|Windows)/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/(Chrome|Firefox|MSIE)/', $_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/Windows/', $_SERVER['HTTP_USER_AGENT'])) { $tpl->setVar('downloadlink', '?download=windows'); } else { if (preg_match('/x86_64/', $_SERVER['HTTP_USER_AGENT'])) { $tpl->setVar('downloadlink', '?download=linux64'); } else { $tpl->setVar('downloadlink', '?download=linux32'); } } $tpl->setVar('label_openconsole', _('Open console')); $tpl->setVar('label_plugindownload', _('Download console plugin')); $tpl->parse('openconsole'); $this->commands[] = '$(\'span#consolebutton\').css(\'display\', has_plugin() ? \'block\' : \'none\');'; $this->commands[] = '$(\'span#plugindownload\').css(\'display\', has_plugin() ? \'none\' : \'block\');'; } else { $tpl->hideBlock('openconsole'); } $tpl->hideBlock('poweron'); } else { $tpl->setVar('label_poweron', _('Power on')); $tpl->parse('poweron'); $tpl->hideBlock('poweroff'); $tpl->hideBlock('suspend'); $tpl->hideBlock('reset'); $tpl->hideBlock('shutdown'); $tpl->hideBlock('openconsole'); } $tpl->setVar('label_editsettings', _('Edit settings')); $tpl->parse('editsettings'); $tpl->setVar('label_deletevm', _('Delete virtual machine')); /* Resources */ $tpl->setVar('label_resources', _('Resources')); /* Performance */ $tpl->setVar('label_performance', _('Performance')); /* Tabs */ $tpl->setVar('tabcontent_gettingstarted', 'Getting started!!'); $tpl->setVar('tabcontent_summary', 'Summary!'); $tpl->setVar('tabcontent_performance', 'Performance!'); $this->html['content'] = $tpl->get(); }
<?php /* * Imports trough JimberLibs */ $debug = 1; require_once 'lib/JimberLibs.php'; libadd("lib.Jimber"); libadd("lib.Jimber.Data.MySQL"); //requireLogin(0); /* * Start of page specific stuff */ $tpl = new Template("templates/page.tpl"); $tpl->DefineBlock("PAGEBLOCK"); $tpl->DefineBlock("CONTENTBLOCK"); $tpl->setVars("PAGEBLOCK", "CONTENT", $tpl->ParseBlock("CONTENTBLOCK")); $page = $tpl->ParseBlock("PAGEBLOCK"); $tpl->Show($page);