@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $this->importSupport = false; |
| 59 | 59 | |
| 60 | 60 | $browserName = $this->getBrowserName(); |
| 61 | - if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 61 | + if ($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 62 | 62 | { |
| 63 | - header( 'Location: /badbrowser.php' ) ; |
|
| 63 | + header('Location: /badbrowser.php'); |
|
| 64 | 64 | } |
| 65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 65 | + else if ($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 66 | 66 | { |
| 67 | 67 | $this->importSupport = true; |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function getBrowscap() |
| 79 | 79 | { |
| 80 | - if(isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 80 | + if (isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 81 | 81 | { |
| 82 | 82 | return new Browscap($GLOBALS['BROWSCAP_CACHE']); |
| 83 | 83 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function getBrowser() |
| 91 | 91 | { |
| 92 | - static $browser;//No accident can arise from depending on an unset variable. |
|
| 93 | - if(!isset($browser)) |
|
| 92 | + static $browser; //No accident can arise from depending on an unset variable. |
|
| 93 | + if (!isset($browser)) |
|
| 94 | 94 | { |
| 95 | 95 | $browser = $this->browscap->getBrowser(); |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | private function getBrowserName() |
| 104 | 104 | { |
| 105 | - if(isset($this->browser->Browser)) |
|
| 105 | + if (isset($this->browser->Browser)) |
|
| 106 | 106 | { |
| 107 | 107 | return $this->browser->Browser; |
| 108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function getBrowserMajorVer() |
| 119 | 119 | { |
| 120 | - if(isset($this->browser->MajorVer)) |
|
| 120 | + if (isset($this->browser->MajorVer)) |
|
| 121 | 121 | { |
| 122 | 122 | return $this->browser->MajorVer; |
| 123 | 123 | } |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return string The tag as a string |
| 192 | 192 | */ |
| 193 | - protected function createOpenTag($tagName, $attribs=array(), $selfClose=false) |
|
| 193 | + protected function createOpenTag($tagName, $attribs = array(), $selfClose = false) |
|
| 194 | 194 | { |
| 195 | 195 | $tag = '<'.$tagName; |
| 196 | 196 | $attribNames = array_keys($attribs); |
| 197 | - foreach($attribNames as $attribName) |
|
| 197 | + foreach ($attribNames as $attribName) |
|
| 198 | 198 | { |
| 199 | - $tag.=' '.$attribName; |
|
| 200 | - if($attribs[$attribName]) |
|
| 199 | + $tag .= ' '.$attribName; |
|
| 200 | + if ($attribs[$attribName]) |
|
| 201 | 201 | { |
| 202 | - $tag.='="'.$attribs[$attribName].'"'; |
|
| 202 | + $tag .= '="'.$attribs[$attribName].'"'; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - if($selfClose) |
|
| 205 | + if ($selfClose) |
|
| 206 | 206 | { |
| 207 | 207 | return $tag.'/>'; |
| 208 | 208 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return string The link |
| 231 | 231 | */ |
| 232 | - public function createLink($linkName, $linkTarget='#') |
|
| 232 | + public function createLink($linkName, $linkTarget = '#') |
|
| 233 | 233 | { |
| 234 | 234 | $startTag = $this->createOpenTag('a', array('href'=>$linkTarget)); |
| 235 | 235 | $endTag = $this->createCloseTag('a'); |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param string $prefix The prefix to append to each line |
| 247 | 247 | */ |
| 248 | - protected function printIeCompatability($prefix='') |
|
| 248 | + protected function printIeCompatability($prefix = '') |
|
| 249 | 249 | { |
| 250 | 250 | //IE 8 doesn't support HTML 5. Install the shim... |
| 251 | - if($this->getBrowserMajorVer() < 9) |
|
| 251 | + if ($this->getBrowserMajorVer() < 9) |
|
| 252 | 252 | { |
| 253 | 253 | echo $prefix.'<script src="js/html5.js"></script>'; |
| 254 | 254 | echo "\n"; |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param string $prefix The prefix to append to each line |
| 265 | 265 | */ |
| 266 | - protected function printHead($prefix='') |
|
| 266 | + protected function printHead($prefix = '') |
|
| 267 | 267 | { |
| 268 | 268 | echo $prefix.'<HEAD>'; |
| 269 | - if($this->getBrowserName() === 'IE') |
|
| 269 | + if ($this->getBrowserName() === 'IE') |
|
| 270 | 270 | { |
| 271 | 271 | $this->printIeCompatability($prefix.$prefix); |
| 272 | 272 | } |
| 273 | 273 | echo $prefix.$prefix.'<TITLE>'.$this->title.'</TITLE>'; |
| 274 | 274 | echo $prefix.$prefix.'<meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
| 275 | - foreach($this->headTags as $tag) |
|
| 275 | + foreach ($this->headTags as $tag) |
|
| 276 | 276 | { |
| 277 | 277 | echo $prefix.$prefix.$tag."\n"; |
| 278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @param string $prefix The prefix to append to each line |
| 286 | 286 | */ |
| 287 | - protected function printBody($prefix='') |
|
| 287 | + protected function printBody($prefix = '') |
|
| 288 | 288 | { |
| 289 | 289 | echo $prefix.'<BODY '.$this->body_tags.'>'; |
| 290 | 290 | echo $prefix.$prefix.$this->body."\n"; |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function currentURL() |
| 314 | 314 | { |
| 315 | - if(!isset($_SERVER['REQUEST_URI'])) |
|
| 315 | + if (!isset($_SERVER['REQUEST_URI'])) |
|
| 316 | 316 | { |
| 317 | 317 | return ''; |
| 318 | 318 | } |
| 319 | 319 | $requestURI = $_SERVER['REQUEST_URI']; |
| 320 | - if($requestURI[0] === '/') |
|
| 320 | + if ($requestURI[0] === '/') |
|
| 321 | 321 | { |
| 322 | 322 | $requestURI = substr($requestURI, 1); |
| 323 | 323 | } |
| 324 | - return 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 324 | + return 'http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | protected function __construct() |
| 38 | 38 | { |
| 39 | 39 | $this->methods = array(); |
| 40 | - if(isset(FlipsideSettings::$email_providers)) |
|
| 40 | + if (isset(FlipsideSettings::$email_providers)) |
|
| 41 | 41 | { |
| 42 | 42 | $keys = array_keys(FlipsideSettings::$email_providers); |
| 43 | 43 | $count = count($keys); |
| 44 | - for($i = 0; $i < $count; $i++) |
|
| 44 | + for ($i = 0; $i < $count; $i++) |
|
| 45 | 45 | { |
| 46 | 46 | $class = $keys[$i]; |
| 47 | 47 | array_push($this->methods, new $class(FlipsideSettings::$email_providers[$keys[$i]])); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | public function getEmailMethod($methodName) |
| 60 | 60 | { |
| 61 | 61 | $count = count($this->methods); |
| 62 | - for($i = 0; $i < $count; $i++) |
|
| 62 | + for ($i = 0; $i < $count; $i++) |
|
| 63 | 63 | { |
| 64 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 64 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 65 | 65 | { |
| 66 | 66 | return $this->methods[$i]; |
| 67 | 67 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function sendEmail($email, $methodName = false) |
| 81 | 81 | { |
| 82 | - if($methodName === false) |
|
| 82 | + if ($methodName === false) |
|
| 83 | 83 | { |
| 84 | 84 | $res = false; |
| 85 | 85 | $count = count($this->methods); |
| 86 | - for($i = 0; $i < $count; $i++) |
|
| 86 | + for ($i = 0; $i < $count; $i++) |
|
| 87 | 87 | { |
| 88 | 88 | $res = $this->methods[$i]->sendEmail($email); |
| 89 | - if($res !== false) |
|
| 89 | + if ($res !== false) |
|
| 90 | 90 | { |
| 91 | 91 | return $res; |
| 92 | 92 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getFromAddress() |
| 64 | 64 | { |
| 65 | - if($this->sender === false) |
|
| 65 | + if ($this->sender === false) |
|
| 66 | 66 | { |
| 67 | 67 | return 'Burning Flipside <[email protected]>'; |
| 68 | 68 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getReplyTo() |
| 108 | 108 | { |
| 109 | - if($this->replyTo === false) |
|
| 109 | + if ($this->replyTo === false) |
|
| 110 | 110 | { |
| 111 | 111 | return $this->getFromAddress(); |
| 112 | 112 | } |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | * @param string $email The email address to send from |
| 150 | 150 | * @param string $name The name to associate with the from address |
| 151 | 151 | */ |
| 152 | - public function setFromAddress($email, $name=false) |
|
| 152 | + public function setFromAddress($email, $name = false) |
|
| 153 | 153 | { |
| 154 | 154 | $address = $email; |
| 155 | - if($name !== false) |
|
| 155 | + if ($name !== false) |
|
| 156 | 156 | { |
| 157 | 157 | $address = $name.' <'.$email.'>'; |
| 158 | 158 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $email The email address to send to |
| 166 | 166 | * @param string $name The name to associate with the address |
| 167 | 167 | */ |
| 168 | - public function addToAddress($email, $name=false) |
|
| 168 | + public function addToAddress($email, $name = false) |
|
| 169 | 169 | { |
| 170 | 170 | $this->addAddress($this->to, $email, $name); |
| 171 | 171 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string $email The email address to send to |
| 177 | 177 | * @param string $name The name to associate with the address |
| 178 | 178 | */ |
| 179 | - public function addCCAddress($email, $name=false) |
|
| 179 | + public function addCCAddress($email, $name = false) |
|
| 180 | 180 | { |
| 181 | 181 | $this->addAddress($this->cc, $email, $name); |
| 182 | 182 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param string $email The email address to send to |
| 188 | 188 | * @param string $name The name to associate with the address |
| 189 | 189 | */ |
| 190 | - public function addBCCAddress($email, $name=false) |
|
| 190 | + public function addBCCAddress($email, $name = false) |
|
| 191 | 191 | { |
| 192 | 192 | $this->addAddress($this->bcc, $email, $name); |
| 193 | 193 | } |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | * @param string $email The email address to send to |
| 200 | 200 | * @param string $name The name to associate with the address |
| 201 | 201 | */ |
| 202 | - protected function addAddress(&$list, $email, $name=false) |
|
| 202 | + protected function addAddress(&$list, $email, $name = false) |
|
| 203 | 203 | { |
| 204 | 204 | $address = $email; |
| 205 | - if($name !== false) |
|
| 205 | + if ($name !== false) |
|
| 206 | 206 | { |
| 207 | 207 | $address = $name.' <'.$email.'>'; |
| 208 | 208 | } |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | * @param string $email The email address to reply to |
| 216 | 216 | * @param string $name The name to associate with the from address |
| 217 | 217 | */ |
| 218 | - public function setReplyTo($email, $name=false) |
|
| 218 | + public function setReplyTo($email, $name = false) |
|
| 219 | 219 | { |
| 220 | 220 | $address = $email; |
| 221 | - if($name !== false) |
|
| 221 | + if ($name !== false) |
|
| 222 | 222 | { |
| 223 | 223 | $address = $name.' <'.$email.'>'; |
| 224 | 224 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function appendToHTMLBody($body) |
| 264 | 264 | { |
| 265 | - $this->htmlBody.= $body; |
|
| 265 | + $this->htmlBody .= $body; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function appendToTextBody($body) |
| 274 | 274 | { |
| 275 | - $this->textBody.= $body; |
|
| 275 | + $this->textBody .= $body; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function addAttachmentFromFile($filename, $name = false) |
| 297 | 297 | { |
| 298 | - if($name === false) |
|
| 298 | + if ($name === false) |
|
| 299 | 299 | { |
| 300 | 300 | $name = basename($filename); |
| 301 | 301 | } |
| 302 | 302 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 303 | 303 | $mimeType = finfo_file($finfo, $filename); |
| 304 | - if($mimeType === false) |
|
| 304 | + if ($mimeType === false) |
|
| 305 | 305 | { |
| 306 | 306 | $mimeType = 'application/octet-stream'; |
| 307 | 307 | } |
| 308 | - if(file_exists($filename) && is_file($filename) && is_readable($filename)) |
|
| 308 | + if (file_exists($filename) && is_file($filename) && is_readable($filename)) |
|
| 309 | 309 | { |
| 310 | 310 | $this->addAttachmentFromBuffer($name, file_get_contents($filename), $mimeType); |
| 311 | 311 | } |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | $boundary = uniqid(rand(), true); |
| 332 | 332 | $rawMessage = 'To: '.$this->encodeRecipients($this->getToAddresses())."\n"; |
| 333 | - $rawMessage.= 'From: '.$this->encodeRecipients($this->getFromAddress())."\n"; |
|
| 334 | - if(!empty($this->cc)) |
|
| 333 | + $rawMessage .= 'From: '.$this->encodeRecipients($this->getFromAddress())."\n"; |
|
| 334 | + if (!empty($this->cc)) |
|
| 335 | 335 | { |
| 336 | - $rawMessage.= 'CC: '. $this->encodeRecipients($this->getCCAddresses())."\n"; |
|
| 336 | + $rawMessage .= 'CC: '.$this->encodeRecipients($this->getCCAddresses())."\n"; |
|
| 337 | 337 | } |
| 338 | - if(!empty($this->bcc)) |
|
| 338 | + if (!empty($this->bcc)) |
|
| 339 | 339 | { |
| 340 | - $rawMessage.= 'BCC: '. $this->encodeRecipients($this->getBCCAddresses())."\n"; |
|
| 340 | + $rawMessage .= 'BCC: '.$this->encodeRecipients($this->getBCCAddresses())."\n"; |
|
| 341 | 341 | } |
| 342 | 342 | $rawMessage .= 'Subject: '.$this->getSubject()."\n"; |
| 343 | 343 | $rawMessage .= 'MIME-Version: 1.0'."\n"; |
@@ -345,27 +345,27 @@ discard block |
||
| 345 | 345 | $rawMessage .= "\n--{$boundary}\n"; |
| 346 | 346 | $rawMessage .= 'Content-type: Multipart/Alternative; boundary="alt-'.$boundary.'"'."\n"; |
| 347 | 347 | $textBody = $this->getTextBody(); |
| 348 | - if($textBody !== false && strlen($textBody) > 0) |
|
| 348 | + if ($textBody !== false && strlen($textBody) > 0) |
|
| 349 | 349 | { |
| 350 | - $rawMessage.= "\n--alt-{$boundary}\n"; |
|
| 351 | - $rawMessage.= "Content-Type: text/plain\n\n"; |
|
| 352 | - $rawMessage.= $textBody."\n"; |
|
| 350 | + $rawMessage .= "\n--alt-{$boundary}\n"; |
|
| 351 | + $rawMessage .= "Content-Type: text/plain\n\n"; |
|
| 352 | + $rawMessage .= $textBody."\n"; |
|
| 353 | 353 | } |
| 354 | - $htmlBody = $this->getHTMLBody(); |
|
| 355 | - if($htmlBody !== false && strlen($htmlBody) > 0) |
|
| 354 | + $htmlBody = $this->getHTMLBody(); |
|
| 355 | + if ($htmlBody !== false && strlen($htmlBody) > 0) |
|
| 356 | 356 | { |
| 357 | 357 | $rawMessage .= "\n--alt-{$boundary}\n"; |
| 358 | 358 | $rawMessage .= 'Content-Type: text/html; charset="UTF-8"'."\n\n"; |
| 359 | 359 | $rawMessage .= $htmlBody."\n"; |
| 360 | 360 | } |
| 361 | - $rawMessage.= "\n--alt-{$boundary}--\n"; |
|
| 362 | - foreach($this->attachments as $attachment) |
|
| 361 | + $rawMessage .= "\n--alt-{$boundary}--\n"; |
|
| 362 | + foreach ($this->attachments as $attachment) |
|
| 363 | 363 | { |
| 364 | - $rawMessage.= "\n--{$boundary}\n"; |
|
| 365 | - $rawMessage.= 'Content-Type: '. $attachment['mimeType'].'; name="'.$attachment['name']."\"\n"; |
|
| 366 | - $rawMessage.= 'Content-Disposition: attachment'."\n"; |
|
| 367 | - $rawMessage.= 'Content-Transfer-Encoding: base64'."\n\n"; |
|
| 368 | - $rawMessage.= chunk_split(base64_encode($attachment['data']), 76, "\n")."\n"; |
|
| 364 | + $rawMessage .= "\n--{$boundary}\n"; |
|
| 365 | + $rawMessage .= 'Content-Type: '.$attachment['mimeType'].'; name="'.$attachment['name']."\"\n"; |
|
| 366 | + $rawMessage .= 'Content-Disposition: attachment'."\n"; |
|
| 367 | + $rawMessage .= 'Content-Transfer-Encoding: base64'."\n\n"; |
|
| 368 | + $rawMessage .= chunk_split(base64_encode($attachment['data']), 76, "\n")."\n"; |
|
| 369 | 369 | } |
| 370 | 370 | $rawMessage .= "\n--{$boundary}--\n"; |
| 371 | 371 | return $rawMessage; |
@@ -380,11 +380,11 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function encodeRecipients($recipient) |
| 382 | 382 | { |
| 383 | - if(is_array($recipient)) |
|
| 383 | + if (is_array($recipient)) |
|
| 384 | 384 | { |
| 385 | 385 | return join(', ', array_map(array($this, 'encodeRecipients'), $recipient)); |
| 386 | 386 | } |
| 387 | - if(preg_match("/(.*)<(.*)>/", $recipient, $regs)) |
|
| 387 | + if (preg_match("/(.*)<(.*)>/", $recipient, $regs)) |
|
| 388 | 388 | { |
| 389 | 389 | $recipient = '=?UTF-8?B?'.base64_encode($regs[1]).'?= <'.$regs[2].'>'; |
| 390 | 390 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | public function sendEmail($email) |
| 29 | 29 | { |
| 30 | - if($email->hasAttachments()) |
|
| 30 | + if ($email->hasAttachments()) |
|
| 31 | 31 | { |
| 32 | 32 | //Amazeon sendEmail doesn't support attachments. We need to use sendRawEmail |
| 33 | 33 | $args = array(); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public $server; |
| 7 | 7 | |
| 8 | - function __construct($array=false, $server=false) |
|
| 8 | + function __construct($array = false, $server = false) |
|
| 9 | 9 | { |
| 10 | 10 | parent::__construct($array); |
| 11 | 11 | $this->server = $server; |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | $ret = array(); |
| 17 | 17 | foreach ($this as $key => $value) |
| 18 | 18 | { |
| 19 | - if($key === 'server' || $key === 'count') continue; |
|
| 20 | - if(is_numeric($key)) continue; |
|
| 21 | - if($key === 'jpegphoto') |
|
| 19 | + if ($key === 'server' || $key === 'count') continue; |
|
| 20 | + if (is_numeric($key)) continue; |
|
| 21 | + if ($key === 'jpegphoto') |
|
| 22 | 22 | { |
| 23 | 23 | $ret[$key] = base64_encode($value[0]); |
| 24 | 24 | continue; |
| 25 | 25 | } |
| 26 | - if(is_array($value) && $value['count'] === 1) |
|
| 26 | + if (is_array($value) && $value['count'] === 1) |
|
| 27 | 27 | { |
| 28 | 28 | $ret[$key] = $value[0]; |
| 29 | 29 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * use the FlipsideSettings class |
| 16 | 16 | */ |
| 17 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 17 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 18 | 18 | { |
| 19 | 19 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
| 20 | 20 | } |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | static function getDataSetByName($setName) |
| 60 | 60 | { |
| 61 | 61 | static $instances = array(); |
| 62 | - if(isset($instances[$setName])) |
|
| 62 | + if (isset($instances[$setName])) |
|
| 63 | 63 | { |
| 64 | 64 | return $instances[$setName]; |
| 65 | 65 | } |
| 66 | - if(!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
| 66 | + if (!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
| 67 | 67 | { |
| 68 | 68 | throw new Exception('Unknown dataset name '.$setName); |
| 69 | 69 | } |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | protected function __construct() |
| 37 | 37 | { |
| 38 | 38 | $this->methods = array(); |
| 39 | - if(isset(FlipsideSettings::$authProviders)) |
|
| 39 | + if (isset(FlipsideSettings::$authProviders)) |
|
| 40 | 40 | { |
| 41 | 41 | $keys = array_keys(FlipsideSettings::$authProviders); |
| 42 | 42 | $count = count($keys); |
| 43 | - for($i = 0; $i < $count; $i++) |
|
| 43 | + for ($i = 0; $i < $count; $i++) |
|
| 44 | 44 | { |
| 45 | 45 | $class = $keys[$i]; |
| 46 | 46 | array_push($this->methods, new $class(FlipsideSettings::$authProviders[$keys[$i]])); |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | public function getAuthenticator($methodName) |
| 59 | 59 | { |
| 60 | 60 | $count = count($this->methods); |
| 61 | - for($i = 0; $i < $count; $i++) |
|
| 61 | + for ($i = 0; $i < $count; $i++) |
|
| 62 | 62 | { |
| 63 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 63 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 64 | 64 | { |
| 65 | 65 | return $this->methods[$i]; |
| 66 | 66 | } |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $res = false; |
| 84 | 84 | $count = count($this->methods); |
| 85 | - for($i = 0; $i < $count; $i++) |
|
| 85 | + for ($i = 0; $i < $count; $i++) |
|
| 86 | 86 | { |
| 87 | 87 | $res = $this->methods[$i]->login($username, $password); |
| 88 | - if($res !== false) |
|
| 88 | + if ($res !== false) |
|
| 89 | 89 | { |
| 90 | 90 | return $this->methods[$i]->getUser($res); |
| 91 | 91 | } |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $res = false; |
| 107 | 107 | $count = count($this->methods); |
| 108 | - for($i = 0; $i < $count; $i++) |
|
| 108 | + for ($i = 0; $i < $count; $i++) |
|
| 109 | 109 | { |
| 110 | 110 | $res = $this->methods[$i]->login($username, $password); |
| 111 | - if($res !== false) |
|
| 111 | + if ($res !== false) |
|
| 112 | 112 | { |
| 113 | 113 | FlipSession::setVar('AuthMethod', get_class($this->methods[$i])); |
| 114 | 114 | FlipSession::setVar('AuthData', $res); |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | private function mergeResult(&$returnValue, $res) |
| 158 | 158 | { |
| 159 | - if($res === false) |
|
| 159 | + if ($res === false) |
|
| 160 | 160 | { |
| 161 | 161 | return; |
| 162 | 162 | } |
| 163 | - if($returnValue === false) |
|
| 163 | + if ($returnValue === false) |
|
| 164 | 164 | { |
| 165 | 165 | $returnValue = $res; |
| 166 | 166 | return; |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $ret = false; |
| 184 | 184 | $count = count($this->methods); |
| 185 | - for($i = 0; $i < $count; $i++) |
|
| 185 | + for ($i = 0; $i < $count; $i++) |
|
| 186 | 186 | { |
| 187 | - if($checkField) |
|
| 187 | + if ($checkField) |
|
| 188 | 188 | { |
| 189 | - if($this->methods[$i]->{$checkField} === $checkValue) |
|
| 189 | + if ($this->methods[$i]->{$checkField} === $checkValue) |
|
| 190 | 190 | { |
| 191 | 191 | continue; |
| 192 | 192 | } |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $retCount = 0; |
| 212 | 212 | $count = count($this->methods); |
| 213 | - for($i = 0; $i < $count; $i++) |
|
| 213 | + for ($i = 0; $i < $count; $i++) |
|
| 214 | 214 | { |
| 215 | - if($checkField) |
|
| 215 | + if ($checkField) |
|
| 216 | 216 | { |
| 217 | - if($this->methods[$i]->{$checkField} === $checkValue) |
|
| 217 | + if ($this->methods[$i]->{$checkField} === $checkValue) |
|
| 218 | 218 | { |
| 219 | 219 | continue; |
| 220 | 220 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getGroupByName($name, $methodName = false) |
| 237 | 237 | { |
| 238 | - if($methodName === false) |
|
| 238 | + if ($methodName === false) |
|
| 239 | 239 | { |
| 240 | 240 | return $this->callOnEach('getGroupByName', array($name)); |
| 241 | 241 | } |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | * |
| 256 | 256 | * @return array|false An array of Auth\User objects or false if no users were found |
| 257 | 257 | */ |
| 258 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
| 258 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
| 259 | 259 | { |
| 260 | - if($methodName === false) |
|
| 260 | + if ($methodName === false) |
|
| 261 | 261 | { |
| 262 | 262 | return $this->callOnEach('getUsersByFilter', array($filter, $select, $top, $skip, $orderby), 'current'); |
| 263 | 263 | } |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return array|false An array of Auth\PendingUser objects or false if no pending users were found |
| 279 | 279 | */ |
| 280 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
| 280 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
| 281 | 281 | { |
| 282 | - if($methodName === false) |
|
| 282 | + if ($methodName === false) |
|
| 283 | 283 | { |
| 284 | 284 | return $this->callOnEach('getPendingUsersByFilter', array($filter, $select, $top, $skip, $orderby), 'pending'); |
| 285 | 285 | } |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | * |
| 300 | 300 | * @return array|false An array of Auth\Group objects or false if no pending users were found |
| 301 | 301 | */ |
| 302 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
| 302 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
| 303 | 303 | { |
| 304 | - if($methodName === false) |
|
| 304 | + if ($methodName === false) |
|
| 305 | 305 | { |
| 306 | 306 | return $this->callOnEach('getGroupsByFilter', array($filter, $select, $top, $skip, $orderby), 'current'); |
| 307 | 307 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function getActiveUserCount($methodName = false) |
| 320 | 320 | { |
| 321 | - if($methodName === false) |
|
| 321 | + if ($methodName === false) |
|
| 322 | 322 | { |
| 323 | 323 | return $this->addFromEach('getActiveUserCount', 'current'); |
| 324 | 324 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function getPendingUserCount($methodName = false) |
| 337 | 337 | { |
| 338 | - if($methodName === false) |
|
| 338 | + if ($methodName === false) |
|
| 339 | 339 | { |
| 340 | 340 | return $this->addFromEach('getPendingUserCount', 'pending'); |
| 341 | 341 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public function getGroupCount($methodName = false) |
| 354 | 354 | { |
| 355 | - if($methodName === false) |
|
| 355 | + if ($methodName === false) |
|
| 356 | 356 | { |
| 357 | 357 | return $this->addFromEach('getGroupCount', 'current'); |
| 358 | 358 | } |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | { |
| 373 | 373 | $ret = array(); |
| 374 | 374 | $count = count($this->methods); |
| 375 | - for($i = 0; $i < $count; $i++) |
|
| 375 | + for ($i = 0; $i < $count; $i++) |
|
| 376 | 376 | { |
| 377 | - if($this->methods[$i]->supplement === false) continue; |
|
| 377 | + if ($this->methods[$i]->supplement === false) continue; |
|
| 378 | 378 | |
| 379 | 379 | array_push($ret, $this->methods[$i]->getSupplementLink()); |
| 380 | 380 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function impersonateUser($userArray) |
| 393 | 393 | { |
| 394 | - if(!is_object($userArray)) |
|
| 394 | + if (!is_object($userArray)) |
|
| 395 | 395 | { |
| 396 | 396 | $user = new $userArray['class']($userArray); |
| 397 | 397 | } |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | public function getTempUserByHash($hash, $methodName = false) |
| 410 | 410 | { |
| 411 | - if($methodName === false) |
|
| 411 | + if ($methodName === false) |
|
| 412 | 412 | { |
| 413 | 413 | $count = count($this->methods); |
| 414 | - for($i = 0; $i < $count; $i++) |
|
| 414 | + for ($i = 0; $i < $count; $i++) |
|
| 415 | 415 | { |
| 416 | - if($this->methods[$i]->pending === false) continue; |
|
| 416 | + if ($this->methods[$i]->pending === false) continue; |
|
| 417 | 417 | |
| 418 | 418 | $ret = $this->methods[$i]->getTempUserByHash($hash); |
| 419 | - if($ret !== false) |
|
| 419 | + if ($ret !== false) |
|
| 420 | 420 | { |
| 421 | 421 | return $ret; |
| 422 | 422 | } |
@@ -437,15 +437,15 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | public function createPendingUser($user, $methodName = false) |
| 439 | 439 | { |
| 440 | - if($methodName === false) |
|
| 440 | + if ($methodName === false) |
|
| 441 | 441 | { |
| 442 | 442 | $count = count($this->methods); |
| 443 | - for($i = 0; $i < $count; $i++) |
|
| 443 | + for ($i = 0; $i < $count; $i++) |
|
| 444 | 444 | { |
| 445 | - if($this->methods[$i]->pending === false) continue; |
|
| 445 | + if ($this->methods[$i]->pending === false) continue; |
|
| 446 | 446 | |
| 447 | 447 | $ret = $this->methods[$i]->createPendingUser($user); |
| 448 | - if($ret !== false) |
|
| 448 | + if ($ret !== false) |
|
| 449 | 449 | { |
| 450 | 450 | return true; |
| 451 | 451 | } |
@@ -469,15 +469,15 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | public function activatePendingUser($user, $methodName = false) |
| 471 | 471 | { |
| 472 | - if($methodName === false) |
|
| 472 | + if ($methodName === false) |
|
| 473 | 473 | { |
| 474 | 474 | $count = count($this->methods); |
| 475 | - for($i = 0; $i < $count; $i++) |
|
| 475 | + for ($i = 0; $i < $count; $i++) |
|
| 476 | 476 | { |
| 477 | - if($this->methods[$i]->current === false) continue; |
|
| 477 | + if ($this->methods[$i]->current === false) continue; |
|
| 478 | 478 | |
| 479 | 479 | $ret = $this->methods[$i]->activatePendingUser($user); |
| 480 | - if($ret !== false) |
|
| 480 | + if ($ret !== false) |
|
| 481 | 481 | { |
| 482 | 482 | $this->impersonateUser($ret); |
| 483 | 483 | return true; |
@@ -499,15 +499,15 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | public function getUserByResetHash($hash, $methodName = false) |
| 501 | 501 | { |
| 502 | - if($methodName === false) |
|
| 502 | + if ($methodName === false) |
|
| 503 | 503 | { |
| 504 | 504 | $count = count($this->methods); |
| 505 | - for($i = 0; $i < $count; $i++) |
|
| 505 | + for ($i = 0; $i < $count; $i++) |
|
| 506 | 506 | { |
| 507 | - if($this->methods[$i]->current === false) continue; |
|
| 507 | + if ($this->methods[$i]->current === false) continue; |
|
| 508 | 508 | |
| 509 | 509 | $ret = $this->methods[$i]->getUserByResetHash($hash); |
| 510 | - if($ret !== false) |
|
| 510 | + if ($ret !== false) |
|
| 511 | 511 | { |
| 512 | 512 | return $ret; |
| 513 | 513 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | return false; |
| 516 | 516 | } |
| 517 | 517 | $auth = $this->getAuthenticator($methodName); |
| 518 | - if($auth === false) |
|
| 518 | + if ($auth === false) |
|
| 519 | 519 | { |
| 520 | 520 | return $this->getUserByResetHash($hash, false); |
| 521 | 521 | } |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | public function getSuplementalProviderByHost($host) |
| 533 | 533 | { |
| 534 | 534 | $count = count($this->methods); |
| 535 | - for($i = 0; $i < $count; $i++) |
|
| 535 | + for ($i = 0; $i < $count; $i++) |
|
| 536 | 536 | { |
| 537 | - if($this->methods[$i]->supplement === false) continue; |
|
| 537 | + if ($this->methods[$i]->supplement === false) continue; |
|
| 538 | 538 | |
| 539 | - if($this->methods[$i]->getHostName() === $host) |
|
| 539 | + if ($this->methods[$i]->getHostName() === $host) |
|
| 540 | 540 | { |
| 541 | 541 | return $this->methods[$i]; |
| 542 | 542 | } |
@@ -544,15 +544,15 @@ discard block |
||
| 544 | 544 | return false; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - public function deletePendingUsersByFilter($filter, $methodName=false) |
|
| 547 | + public function deletePendingUsersByFilter($filter, $methodName = false) |
|
| 548 | 548 | { |
| 549 | 549 | $users = $this->getPendingUsersByFilter($filter, false, false, false, false, $methodName); |
| 550 | - if($users === false) |
|
| 550 | + if ($users === false) |
|
| 551 | 551 | { |
| 552 | 552 | return false; |
| 553 | 553 | } |
| 554 | 554 | $count = count($users); |
| 555 | - for($i = 0; $i < $count; $i++) |
|
| 555 | + for ($i = 0; $i < $count; $i++) |
|
| 556 | 556 | { |
| 557 | 557 | $users[$i]->delete(); |
| 558 | 558 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function send_HTML($mail) |
| 24 | 24 | { |
| 25 | - if(isset($mail['from'])) |
|
| 25 | + if (isset($mail['from'])) |
|
| 26 | 26 | { |
| 27 | 27 | $this->From = $mail['from']; |
| 28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $this->From = $this->Username; |
| 32 | 32 | } |
| 33 | - if(isset($mail['from_name'])) |
|
| 33 | + if (isset($mail['from_name'])) |
|
| 34 | 34 | { |
| 35 | 35 | $this->FromName = $mail['from_name']; |
| 36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->FromName = 'Burning Flipside'; |
| 40 | 40 | } |
| 41 | 41 | $this->clearAllRecipients(); |
| 42 | - if(is_array($mail['to'])) |
|
| 42 | + if (is_array($mail['to'])) |
|
| 43 | 43 | { |
| 44 | 44 | array_walk($mail['to'], 'FlipsideMail::addTo', $this); |
| 45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $this->addAddress($mail['to']); |
| 49 | 49 | } |
| 50 | - if(isset($mail['reply_to'])) |
|
| 50 | + if (isset($mail['reply_to'])) |
|
| 51 | 51 | { |
| 52 | 52 | $this->addReplyTo($mail['reply_to']); |
| 53 | 53 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | static $instances = array(); |
| 30 | 30 | $class = get_called_class(); |
| 31 | - if(!isset($instances[$class])) |
|
| 31 | + if (!isset($instances[$class])) |
|
| 32 | 32 | { |
| 33 | 33 | $instances[$class] = new static(); |
| 34 | 34 | } |