@@ -1,32 +1,32 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2016-2016 Andreas Heigl<[email protected]> |
|
4 | - * |
|
5 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | - * of this software and associated documentation files (the "Software"), to deal |
|
7 | - * in the Software without restriction, including without limitation the rights |
|
8 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | - * copies of the Software, and to permit persons to whom the Software is |
|
10 | - * furnished to do so, subject to the following conditions: |
|
11 | - * |
|
12 | - * The above copyright notice and this permission notice shall be included in |
|
13 | - * all copies or substantial portions of the Software. |
|
14 | - * |
|
15 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | - * THE SOFTWARE. |
|
22 | - * |
|
23 | - * @author Andreas Heigl<[email protected]> |
|
24 | - * @copyright 2016-2016 Andreas Heigl |
|
25 | - * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | - * @version 0.0 |
|
27 | - * @since 15.01.2016 |
|
28 | - * @link http://github.com/heiglandreas/callingallpapers |
|
29 | - */ |
|
3 | + * Copyright (c) 2016-2016 Andreas Heigl<[email protected]> |
|
4 | + * |
|
5 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | + * of this software and associated documentation files (the "Software"), to deal |
|
7 | + * in the Software without restriction, including without limitation the rights |
|
8 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | + * copies of the Software, and to permit persons to whom the Software is |
|
10 | + * furnished to do so, subject to the following conditions: |
|
11 | + * |
|
12 | + * The above copyright notice and this permission notice shall be included in |
|
13 | + * all copies or substantial portions of the Software. |
|
14 | + * |
|
15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | + * THE SOFTWARE. |
|
22 | + * |
|
23 | + * @author Andreas Heigl<[email protected]> |
|
24 | + * @copyright 2016-2016 Andreas Heigl |
|
25 | + * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | + * @version 0.0 |
|
27 | + * @since 15.01.2016 |
|
28 | + * @link http://github.com/heiglandreas/callingallpapers |
|
29 | + */ |
|
30 | 30 | require_once realpath(__DIR__ . '/../vendor/autoload.php'); |
31 | 31 | |
32 | 32 | $app = new \Slim\App; |
@@ -27,22 +27,22 @@ |
||
27 | 27 | * @since 15.01.2016 |
28 | 28 | * @link http://github.com/heiglandreas/callingallpapers |
29 | 29 | */ |
30 | -require_once realpath(__DIR__ . '/../vendor/autoload.php'); |
|
30 | +require_once realpath(__DIR__.'/../vendor/autoload.php'); |
|
31 | 31 | |
32 | 32 | session_start(); |
33 | 33 | |
34 | 34 | // Instantiate the app |
35 | -$settings = require __DIR__ . '/../config/settings.php'; |
|
35 | +$settings = require __DIR__.'/../config/settings.php'; |
|
36 | 36 | $app = new \Slim\App($settings); |
37 | 37 | |
38 | 38 | // Set up dependencies |
39 | -require __DIR__ . '/../config/dependencies.php'; |
|
39 | +require __DIR__.'/../config/dependencies.php'; |
|
40 | 40 | |
41 | 41 | // Register middleware |
42 | -require __DIR__ . '/../config/middleware.php'; |
|
42 | +require __DIR__.'/../config/middleware.php'; |
|
43 | 43 | |
44 | 44 | // Register routes |
45 | -require __DIR__ . '/../config/routes.php'; |
|
45 | +require __DIR__.'/../config/routes.php'; |
|
46 | 46 | |
47 | 47 | // Run app |
48 | 48 | $app->run(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ), 400); |
57 | 57 | } |
58 | 58 | $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' . |
59 | - 'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);'; |
|
59 | + 'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);'; |
|
60 | 60 | $statement = $this->pdo->prepare($statement); |
61 | 61 | |
62 | 62 | $values = [ |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | $statement = 'UPDATE `cfp` SET ' |
139 | - . implode(',', $statementElements) . ',' |
|
140 | - . '`lastUpdate` = :lastUpdate ' |
|
141 | - . 'WHERE `hash` = :fetchHash'; |
|
139 | + . implode(',', $statementElements) . ',' |
|
140 | + . '`lastUpdate` = :lastUpdate ' |
|
141 | + . 'WHERE `hash` = :fetchHash'; |
|
142 | 142 | $statement = $this->pdo->prepare($statement); |
143 | 143 | $values['fetchHash'] = $fetchHash; |
144 | 144 | $values['lastUpdate'] = (new \DateTime('now', new \DateTimezone('UTC')))->format('c'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $cfp->getEventUri() |
55 | 55 | ), 400); |
56 | 56 | } |
57 | - $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' . |
|
57 | + $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) '. |
|
58 | 58 | 'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);'; |
59 | 59 | $statement = $this->pdo->prepare($statement); |
60 | 60 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function update(Cfp $cfp, $fetchHash) |
89 | 89 | { |
90 | - if (! $fetchHash) { |
|
90 | + if (!$fetchHash) { |
|
91 | 91 | throw new \UnexpectedValueException('No Hash given', 400); |
92 | 92 | } |
93 | 93 | $oldValues = $this->select($fetchHash); |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | ]; |
117 | 117 | |
118 | 118 | foreach ($options as $option) { |
119 | - $method = 'get' . $option; |
|
119 | + $method = 'get'.$option; |
|
120 | 120 | if ($cfp->$method() != $oldValues->$method()) { |
121 | - $statementElements[] = '`' . $option . '` = :' . $option; |
|
121 | + $statementElements[] = '`'.$option.'` = :'.$option; |
|
122 | 122 | $values[$option] = $cfp->$method(); |
123 | 123 | if ($values[$option] instanceof \DateTimeInterface) { |
124 | 124 | $values[$option] = $values[$option]->format('c'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $statement = 'UPDATE `cfp` SET ' |
138 | - . implode(',', $statementElements) . ',' |
|
138 | + . implode(',', $statementElements).',' |
|
139 | 139 | . '`lastUpdate` = :lastUpdate ' |
140 | 140 | . 'WHERE `hash` = :fetchHash'; |
141 | 141 | $statement = $this->pdo->prepare($statement); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | \Psr\Http\Message\ResponseInterface $response |
42 | 42 | ) use ($app){ |
43 | 43 | $params = $request->getParsedBody(); |
44 | - if (! is_array($params)) { |
|
44 | + if (!is_array($params)) { |
|
45 | 45 | throw new UnexpectedValueException('Expected array'); |
46 | 46 | } |
47 | 47 | |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | $cpl->insert($cfp); |
55 | 55 | |
56 | 56 | $uri = $request->getUri(); |
57 | - $uri = $uri->withPath('v1/cfp/' . $cfp->getId()); |
|
57 | + $uri = $uri->withPath('v1/cfp/'.$cfp->getId()); |
|
58 | 58 | return $response->withRedirect((string)$uri, 201); |
59 | 59 | }); |
60 | 60 | |
61 | 61 | |
62 | -$app->put('/v1/cfp/{hash}', function ( |
|
62 | +$app->put('/v1/cfp/{hash}', function( |
|
63 | 63 | \Psr\Http\Message\ServerRequestInterface $request, |
64 | 64 | \Psr\Http\Message\ResponseInterface $response, |
65 | 65 | array $args |
66 | 66 | ) use ($app){ |
67 | 67 | $params = $request->getParsedBody(); |
68 | - if (! is_array($params)) { |
|
68 | + if (!is_array($params)) { |
|
69 | 69 | throw new UnexpectedValueException('Expected array'); |
70 | 70 | } |
71 | 71 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $cpl->update($cfp, $args['hash']); |
79 | 79 | |
80 | 80 | $uri = $request->getUri(); |
81 | - $uri = $uri->withPath('v1/cfp/' . $cfp->getId()); |
|
81 | + $uri = $uri->withPath('v1/cfp/'.$cfp->getId()); |
|
82 | 82 | return $response->withHeader('Location', (string)$uri)->withStatus(204); |
83 | 83 | }); |
84 | 84 | |
85 | 85 | |
86 | -$app->delete('/v1/cfp/{id}', function ( |
|
86 | +$app->delete('/v1/cfp/{id}', function( |
|
87 | 87 | \Psr\Http\Message\ServerRequestInterface $request, |
88 | 88 | \Psr\Http\Message\ResponseInterface $response |
89 | 89 | ) use ($app){ |
@@ -1,32 +1,32 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2016-2016 The callingallpapers.com Developer Team |
|
4 | - * |
|
5 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | - * of this software and associated documentation files (the "Software"), to deal |
|
7 | - * in the Software without restriction, including without limitation the rights |
|
8 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | - * copies of the Software, and to permit persons to whom the Software is |
|
10 | - * furnished to do so, subject to the following conditions: |
|
11 | - * |
|
12 | - * The above copyright notice and this permission notice shall be included in |
|
13 | - * all copies or substantial portions of the Software. |
|
14 | - * |
|
15 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | - * THE SOFTWARE. |
|
22 | - * |
|
23 | - * @author Andreas Heigl<[email protected]> |
|
24 | - * @copyright 2016-2016 The callingallpapers.com Developer Team |
|
25 | - * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | - * @version 0.0 |
|
27 | - * @since 16.01.2016 |
|
28 | - * @link https://github.com/joindin/callingallpapers |
|
29 | - */ |
|
3 | + * Copyright (c) 2016-2016 The callingallpapers.com Developer Team |
|
4 | + * |
|
5 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | + * of this software and associated documentation files (the "Software"), to deal |
|
7 | + * in the Software without restriction, including without limitation the rights |
|
8 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | + * copies of the Software, and to permit persons to whom the Software is |
|
10 | + * furnished to do so, subject to the following conditions: |
|
11 | + * |
|
12 | + * The above copyright notice and this permission notice shall be included in |
|
13 | + * all copies or substantial portions of the Software. |
|
14 | + * |
|
15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | + * THE SOFTWARE. |
|
22 | + * |
|
23 | + * @author Andreas Heigl<[email protected]> |
|
24 | + * @copyright 2016-2016 The callingallpapers.com Developer Team |
|
25 | + * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | + * @version 0.0 |
|
27 | + * @since 16.01.2016 |
|
28 | + * @link https://github.com/joindin/callingallpapers |
|
29 | + */ |
|
30 | 30 | |
31 | 31 | namespace Callingallpapers\Api\Middleware; |
32 | 32 |
@@ -1,32 +1,32 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2016-2016} Andreas Heigl<[email protected]> |
|
4 | - * |
|
5 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | - * of this software and associated documentation files (the "Software"), to deal |
|
7 | - * in the Software without restriction, including without limitation the rights |
|
8 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | - * copies of the Software, and to permit persons to whom the Software is |
|
10 | - * furnished to do so, subject to the following conditions: |
|
11 | - * |
|
12 | - * The above copyright notice and this permission notice shall be included in |
|
13 | - * all copies or substantial portions of the Software. |
|
14 | - * |
|
15 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | - * THE SOFTWARE. |
|
22 | - * |
|
23 | - * @author Andreas Heigl<[email protected]> |
|
24 | - * @copyright 2016-2016 Andreas Heigl |
|
25 | - * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | - * @version 0.0 |
|
27 | - * @since 16.01.2016 |
|
28 | - * @link http://github.com/heiglandreas/callingallpapers |
|
29 | - */ |
|
3 | + * Copyright (c) 2016-2016} Andreas Heigl<[email protected]> |
|
4 | + * |
|
5 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | + * of this software and associated documentation files (the "Software"), to deal |
|
7 | + * in the Software without restriction, including without limitation the rights |
|
8 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | + * copies of the Software, and to permit persons to whom the Software is |
|
10 | + * furnished to do so, subject to the following conditions: |
|
11 | + * |
|
12 | + * The above copyright notice and this permission notice shall be included in |
|
13 | + * all copies or substantial portions of the Software. |
|
14 | + * |
|
15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 | + * THE SOFTWARE. |
|
22 | + * |
|
23 | + * @author Andreas Heigl<[email protected]> |
|
24 | + * @copyright 2016-2016 Andreas Heigl |
|
25 | + * @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
26 | + * @version 0.0 |
|
27 | + * @since 16.01.2016 |
|
28 | + * @link http://github.com/heiglandreas/callingallpapers |
|
29 | + */ |
|
30 | 30 | namespace Callingallpapers\Api\Renderer; |
31 | 31 | |
32 | 32 | use Psr\Http\Message\ResponseInterface; |
@@ -56,7 +56,7 @@ |
||
56 | 56 | 'uri' => 'http://andreas.heigl.org', |
57 | 57 | ]); |
58 | 58 | $feed->setDateModified(time()); |
59 | - if (! isset($data['cfps'])) { |
|
59 | + if (!isset($data['cfps'])) { |
|
60 | 60 | $data['cfps'] = []; |
61 | 61 | } |
62 | 62 | foreach ($data['cfps'] as $cfp) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function render(ResponseInterface $response, array $data = [], $status = 200) |
46 | 46 | { |
47 | 47 | $icalendar = new VCalendar(); |
48 | - if (! isset($data['cfps'])) { |
|
48 | + if (!isset($data['cfps'])) { |
|
49 | 49 | $data['cfps'] = []; |
50 | 50 | } |
51 | 51 | foreach ($data['cfps'] as $cfp) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'DTSTAMP' => $lastChange, |
67 | 67 | 'UID' => $cfp['_rel']['cfp_uri'], |
68 | 68 | 'DESCRIPTION' => $cfp['description'], |
69 | - 'GEO' => round($cfp['latitude'], 6) . ';' . round($cfp['longitude'], 6), |
|
69 | + 'GEO' => round($cfp['latitude'], 6).';'.round($cfp['longitude'], 6), |
|
70 | 70 | 'LOCATION' => $cfp['location'], |
71 | 71 | |
72 | 72 | ]); |