diff options
Diffstat (limited to 'endpoints')
-rw-r--r-- | endpoints/language.php | 60 | ||||
-rw-r--r-- | endpoints/lib/config.php | 2 | ||||
-rw-r--r-- | endpoints/lib/language.php | 4 | ||||
-rw-r--r-- | endpoints/lib/vboxconnector.php | 18 |
4 files changed, 47 insertions, 37 deletions
diff --git a/endpoints/language.php b/endpoints/language.php index a8eb1c6..e0769c6 100644 --- a/endpoints/language.php +++ b/endpoints/language.php @@ -3,7 +3,7 @@ * Injects language translations into phpVirtualBox as a JavaScript object and
* provides interface translation logic
* Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- *
+ *
* $Id: language.php 595 2015-04-17 09:50:36Z imoore76 $
*/
@@ -40,52 +40,78 @@ echo('var __vboxLangData = ' . json_encode(__vbox_language::$langdata) .";\n\nva // Failsafe wrapper
function trans(s,c,n,h) {
+ if(s && c && c.constructor === Array) {
+ o = c.shift();
+ n = c.shift();
+ h = c.shift();
+ c = o;
+ }
if(!c) c = 'VBoxGlobal';
var r = transreal(s,c,n,h);
-
- if(typeof r != 'string') {
+
+ if(typeof r != 'string') {
+ // console.log('Could not translate ' + s + ' with ' + c);
return s;
}
-
+
return r;
}
function transreal(w,context,number,comment) {
-
+
try {
-
+
if(__vboxLangData['contexts'][context]['messages'][w]['translation']) {
-
+
if(__vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform']) {
-
+
var t = __vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform'];
-
+
if(!number) number = 1;
-
+
if(number <= 1 && t[0]) return t[0];
if(number > 1 && t[1]) return t[1];
if(t[0]) return t[0];
return t[1];
}
+ /*
+ if (__vboxLangData['contexts'][context]['messages'][w] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr']['type'] == 'obsolete') {
+ console.log(w + ' in ' + context + ' is obsolete');
+ }
+ */
return __vboxLangData['contexts'][context]['messages'][w]['translation'];
-
+
} else if(__vboxLangData['contexts'][context]['messages'][w][0]) {
-
+
if(comment) {
for(var i in __vboxLangData['contexts'][context]['messages'][w]) {
- if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
+ if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) {
+ /*
+ if (__vboxLangData['contexts'][context]['messages'][w][i]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][i]['translation_attr']['type'] == 'obsolete') {
+ console.log(w + ' ' + ' and ' + comment + ' is obsolete');
+ }
+ */
+
+ return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
+ }
}
}
+ /*
+ if (__vboxLangData['contexts'][context]['messages'][w][0] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr']['type'] == 'obsolete') {
+ console.log(w + ' in ' + context + ' is obsolete');
+ }
+ */
+
return __vboxLangData['contexts'][context]['messages'][w][0]['translation'];
-
+
} else {
return w;
}
-
+
} catch(err) {
- // alert(w + ' - ' + context + ': ' + err);
+ // console.log(w + ' - ' + context + ': ' + err);
return w;
- }
+ }
}
diff --git a/endpoints/lib/config.php b/endpoints/lib/config.php index 4cb4ee2..ebe34c2 100644 --- a/endpoints/lib/config.php +++ b/endpoints/lib/config.php @@ -14,7 +14,7 @@ /*
* This version of phpVirtualBox
*/
-define('PHPVBOX_VER', '5.0-1');
+define('PHPVBOX_VER', '5.0-2');
class phpVBoxConfigClass {
diff --git a/endpoints/lib/language.php b/endpoints/lib/language.php index 4e5b6b4..da8241b 100644 --- a/endpoints/lib/language.php +++ b/endpoints/lib/language.php @@ -68,9 +68,9 @@ class __vbox_language { }
- self::$langdata = unserialize(file_get_contents(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat'));
+ self::$langdata = unserialize(@file_get_contents(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat'));
- $xmlObj = simplexml_load_string(file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
+ $xmlObj = simplexml_load_string(@file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
$arrXml = $this->objectsIntoArray($xmlObj);
$lang = array();
diff --git a/endpoints/lib/vboxconnector.php b/endpoints/lib/vboxconnector.php index c813f78..c1d6cd7 100644 --- a/endpoints/lib/vboxconnector.php +++ b/endpoints/lib/vboxconnector.php @@ -1463,8 +1463,6 @@ class vboxconnector { $m->setExtraData('phpvb/icon', $args['customIcon']); }
- $m->setExtraData('GUI/SaveMountedAtRuntime', ($args['GUI']['SaveMountedAtRuntime'] == 'no' ? 'no' : 'yes')); - // VRDE settings try { if($m->VRDEServer && $this->vbox->systemProperties->defaultVRDEExtPack) { @@ -1914,8 +1912,6 @@ class vboxconnector { $m->VRAMSize = $args['VRAMSize']; - $m->setExtraData('GUI/SaveMountedAtRuntime', ($args['GUI']['SaveMountedAtRuntime'] == 'no' ? 'no' : 'yes')); - // Video $m->accelerate3DEnabled = $args['accelerate3DEnabled']; $m->accelerate2DVideoEnabled = $args['accelerate2DVideoEnabled']; @@ -2360,7 +2356,6 @@ class vboxconnector { // progress operation result $response = array(); - $success = 1; $error = 0; // Connect to vboxwebsrv @@ -2382,7 +2377,6 @@ class vboxconnector { } catch (Exception $e) { $this->errors[] = $e; throw new Exception('Could not obtain progress operation: '.$args['progress']); - $success = 0; } $response['progress'] = $args['progress']; @@ -2428,16 +2422,9 @@ class vboxconnector { } } catch (Exception $null) {} - // Some progress operations seem to go away after completion - if(!($this->session->handle && (string)$this->session->state == 'Unlocked')) { - $this->errors[] = $e; - $success = 0; - } - } if($error) { - $success = 0; if(@$args['catcherrs']) $response['error'] = $error; else $this->errors[] = new Exception($error['message']); @@ -3832,7 +3819,6 @@ class vboxconnector { $this->session->machine->setExtraData('VBoxAuthSimple/users/'.$_SESSION['user'].'', $_SESSION['uHash']); // Always set - $this->session->machine->setExtraData('GUI/SaveMountedAtRuntime', 'yes'); $this->session->machine->setExtraData('GUI/FirstRun', 'yes'); try { @@ -4261,8 +4247,7 @@ class vboxconnector { 'bootOrder' => $this->_machineGetBootOrder($m), 'chipsetType' => (string)$m->chipsetType, 'GUI' => array( - 'SaveMountedAtRuntime' => $m->getExtraData('GUI/SaveMountedAtRuntime'), - 'FirstRun' => $m->getExtraData('GUI/FirstRun') + 'FirstRun' => $m->getExtraData('GUI/FirstRun'), ), 'customIcon' => (@$this->settings->enableCustomIcons ? $m->getExtraData('phpvb/icon') : ''), 'disableHostTimeSync' => intval($m->getExtraData("VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled")), @@ -5358,7 +5343,6 @@ class vboxconnector { /* @var $machine IMachine */ $machine = $this->vbox->findMachine($args['vm']); $state = (string)$machine->sessionState; - $save = (strtolower($machine->getExtraData('GUI/SaveMountedAtRuntime')) == 'yes'); // create session $this->session = $this->websessionManager->getSessionObject($this->vbox->handle); |