Register CSS files via API
[grauphel.git] / lib / client.php
1 <?php
2 /**
3  * Part of grauphel
4  *
5  * PHP version 5
6  *
7  * @category  Tools
8  * @package   Grauphel
9  * @author    Christian Weiske <cweiske@cweiske.de>
10  * @copyright 2014 Christian Weiske
11  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12  * @link      http://cweiske.de/grauphel.htm
13  */
14 namespace OCA\Grauphel\Lib;
15
16 /**
17  * Client identification helper
18  *
19  * @category  Tools
20  * @package   Grauphel
21  * @author    Christian Weiske <cweiske@cweiske.de>
22  * @copyright 2014 Christian Weiske
23  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
24  * @version   Release: @package_version@
25  * @link      http://cweiske.de/grauphel.htm
26  */
27 class Client
28 {
29     public function getClient()
30     {
31         if (isset($_SERVER['HTTP_X_TOMBOY_CLIENT'])) {
32             $client = $_SERVER['HTTP_X_TOMBOY_CLIENT'];
33             $doublepos = strpos($client, ', org.tomdroid');
34             if ($doublepos !== false) {
35                 //https://bugs.launchpad.net/tomdroid/+bug/1375436
36                 //X-Tomboy-Client header is sent twice
37                 $client = substr($client, 0, $doublepos);
38             }
39             return $client;
40         }
41
42         return false;
43     }
44
45     public function getNiceName($client)
46     {
47         if (substr($client, 0, 12) == 'org.tomdroid') {
48             //org.tomdroid v0.7.5, build 14, Android v4.4.2, innotek GmbH/VirtualBox
49             return 'Tomdroid';
50         }
51         return $client;
52     }
53
54 }
55 ?>