@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | parent::__construct($config, $secretconfig); |
| 45 | 45 | $this->tablename = isset($config['table']) ? $config['table'] : 'tiqruser'; |
| 46 | 46 | try { |
| 47 | - $this->handle = new PDO($config['dsn'],$config['username'],$config['password']); |
|
| 47 | + $this->handle = new PDO($config['dsn'], $config['username'], $config['password']); |
|
| 48 | 48 | } catch (PDOException $e) { |
| 49 | 49 | return false; |
| 50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } else { |
| 58 | 58 | $sth = $this->handle->prepare("INSERT INTO ".$this->tablename." (displayname,userid) VALUES (?,?)"); |
| 59 | 59 | } |
| 60 | - $sth->execute(array($displayName,$userId)); |
|
| 60 | + $sth->execute(array($displayName, $userId)); |
|
| 61 | 61 | return $this->userExists($userId); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function setNotificationType($userId, $type) |
| 86 | 86 | { |
| 87 | 87 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationtype = ? WHERE userid = ?"); |
| 88 | - $sth->execute(array($type,$userId)); |
|
| 88 | + $sth->execute(array($type, $userId)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function getNotificationAddress($userId) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | public function setNotificationAddress($userId, $address) |
| 99 | 99 | { |
| 100 | 100 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationaddress = ? WHERE userid = ?"); |
| 101 | - $sth->execute(array($address,$userId)); |
|
| 101 | + $sth->execute(array($address, $userId)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function getLoginAttempts($userId) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function setLoginAttempts($userId, $amount) |
| 112 | 112 | { |
| 113 | 113 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET loginattempts = ? WHERE userid = ?"); |
| 114 | - $sth->execute(array($amount,$userId)); |
|
| 114 | + $sth->execute(array($amount, $userId)); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function isBlocked($userId, $duration) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | public function setTemporaryBlockAttempts($userId, $amount) { |
| 144 | 144 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblockattempts = ? WHERE userid = ?"); |
| 145 | - $sth->execute(array($amount,$userId)); |
|
| 145 | + $sth->execute(array($amount, $userId)); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function getTemporaryBlockAttempts($userId) { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function setTemporaryBlockTimestamp($userId, $timestamp) |
| 158 | 158 | { |
| 159 | 159 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblocktimestamp = ? WHERE userid = ?"); |
| 160 | - $sth->execute(array($timestamp,$userId)); |
|
| 160 | + $sth->execute(array($timestamp, $userId)); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function getTemporaryBlockTimestamp($userId) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function createUser($userId, $displayName) |
| 44 | 44 | { |
| 45 | 45 | $user = array("userId"=>$userId, |
| 46 | - "displayName"=>$displayName); |
|
| 46 | + "displayName"=>$displayName); |
|
| 47 | 47 | return $this->_saveUser($userId, $user); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | if ($data = $this->_loadUser($userId)) { |
| 79 | 79 | if (isset($data["notificationType"])) { |
| 80 | - return $data["notificationType"]; |
|
| 80 | + return $data["notificationType"]; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | return NULL; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | if ($data = $this->_loadUser($userId)) { |
| 104 | 104 | if (isset($data["notificationAddress"])) { |
| 105 | - return $data["notificationAddress"]; |
|
| 105 | + return $data["notificationAddress"]; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | return NULL; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function userExists($userId) |
| 55 | 55 | { |
| 56 | 56 | $user = $this->_loadUser($userId, FALSE); |
| 57 | - return (is_array($user)||is_object($user)); |
|
| 57 | + return (is_array($user) || is_object($user)); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if ($data = $this->_loadUser($userId)) { |
| 154 | 154 | $timestamp = $this->getTemporaryBlockTimestamp($userId); |
| 155 | 155 | // if not blocked or block is expired, return false |
| 156 | - if (!isset($data["blocked"]) || $data["blocked"]==false || (false !== $timestamp && false != $duration && (strtotime($timestamp) + $duration * 60) < time())) { |
|
| 156 | + if (!isset($data["blocked"]) || $data["blocked"] == false || (false !== $timestamp && false != $duration && (strtotime($timestamp) + $duration * 60) < time())) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return Tiqr_UserStorage_Encryption_Interface |
| 40 | 40 | */ |
| 41 | - public static function getEncryption($type="dummy", $options=array()) |
|
| 41 | + public static function getEncryption($type = "dummy", $options = array()) |
|
| 42 | 42 | { |
| 43 | 43 | switch ($type) { |
| 44 | 44 | case "dummy": |
@@ -94,8 +94,8 @@ |
||
| 94 | 94 | */ |
| 95 | 95 | public function getPath() |
| 96 | 96 | { |
| 97 | - if (substr($this->_path, -1)!="/") return $this->_path."/"; |
|
| 98 | - return $this->_path; |
|
| 97 | + if (substr($this->_path, -1)!="/") return $this->_path."/"; |
|
| 98 | + return $this->_path; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if ($data === NULL) { |
| 69 | 69 | if ($failIfNotFound) { |
| 70 | - throw new Exception('Error loading data for user: ' . var_export($userId, TRUE)); |
|
| 70 | + throw new Exception('Error loading data for user: '.var_export($userId, TRUE)); |
|
| 71 | 71 | } else { |
| 72 | 72 | return false; |
| 73 | 73 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function getPath() |
| 96 | 96 | { |
| 97 | - if (substr($this->_path, -1)!="/") return $this->_path."/"; |
|
| 97 | + if (substr($this->_path, -1) != "/") return $this->_path."/"; |
|
| 98 | 98 | return $this->_path; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return Tiqr_OcraService_Interface |
| 38 | 38 | */ |
| 39 | - public static function getOcraService($type="tiqr", $options=array()) |
|
| 39 | + public static function getOcraService($type = "tiqr", $options = array()) |
|
| 40 | 40 | { |
| 41 | 41 | switch ($type) { |
| 42 | 42 | case "tiqr": |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if (!isset($type)) { |
| 52 | 52 | throw new Exception('Class name not set'); |
| 53 | 53 | } elseif (!class_exists($type)) { |
| 54 | - throw new Exception('Class not found: ' . var_export($type, TRUE)); |
|
| 54 | + throw new Exception('Class not found: '.var_export($type, TRUE)); |
|
| 55 | 55 | } |
| 56 | 56 | $instance = new $type($options); |
| 57 | 57 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * options per type. |
| 44 | 44 | * @throws Exception If an unknown type is requested. |
| 45 | 45 | */ |
| 46 | - public static function getStorage($type="file", $options=array()) |
|
| 46 | + public static function getStorage($type = "file", $options = array()) |
|
| 47 | 47 | { |
| 48 | 48 | switch ($type) { |
| 49 | 49 | case "file": |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | if (!isset($type)) { |
| 63 | 63 | throw new Exception('Class name not set'); |
| 64 | 64 | } elseif (!class_exists($type)) { |
| 65 | - throw new Exception('Class not found: ' . var_export($type, TRUE)); |
|
| 65 | + throw new Exception('Class not found: '.var_export($type, TRUE)); |
|
| 66 | 66 | } elseif (!is_subclass_of($type, 'Tiqr_StateStorage_Abstract')) { |
| 67 | - throw new Exception('Class ' . $type . ' not subclass of Tiqr_StateStorage_Abstract'); |
|
| 67 | + throw new Exception('Class '.$type.' not subclass of Tiqr_StateStorage_Abstract'); |
|
| 68 | 68 | } |
| 69 | 69 | $instance = new $type($options); |
| 70 | 70 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * the Tiqr_DeviceStorage factory will call this for you. |
| 54 | 54 | * @param array $options The options for the s |
| 55 | 55 | */ |
| 56 | - public function __construct($options=array()) |
|
| 56 | + public function __construct($options = array()) |
|
| 57 | 57 | { |
| 58 | 58 | $this->_options = $options; |
| 59 | 59 | } |
@@ -41,11 +41,11 @@ |
||
| 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) return false; |
|
| 48 | - if (stripos($output, "error")!==false) return false; |
|
| 47 | + if (stripos($output, "not found") !== false) return false; |
|
| 48 | + if (stripos($output, "error") !== false) return false; |
|
| 49 | 49 | return trim($output); |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | \ No newline at end of file |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $this->tablename = isset($config['table']) ? $config['table'] : 'tiqrusersecret'; |
| 42 | 42 | try { |
| 43 | - $this->handle = new PDO($config['dsn'],$config['username'],$config['password']); |
|
| 43 | + $this->handle = new PDO($config['dsn'], $config['username'], $config['password']); |
|
| 44 | 44 | } catch (PDOException $e) { |
| 45 | 45 | return false; |
| 46 | 46 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } else { |
| 74 | 74 | $sth = $this->handle->prepare("INSERT INTO ".$this->tablename." (secret,userid) VALUES (?,?)"); |
| 75 | 75 | } |
| 76 | - $sth->execute(array($secret,$userId)); |
|
| 76 | + $sth->execute(array($secret, $userId)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public static function log($message) |