@@ -130,8 +130,9 @@ |
||
130 | 130 | $key = $this->_getKeyPrefix().$key; |
131 | 131 | |
132 | 132 | $result = $this->_memcache->get($key); |
133 | - if( $result === false ) |
|
134 | - return null; |
|
133 | + if( $result === false ) { |
|
134 | + return null; |
|
135 | + } |
|
135 | 136 | return $result; |
136 | 137 | } |
137 | 138 |
@@ -94,7 +94,9 @@ |
||
94 | 94 | */ |
95 | 95 | public function getPath() |
96 | 96 | { |
97 | - if (substr($this->_path, -1)!="/") return $this->_path."/"; |
|
97 | + if (substr($this->_path, -1)!="/") { |
|
98 | + return $this->_path."/"; |
|
99 | + } |
|
98 | 100 | return $this->_path; |
99 | 101 | } |
100 | 102 |
@@ -44,8 +44,12 @@ |
||
44 | 44 | $url.= "¬ificationToken=".$notificationToken; |
45 | 45 | |
46 | 46 | $output = file_get_contents($url); |
47 | - if (stripos($output, "not found")!==false) return false; |
|
48 | - if (stripos($output, "error")!==false) return false; |
|
47 | + if (stripos($output, "not found")!==false) { |
|
48 | + return false; |
|
49 | + } |
|
50 | + if (stripos($output, "error")!==false) { |
|
51 | + return false; |
|
52 | + } |
|
49 | 53 | return trim($output); |
50 | 54 | } |
51 | 55 | } |
52 | 56 | \ No newline at end of file |
@@ -107,7 +107,9 @@ |
||
107 | 107 | { |
108 | 108 | // find the :QN10, -QN10, QH10 etc. bit |
109 | 109 | $pos = stripos($ocraSuite, ":q"); |
110 | - if ($pos===false) $pos = stripos($ocraSuite, "-q"); |
|
110 | + if ($pos===false) { |
|
111 | + $pos = stripos($ocraSuite, "-q"); |
|
112 | + } |
|
111 | 113 | if ($pos===false) { |
112 | 114 | // No challenge config specified. Since we only support challenge based OCRA, we fallback to default 10 digit hexadecimal. |
113 | 115 | return array("format"=>"H", "length"=>10); |
@@ -101,12 +101,15 @@ discard block |
||
101 | 101 | $sessionInformationLength = 0; |
102 | 102 | $timeStampLength = 0; |
103 | 103 | |
104 | - if(stripos($ocraSuite, "sha1")!==false) |
|
105 | - $crypto = "sha1"; |
|
106 | - if(stripos($ocraSuite, "sha256")!==false) |
|
107 | - $crypto = "sha256"; |
|
108 | - if(stripos($ocraSuite, "sha512")!==false) |
|
109 | - $crypto = "sha512"; |
|
104 | + if(stripos($ocraSuite, "sha1")!==false) { |
|
105 | + $crypto = "sha1"; |
|
106 | + } |
|
107 | + if(stripos($ocraSuite, "sha256")!==false) { |
|
108 | + $crypto = "sha256"; |
|
109 | + } |
|
110 | + if(stripos($ocraSuite, "sha512")!==false) { |
|
111 | + $crypto = "sha512"; |
|
112 | + } |
|
110 | 113 | |
111 | 114 | // How many digits should we return |
112 | 115 | $oS = substr($ocraSuite, strpos($ocraSuite, ":")+1, strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1) -strpos($ocraSuite, ":")-1); |
@@ -116,31 +119,35 @@ discard block |
||
116 | 119 | // Counter |
117 | 120 | if(stripos($ocraSuite, ":c") !==false) { |
118 | 121 | // Fix the length of the HEX string |
119 | - while(strlen($counter) < 16) |
|
120 | - $counter = "0" . $counter; |
|
122 | + while(strlen($counter) < 16) { |
|
123 | + $counter = "0" . $counter; |
|
124 | + } |
|
121 | 125 | $counterLength=8; |
122 | 126 | } |
123 | 127 | // Question |
124 | 128 | if(stripos($ocraSuite, ":q")!==false || |
125 | 129 | stripos($ocraSuite, "-q")!==false) { |
126 | - while(strlen($question) < 256) |
|
127 | - $question = $question . "0"; |
|
130 | + while(strlen($question) < 256) { |
|
131 | + $question = $question . "0"; |
|
132 | + } |
|
128 | 133 | $questionLength=128; |
129 | 134 | } |
130 | 135 | |
131 | 136 | // Password |
132 | 137 | if(stripos($ocraSuite, ":p")!==false || |
133 | 138 | stripos($ocraSuite, "-p") !==false) { |
134 | - while(strlen($password) < 40) |
|
135 | - $password = "0" . $password; |
|
139 | + while(strlen($password) < 40) { |
|
140 | + $password = "0" . $password; |
|
141 | + } |
|
136 | 142 | $passwordLength=20; |
137 | 143 | } |
138 | 144 | |
139 | 145 | // sessionInformation |
140 | 146 | if(stripos($ocraSuite, ":s") !==false || |
141 | 147 | stripos($ocraSuite, "-s", strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1)) !== false) { |
142 | - while(strlen($sessionInformation) < 128) |
|
143 | - $sessionInformation = "0" . $sessionInformation; |
|
148 | + while(strlen($sessionInformation) < 128) { |
|
149 | + $sessionInformation = "0" . $sessionInformation; |
|
150 | + } |
|
144 | 151 | |
145 | 152 | $sessionInformationLength=64; |
146 | 153 | } |
@@ -148,8 +155,9 @@ discard block |
||
148 | 155 | // TimeStamp |
149 | 156 | if(stripos($ocraSuite, ":t") !==false || |
150 | 157 | stripos($ocraSuite, "-t") !== false) { |
151 | - while(strlen($timeStamp) < 16) |
|
152 | - $timeStamp = "0" . $timeStamp; |
|
158 | + while(strlen($timeStamp) < 16) { |
|
159 | + $timeStamp = "0" . $timeStamp; |
|
160 | + } |
|
153 | 161 | $timeStampLength=8; |
154 | 162 | } |
155 | 163 |
@@ -97,12 +97,15 @@ discard block |
||
97 | 97 | $cryptoFunction = $components[1]; |
98 | 98 | $dataInput = strtolower($components[2]); // lower here so we can do case insensitive comparisons |
99 | 99 | |
100 | - if(stripos($cryptoFunction, "sha1")!==false) |
|
101 | - $crypto = "sha1"; |
|
102 | - if(stripos($cryptoFunction, "sha256")!==false) |
|
103 | - $crypto = "sha256"; |
|
104 | - if(stripos($cryptoFunction, "sha512")!==false) |
|
105 | - $crypto = "sha512"; |
|
100 | + if(stripos($cryptoFunction, "sha1")!==false) { |
|
101 | + $crypto = "sha1"; |
|
102 | + } |
|
103 | + if(stripos($cryptoFunction, "sha256")!==false) { |
|
104 | + $crypto = "sha256"; |
|
105 | + } |
|
106 | + if(stripos($cryptoFunction, "sha512")!==false) { |
|
107 | + $crypto = "sha512"; |
|
108 | + } |
|
106 | 109 | |
107 | 110 | $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-")+1); |
108 | 111 | |
@@ -110,63 +113,73 @@ discard block |
||
110 | 113 | // Counter |
111 | 114 | if($dataInput[0] == "c" ) { |
112 | 115 | // Fix the length of the HEX string |
113 | - while(strlen($counter) < 16) |
|
114 | - $counter = "0" . $counter; |
|
116 | + while(strlen($counter) < 16) { |
|
117 | + $counter = "0" . $counter; |
|
118 | + } |
|
115 | 119 | $counterLength=8; |
116 | 120 | } |
117 | 121 | // Question |
118 | 122 | if($dataInput[0] == "q" || |
119 | 123 | stripos($dataInput, "-q")!==false) { |
120 | - while(strlen($question) < 256) |
|
121 | - $question = $question . "0"; |
|
124 | + while(strlen($question) < 256) { |
|
125 | + $question = $question . "0"; |
|
126 | + } |
|
122 | 127 | $questionLength=128; |
123 | 128 | } |
124 | 129 | |
125 | 130 | // Password |
126 | 131 | if(stripos($dataInput, "psha1")!==false) { |
127 | - while(strlen($password) < 40) |
|
128 | - $password = "0" . $password; |
|
132 | + while(strlen($password) < 40) { |
|
133 | + $password = "0" . $password; |
|
134 | + } |
|
129 | 135 | $passwordLength=20; |
130 | 136 | } |
131 | 137 | |
132 | 138 | if(stripos($dataInput, "psha256")!==false) { |
133 | - while(strlen($password) < 64) |
|
134 | - $password = "0" . $password; |
|
139 | + while(strlen($password) < 64) { |
|
140 | + $password = "0" . $password; |
|
141 | + } |
|
135 | 142 | $passwordLength=32; |
136 | 143 | } |
137 | 144 | |
138 | 145 | if(stripos($dataInput, "psha512")!==false) { |
139 | - while(strlen($password) < 128) |
|
140 | - $password = "0" . $password; |
|
146 | + while(strlen($password) < 128) { |
|
147 | + $password = "0" . $password; |
|
148 | + } |
|
141 | 149 | $passwordLength=64; |
142 | 150 | } |
143 | 151 | |
144 | 152 | // sessionInformation |
145 | 153 | if(stripos($dataInput, "s064") !==false) { |
146 | - while(strlen($sessionInformation) < 128) |
|
147 | - $sessionInformation = "0" . $sessionInformation; |
|
154 | + while(strlen($sessionInformation) < 128) { |
|
155 | + $sessionInformation = "0" . $sessionInformation; |
|
156 | + } |
|
148 | 157 | |
149 | 158 | $sessionInformationLength=64; |
150 | 159 | } else if(stripos($dataInput, "s128") !==false) { |
151 | - while(strlen($sessionInformation) < 256) |
|
152 | - $sessionInformation = "0" . $sessionInformation; |
|
160 | + while(strlen($sessionInformation) < 256) { |
|
161 | + $sessionInformation = "0" . $sessionInformation; |
|
162 | + } |
|
153 | 163 | |
154 | 164 | $sessionInformationLength=128; |
155 | 165 | } else if(stripos($dataInput, "s256") !==false) { |
156 | - while(strlen($sessionInformation) < 512) |
|
157 | - $sessionInformation = "0" . $sessionInformation; |
|
166 | + while(strlen($sessionInformation) < 512) { |
|
167 | + $sessionInformation = "0" . $sessionInformation; |
|
168 | + } |
|
158 | 169 | |
159 | 170 | $sessionInformationLength=256; |
160 | 171 | } else if(stripos($dataInput, "s512") !==false) { |
161 | - while(strlen($sessionInformation) < 128) |
|
162 | - $sessionInformation = "0" . $sessionInformation; |
|
172 | + while(strlen($sessionInformation) < 128) { |
|
173 | + $sessionInformation = "0" . $sessionInformation; |
|
174 | + } |
|
163 | 175 | |
164 | 176 | $sessionInformationLength=64; |
165 | 177 | } else if (stripos($dataInput, "s") !== false ) { |
166 | 178 | // deviation from spec. Officially 's' without a length indicator is not in the reference implementation. |
167 | 179 | // RFC is ambigious. However we have supported this in Tiqr since day 1, so we continue to support it. |
168 | - while(strlen($sessionInformation) < 128) |
|
169 | - $sessionInformation = "0" . $sessionInformation; |
|
180 | + while(strlen($sessionInformation) < 128) { |
|
181 | + $sessionInformation = "0" . $sessionInformation; |
|
182 | + } |
|
170 | 183 | |
171 | 184 | $sessionInformationLength=64; |
172 | 185 | } |
@@ -176,8 +189,9 @@ discard block |
||
176 | 189 | // TimeStamp |
177 | 190 | if($dataInput[0] == "t" || |
178 | 191 | stripos($dataInput, "-t") !== false) { |
179 | - while(strlen($timeStamp) < 16) |
|
180 | - $timeStamp = "0" . $timeStamp; |
|
192 | + while(strlen($timeStamp) < 16) { |
|
193 | + $timeStamp = "0" . $timeStamp; |
|
194 | + } |
|
181 | 195 | $timeStampLength=8; |
182 | 196 | } |
183 | 197 |
@@ -453,7 +453,9 @@ |
||
453 | 453 | $sessionId = session_id(); |
454 | 454 | } |
455 | 455 | $status = $this->_stateStorage->getValue("enrollstatus".$sessionId); |
456 | - if (is_null($status)) return self::ENROLLMENT_STATUS_IDLE; |
|
456 | + if (is_null($status)) { |
|
457 | + return self::ENROLLMENT_STATUS_IDLE; |
|
458 | + } |
|
457 | 459 | return $status; |
458 | 460 | } |
459 | 461 |