From eb5c81dea5a60bc65d3ec607daf5ad81fd709928 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 30 Sep 2014 23:13:49 +0200 Subject: store client name and last use time for tokens. show them in token management --- lib/client.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/client.php (limited to 'lib/client.php') 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 @@ + + * @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 + * @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 -- cgit v1.2.3