@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function setBaseURL($apiBaseURL) |
| 27 | 27 | { |
| 28 | - $this->_apiBaseURL = rtrim($apiBaseURL, '/') . '/'; |
|
| 28 | + $this->_apiBaseURL = rtrim($apiBaseURL, '/').'/'; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | protected function callAPI($resource, $method = "GET", $data = array(), $headers = array()) |
| 79 | 79 | { |
| 80 | 80 | $ch = curl_init(); |
| 81 | - curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL . ltrim($resource, '/')); |
|
| 81 | + curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL.ltrim($resource, '/')); |
|
| 82 | 82 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 83 | 83 | |
| 84 | 84 | // Explicitly empty null values, because http_build_query will throw away |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $headerArray = array(); |
| 109 | 109 | foreach ($headers as $key => $value) { |
| 110 | - $headerArray[] = $key . ': ' . $value; |
|
| 110 | + $headerArray[] = $key.': '.$value; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * @param boolean $temporary temporary failure? |
| 36 | 36 | * @param Exception $parent parent exception |
| 37 | 37 | */ |
| 38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
| 38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
| 39 | 39 | { |
| 40 | 40 | parent::__construct($message, $parent); |
| 41 | 41 | $this->_temporary = $temporary; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param string $message exception message |
| 30 | 30 | * @param Exception $parent parent exception |
| 31 | 31 | */ |
| 32 | - public function __construct($message, $parent=null) |
|
| 32 | + public function __construct($message, $parent = null) |
|
| 33 | 33 | { |
| 34 | 34 | parent::__construct($message, 0, $parent); |
| 35 | 35 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * @param boolean $temporary temporary failure? |
| 36 | 36 | * @param Exception $parent parent exception |
| 37 | 37 | */ |
| 38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
| 38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
| 39 | 39 | { |
| 40 | 40 | parent::__construct($message, $parent); |
| 41 | 41 | $this->_temporary = $temporary; |
@@ -41,15 +41,15 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $url = $this->_options["url"]."?appId=".$this->_options["appid"]; |
| 43 | 43 | |
| 44 | - $url.= "¬ificationToken=".$notificationToken; |
|
| 44 | + $url .= "¬ificationToken=".$notificationToken; |
|
| 45 | 45 | |
| 46 | 46 | $output = file_get_contents($url); |
| 47 | - if (stripos($output, "not found")!==false) { |
|
| 47 | + if (stripos($output, "not found") !== false) { |
|
| 48 | 48 | $this->logger->error('Token Exchange failed and responded with: not found', ['full output' => $output]); |
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (stripos($output, "error")!==false) { |
|
| 52 | + if (stripos($output, "error") !== false) { |
|
| 53 | 53 | $this->logger->error('Token Exchange failed and responded with: error', ['full output' => $output]); |
| 54 | 54 | return false; |
| 55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @throws Tiqr_Message_Exception_SendFailure |
| 59 | 59 | */ |
| 60 | - private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry=false) |
|
| 60 | + private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry = false) |
|
| 61 | 61 | { |
| 62 | 62 | $msg = array( |
| 63 | 63 | 'challenge' => $challenge, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | $headers = array( |
| 74 | - 'Authorization: key=' . $apiKey, |
|
| 74 | + 'Authorization: key='.$apiKey, |
|
| 75 | 75 | 'Content-Type: application/json', |
| 76 | 76 | ); |
| 77 | 77 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $result = curl_exec($ch); |
| 85 | 85 | $errors = curl_error($ch); |
| 86 | 86 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 87 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
| 87 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
| 88 | 88 | curl_close($ch); |
| 89 | 89 | |
| 90 | 90 | if ($result === false) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | if (!empty($errors)) { |
| 95 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
| 95 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $response = json_decode($result, true); |
| 111 | 111 | foreach ($response['results'] as $k => $v) { |
| 112 | 112 | if (isset($v['error'])) { |
| 113 | - throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: " . $v['error'], true); |
|
| 113 | + throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: ".$v['error'], true); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -58,18 +58,18 @@ discard block |
||
| 58 | 58 | private static function _hexStr2Bytes(string $hex, int $maxBytes, string $parameterName) : string |
| 59 | 59 | { |
| 60 | 60 | $len = strlen($hex); |
| 61 | - if ( ($len !== 0) && (! ctype_xdigit($hex)) ) { |
|
| 61 | + if (($len !== 0) && (!ctype_xdigit($hex))) { |
|
| 62 | 62 | throw new InvalidArgumentException("Parameter '$parameterName' contains non hex digits"); |
| 63 | 63 | } |
| 64 | - if ( $len % 2 !== 0 ) { |
|
| 64 | + if ($len % 2 !== 0) { |
|
| 65 | 65 | throw new InvalidArgumentException("Parameter '$parameterName' contains odd number of hex digits"); |
| 66 | 66 | } |
| 67 | - if ( $len > $maxBytes * 2) { |
|
| 67 | + if ($len > $maxBytes * 2) { |
|
| 68 | 68 | throw new InvalidArgumentException("Parameter '$parameterName' too long"); |
| 69 | 69 | } |
| 70 | 70 | // hex2bin logs PHP warnings when $hex contains invalid characters or has uneven length. Because we |
| 71 | 71 | // check for these conditions above hex2bin() should always be silent |
| 72 | - $res=hex2bin($hex); |
|
| 72 | + $res = hex2bin($hex); |
|
| 73 | 73 | if (false === $res) { |
| 74 | 74 | throw new InvalidArgumentException("Parameter '$parameterName' could not be decoded"); |
| 75 | 75 | } |
@@ -122,72 +122,72 @@ discard block |
||
| 122 | 122 | $cryptoFunction = $components[1]; |
| 123 | 123 | $dataInput = strtolower($components[2]); // lower here so we can do case insensitive comparisons |
| 124 | 124 | |
| 125 | - if(stripos($cryptoFunction, "sha1")!==false) |
|
| 125 | + if (stripos($cryptoFunction, "sha1") !== false) |
|
| 126 | 126 | $crypto = "sha1"; |
| 127 | - if(stripos($cryptoFunction, "sha256")!==false) |
|
| 127 | + if (stripos($cryptoFunction, "sha256") !== false) |
|
| 128 | 128 | $crypto = "sha256"; |
| 129 | - if(stripos($cryptoFunction, "sha512")!==false) |
|
| 129 | + if (stripos($cryptoFunction, "sha512") !== false) |
|
| 130 | 130 | $crypto = "sha512"; |
| 131 | 131 | |
| 132 | - $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-")+1); |
|
| 132 | + $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-") + 1); |
|
| 133 | 133 | |
| 134 | 134 | // The size of the byte array message to be encrypted |
| 135 | 135 | // Counter |
| 136 | - if($dataInput[0] == "c" ) { |
|
| 136 | + if ($dataInput[0] == "c") { |
|
| 137 | 137 | // Fix the length of the HEX string |
| 138 | - while(strlen($counter) < 16) |
|
| 139 | - $counter = "0" . $counter; |
|
| 140 | - $counterLength=8; |
|
| 138 | + while (strlen($counter) < 16) |
|
| 139 | + $counter = "0".$counter; |
|
| 140 | + $counterLength = 8; |
|
| 141 | 141 | } |
| 142 | 142 | // Question |
| 143 | - if($dataInput[0] == "q" || |
|
| 144 | - stripos($dataInput, "-q")!==false) { |
|
| 145 | - while(strlen($question) < 256) |
|
| 146 | - $question = $question . "0"; |
|
| 147 | - $questionLength=128; |
|
| 143 | + if ($dataInput[0] == "q" || |
|
| 144 | + stripos($dataInput, "-q") !== false) { |
|
| 145 | + while (strlen($question) < 256) |
|
| 146 | + $question = $question."0"; |
|
| 147 | + $questionLength = 128; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Password |
| 151 | - if(stripos($dataInput, "psha1")!==false) { |
|
| 152 | - while(strlen($password) < 40) |
|
| 153 | - $password = "0" . $password; |
|
| 154 | - $passwordLength=20; |
|
| 151 | + if (stripos($dataInput, "psha1") !== false) { |
|
| 152 | + while (strlen($password) < 40) |
|
| 153 | + $password = "0".$password; |
|
| 154 | + $passwordLength = 20; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if(stripos($dataInput, "psha256")!==false) { |
|
| 158 | - while(strlen($password) < 64) |
|
| 159 | - $password = "0" . $password; |
|
| 160 | - $passwordLength=32; |
|
| 157 | + if (stripos($dataInput, "psha256") !== false) { |
|
| 158 | + while (strlen($password) < 64) |
|
| 159 | + $password = "0".$password; |
|
| 160 | + $passwordLength = 32; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if(stripos($dataInput, "psha512")!==false) { |
|
| 164 | - while(strlen($password) < 128) |
|
| 165 | - $password = "0" . $password; |
|
| 166 | - $passwordLength=64; |
|
| 163 | + if (stripos($dataInput, "psha512") !== false) { |
|
| 164 | + while (strlen($password) < 128) |
|
| 165 | + $password = "0".$password; |
|
| 166 | + $passwordLength = 64; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // sessionInformation |
| 170 | - if(stripos($dataInput, "s064") !==false) { |
|
| 171 | - while(strlen($sessionInformation) < 128) |
|
| 172 | - $sessionInformation = "0" . $sessionInformation; |
|
| 170 | + if (stripos($dataInput, "s064") !== false) { |
|
| 171 | + while (strlen($sessionInformation) < 128) |
|
| 172 | + $sessionInformation = "0".$sessionInformation; |
|
| 173 | 173 | |
| 174 | - $sessionInformationLength=64; |
|
| 175 | - } else if(stripos($dataInput, "s128") !==false) { |
|
| 176 | - while(strlen($sessionInformation) < 256) |
|
| 177 | - $sessionInformation = "0" . $sessionInformation; |
|
| 174 | + $sessionInformationLength = 64; |
|
| 175 | + } else if (stripos($dataInput, "s128") !== false) { |
|
| 176 | + while (strlen($sessionInformation) < 256) |
|
| 177 | + $sessionInformation = "0".$sessionInformation; |
|
| 178 | 178 | |
| 179 | - $sessionInformationLength=128; |
|
| 180 | - } else if(stripos($dataInput, "s256") !==false) { |
|
| 181 | - while(strlen($sessionInformation) < 512) |
|
| 182 | - $sessionInformation = "0" . $sessionInformation; |
|
| 179 | + $sessionInformationLength = 128; |
|
| 180 | + } else if (stripos($dataInput, "s256") !== false) { |
|
| 181 | + while (strlen($sessionInformation) < 512) |
|
| 182 | + $sessionInformation = "0".$sessionInformation; |
|
| 183 | 183 | |
| 184 | - $sessionInformationLength=256; |
|
| 185 | - } else if(stripos($dataInput, "s512") !==false) { |
|
| 186 | - while(strlen($sessionInformation) < 128) |
|
| 187 | - $sessionInformation = "0" . $sessionInformation; |
|
| 184 | + $sessionInformationLength = 256; |
|
| 185 | + } else if (stripos($dataInput, "s512") !== false) { |
|
| 186 | + while (strlen($sessionInformation) < 128) |
|
| 187 | + $sessionInformation = "0".$sessionInformation; |
|
| 188 | 188 | |
| 189 | - $sessionInformationLength=64; |
|
| 190 | - } else if (stripos($dataInput, "-s") !== false ) { |
|
| 189 | + $sessionInformationLength = 64; |
|
| 190 | + } else if (stripos($dataInput, "-s") !== false) { |
|
| 191 | 191 | // deviation from spec. Officially 's' without a length indicator is not in the reference implementation. |
| 192 | 192 | // RFC is ambigious. However we have supported this in Tiqr since day 1, so we continue to support it. |
| 193 | 193 | |
@@ -196,27 +196,27 @@ discard block |
||
| 196 | 196 | // to prevent matching the "s" in the password input e.g. "psha1". |
| 197 | 197 | // [C] | QFxx | [PH | Snnn | TG] : Challenge-Response computation |
| 198 | 198 | // [C] | QFxx | [PH | TG] : Plain Signature computation |
| 199 | - while(strlen($sessionInformation) < 128) |
|
| 200 | - $sessionInformation = "0" . $sessionInformation; |
|
| 199 | + while (strlen($sessionInformation) < 128) |
|
| 200 | + $sessionInformation = "0".$sessionInformation; |
|
| 201 | 201 | |
| 202 | - $sessionInformationLength=64; |
|
| 202 | + $sessionInformationLength = 64; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | // TimeStamp |
| 208 | - if($dataInput[0] == "t" || |
|
| 208 | + if ($dataInput[0] == "t" || |
|
| 209 | 209 | stripos($dataInput, "-t") !== false) { |
| 210 | - while(strlen($timeStamp) < 16) |
|
| 211 | - $timeStamp = "0" . $timeStamp; |
|
| 212 | - $timeStampLength=8; |
|
| 210 | + while (strlen($timeStamp) < 16) |
|
| 211 | + $timeStamp = "0".$timeStamp; |
|
| 212 | + $timeStampLength = 8; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // Put the bytes of "ocraSuite" parameters into the message |
| 216 | 216 | |
| 217 | - $msg = array_fill(0,$ocraSuiteLength+$counterLength+$questionLength+$passwordLength+$sessionInformationLength+$timeStampLength+1, 0); |
|
| 217 | + $msg = array_fill(0, $ocraSuiteLength + $counterLength + $questionLength + $passwordLength + $sessionInformationLength + $timeStampLength + 1, 0); |
|
| 218 | 218 | |
| 219 | - for($i=0;$i<strlen($ocraSuite);$i++) { |
|
| 219 | + for ($i = 0; $i < strlen($ocraSuite); $i++) { |
|
| 220 | 220 | $msg[$i] = $ocraSuite[$i]; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | // Put the bytes of "Counter" to the message |
| 227 | 227 | // Input is HEX encoded |
| 228 | - if($counterLength > 0 ) { |
|
| 228 | + if ($counterLength > 0) { |
|
| 229 | 229 | $bArray = self::_hexStr2Bytes($counter, $counterLength, 'counter'); |
| 230 | - for ($i=0;$i<strlen($bArray);$i++) { |
|
| 230 | + for ($i = 0; $i < strlen($bArray); $i++) { |
|
| 231 | 231 | $msg [$i + $ocraSuiteLength + 1] = $bArray[$i]; |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -235,41 +235,41 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | // Put the bytes of "question" to the message |
| 237 | 237 | // Input is text encoded |
| 238 | - if($questionLength > 0 ) { |
|
| 238 | + if ($questionLength > 0) { |
|
| 239 | 239 | $bArray = self::_hexStr2Bytes($question, $questionLength, 'question'); |
| 240 | - for ($i=0;$i<strlen($bArray);$i++) { |
|
| 240 | + for ($i = 0; $i < strlen($bArray); $i++) { |
|
| 241 | 241 | $msg [$i + $ocraSuiteLength + 1 + $counterLength] = $bArray[$i]; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // Put the bytes of "password" to the message |
| 246 | 246 | // Input is HEX encoded |
| 247 | - if($passwordLength > 0){ |
|
| 247 | + if ($passwordLength > 0) { |
|
| 248 | 248 | $bArray = self::_hexStr2Bytes($password, $passwordLength, 'password'); |
| 249 | - for ($i=0;$i<strlen($bArray);$i++) { |
|
| 249 | + for ($i = 0; $i < strlen($bArray); $i++) { |
|
| 250 | 250 | $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength] = $bArray[$i]; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // Put the bytes of "sessionInformation" to the message |
| 255 | 255 | // Input is HEX encoded |
| 256 | - if($sessionInformationLength > 0 ){ |
|
| 256 | + if ($sessionInformationLength > 0) { |
|
| 257 | 257 | $bArray = self::_hexStr2Bytes($sessionInformation, $sessionInformationLength, 'sessionInformation'); |
| 258 | - for ($i=0;$i<strlen($bArray);$i++) { |
|
| 258 | + for ($i = 0; $i < strlen($bArray); $i++) { |
|
| 259 | 259 | $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength] = $bArray[$i]; |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Put the bytes of "time" to the message |
| 264 | 264 | // Input is HEX encoded value of minutes |
| 265 | - if($timeStampLength > 0){ |
|
| 265 | + if ($timeStampLength > 0) { |
|
| 266 | 266 | $bArray = self::_hexStr2Bytes($timeStamp, $timeStampLength, 'timeStamp'); |
| 267 | - for ($i=0;$i<strlen($bArray);$i++) { |
|
| 267 | + for ($i = 0; $i < strlen($bArray); $i++) { |
|
| 268 | 268 | $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength + $sessionInformationLength] = $bArray[$i]; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - $byteKey = self::_hexStr2Bytes($key, strlen($key)/2, 'key'); |
|
| 272 | + $byteKey = self::_hexStr2Bytes($key, strlen($key) / 2, 'key'); |
|
| 273 | 273 | |
| 274 | 274 | $msg = implode("", $msg); |
| 275 | 275 | |
@@ -291,23 +291,23 @@ discard block |
||
| 291 | 291 | static function _oath_truncate(string $hash, int $length = 6) : string |
| 292 | 292 | { |
| 293 | 293 | // Convert to dec |
| 294 | - foreach(str_split($hash,2) as $hex) |
|
| 294 | + foreach (str_split($hash, 2) as $hex) |
|
| 295 | 295 | { |
| 296 | - $hmac_result[]=hexdec($hex); |
|
| 296 | + $hmac_result[] = hexdec($hex); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // Find offset |
| 300 | 300 | $offset = $hmac_result[count($hmac_result) - 1] & 0xf; |
| 301 | 301 | |
| 302 | 302 | $v = strval( |
| 303 | - (($hmac_result[$offset+0] & 0x7f) << 24 ) | |
|
| 304 | - (($hmac_result[$offset+1] & 0xff) << 16 ) | |
|
| 305 | - (($hmac_result[$offset+2] & 0xff) << 8 ) | |
|
| 306 | - ($hmac_result[$offset+3] & 0xff) |
|
| 303 | + (($hmac_result[$offset + 0] & 0x7f) << 24) | |
|
| 304 | + (($hmac_result[$offset + 1] & 0xff) << 16) | |
|
| 305 | + (($hmac_result[$offset + 2] & 0xff) << 8) | |
|
| 306 | + ($hmac_result[$offset + 3] & 0xff) |
|
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | // Prefix truncated string with 0's to ensure it always has the required length |
| 310 | - $v=str_pad($v, $length, "0", STR_PAD_LEFT); |
|
| 310 | + $v = str_pad($v, $length, "0", STR_PAD_LEFT); |
|
| 311 | 311 | |
| 312 | 312 | $v = substr($v, strlen($v) - $length); |
| 313 | 313 | return $v; |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | private function setUserSecret(string $userId, string $secret): void |
| 81 | 81 | { |
| 82 | - $data=array(); |
|
| 82 | + $data = array(); |
|
| 83 | 83 | if ($this->_userExists($userId)) { |
| 84 | 84 | $data = $this->_loadUser($userId); |
| 85 | 85 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function userExists(string $userId): bool |
| 84 | 84 | { |
| 85 | 85 | try { |
| 86 | - $sth = $this->handle->prepare('SELECT userid FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
| 86 | + $sth = $this->handle->prepare('SELECT userid FROM '.$this->tableName.' WHERE userid = ?'); |
|
| 87 | 87 | $sth->execute(array($userId)); |
| 88 | 88 | return (false !== $sth->fetchColumn()); |
| 89 | 89 | } |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | private function getUserSecret(string $userId): string |
| 104 | 104 | { |
| 105 | 105 | try { |
| 106 | - $sth = $this->handle->prepare('SELECT secret FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
| 106 | + $sth = $this->handle->prepare('SELECT secret FROM '.$this->tableName.' WHERE userid = ?'); |
|
| 107 | 107 | $sth->execute(array($userId)); |
| 108 | - $res=$sth->fetchColumn(); |
|
| 108 | + $res = $sth->fetchColumn(); |
|
| 109 | 109 | if ($res === false) { |
| 110 | 110 | // No result |
| 111 | 111 | $this->logger->error(sprintf('No result getting secret for user "%s"', $userId)); |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | // - The INSERT will fail when displayname has a NOT NULL constraint |
| 142 | 142 | try { |
| 143 | 143 | if ($this->userExists($userId)) { |
| 144 | - $sth = $this->handle->prepare('UPDATE ' . $this->tableName . ' SET secret = ? WHERE userid = ?'); |
|
| 144 | + $sth = $this->handle->prepare('UPDATE '.$this->tableName.' SET secret = ? WHERE userid = ?'); |
|
| 145 | 145 | } else { |
| 146 | - $sth = $this->handle->prepare('INSERT INTO ' . $this->tableName . ' (secret,userid) VALUES (?,?)'); |
|
| 146 | + $sth = $this->handle->prepare('INSERT INTO '.$this->tableName.' (secret,userid) VALUES (?,?)'); |
|
| 147 | 147 | } |
| 148 | 148 | $sth->execute(array($secret, $userId)); |
| 149 | 149 | } |