diff --git a/build/portal/html/classes/template.class.php b/build/portal/html/classes/template.class.php
index cbfc135..ea3c8d7 100644
--- a/build/portal/html/classes/template.class.php
+++ b/build/portal/html/classes/template.class.php
@@ -46,12 +46,16 @@
// PUT THE TEMPLATE TOGETHER
- function display($page) {
+ function display() {
+ $common = new Common($this);
+
// Load the master template.
$master = $this->readTemplate('master.tpl.php');
// Load the template for the requested page.
- $page = $this->readTemplate($page.'.tpl.php');
+ $page = $this->readTemplate($common->removeExtension($_SERVER["SCRIPT_NAME"]).'.tpl.php');
+
+ print_r($pageData);
$output = $this->mergeAreas($master, $page);
$output = $this->mergeSettings($output);
@@ -62,7 +66,7 @@
// Insert page ID mainly used to mark an active navigation link when using Bootstrap.
$output = str_replace("{template:pageId}", $common->removeExtension($_SERVER["SCRIPT_NAME"])."-link", $output);
- return $output;
+ echo $output;
}
@@ -71,17 +75,17 @@
// Return the contents of the requested template.
function readTemplate($template) {
$common = new Common($this);
- return file_get_contents($_SERVER['DOCUMENT_ROOT']."/templates/".$common->getSetting('language')."/".$template, "r");
+ return file_get_contents($_SERVER['DOCUMENT_ROOT']."/templates/".$common->getSetting('template')."/".$template, "r");
}
function mergeAreas($master, $template) {
- $pattern = '\{area:(.*)/\}#U';
- preg_match_all($pattern, $master, $areas, PREG_PATTERN_ORDER);
+ $pattern = '/\{area:(.*)\}/';
+ preg_match_all($pattern, $master, $areas);
foreach ($areas[0] as $element) {
- $id = extractString($element, ':', '}');
+ $id = $this->extractString($element, ':', '}');
if (strpos($template, '{area:'.$id.'/}') !== TRUE) {
- $content = extractString($template, '{area:'.$id.'}', '{/area}');
+ $content = $this->extractString($template, '{area:'.$id.'}', '{/area}');
$master = str_replace("{area:'.$id.'}", $content, $master);
} else {
$master = str_replace("{area:'.$id.'}", "", $master);
@@ -92,10 +96,10 @@
function mergeSettings($output) {
$common = new Common($this);
- $pattern = '\{setting:(.*)/\}#U';
+ $pattern = '/\{setting:(.*)\}/';
preg_match_all($pattern, $output, $settings, PREG_PATTERN_ORDER);
foreach ($settings[0] as $element) {
- $name = extractString($element, ':', '}');
+ $name = $this->extractString($element, ':', '}');
$value = $common->getSetting($name);
$output = str_replace("{setting:'.$name.'}", $value, $output);
}
@@ -103,14 +107,14 @@
}
function mergeStrings($output) {
-
+ return $output;
}
function mergePageData($output) {
- $pattern = '\{page:(.*)/\}#U';
+ $pattern = '/\{page:(.*)\}/';
preg_match_all($pattern, $output, $pageVariables, PREG_PATTERN_ORDER);
foreach ($pageVariables[0] as $element) {
- $variable = extractString($element, ':', '}');
+ $variable = $this->extractString($element, ':', '}');
foreach ($pageData as $key => $value) {
if ($key == $variable) {
$output = str_replace("{page:'.$variable.'}", $value, $output);
@@ -120,7 +124,7 @@
}
function removeComments($output) {
- $pattern = '\{\*:(.*)/\*\}#U';
+ $pattern = '/\{\*(.*)\*\}/';
preg_match_all($pattern, $output, $comments, PREG_PATTERN_ORDER);
foreach ($comments[0] as $element) {
$output = str_replace($element, "", $output);
@@ -140,11 +144,11 @@
$operator == "neq";
}
- $ifThis = extractString($element, "{if ", " ");
+ $ifThis = $this->extractString($element, "{if ", " ");
if (strpos($element, 'setting:') !== FALSE) {
- $ifThis = $common->getSetting(extractString($element, "{if setting:", " "));
+ $ifThis = $common->getSetting($this->extractString($element, "{if setting:", " "));
} elseif (strpos($element, 'page:') !== FALSE) {
- $variable = extractString($element, "{if page:", " ");
+ $variable = $this->extractString($element, "{if page:", " ");
foreach ($pageData as $key => $value) {
if ($key == $variable) {
$ifThis = $value;
@@ -152,8 +156,8 @@
}
}
- $that = extractString($element, " ".$operator." ", "}")
- $content = extractString($element, "}", "{/if}")
+ $that = $this->extractString($element, " ".$operator." ", "}");
+ $content = $this->extractString($element, "}", "{/if}");
if ($operator == "eq") {
if ($ifThis == $that) {
diff --git a/build/portal/html/data/settings.xml b/build/portal/html/data/settings.xml
index befc135..1157162 100644
--- a/build/portal/html/data/settings.xml
+++ b/build/portal/html/data/settings.xml
@@ -44,8 +44,4 @@
networkInterface
eth0
-
- language
- en-us
-
diff --git a/build/portal/html/system.php b/build/portal/html/system.php
index 4b60954..00e0ac3 100644
--- a/build/portal/html/system.php
+++ b/build/portal/html/system.php
@@ -44,5 +44,5 @@
$pageData['title'] = "System Information";
$template->pageData = $pageData;
- $template->display("system");
+ $template->display();
?>