@@ -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 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $datatable = $dataset['captcha']; |
12 | 12 | $data = $datatable->read(false, array('id')); |
13 | 13 | $count = count($data); |
14 | - for($i = 0; $i < $count; $i++) |
|
14 | + for ($i = 0; $i < $count; $i++) |
|
15 | 15 | { |
16 | 16 | $data[$i] = $data[$i]['id']; |
17 | 17 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $res = array(); |
24 | 24 | $ids = FlipsideCAPTCHA::get_valid_captcha_ids(); |
25 | - for($i = 0; $i < count($ids); $i++) |
|
25 | + for ($i = 0; $i < count($ids); $i++) |
|
26 | 26 | { |
27 | 27 | $captcha = new FlipsideCAPTCHA(); |
28 | 28 | $captcha->random_id = $ids[$i]; |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | { |
36 | 36 | $dataset = DataSetFactory::get_data_set('profiles'); |
37 | 37 | $datatable = $dataset['captcha']; |
38 | - return $datatable->create(array('question'=>$question,'hint'=>$hint,'answer'=>$answer)); |
|
38 | + return $datatable->create(array('question'=>$question, 'hint'=>$hint, 'answer'=>$answer)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function __construct() |
42 | 42 | { |
43 | 43 | $this->validIDs = FlipsideCAPTCHA::get_valid_captcha_ids(); |
44 | - $this->random_id = mt_rand(0, count($this->validIDs)-1); |
|
44 | + $this->random_id = mt_rand(0, count($this->validIDs) - 1); |
|
45 | 45 | $this->random_id = $this->validIDs[$this->random_id]; |
46 | 46 | } |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $dataset = DataSetFactory::get_data_set('profiles'); |
51 | 51 | $datatable = $dataset['captcha']; |
52 | 52 | $data = $datatable->read(new \Data\Filter('id eq '.$this->random_id), array('question')); |
53 | - if($data === false) |
|
53 | + if ($data === false) |
|
54 | 54 | { |
55 | 55 | return false; |
56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $dataset = DataSetFactory::get_data_set('profiles'); |
63 | 63 | $datatable = $dataset['captcha']; |
64 | 64 | $data = $datatable->read(new \Data\Filter('id eq '.$this->random_id), array('hint')); |
65 | - if($data === false) |
|
65 | + if ($data === false) |
|
66 | 66 | { |
67 | 67 | return false; |
68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $dataset = DataSetFactory::get_data_set('profiles'); |
75 | 75 | $datatable = $dataset['captcha']; |
76 | 76 | $data = $datatable->read(new \Data\Filter('id eq '.$this->random_id), array('answer')); |
77 | - if($data === false) |
|
77 | + if ($data === false) |
|
78 | 78 | { |
79 | 79 | return false; |
80 | 80 | } |
@@ -83,29 +83,29 @@ discard block |
||
83 | 83 | |
84 | 84 | public function is_answer_right($answer) |
85 | 85 | { |
86 | - return strcasecmp($this->get_answer(),$answer) == 0; |
|
86 | + return strcasecmp($this->get_answer(), $answer) == 0; |
|
87 | 87 | } |
88 | 88 | |
89 | - public function draw_captcha($explination=true, $return=false, $ownForm=false) |
|
89 | + public function draw_captcha($explination = true, $return = false, $ownForm = false) |
|
90 | 90 | { |
91 | 91 | $string = ''; |
92 | 92 | |
93 | - if($ownForm) |
|
93 | + if ($ownForm) |
|
94 | 94 | { |
95 | - $string.= '<form id="flipcaptcha" name="flipcaptcha">'; |
|
95 | + $string .= '<form id="flipcaptcha" name="flipcaptcha">'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $string .= '<label for="captcha" class="col-sm-2 control-label">'.$this->get_question().'</label><div class="col-sm-10"><input class="form-control" type="text" id="captcha" name="captcha" placeholder="'.$this->get_hint().'" required/></div>'; |
99 | - if($ownForm) |
|
99 | + if ($ownForm) |
|
100 | 100 | { |
101 | - $string.='</form>'; |
|
101 | + $string .= '</form>'; |
|
102 | 102 | } |
103 | - if($explination) |
|
103 | + if ($explination) |
|
104 | 104 | { |
105 | 105 | $string .= '<div class="col-sm-10">The answer to this question may be found in the Burning Flipside Survival Guide. It may be found <a href="http://www.burningflipside.com/sg">here</a>.</div>'; |
106 | 106 | } |
107 | 107 | |
108 | - if(!$return) |
|
108 | + if (!$return) |
|
109 | 109 | { |
110 | 110 | echo $string; |
111 | 111 | } |
@@ -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 | } |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | * |
17 | 17 | * This class can be serialized to various formats |
18 | 18 | */ |
19 | -class SerializableObject implements ArrayAccess,JsonSerializable |
|
19 | +class SerializableObject implements ArrayAccess, JsonSerializable |
|
20 | 20 | { |
21 | 21 | /** |
22 | 22 | * Create the object from an array |
23 | 23 | * |
24 | 24 | * @param array $array The array of object properties |
25 | 25 | */ |
26 | - public function __construct($array=false) |
|
26 | + public function __construct($array = false) |
|
27 | 27 | { |
28 | - if($array !== false && is_array($array)) |
|
28 | + if ($array !== false && is_array($array)) |
|
29 | 29 | { |
30 | - foreach($array as $key => $value) |
|
30 | + foreach ($array as $key => $value) |
|
31 | 31 | { |
32 | 32 | $this->{$key} = $value; |
33 | 33 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $xml = new XmlWriter(); |
55 | 55 | $xml->openMemory(); |
56 | 56 | $xml->startDocument('1.0'); |
57 | - if(isset($this[0])) |
|
57 | + if (isset($this[0])) |
|
58 | 58 | { |
59 | 59 | $xml->startElement('Array'); |
60 | 60 | $this->array2XML($xml, 'Entity', (array)$this); |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function object2XML(XMLWriter $xml, $data) |
78 | 78 | { |
79 | - foreach($data as $key => $value) |
|
79 | + foreach ($data as $key => $value) |
|
80 | 80 | { |
81 | - if(is_array($value) || is_numeric($key)) |
|
81 | + if (is_array($value) || is_numeric($key)) |
|
82 | 82 | { |
83 | 83 | $this->array2XML($xml, $key, (array)$value); |
84 | 84 | } |
85 | - else if(is_object($value)) |
|
85 | + else if (is_object($value)) |
|
86 | 86 | { |
87 | 87 | $xml->startElement($key); |
88 | 88 | $this->object2XML($xml, $value); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
93 | - if($key[0] === '$') |
|
93 | + if ($key[0] === '$') |
|
94 | 94 | { |
95 | 95 | $xml->writeElement(substr($key, 1), $value); |
96 | 96 | } |
@@ -112,29 +112,29 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function array2XML(XMLWriter $xml, $keyParent, $data) |
114 | 114 | { |
115 | - foreach($data as $key => $value) |
|
115 | + foreach ($data as $key => $value) |
|
116 | 116 | { |
117 | - if(is_string($value)) |
|
117 | + if (is_string($value)) |
|
118 | 118 | { |
119 | 119 | $xml->writeElement($keyParent, $value); |
120 | 120 | continue; |
121 | 121 | } |
122 | - if(is_numeric($key)) |
|
122 | + if (is_numeric($key)) |
|
123 | 123 | { |
124 | 124 | $xml->startElement($keyParent); |
125 | 125 | } |
126 | 126 | |
127 | - if(is_object($value)) |
|
127 | + if (is_object($value)) |
|
128 | 128 | { |
129 | 129 | $this->object2XML($xml, $value); |
130 | 130 | } |
131 | - else if(is_array($value)) |
|
131 | + else if (is_array($value)) |
|
132 | 132 | { |
133 | 133 | $this->array2XML($xml, $key, $value); |
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - if(is_numeric($key)) |
|
137 | + if (is_numeric($key)) |
|
138 | 138 | { |
139 | 139 | $xml->endElement(); |
140 | 140 | } |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | public function serializeObject($fmt = 'json', $select = false) |
166 | 166 | { |
167 | 167 | $copy = $this; |
168 | - if($select !== false) |
|
168 | + if ($select !== false) |
|
169 | 169 | { |
170 | 170 | $copy = new self(); |
171 | 171 | $count = count($select); |
172 | - for($i = 0; $i < $count; $i++) |
|
172 | + for ($i = 0; $i < $count; $i++) |
|
173 | 173 | { |
174 | 174 | $copy->{$select[$i]} = $this->offsetGet($select[$i]); |
175 | 175 | } |
176 | 176 | } |
177 | - switch($fmt) |
|
177 | + switch ($fmt) |
|
178 | 178 | { |
179 | 179 | case 'json': |
180 | 180 | return json_encode($copy); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } else { |
59 | 59 | $host = FCgetHostName(); |
60 | 60 | } |
61 | - $pattern = '#^https?://' . str_replace('.', '\.', $host) . '(:\d*)?/#'; |
|
61 | + $pattern = '#^https?://'.str_replace('.', '\.', $host).'(:\d*)?/#'; |
|
62 | 62 | if (!preg_match($pattern, $_SERVER['HTTP_REFERER'])) { |
63 | 63 | exit; |
64 | 64 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | // Percent-encode special characters in the URL |
76 | -$search = array( '%', '#', ' '); |
|
76 | +$search = array('%', '#', ' '); |
|
77 | 77 | $replace = array('%25', '%23', '%20'); |
78 | 78 | $url = str_replace($search, $replace, $_GET['url']); |
79 | 79 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | // Force download |
43 | 43 | header('Content-Type: application/octet-stream'); |
44 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
44 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
45 | 45 | |
46 | 46 | if (isset($_POST['dataurl'])) { |
47 | 47 | // Decode the base64-encoded data |
@@ -12,45 +12,45 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct($params) |
14 | 14 | { |
15 | - if(isset($params['filter'])) |
|
15 | + if (isset($params['filter'])) |
|
16 | 16 | { |
17 | 17 | $this->filter = new \Data\Filter($params['filter']); |
18 | 18 | } |
19 | - else if(isset($params['$filter'])) |
|
19 | + else if (isset($params['$filter'])) |
|
20 | 20 | { |
21 | 21 | $this->filter = new \Data\Filter($params['$filter']); |
22 | 22 | } |
23 | 23 | |
24 | - if(isset($params['$expand'])) |
|
24 | + if (isset($params['$expand'])) |
|
25 | 25 | { |
26 | - $this->expand = explode(',',$params['$expand']); |
|
26 | + $this->expand = explode(',', $params['$expand']); |
|
27 | 27 | } |
28 | 28 | |
29 | - if(isset($params['select'])) |
|
29 | + if (isset($params['select'])) |
|
30 | 30 | { |
31 | - $this->select = explode(',',$params['select']); |
|
31 | + $this->select = explode(',', $params['select']); |
|
32 | 32 | } |
33 | - else if(isset($params['$select'])) |
|
33 | + else if (isset($params['$select'])) |
|
34 | 34 | { |
35 | - $this->select = explode(',',$params['$select']); |
|
35 | + $this->select = explode(',', $params['$select']); |
|
36 | 36 | } |
37 | 37 | |
38 | - if(isset($params['$orderby'])) |
|
38 | + if (isset($params['$orderby'])) |
|
39 | 39 | { |
40 | 40 | $this->orderby = array(); |
41 | - $orderby = explode(',',$params['$orderby']); |
|
41 | + $orderby = explode(',', $params['$orderby']); |
|
42 | 42 | $count = count($orderby); |
43 | - for($i = 0; $i < $count; $i++) |
|
43 | + for ($i = 0; $i < $count; $i++) |
|
44 | 44 | { |
45 | - $exp = explode(' ',$orderby[$i]); |
|
46 | - if(count($exp) === 1) |
|
45 | + $exp = explode(' ', $orderby[$i]); |
|
46 | + if (count($exp) === 1) |
|
47 | 47 | { |
48 | 48 | //Default to assending |
49 | 49 | $this->orderby[$exp[0]] = 1; |
50 | 50 | } |
51 | 51 | else |
52 | 52 | { |
53 | - switch($exp[1]) |
|
53 | + switch ($exp[1]) |
|
54 | 54 | { |
55 | 55 | case 'asc': |
56 | 56 | $this->orderby[$exp[0]] = 1; |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if(isset($params['$top'])) |
|
68 | + if (isset($params['$top'])) |
|
69 | 69 | { |
70 | 70 | $this->top = $params['$top']; |
71 | 71 | } |
72 | 72 | |
73 | - if(isset($params['$skip'])) |
|
73 | + if (isset($params['$skip'])) |
|
74 | 74 | { |
75 | 75 | $this->skip = $params['$skip']; |
76 | 76 | } |
77 | 77 | |
78 | - if(isset($params['$count']) && $params['$count'] === 'true') |
|
78 | + if (isset($params['$count']) && $params['$count'] === 'true') |
|
79 | 79 | { |
80 | 80 | $this->count = true; |
81 | 81 | } |
82 | 82 | |
83 | - if(isset($params['$seach'])) |
|
83 | + if (isset($params['$seach'])) |
|
84 | 84 | { |
85 | 85 | throw new Exception('Search not yet implemented'); |
86 | 86 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function getUserFromToken($token) |
32 | 32 | { |
33 | - if($token === false) |
|
33 | + if ($token === false) |
|
34 | 34 | { |
35 | 35 | $token = \FlipSession::getVar('OAuthToken'); |
36 | 36 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } else { |
59 | 59 | $host = FCgetHostName(); |
60 | 60 | } |
61 | - $pattern = '#^https?://' . str_replace('.', '\.', $host) . '(:\d*)?/#'; |
|
61 | + $pattern = '#^https?://'.str_replace('.', '\.', $host).'(:\d*)?/#'; |
|
62 | 62 | if (!preg_match($pattern, $_SERVER['HTTP_REFERER'])) { |
63 | 63 | exit; |
64 | 64 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | // Percent-encode special characters in the URL |
76 | -$search = array( '%', '#', ' '); |
|
76 | +$search = array('%', '#', ' '); |
|
77 | 77 | $replace = array('%25', '%23', '%20'); |
78 | 78 | $url = str_replace($search, $replace, $_GET['url']); |
79 | 79 |