Commit 5407bc5d authored by Sebastian Kummer's avatar Sebastian Kummer

ZO-71 Save data from the OL plugin and display it in every Outlook

request and in z-push-admin.
parent 1a43ed4f
...@@ -69,6 +69,9 @@ class ASDevice extends StateObject { ...@@ -69,6 +69,9 @@ class ASDevice extends StateObject {
'announcedASversion' => false, 'announcedASversion' => false,
'foldersynccomplete' => true, 'foldersynccomplete' => true,
'additionalfolders' => array(), 'additionalfolders' => array(),
'olpluginversion' => false,
'olpluginbuild' => false,
'olpluginbuilddate' => false,
); );
static private $loadedData; static private $loadedData;
......
...@@ -100,6 +100,10 @@ class DeviceManager { ...@@ -100,6 +100,10 @@ class DeviceManager {
$this->stateManager->SetDevice($this->device); $this->stateManager->SetDevice($this->device);
$this->additionalFoldersHash = $this->getAdditionalFoldersHash(); $this->additionalFoldersHash = $this->getAdditionalFoldersHash();
if ($this->IsOutlookClient()) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Acacia OL Plugin: %s / %s / %s", $this->device->GetOLPluginVersion(), $this->device->GetOLPluginBuild(), strftime("%Y-%m-%d %H:%M", $this->device->GetOLPluginBuildDate())));
}
} }
/** /**
...@@ -149,6 +153,13 @@ class DeviceManager { ...@@ -149,6 +153,13 @@ class DeviceManager {
$this->device->SetUserAgent(Request::GetUserAgent()); $this->device->SetUserAgent(Request::GetUserAgent());
$this->device->SetASVersion(Request::GetProtocolVersion()); $this->device->SetASVersion(Request::GetProtocolVersion());
// update data from the OL plugin (if available)
if (Request::HasOLPluginStats()) {
$this->device->SetOLPluginVersion(Request::GetOLPluginVersion());
$this->device->SetOLPluginBuild(Request::GetOLPluginBuild());
$this->device->SetOLPluginBuildDate(Request::GetOLPluginBuildDate());
}
// data to be saved // data to be saved
$data = $this->device->GetData(); $data = $this->device->GetData();
if ($data && Request::IsValidDeviceID()) { if ($data && Request::IsValidDeviceID()) {
...@@ -659,7 +670,7 @@ class DeviceManager { ...@@ -659,7 +670,7 @@ class DeviceManager {
* @return boolean * @return boolean
*/ */
public function IsOutlookClient() { public function IsOutlookClient() {
if (Request::GetDeviceType() == "WindowsOutlook") { if (Request::GetDeviceType() == "WindowsOutlook" && $this->device->GetOLPluginVersion() !== false) {
return true; return true;
} }
return false; return false;
......
...@@ -54,6 +54,7 @@ class Request { ...@@ -54,6 +54,7 @@ class Request {
const NUMBERS_ONLY = 4; const NUMBERS_ONLY = 4;
const NUMBERSDOT_ONLY = 5; const NUMBERSDOT_ONLY = 5;
const HEX_EXTENDED = 6; const HEX_EXTENDED = 6;
const ISO8601 = 7;
/** /**
* Command parameters for base64 encoded requests (AS >= 12.1) * Command parameters for base64 encoded requests (AS >= 12.1)
...@@ -93,6 +94,9 @@ class Request { ...@@ -93,6 +94,9 @@ class Request {
static private $occurence; //TODO static private $occurence; //TODO
static private $saveInSent; static private $saveInSent;
static private $acceptMultipart; static private $acceptMultipart;
static private $olPluginVersion;
static private $olPluginBuild;
static private $olPluginBuildDate;
/** /**
...@@ -232,6 +236,13 @@ class Request { ...@@ -232,6 +236,13 @@ class Request {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request::ProcessHeaders() ASVersion: %s", self::$asProtocolVersion)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request::ProcessHeaders() ASVersion: %s", self::$asProtocolVersion));
if (isset(self::$headers["x-push-plugin"])) {
list($version, $build, $buildDate) = explode("/", self::$headers["x-push-plugin"]);
self::$olPluginVersion = self::filterEvilInput($version, self::NUMBERSDOT_ONLY);
self::$olPluginBuild = self::filterEvilInput($build, self::HEX_ONLY);
self::$olPluginBuildDate = strtotime(self::filterEvilInput($buildDate, self::ISO8601));
}
if (defined('USE_X_FORWARDED_FOR_HEADER') && USE_X_FORWARDED_FOR_HEADER == true && isset(self::$headers["x-forwarded-for"])) { if (defined('USE_X_FORWARDED_FOR_HEADER') && USE_X_FORWARDED_FOR_HEADER == true && isset(self::$headers["x-forwarded-for"])) {
$forwardedIP = self::filterEvilInput(self::$headers["x-forwarded-for"], self::NUMBERSDOT_ONLY); $forwardedIP = self::filterEvilInput(self::$headers["x-forwarded-for"], self::NUMBERSDOT_ONLY);
if ($forwardedIP) { if ($forwardedIP) {
...@@ -627,6 +638,7 @@ class Request { ...@@ -627,6 +638,7 @@ class Request {
else if ($filter == self::NUMBERS_ONLY) $re = "/[^0-9]/"; else if ($filter == self::NUMBERS_ONLY) $re = "/[^0-9]/";
else if ($filter == self::NUMBERSDOT_ONLY) $re = "/[^0-9\.]/"; else if ($filter == self::NUMBERSDOT_ONLY) $re = "/[^0-9\.]/";
else if ($filter == self::HEX_EXTENDED) $re = "/[^A-Fa-f0-9\:]/"; else if ($filter == self::HEX_EXTENDED) $re = "/[^A-Fa-f0-9\:]/";
else if ($filter == self::ISO8601) $re = "/[^\d{8}T\d{6}Z]/";
return ($re) ? preg_replace($re, $replacevalue, $input) : ''; return ($re) ? preg_replace($re, $replacevalue, $input) : '';
} }
...@@ -645,4 +657,53 @@ class Request { ...@@ -645,4 +657,53 @@ class Request {
fclose($input); fclose($input);
return $wbxml; return $wbxml;
} }
/**
* Indicates if the request contained the OL plugin stats header.
*
* @access public
* @return boolean
*/
static public function HasOLPluginStats() {
return isset(self::$olPluginVersion) && isset(self::$olPluginBuild) && isset(self::$olPluginBuildDate);
}
/**
* Returns the version number of the OL plugin informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginVersion() {
if (isset(self::$olPluginVersion))
return self::$olPluginVersion;
else
return self::UNKNOWN;
}
/**
* Returns the build of the OL plugin informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginBuild() {
if (isset(self::$olPluginBuild))
return self::$olPluginBuild;
else
return self::UNKNOWN;
}
/**
* Returns the build date of the OL plugin informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginBuildDate() {
if (isset(self::$olPluginBuildDate))
return self::$olPluginBuildDate;
else
return self::UNKNOWN;
}
} }
...@@ -861,6 +861,13 @@ class ZPushAdminCLI { ...@@ -861,6 +861,13 @@ class ZPushAdminCLI {
echo "WipeRequest by:\t\t". ($device->GetWipeRequestedBy() ? $device->GetWipeRequestedBy() : "not set")."\n"; echo "WipeRequest by:\t\t". ($device->GetWipeRequestedBy() ? $device->GetWipeRequestedBy() : "not set")."\n";
echo "Wiped on:\t\t". ($device->GetWipeActionOn() ? strftime("%Y-%m-%d %H:%M", $device->GetWipeActionOn()) : "not set")."\n"; echo "Wiped on:\t\t". ($device->GetWipeActionOn() ? strftime("%Y-%m-%d %H:%M", $device->GetWipeActionOn()) : "not set")."\n";
if ($device->GetOLPluginVersion()) {
echo "Acacia OL Plugin:\n";
echo "\tVersion:\t". $device->GetOLPluginVersion() ."\n";
echo "\tBuild:\t\t". $device->GetOLPluginBuild() ."\n";
echo "\tBuild Date:\t". strftime("%Y-%m-%d %H:%M",$device->GetOLPluginBuildDate()) ."\n";
}
echo "Attention needed:\t"; echo "Attention needed:\t";
if ($device->GetDeviceError()) if ($device->GetDeviceError())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment