@@ -12,7 +12,8 @@ |
||
| 12 | 12 | |
| 13 | 13 | } |
| 14 | 14 | $db = new DatabaseConnect(); |
| 15 | -if ($db->connect_errno) { |
|
| 15 | +if ($db->connect_errno) |
|
| 16 | +{ |
|
| 16 | 17 | echo 'Sorry, die Verbindung zu unserem superfetten endgeilen |
| 17 | 18 | Server ist hops gegangen. Wegen '.$db -> connect_error; |
| 18 | 19 | } |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class GetKarma extends AbstractRequest { |
|
| 4 | +class GetKarma extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | |
| 6 | 7 | function getApiEndPoint() |
| 7 | 8 | { |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class SetLocation extends AbstractRequest { |
|
| 4 | +class SetLocation extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | /** |
| 6 | 7 | * @var Location |
| 7 | 8 | */ |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class CreateUser extends AbstractRequest { |
|
| 3 | +class CreateUser extends AbstractRequest |
|
| 4 | +{ |
|
| 4 | 5 | /** |
| 5 | 6 | * @var Location |
| 6 | 7 | */ |
@@ -25,7 +26,7 @@ discard block |
||
| 25 | 26 | return $this->deviceUid; |
| 26 | 27 | } |
| 27 | 28 | public function setDeviceUid($deviceUid) |
| 28 | - { |
|
| 29 | + { |
|
| 29 | 30 | $this->deviceUid = $deviceUid; |
| 30 | 31 | } |
| 31 | 32 | public function generateDeviceUid() |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | { |
| 37 | 38 | $str = ''; |
| 38 | 39 | $max = mb_strlen($keyspace, '8bit') - 1; |
| 39 | - for ($i = 0; $i < $length; ++$i) { |
|
| 40 | + for ($i = 0; $i < $length; ++$i) |
|
| 41 | + { |
|
| 40 | 42 | $str .= $keyspace[random_int(0, $max)]; |
| 41 | 43 | } |
| 42 | 44 | return $str; |
@@ -31,7 +31,8 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $apiEndPoint = $this->getUrl(); |
| 33 | 33 | //echo $GLOBALS['lastPostId']; |
| 34 | - if ($this->getLastPostId() != "") { |
|
| 34 | + if ($this->getLastPostId() != "") |
|
| 35 | + { |
|
| 35 | 36 | $apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId(); |
| 36 | 37 | } |
| 37 | 38 | return $apiEndPoint; |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class Upvote extends AbstractRequest { |
|
| 4 | +class Upvote extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | |
| 6 | 7 | function getApiEndPoint() |
| 7 | 8 | { |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @param array $cookies Existing cookie values |
| 27 | 27 | */ |
| 28 | - public function __construct($cookies = array()) { |
|
| 28 | + public function __construct($cookies = array()) |
|
| 29 | + { |
|
| 29 | 30 | $this->cookies = $cookies; |
| 30 | 31 | } |
| 31 | 32 | |
@@ -35,8 +36,10 @@ discard block |
||
| 35 | 36 | * @param string|Requests_Cookie $cookie |
| 36 | 37 | * @return Requests_Cookie |
| 37 | 38 | */ |
| 38 | - public function normalize_cookie($cookie, $key = null) { |
|
| 39 | - if ($cookie instanceof Requests_Cookie) { |
|
| 39 | + public function normalize_cookie($cookie, $key = null) |
|
| 40 | + { |
|
| 41 | + if ($cookie instanceof Requests_Cookie) |
|
| 42 | + { |
|
| 40 | 43 | return $cookie; |
| 41 | 44 | } |
| 42 | 45 | |
@@ -50,7 +53,8 @@ discard block |
||
| 50 | 53 | * @deprecated Use {@see Requests_Cookie_Jar::normalize_cookie} |
| 51 | 54 | * @return Requests_Cookie |
| 52 | 55 | */ |
| 53 | - public function normalizeCookie($cookie, $key = null) { |
|
| 56 | + public function normalizeCookie($cookie, $key = null) |
|
| 57 | + { |
|
| 54 | 58 | return $this->normalize_cookie($cookie, $key); |
| 55 | 59 | } |
| 56 | 60 | |
@@ -60,7 +64,8 @@ discard block |
||
| 60 | 64 | * @param string $key Item key |
| 61 | 65 | * @return boolean Does the item exist? |
| 62 | 66 | */ |
| 63 | - public function offsetExists($key) { |
|
| 67 | + public function offsetExists($key) |
|
| 68 | + { |
|
| 64 | 69 | return isset($this->cookies[$key]); |
| 65 | 70 | } |
| 66 | 71 | |
@@ -70,8 +75,10 @@ discard block |
||
| 70 | 75 | * @param string $key Item key |
| 71 | 76 | * @return string Item value |
| 72 | 77 | */ |
| 73 | - public function offsetGet($key) { |
|
| 74 | - if (!isset($this->cookies[$key])) { |
|
| 78 | + public function offsetGet($key) |
|
| 79 | + { |
|
| 80 | + if (!isset($this->cookies[$key])) |
|
| 81 | + { |
|
| 75 | 82 | return null; |
| 76 | 83 | } |
| 77 | 84 | |
@@ -86,8 +93,10 @@ discard block |
||
| 86 | 93 | * @param string $key Item name |
| 87 | 94 | * @param string $value Item value |
| 88 | 95 | */ |
| 89 | - public function offsetSet($key, $value) { |
|
| 90 | - if ($key === null) { |
|
| 96 | + public function offsetSet($key, $value) |
|
| 97 | + { |
|
| 98 | + if ($key === null) |
|
| 99 | + { |
|
| 91 | 100 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); |
| 92 | 101 | } |
| 93 | 102 | |
@@ -99,7 +108,8 @@ discard block |
||
| 99 | 108 | * |
| 100 | 109 | * @param string $key |
| 101 | 110 | */ |
| 102 | - public function offsetUnset($key) { |
|
| 111 | + public function offsetUnset($key) |
|
| 112 | + { |
|
| 103 | 113 | unset($this->cookies[$key]); |
| 104 | 114 | } |
| 105 | 115 | |
@@ -108,7 +118,8 @@ discard block |
||
| 108 | 118 | * |
| 109 | 119 | * @return ArrayIterator |
| 110 | 120 | */ |
| 111 | - public function getIterator() { |
|
| 121 | + public function getIterator() |
|
| 122 | + { |
|
| 112 | 123 | return new ArrayIterator($this->cookies); |
| 113 | 124 | } |
| 114 | 125 | |
@@ -117,7 +128,8 @@ discard block |
||
| 117 | 128 | * |
| 118 | 129 | * @param Requests_Hooker $hooks Hooking system |
| 119 | 130 | */ |
| 120 | - public function register(Requests_Hooker $hooks) { |
|
| 131 | + public function register(Requests_Hooker $hooks) |
|
| 132 | + { |
|
| 121 | 133 | $hooks->register('requests.before_request', array($this, 'before_request')); |
| 122 | 134 | $hooks->register('requests.before_redirect_check', array($this, 'before_redirect_check')); |
| 123 | 135 | } |
@@ -133,22 +145,28 @@ discard block |
||
| 133 | 145 | * @param string $type |
| 134 | 146 | * @param array $options |
| 135 | 147 | */ |
| 136 | - public function before_request($url, &$headers, &$data, &$type, &$options) { |
|
| 137 | - if (!$url instanceof Requests_IRI) { |
|
| 148 | + public function before_request($url, &$headers, &$data, &$type, &$options) |
|
| 149 | + { |
|
| 150 | + if (!$url instanceof Requests_IRI) |
|
| 151 | + { |
|
| 138 | 152 | $url = new Requests_IRI($url); |
| 139 | 153 | } |
| 140 | 154 | |
| 141 | - if (!empty($this->cookies)) { |
|
| 155 | + if (!empty($this->cookies)) |
|
| 156 | + { |
|
| 142 | 157 | $cookies = array(); |
| 143 | - foreach ($this->cookies as $key => $cookie) { |
|
| 158 | + foreach ($this->cookies as $key => $cookie) |
|
| 159 | + { |
|
| 144 | 160 | $cookie = $this->normalize_cookie($cookie, $key); |
| 145 | 161 | |
| 146 | 162 | // Skip expired cookies |
| 147 | - if ($cookie->is_expired()) { |
|
| 163 | + if ($cookie->is_expired()) |
|
| 164 | + { |
|
| 148 | 165 | continue; |
| 149 | 166 | } |
| 150 | 167 | |
| 151 | - if ($cookie->domain_matches($url->host)) { |
|
| 168 | + if ($cookie->domain_matches($url->host)) |
|
| 169 | + { |
|
| 152 | 170 | $cookies[] = $cookie->format_for_header(); |
| 153 | 171 | } |
| 154 | 172 | } |
@@ -162,9 +180,11 @@ discard block |
||
| 162 | 180 | * |
| 163 | 181 | * @var Requests_Response $response |
| 164 | 182 | */ |
| 165 | - public function before_redirect_check(Requests_Response &$return) { |
|
| 183 | + public function before_redirect_check(Requests_Response &$return) |
|
| 184 | + { |
|
| 166 | 185 | $url = $return->url; |
| 167 | - if (!$url instanceof Requests_IRI) { |
|
| 186 | + if (!$url instanceof Requests_IRI) |
|
| 187 | + { |
|
| 168 | 188 | $url = new Requests_IRI($url); |
| 169 | 189 | } |
| 170 | 190 | |
@@ -18,7 +18,8 @@ |
||
| 18 | 18 | * @package Requests |
| 19 | 19 | * @subpackage Authentication |
| 20 | 20 | */ |
| 21 | -interface Requests_Auth { |
|
| 21 | +interface Requests_Auth |
|
| 22 | +{ |
|
| 22 | 23 | /** |
| 23 | 24 | * Register hooks as needed |
| 24 | 25 | * |
@@ -16,7 +16,8 @@ discard block |
||
| 16 | 16 | * @subpackage Proxy |
| 17 | 17 | * @since 1.6 |
| 18 | 18 | */ |
| 19 | -class Requests_Proxy_HTTP implements Requests_Proxy { |
|
| 19 | +class Requests_Proxy_HTTP implements Requests_Proxy |
|
| 20 | +{ |
|
| 20 | 21 | /** |
| 21 | 22 | * Proxy host and port |
| 22 | 23 | * |
@@ -54,19 +55,25 @@ discard block |
||
| 54 | 55 | * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`) |
| 55 | 56 | * @param array|null $args Array of user and password. Must have exactly two elements |
| 56 | 57 | */ |
| 57 | - public function __construct($args = null) { |
|
| 58 | - if (is_string($args)) { |
|
| 58 | + public function __construct($args = null) |
|
| 59 | + { |
|
| 60 | + if (is_string($args)) |
|
| 61 | + { |
|
| 59 | 62 | $this->proxy = $args; |
| 60 | 63 | } |
| 61 | - elseif (is_array($args)) { |
|
| 62 | - if (count($args) == 1) { |
|
| 64 | + elseif (is_array($args)) |
|
| 65 | + { |
|
| 66 | + if (count($args) == 1) |
|
| 67 | + { |
|
| 63 | 68 | list($this->proxy) = $args; |
| 64 | 69 | } |
| 65 | - elseif (count($args) == 3) { |
|
| 70 | + elseif (count($args) == 3) |
|
| 71 | + { |
|
| 66 | 72 | list($this->proxy, $this->user, $this->pass) = $args; |
| 67 | 73 | $this->use_authentication = true; |
| 68 | 74 | } |
| 69 | - else { |
|
| 75 | + else |
|
| 76 | + { |
|
| 70 | 77 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
| 71 | 78 | } |
| 72 | 79 | } |
@@ -82,12 +89,14 @@ discard block |
||
| 82 | 89 | * @see fsockopen_header |
| 83 | 90 | * @param Requests_Hooks $hooks Hook system |
| 84 | 91 | */ |
| 85 | - public function register(Requests_Hooks &$hooks) { |
|
| 92 | + public function register(Requests_Hooks &$hooks) |
|
| 93 | + { |
|
| 86 | 94 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
| 87 | 95 | |
| 88 | 96 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
| 89 | 97 | $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path')); |
| 90 | - if ($this->use_authentication) { |
|
| 98 | + if ($this->use_authentication) |
|
| 99 | + { |
|
| 91 | 100 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); |
| 92 | 101 | } |
| 93 | 102 | } |
@@ -98,11 +107,13 @@ discard block |
||
| 98 | 107 | * @since 1.6 |
| 99 | 108 | * @param resource $handle cURL resource |
| 100 | 109 | */ |
| 101 | - public function curl_before_send(&$handle) { |
|
| 110 | + public function curl_before_send(&$handle) |
|
| 111 | + { |
|
| 102 | 112 | curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
| 103 | 113 | curl_setopt($handle, CURLOPT_PROXY, $this->proxy); |
| 104 | 114 | |
| 105 | - if ($this->use_authentication) { |
|
| 115 | + if ($this->use_authentication) |
|
| 116 | + { |
|
| 106 | 117 | curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); |
| 107 | 118 | curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string()); |
| 108 | 119 | } |
@@ -114,7 +125,8 @@ discard block |
||
| 114 | 125 | * @since 1.6 |
| 115 | 126 | * @param string $remote_socket Socket connection string |
| 116 | 127 | */ |
| 117 | - public function fsockopen_remote_socket(&$remote_socket) { |
|
| 128 | + public function fsockopen_remote_socket(&$remote_socket) |
|
| 129 | + { |
|
| 118 | 130 | $remote_socket = $this->proxy; |
| 119 | 131 | } |
| 120 | 132 | |
@@ -125,7 +137,8 @@ discard block |
||
| 125 | 137 | * @param string $path Path to send in HTTP request string ("GET ...") |
| 126 | 138 | * @param string $url Full URL we're requesting |
| 127 | 139 | */ |
| 128 | - public function fsockopen_remote_host_path(&$path, $url) { |
|
| 140 | + public function fsockopen_remote_host_path(&$path, $url) |
|
| 141 | + { |
|
| 129 | 142 | $path = $url; |
| 130 | 143 | } |
| 131 | 144 | |
@@ -135,7 +148,8 @@ discard block |
||
| 135 | 148 | * @since 1.6 |
| 136 | 149 | * @param string $out HTTP header string |
| 137 | 150 | */ |
| 138 | - public function fsockopen_header(&$out) { |
|
| 151 | + public function fsockopen_header(&$out) |
|
| 152 | + { |
|
| 139 | 153 | $out .= sprintf("Proxy-Authorization: Basic %s\r\n", base64_encode($this->get_auth_string())); |
| 140 | 154 | } |
| 141 | 155 | |
@@ -145,7 +159,8 @@ discard block |
||
| 145 | 159 | * @since 1.6 |
| 146 | 160 | * @return string |
| 147 | 161 | */ |
| 148 | - public function get_auth_string() { |
|
| 162 | + public function get_auth_string() |
|
| 163 | + { |
|
| 149 | 164 | return $this->user . ':' . $this->pass; |
| 150 | 165 | } |
| 151 | 166 | } |
| 152 | 167 | \ No newline at end of file |