diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-09-30 23:13:49 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-09-30 23:13:49 +0200 |
| commit | eb5c81dea5a60bc65d3ec607daf5ad81fd709928 (patch) | |
| tree | 81407f1e67adba222a020e142d0ebfb15a3f5ef3 /lib/client.php | |
| parent | f38e545235173bb145e4b1c9c29dc2960a0a3389 (diff) | |
| download | grauphel-eb5c81dea5a60bc65d3ec607daf5ad81fd709928.tar.gz grauphel-eb5c81dea5a60bc65d3ec607daf5ad81fd709928.zip | |
store client name and last use time for tokens. show them in token management
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 |
