diff options
Diffstat (limited to 'lib/client.php')
| -rw-r--r-- | lib/client.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/client.php b/lib/client.php new file mode 100644 index 0000000..358e60b --- /dev/null +++ b/lib/client.php @@ -0,0 +1,55 @@ +<?php +/** + * Part of grauphel + * + * PHP version 5 + * + * @category Tools + * @package Grauphel + * @author Christian Weiske <cweiske@cweiske.de> + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @link http://cweiske.de/grauphel.htm + */ +namespace OCA\Grauphel\Lib; + +/** + * Client identification helper + * + * @category Tools + * @package Grauphel + * @author Christian Weiske <cweiske@cweiske.de> + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @version Release: @package_version@ + * @link http://cweiske.de/grauphel.htm + */ +class Client +{ + public function getClient() + { + if (isset($_SERVER['HTTP_X_TOMBOY_CLIENT'])) { + $client = $_SERVER['HTTP_X_TOMBOY_CLIENT']; + $doublepos = strpos($client, ', org.tomdroid'); + if ($doublepos !== false) { + //https://bugs.launchpad.net/tomdroid/+bug/1375436 + //X-Tomboy-Client header is sent twice + $client = substr($client, 0, $doublepos); + } + return $client; + } + + return false; + } + + public function getNiceName($client) + { + if (substr($client, 0, 12) == 'org.tomdroid') { + //org.tomdroid v0.7.5, build 14, Android v4.4.2, innotek GmbH/VirtualBox + return 'Tomdroid'; + } + return $client; + } + +} +?>
\ No newline at end of file |
