First stages of SessionKey storage implemented
First stages of SessionKey storage implemented

--- a/Resources/info.php
+++ b/Resources/info.php
@@ -184,7 +184,7 @@
 
 ob_start();
 ?> 
-function getKey(){ return '<?php echo base64_encode(BTMain::getSessVar('tls'));?>'; }
+function getTLSKey(){ return '<?php echo base64_encode(BTMain::getSessVar('tls'));?>'; }
 
 
 function getDelimiter(){ return "|..|";}
@@ -195,7 +195,7 @@
 if (a == 'undefined' || a == 'null' || a == ''){
 return;}
 
-<?php foreach ($terms as $key=>$value){ echo "this.$value='".base64_encode($key) ."';"; }?>
+
 
 return this[a];
  }
@@ -215,16 +215,25 @@
 return window.destroyKeys = '';
 }
 
-function enabledEncryption(){
+function enabledTLSEncryption(){
 return <?php echo $enabled;?>;
 }
 
-
-
-
-
-
-
+function setStorage(){
+  if(typeof(Storage)!=="undefined"){
+	sessionStorage.setItem('key', getTLSKey());
+	sessionStorage.setItem('Terminology','{<?php foreach ($terms as $key=>$value){ echo "\"$value\":\"".base64_encode($key) ."\","; }?>"null":"null"}');
+	sessionStorage.setItem('CryptEnabled',enabledTLSEncryption());
+	sessionStorage.setItem('Delimiter',getDelimiter());
+    }else{
+    alert("You're using an out of date browser, this has a serious impact on security. Please use at least IE8, Firefox, Chrome or Safari");
+    }
+}
+
+
+
+
+setStorage();
 new getTerminology();
 <?php
 

--- a/Resources/main.js
+++ b/Resources/main.js
@@ -12,7 +12,7 @@
 */
 
 
-var counter=false, cancel='', dispcred, interval;
+var counter=false, cancel='', dispcred, interval,terms;
 
 
 
@@ -1090,11 +1090,24 @@
 
 
 function getDivider(){
+  
+    if(typeof(Storage)!=="undefined" && sessionStorage.Delimiter){
+	return sessionStorage.getItem('Delimiter');
+  }
+  
  return getDelimiter(); 
 }
 
 
 function getTerms(a){
+  
+  if(typeof(Storage)!=="undefined"){
+	if (!terms){
+      terms = JSON.parse(sessionStorage.getItem('Terminology'))
+	}
+      return Base64.decode(terms[a.toString()]);
+  }
+  
   return Base64.decode(getTerminology(a));
 }
 
@@ -1143,7 +1156,7 @@
 function checkKeyAvailable(){
  
   
- if(typeof getKey != 'function') {
+ if(!getKey && typeof getTLSKey != 'function') {
    
    if (confirm("Key retrieval failed - Attempting to rectify, Click OK to continue - Screen may refresh")){
    
@@ -1156,7 +1169,7 @@
    
    removeCurrKey();
    
-    if(typeof getKey == 'function') {
+    if(typeof getTLSKey == 'function') {
       alert("Keys retrieved successfully");
       return true;
       
@@ -1173,7 +1186,32 @@
   
 }
 
-
+function getKey(){ 
+  
+ if(typeof(Storage)!=="undefined" && sessionStorage.key){
+    return sessionStorage.getItem('key');
+  }else{
+    if(typeof getTLSKey != 'function'){
+     return false; 
+    }
+   return getTLSKey(); 
+  }
+    
+}
+
+function enabledEncryption(){
+  
+   if(typeof(Storage)!=="undefined" && sessionStorage.CryptEnabled){
+    return sessionStorage.getItem('CryptEnabled');
+  }else{
+    if(typeof enabledTLSEncryption != 'function'){
+     return false; 
+    }
+   return enabledTLSEncryption(); 
+  }
+  
+
+}