Optimized Funambol recognition

This commit is contained in:
Jörg Lehrke 2010-01-05 10:09:47 +00:00
parent 946ecb41b2
commit ed519fda33

View File

@ -240,12 +240,16 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
if (preg_match("/^\s*Funambol (.*) [^\d]*(\d+\.?\d*)[\.|\d]*\s*$/i", $ua, $matches)) { if (($pos = strpos($ua, 'Funambol'))!== false) {
// Funambol uses the hardware Manufacturer we don't care about
$this->_deviceInfo['manufacturer'] = 'Funambol'; $this->_deviceInfo['manufacturer'] = 'Funambol';
$this->_deviceInfo['model'] = 'generic';
$this->_deviceInfo['softwareVersion'] = 3.1; // force special treatment
$type = substr($ua, $pos + 9);
if (preg_match("/^(.*) [^\d]*(\d+\.?\d*)[\.|\d]*\s*$/i", $type, $matches)) {
// Funambol uses the hardware Manufacturer we don't care about
$this->_deviceInfo['model'] = trim($matches[1]); $this->_deviceInfo['model'] = trim($matches[1]);
$this->_deviceInfo['softwareVersion'] = floatval($matches[2]); $this->_deviceInfo['softwareVersion'] = floatval($matches[2]);
}
if (!isset($this->_deviceInfo['deviceType'])) { if (!isset($this->_deviceInfo['deviceType'])) {
switch (strtolower(trim($matches[1]))) { switch (strtolower(trim($matches[1]))) {
case 'pocket pc plug-in': case 'pocket pc plug-in':
@ -257,6 +261,7 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
break; break;
} }
} }
} }
switch (strtolower($this->_deviceInfo['deviceID'])) { switch (strtolower($this->_deviceInfo['deviceID'])) {