1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright (c) Andreas Heigl<[email protected]> |
5
|
|
|
* |
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
8
|
|
|
* in the Software without restriction, including without limitation the rights |
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
11
|
|
|
* furnished to do so, subject to the following conditions: |
12
|
|
|
* |
13
|
|
|
* The above copyright notice and this permission notice shall be included in |
14
|
|
|
* all copies or substantial portions of the Software. |
15
|
|
|
* |
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22
|
|
|
* THE SOFTWARE. |
23
|
|
|
* |
24
|
|
|
* @author Andreas Heigl<[email protected]> |
25
|
|
|
* @copyright Andreas Heigl |
26
|
|
|
* @license http://www.opesource.org/licenses/mit-license.php MIT-License |
27
|
|
|
* @version 0.0 |
28
|
|
|
* @since 06.03.2012 |
29
|
|
|
* @link http://github.com/heiglandreas/OrgHeiglMailproxy |
30
|
|
|
*/ |
31
|
|
|
namespace Org_Heigl\Mailproxy\Controller; |
32
|
|
|
|
33
|
|
|
use Zend\Http\Response; |
34
|
|
|
use Zend\Mvc\Controller\AbstractActionController; |
35
|
|
|
use Zend\Uri\Mailto; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* A controller that proxies mailto-requests |
39
|
|
|
* |
40
|
|
|
* @author Andreas Heigl<[email protected]> |
41
|
|
|
* @copyright Andreas Heigl |
42
|
|
|
* @license http://www.opesource.org/licenses/mit-license.php MIT-License |
43
|
|
|
* @version 0.0 |
44
|
|
|
* @since 06.03.2012 |
45
|
|
|
* @link http://github.com/heiglandreas/OrgHeiglMailproxy |
46
|
|
|
*/ |
47
|
|
|
class ProxyController extends AbstractActionController |
48
|
|
|
{ |
49
|
|
|
/** |
50
|
|
|
* Proxy a given http-request to a mailto-request |
51
|
|
|
*/ |
52
|
|
|
public function indexAction() : Response |
53
|
|
|
{ |
54
|
|
|
$params = $this->getEvent()->getRouteMatch()->getParams(); |
55
|
|
|
$id = $params['id']; |
56
|
|
|
unset($params['id']); |
57
|
|
|
unset($params['controller']); |
58
|
|
|
unset($params['action']); |
59
|
|
|
$querystring = http_build_query($params); |
60
|
|
|
$mailtoUri = 'mailto:' . strrev($id) . '?' . $querystring; |
61
|
|
|
$redirect = new Mailto($mailtoUri); |
62
|
|
|
|
63
|
|
|
return $this->redirect()->toUrl($redirect); |
64
|
|
|
|
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|