@@ -47,6 +47,6 @@ |
||
47 | 47 | </content> |
48 | 48 | </article> |
49 | 49 | </div> |
50 | - <?php include 'templates/nav-bottom.php';?> |
|
50 | + <?php include 'templates/nav-bottom.php'; ?> |
|
51 | 51 | </div> |
52 | -<?php include 'templates/footer.php';?> |
|
53 | 52 | \ No newline at end of file |
53 | +<?php include 'templates/footer.php'; ?> |
|
54 | 54 | \ No newline at end of file |
@@ -129,7 +129,7 @@ |
||
129 | 129 | <?php |
130 | 130 | if(is_file(realpath(__DIR__ . '/..') . '/piwik-script.html')) |
131 | 131 | { |
132 | - include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
132 | + include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
133 | 133 | } |
134 | 134 | ?> |
135 | 135 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | crossorigin="anonymous"></script> |
6 | 6 | <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> |
7 | 7 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> |
8 | - <script src="<?php echo $baseUrl;?>js/jQueryEmoji.js"></script> |
|
8 | + <script src="<?php echo $baseUrl; ?>js/jQueryEmoji.js"></script> |
|
9 | 9 | |
10 | 10 | <script> |
11 | 11 | //BackButton |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | window.history.back(); |
15 | 15 | } |
16 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
16 | + <?php if(isset($includeEmojiAndAjax)) { ?> |
|
17 | 17 | $(document).ready(function() |
18 | 18 | { |
19 | 19 | //Transform UTF-8 Emoji to img |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | function getMorePosts(lastPostId, view, hashtag, old_lastPostId) |
46 | 46 | { |
47 | 47 | $.ajax({ |
48 | - url: '<?php echo $baseUrl;?>get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view + '&hashtag=' + encodeURIComponent(hashtag), |
|
48 | + url: '<?php echo $baseUrl; ?>get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view + '&hashtag=' + encodeURIComponent(hashtag), |
|
49 | 49 | dataType: 'html', |
50 | 50 | async: false, |
51 | 51 | success: function(html) { |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | { |
14 | 14 | window.history.back(); |
15 | 15 | } |
16 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
16 | + <?php if(isset($includeEmojiAndAjax)) |
|
17 | +{ |
|
18 | +?> |
|
17 | 19 | $(document).ready(function() |
18 | 20 | { |
19 | 21 | //Transform UTF-8 Emoji to img |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | return {"lastPostId":lastPostId, "old_lastPostId":old_lastPostId}; |
73 | 75 | } |
74 | 76 | |
75 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
77 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
78 | +{ |
|
79 | +?> |
|
76 | 80 | |
77 | 81 | if(window.location.hash) |
78 | 82 | { |
@@ -66,4 +66,4 @@ |
||
66 | 66 | </article> |
67 | 67 | </div> |
68 | 68 | </div> |
69 | -<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php');?> |
|
70 | 69 | \ No newline at end of file |
70 | +<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php'); ?> |
|
71 | 71 | \ No newline at end of file |
@@ -66,4 +66,4 @@ |
||
66 | 66 | </article> |
67 | 67 | </div> |
68 | 68 | </div> |
69 | -<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php');?> |
|
70 | 69 | \ No newline at end of file |
70 | +<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php'); ?> |
|
71 | 71 | \ No newline at end of file |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | |
5 | 5 | if((!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) && !isUserAdmin()) |
6 | 6 | { |
7 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
7 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
8 | 8 | die(); |
9 | 9 | } |
10 | -else if (isset($_GET['pw'])) |
|
10 | +else if(isset($_GET['pw'])) |
|
11 | 11 | { |
12 | - setcookie('JodelAdminPassword', $_GET['pw'], time()+60*60*24*365*10); |
|
12 | + setcookie('JodelAdminPassword', $_GET['pw'], time() + 60 * 60 * 24 * 365 * 10); |
|
13 | 13 | error_log('admin password saved for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
14 | 14 | } |
15 | 15 | |
@@ -61,42 +61,42 @@ discard block |
||
61 | 61 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client"> |
62 | 62 | |
63 | 63 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
64 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>css/font-awesome.min.css"> |
|
65 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>style.css" type="text/css"> |
|
64 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>css/font-awesome.min.css"> |
|
65 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>style.css" type="text/css"> |
|
66 | 66 | |
67 | - <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
68 | - <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
69 | - <link rel="icon" type="image/gif" href="<?php echo $baseUrl;?>img/favicon/favicon.gif"> |
|
70 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon.png"> |
|
71 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon.png"> |
|
72 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
73 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
74 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
75 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
76 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
77 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
78 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
79 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
80 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
81 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
82 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-precomposed.png"> |
|
83 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
84 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
85 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
86 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
87 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
88 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
89 | - <meta name="msapplication-TileImage" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
67 | + <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
68 | + <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
69 | + <link rel="icon" type="image/gif" href="<?php echo $baseUrl; ?>img/favicon/favicon.gif"> |
|
70 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon.png"> |
|
71 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon.png"> |
|
72 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
73 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
74 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
75 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
76 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
77 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
78 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
79 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
80 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
81 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
82 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-precomposed.png"> |
|
83 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
84 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
85 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
86 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
87 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
88 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
89 | + <meta name="msapplication-TileImage" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
90 | 90 | <meta name="msapplication-TileColor" content="#5682a3"> |
91 | 91 | <meta name="msapplication-navbutton-color" content="#5682a3"> |
92 | 92 | <meta name="application-name" content="JodelBlue"/> |
93 | 93 | <meta name="msapplication-tooltip" content="JodelBlue"/> |
94 | 94 | <meta name="apple-mobile-web-app-title" content="JodelBlue"/> |
95 | - <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-70x70.png"> |
|
96 | - <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
97 | - <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-150x150.png"> |
|
98 | - <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x150.png"> |
|
99 | - <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x310.png"> |
|
95 | + <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-70x70.png"> |
|
96 | + <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
97 | + <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-150x150.png"> |
|
98 | + <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x150.png"> |
|
99 | + <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x310.png"> |
|
100 | 100 | </head> |
101 | 101 | |
102 | 102 | <body> |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $.ajax({ |
201 | 201 | type: "POST", |
202 | - url: "<?php echo $baseUrl;?>vote-ajax.php?pw=<?php echo $_GET["pw"]?>", |
|
202 | + url: "<?php echo $baseUrl; ?>vote-ajax.php?pw=<?php echo $_GET["pw"]?>", |
|
203 | 203 | data: {"vote" : data["vote"], |
204 | 204 | "postId" : data["id"]}, |
205 | 205 | success: function(result){ |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | console.log(solution); |
247 | 247 | $.ajax({ |
248 | 248 | type: "POST", |
249 | - url: "<?php echo $baseUrl;?>vote-ajax.php?pw=<?php echo $_GET["pw"]?>&solution=" + solution + "&key="+key, |
|
249 | + url: "<?php echo $baseUrl; ?>vote-ajax.php?pw=<?php echo $_GET["pw"]?>&solution=" + solution + "&key="+key, |
|
250 | 250 | data: {"deviceUid" : deviceUid}, |
251 | 251 | success: function(result){ |
252 | 252 | var response = JSON.parse(result); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | if(!isset($posts[0])) |
51 | 51 | { |
52 | - error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true)); |
|
52 | + error_log('Fehler: ' . print_r($posts, TRUE) . print_r($posts['recent'], TRUE) . print_r($posts['posts'], TRUE)); |
|
53 | 53 | $title = $view->getTitle(); |
54 | 54 | $description = $view->getMetaDescription(); |
55 | 55 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | </article> |
92 | 92 | |
93 | 93 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
94 | - <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
|
94 | + <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile'); ?>"> |
|
95 | 95 | <article> |
96 | 96 | <div> |
97 | 97 | <h2>Position / Hashtag</h2> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
116 | 116 | <h2>Comment on Jodel</h2> |
117 | 117 | <form method="POST"> |
118 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
|
118 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']); ?>" /> |
|
119 | 119 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
120 | 120 | <br /> |
121 | 121 | <input type="submit" value="SEND" /> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | </div> |
158 | 158 | </aside> |
159 | 159 | </div> |
160 | - <?php include 'templates/nav-bottom.php';?> |
|
160 | + <?php include 'templates/nav-bottom.php'; ?> |
|
161 | 161 | </div> |
162 | 162 | <?php |
163 | 163 | $includeEmojiAndAjax = TRUE; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $posts[0] = $data; |
22 | 22 | |
23 | - if(array_key_exists('children', $data)) { |
|
23 | + if(array_key_exists('children', $data)) |
|
24 | + { |
|
24 | 25 | foreach($data['children'] as $key => $child) |
25 | 26 | { |
26 | 27 | |
@@ -83,7 +84,9 @@ discard block |
||
83 | 84 | } ?> |
84 | 85 | </content> |
85 | 86 | |
86 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
87 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
88 | +{ |
|
89 | +?> |
|
87 | 90 | <p id="loading"> |
88 | 91 | Loading… |
89 | 92 | </p> |
@@ -91,12 +94,20 @@ discard block |
||
91 | 94 | </article> |
92 | 95 | |
93 | 96 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
94 | - <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
|
97 | + <div class="fixed<?php if(!$view->isDetailedView) |
|
98 | +{ |
|
99 | + echo(' hide-mobile'); |
|
100 | +} |
|
101 | +?>"> |
|
95 | 102 | <article> |
96 | 103 | <div> |
97 | 104 | <h2>Position / Hashtag</h2> |
98 | 105 | <form action="index.php" method="get"> |
99 | - <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
106 | + <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
107 | +{ |
|
108 | + echo $newPositionStatus; |
|
109 | +} |
|
110 | +?>" required> |
|
100 | 111 | <label>try: #jhj</label><br> |
101 | 112 | <input type="submit" value="Set Location" /> |
102 | 113 | </form> |
@@ -112,7 +123,9 @@ discard block |
||
112 | 123 | |
113 | 124 | <article> |
114 | 125 | <div> |
115 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
126 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
127 | +{ |
|
128 | +?> |
|
116 | 129 | <h2>Comment on Jodel</h2> |
117 | 130 | <form method="POST"> |
118 | 131 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -120,7 +133,10 @@ discard block |
||
120 | 133 | <br /> |
121 | 134 | <input type="submit" value="SEND" /> |
122 | 135 | </form> |
123 | - <?php } else { ?> |
|
136 | + <?php } |
|
137 | +else |
|
138 | +{ |
|
139 | +?> |
|
124 | 140 | <h2>New Jodel</h2> |
125 | 141 | <form method="POST"> |
126 | 142 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | -{ |
|
4 | +{ |
|
5 | 5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
6 | 6 | const APIURL = 'https://api.go-tellm.com/api'; |
7 | 7 | const SECRET = 'SDydTnTdqqaiAMfneLkqXYxamvNuUYOmkqpdiZTu'; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
22 | 22 | $device_uid = ''; |
23 | - if(isset($this->payLoad['device_uid'])) { |
|
23 | + if(isset($this->payLoad['device_uid'])) |
|
24 | + { |
|
24 | 25 | $device_uid = $this->payLoad['device_uid']; |
25 | 26 | } |
26 | 27 | |
@@ -29,7 +30,8 @@ discard block |
||
29 | 30 | $header = $this->getSignHeaders(); |
30 | 31 | $url = $this->getFullUrl(); |
31 | 32 | |
32 | - if ($this->getAccessToken()) { |
|
33 | + if ($this->getAccessToken()) |
|
34 | + { |
|
33 | 35 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
34 | 36 | } |
35 | 37 | //Comment out to debug the Request: |
@@ -52,7 +54,8 @@ discard block |
||
52 | 54 | 'proxy' => '186.103.169.165:8080', |
53 | 55 | );*/ |
54 | 56 | |
55 | - switch ($this->getMethod()) { |
|
57 | + switch ($this->getMethod()) |
|
58 | + { |
|
56 | 59 | case 'POST': |
57 | 60 | $result = Requests::post($url, $header, $this->payLoad); |
58 | 61 | break; |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | $result = Requests::put($url, $header, $this->payLoad); |
71 | 74 | break; |
72 | 75 | } |
73 | - switch ($result->status_code) { |
|
76 | + switch ($result->status_code) |
|
77 | + { |
|
74 | 78 | case 200: |
75 | 79 | $result = json_decode($result->body, true); |
76 | 80 | break; |
@@ -127,10 +131,12 @@ discard block |
||
127 | 131 | */ |
128 | 132 | private function getSignHeaders() |
129 | 133 | { |
130 | - if($this->getAccessToken() == null) { |
|
134 | + if($this->getAccessToken() == null) |
|
135 | + { |
|
131 | 136 | $payload_accessToken = ""; |
132 | 137 | } |
133 | - else { |
|
138 | + else |
|
139 | + { |
|
134 | 140 | $payload_accessToken = $this->getAccessToken(); |
135 | 141 | } |
136 | 142 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $header = $this->getSignHeaders(); |
30 | 30 | $url = $this->getFullUrl(); |
31 | 31 | |
32 | - if ($this->getAccessToken()) { |
|
32 | + if($this->getAccessToken()) { |
|
33 | 33 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
34 | 34 | } |
35 | 35 | //Comment out to debug the Request: |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'proxy' => '186.103.169.165:8080', |
53 | 53 | );*/ |
54 | 54 | |
55 | - switch ($this->getMethod()) { |
|
55 | + switch($this->getMethod()) { |
|
56 | 56 | case 'POST': |
57 | 57 | $result = Requests::post($url, $header, $this->payLoad); |
58 | 58 | break; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $result = Requests::put($url, $header, $this->payLoad); |
71 | 71 | break; |
72 | 72 | } |
73 | - switch ($result->status_code) { |
|
73 | + switch($result->status_code) { |
|
74 | 74 | case 200: |
75 | 75 | $result = json_decode($result->body, true); |
76 | 76 | break; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | exit("Error 403: Access denied"); |
102 | 102 | break; |
103 | 103 | default: |
104 | - error_log('Error '.$result->status_code.' - Unauthorized'); |
|
104 | + error_log('Error ' . $result->status_code . ' - Unauthorized'); |
|
105 | 105 | $result = json_decode($result->body, true); |
106 | 106 | } |
107 | 107 |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | 4 | { |
5 | - const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | - const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | - const SECRET = 'SDydTnTdqqaiAMfneLkqXYxamvNuUYOmkqpdiZTu'; |
|
8 | - const USERAGENT = 'Jodel/4.34.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | - const CLIENT_TYPE = 'android_4.34.2'; |
|
5 | + const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | + const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | + const SECRET = 'SDydTnTdqqaiAMfneLkqXYxamvNuUYOmkqpdiZTu'; |
|
8 | + const USERAGENT = 'Jodel/4.34.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | + const CLIENT_TYPE = 'android_4.34.2'; |
|
10 | 10 | |
11 | - private $accessToken = null; |
|
12 | - private $payLoad; |
|
13 | - public $expects = ''; |
|
14 | - public $version = 'v2'; |
|
15 | - public $hasPayload = FALSE; |
|
11 | + private $accessToken = null; |
|
12 | + private $payLoad; |
|
13 | + public $expects = ''; |
|
14 | + public $version = 'v2'; |
|
15 | + public $hasPayload = FALSE; |
|
16 | 16 | |
17 | - public function execute() |
|
18 | - { |
|
17 | + public function execute() |
|
18 | + { |
|
19 | 19 | $result = new \stdClass(); |
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | - $this->payLoad = json_encode($this->payLoad); |
|
29 | - $header = $this->getSignHeaders(); |
|
30 | - $url = $this->getFullUrl(); |
|
28 | + $this->payLoad = json_encode($this->payLoad); |
|
29 | + $header = $this->getSignHeaders(); |
|
30 | + $url = $this->getFullUrl(); |
|
31 | 31 | |
32 | - if ($this->getAccessToken()) { |
|
33 | - $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | - } |
|
35 | - //Comment out to debug the Request: |
|
32 | + if ($this->getAccessToken()) { |
|
33 | + $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | + } |
|
35 | + //Comment out to debug the Request: |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | printf("URL: "); |
39 | 39 | var_dump($url); |
40 | 40 | echo "<br />"; |
@@ -45,85 +45,85 @@ discard block |
||
45 | 45 | var_dump($this->payLoad); |
46 | 46 | echo "<br />"; |
47 | 47 | */ |
48 | - /* |
|
48 | + /* |
|
49 | 49 | $options = array( |
50 | 50 | 'timeout' => 100, |
51 | 51 | 'connect_timeout' => 100, |
52 | 52 | 'proxy' => '186.103.169.165:8080', |
53 | 53 | );*/ |
54 | 54 | |
55 | - switch ($this->getMethod()) { |
|
56 | - case 'POST': |
|
57 | - $result = Requests::post($url, $header, $this->payLoad); |
|
58 | - break; |
|
59 | - case 'GET': |
|
60 | - if($this->hasPayload) |
|
61 | - { |
|
62 | - $result = Requests::get($url, $header, $this->payLoad); |
|
63 | - } |
|
64 | - else |
|
65 | - { |
|
66 | - $result = Requests::get($url, $header); |
|
67 | - } |
|
68 | - break; |
|
69 | - case 'PUT': |
|
70 | - $result = Requests::put($url, $header, $this->payLoad); |
|
71 | - break; |
|
72 | - } |
|
73 | - switch ($result->status_code) { |
|
74 | - case 200: |
|
75 | - $result = json_decode($result->body, true); |
|
76 | - break; |
|
77 | - case 204: |
|
78 | - $result = "Success"; |
|
79 | - break; |
|
80 | - case 400: |
|
81 | - error_log('Error 400 - Fehlerhafte Anfrage'); |
|
82 | - $result = json_decode($result->body, true); |
|
83 | - break; |
|
84 | - case 401: |
|
85 | - error_log('Error 401 - Unauthorized'); |
|
86 | - $result = json_decode($result->body, true); |
|
87 | - break; |
|
88 | - case 404: |
|
89 | - error_log('Error 404 - Es wurde bereits gevoted'); |
|
90 | - $result = json_decode($result->body, true); |
|
55 | + switch ($this->getMethod()) { |
|
56 | + case 'POST': |
|
57 | + $result = Requests::post($url, $header, $this->payLoad); |
|
58 | + break; |
|
59 | + case 'GET': |
|
60 | + if($this->hasPayload) |
|
61 | + { |
|
62 | + $result = Requests::get($url, $header, $this->payLoad); |
|
63 | + } |
|
64 | + else |
|
65 | + { |
|
66 | + $result = Requests::get($url, $header); |
|
67 | + } |
|
68 | + break; |
|
69 | + case 'PUT': |
|
70 | + $result = Requests::put($url, $header, $this->payLoad); |
|
71 | + break; |
|
72 | + } |
|
73 | + switch ($result->status_code) { |
|
74 | + case 200: |
|
75 | + $result = json_decode($result->body, true); |
|
76 | + break; |
|
77 | + case 204: |
|
78 | + $result = "Success"; |
|
79 | + break; |
|
80 | + case 400: |
|
81 | + error_log('Error 400 - Fehlerhafte Anfrage'); |
|
82 | + $result = json_decode($result->body, true); |
|
83 | + break; |
|
84 | + case 401: |
|
85 | + error_log('Error 401 - Unauthorized'); |
|
86 | + $result = json_decode($result->body, true); |
|
87 | + break; |
|
88 | + case 404: |
|
89 | + error_log('Error 404 - Es wurde bereits gevoted'); |
|
90 | + $result = json_decode($result->body, true); |
|
91 | 91 | case 477: |
92 | - error_log('Error 477 - Signing failed'); |
|
93 | - $result = json_decode($result->body, true); |
|
94 | - break; |
|
95 | - case 429: |
|
96 | - error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
97 | - exit("Error 429: Too Many Requests"); |
|
98 | - break; |
|
99 | - case 403: |
|
100 | - error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
101 | - exit("Error 403: Access denied"); |
|
102 | - break; |
|
103 | - default: |
|
104 | - error_log('Error '.$result->status_code.' - Unauthorized'); |
|
105 | - $result = json_decode($result->body, true); |
|
106 | - } |
|
92 | + error_log('Error 477 - Signing failed'); |
|
93 | + $result = json_decode($result->body, true); |
|
94 | + break; |
|
95 | + case 429: |
|
96 | + error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
97 | + exit("Error 429: Too Many Requests"); |
|
98 | + break; |
|
99 | + case 403: |
|
100 | + error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
101 | + exit("Error 403: Access denied"); |
|
102 | + break; |
|
103 | + default: |
|
104 | + error_log('Error '.$result->status_code.' - Unauthorized'); |
|
105 | + $result = json_decode($result->body, true); |
|
106 | + } |
|
107 | 107 | |
108 | - //important for account refresh |
|
109 | - if($device_uid != '') |
|
110 | - { |
|
108 | + //important for account refresh |
|
109 | + if($device_uid != '') |
|
110 | + { |
|
111 | 111 | $result[0] = $result; |
112 | 112 | $result[1] = $device_uid; |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /* var_dump($result); */ |
|
116 | + /* var_dump($result); */ |
|
117 | 117 | |
118 | - return $result; |
|
119 | - } |
|
120 | - abstract function getPayload(); |
|
121 | - /** |
|
122 | - * Gets Sign headers |
|
123 | - * @return array headers |
|
124 | - */ |
|
125 | - private function getSignHeaders() |
|
126 | - { |
|
118 | + return $result; |
|
119 | + } |
|
120 | + abstract function getPayload(); |
|
121 | + /** |
|
122 | + * Gets Sign headers |
|
123 | + * @return array headers |
|
124 | + */ |
|
125 | + private function getSignHeaders() |
|
126 | + { |
|
127 | 127 | if($this->getAccessToken() == null) { |
128 | 128 | $payload_accessToken = ""; |
129 | 129 | } |
@@ -132,54 +132,54 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | - $headers = array( |
|
136 | - "Connection" => "keep-alive", |
|
137 | - "Accept-Encoding" => "gzip", |
|
138 | - "Content-Type" => "application/json; charset=UTF-8", |
|
139 | - "User-Agent" => self::USERAGENT |
|
140 | - ); |
|
141 | - $timestamp = new DateTime(); |
|
142 | - $timestamp = $timestamp->format(DateTime::ATOM); |
|
143 | - $timestamp = substr($timestamp, 0, -6); |
|
144 | - $timestamp .= "Z"; |
|
145 | - $urlParts = parse_url($this->getFullUrl()); |
|
146 | - $url2 = ""; |
|
147 | - $req = [$this->getMethod(), |
|
148 | - $urlParts['host'], |
|
149 | - "443", |
|
150 | - $urlParts['path'], |
|
151 | - $payload_accessToken, |
|
152 | - $timestamp, |
|
153 | - $url2, |
|
154 | - $this->payLoad]; |
|
155 | - $reqString = implode("%", $req); |
|
156 | - $secret = self::SECRET; |
|
157 | - $signature = hash_hmac('sha1', $reqString, $secret); |
|
158 | - $signature = strtoupper($signature); |
|
159 | - $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
160 | - $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
161 | - $headers['X-Timestamp'] = $timestamp; |
|
162 | - $headers['X-Api-Version'] = '0.2'; |
|
163 | - return $headers; |
|
164 | - } |
|
165 | - private function getFullUrl() |
|
166 | - { |
|
167 | - return self::APIURL . $this->getApiEndPoint(); |
|
168 | - } |
|
169 | - abstract function getApiEndPoint(); |
|
170 | - abstract function getMethod(); |
|
171 | - /** |
|
172 | - * @return string |
|
173 | - */ |
|
174 | - private function getAccessToken() |
|
175 | - { |
|
176 | - return $this->accessToken; |
|
177 | - } |
|
178 | - /** |
|
179 | - * @param string $accessToken |
|
180 | - */ |
|
181 | - public function setAccessToken($accessToken) |
|
182 | - { |
|
183 | - $this->accessToken = $accessToken; |
|
184 | - } |
|
135 | + $headers = array( |
|
136 | + "Connection" => "keep-alive", |
|
137 | + "Accept-Encoding" => "gzip", |
|
138 | + "Content-Type" => "application/json; charset=UTF-8", |
|
139 | + "User-Agent" => self::USERAGENT |
|
140 | + ); |
|
141 | + $timestamp = new DateTime(); |
|
142 | + $timestamp = $timestamp->format(DateTime::ATOM); |
|
143 | + $timestamp = substr($timestamp, 0, -6); |
|
144 | + $timestamp .= "Z"; |
|
145 | + $urlParts = parse_url($this->getFullUrl()); |
|
146 | + $url2 = ""; |
|
147 | + $req = [$this->getMethod(), |
|
148 | + $urlParts['host'], |
|
149 | + "443", |
|
150 | + $urlParts['path'], |
|
151 | + $payload_accessToken, |
|
152 | + $timestamp, |
|
153 | + $url2, |
|
154 | + $this->payLoad]; |
|
155 | + $reqString = implode("%", $req); |
|
156 | + $secret = self::SECRET; |
|
157 | + $signature = hash_hmac('sha1', $reqString, $secret); |
|
158 | + $signature = strtoupper($signature); |
|
159 | + $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
160 | + $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
161 | + $headers['X-Timestamp'] = $timestamp; |
|
162 | + $headers['X-Api-Version'] = '0.2'; |
|
163 | + return $headers; |
|
164 | + } |
|
165 | + private function getFullUrl() |
|
166 | + { |
|
167 | + return self::APIURL . $this->getApiEndPoint(); |
|
168 | + } |
|
169 | + abstract function getApiEndPoint(); |
|
170 | + abstract function getMethod(); |
|
171 | + /** |
|
172 | + * @return string |
|
173 | + */ |
|
174 | + private function getAccessToken() |
|
175 | + { |
|
176 | + return $this->accessToken; |
|
177 | + } |
|
178 | + /** |
|
179 | + * @param string $accessToken |
|
180 | + */ |
|
181 | + public function setAccessToken($accessToken) |
|
182 | + { |
|
183 | + $this->accessToken = $accessToken; |
|
184 | + } |
|
185 | 185 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | const USERAGENT = 'Jodel/4.34.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
9 | 9 | const CLIENT_TYPE = 'android_4.34.2'; |
10 | 10 | |
11 | - private $accessToken = null; |
|
11 | + private $accessToken = NULL; |
|
12 | 12 | private $payLoad; |
13 | 13 | public $expects = ''; |
14 | 14 | public $version = 'v2'; |
@@ -72,37 +72,37 @@ discard block |
||
72 | 72 | } |
73 | 73 | switch ($result->status_code) { |
74 | 74 | case 200: |
75 | - $result = json_decode($result->body, true); |
|
75 | + $result = json_decode($result->body, TRUE); |
|
76 | 76 | break; |
77 | 77 | case 204: |
78 | 78 | $result = "Success"; |
79 | 79 | break; |
80 | 80 | case 400: |
81 | 81 | error_log('Error 400 - Fehlerhafte Anfrage'); |
82 | - $result = json_decode($result->body, true); |
|
82 | + $result = json_decode($result->body, TRUE); |
|
83 | 83 | break; |
84 | 84 | case 401: |
85 | 85 | error_log('Error 401 - Unauthorized'); |
86 | - $result = json_decode($result->body, true); |
|
86 | + $result = json_decode($result->body, TRUE); |
|
87 | 87 | break; |
88 | 88 | case 404: |
89 | 89 | error_log('Error 404 - Es wurde bereits gevoted'); |
90 | - $result = json_decode($result->body, true); |
|
90 | + $result = json_decode($result->body, TRUE); |
|
91 | 91 | case 477: |
92 | 92 | error_log('Error 477 - Signing failed'); |
93 | - $result = json_decode($result->body, true); |
|
93 | + $result = json_decode($result->body, TRUE); |
|
94 | 94 | break; |
95 | 95 | case 429: |
96 | - error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
96 | + error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
97 | 97 | exit("Error 429: Too Many Requests"); |
98 | 98 | break; |
99 | 99 | case 403: |
100 | - error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
100 | + error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
101 | 101 | exit("Error 403: Access denied"); |
102 | 102 | break; |
103 | 103 | default: |
104 | 104 | error_log('Error '.$result->status_code.' - Unauthorized'); |
105 | - $result = json_decode($result->body, true); |
|
105 | + $result = json_decode($result->body, TRUE); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //important for account refresh |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | private function getSignHeaders() |
126 | 126 | { |
127 | - if($this->getAccessToken() == null) { |
|
127 | + if($this->getAccessToken() == NULL) { |
|
128 | 128 | $payload_accessToken = ""; |
129 | 129 | } |
130 | 130 | else { |
@@ -13,17 +13,17 @@ |
||
13 | 13 | public $varsToDump; |
14 | 14 | |
15 | 15 | function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set') |
16 | - { |
|
17 | - $this->view = $view; |
|
18 | - $this->actions = $actions; |
|
19 | - $this->accountId = $accountId; |
|
20 | - $this->isVerified = $isVerified; |
|
21 | - $this->isTokenFresh = $isTokenFresh; |
|
22 | - $this->page = $page; |
|
23 | - $this->referrer = $referrer; |
|
24 | - $this->msg = $msg; |
|
25 | - $this->varsToDump = $varsToDump; |
|
26 | - } |
|
16 | + { |
|
17 | + $this->view = $view; |
|
18 | + $this->actions = $actions; |
|
19 | + $this->accountId = $accountId; |
|
20 | + $this->isVerified = $isVerified; |
|
21 | + $this->isTokenFresh = $isTokenFresh; |
|
22 | + $this->page = $page; |
|
23 | + $this->referrer = $referrer; |
|
24 | + $this->msg = $msg; |
|
25 | + $this->varsToDump = $varsToDump; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | function writeErrorToLog() |
29 | 29 | { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public $varsToDump; |
14 | 14 | |
15 | 15 | function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set') |
16 | - { |
|
16 | + { |
|
17 | 17 | $this->view = $view; |
18 | 18 | $this->actions = $actions; |
19 | 19 | $this->accountId = $accountId; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | error_log("=============================== ERROR ================================"); |
31 | 31 | error_log("msg: " . $this->msg); |
32 | - error_log("view: " . print_r($this->view, true)); |
|
32 | + error_log("view: " . print_r($this->view, TRUE)); |
|
33 | 33 | error_log("actions: " . $this->actionsToString()); |
34 | 34 | error_log("accountId: " . $this->accountId); |
35 | 35 | error_log("isVerified: " . $this->isVerified); |