@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | public function buildLineages() { |
55 | 55 | $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); |
56 | 56 | |
57 | - if(count($indis) == 0) return null; |
|
57 | + if(count($indis) == 0) { |
|
58 | + return null; |
|
59 | + } |
|
58 | 60 | |
59 | 61 | $root_lineages = array(); |
60 | 62 | |
@@ -72,12 +74,13 @@ discard block |
||
72 | 74 | if($indiChildFamily !== null){ |
73 | 75 | $root_node = new LineageRootNode(null); |
74 | 76 | $root_node->addFamily($indiChildFamily); |
75 | - } |
|
76 | - else{ |
|
77 | + } else{ |
|
77 | 78 | $root_node = new LineageRootNode($indiFirst); |
78 | 79 | } |
79 | 80 | $root_node = $this->buildLineage($root_node); |
80 | - if($root_node) $root_lineages[] = $root_node; |
|
81 | + if($root_node) { |
|
82 | + $root_lineages[] = $root_node; |
|
83 | + } |
|
81 | 84 | } |
82 | 85 | } |
83 | 86 | } |
@@ -116,23 +119,19 @@ discard block |
||
116 | 119 | //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) |
117 | 120 | if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){ |
118 | 121 | $resIndi=$wife; |
119 | - } |
|
120 | - else{ |
|
122 | + } else{ |
|
121 | 123 | $is_first=true; |
122 | 124 | } |
123 | - } |
|
124 | - else{ |
|
125 | + } else{ |
|
125 | 126 | $is_first=true; |
126 | 127 | } |
127 | - } |
|
128 | - else{ |
|
128 | + } else{ |
|
129 | 129 | $is_first=true; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | if(isset($this->used_indis[$resIndi->getXref()])){ |
133 | 133 | return null; |
134 | - } |
|
135 | - else{ |
|
134 | + } else{ |
|
136 | 135 | return $resIndi; |
137 | 136 | } |
138 | 137 | } |
@@ -145,7 +144,9 @@ discard block |
||
145 | 144 | * @return LineageNode Computed lineage |
146 | 145 | */ |
147 | 146 | protected function buildLineage(LineageNode $node) { |
148 | - if($node === null) return; |
|
147 | + if($node === null) { |
|
148 | + return; |
|
149 | + } |
|
149 | 150 | |
150 | 151 | $indi_surname = null; |
151 | 152 | |
@@ -198,7 +199,9 @@ discard block |
||
198 | 199 | $nbNatural++; |
199 | 200 | $node_child = new LineageNode($child, $node->getRootNode()); |
200 | 201 | $node_child = $this->buildLineage($node_child); |
201 | - if($node_child) $node->addChild($family, $node_child); |
|
202 | + if($node_child) { |
|
203 | + $node->addChild($family, $node_child); |
|
204 | + } |
|
202 | 205 | } |
203 | 206 | } |
204 | 207 | } |
@@ -212,12 +215,15 @@ discard block |
||
212 | 215 | $nbNatural++; |
213 | 216 | $node_child = new LineageNode($child, $node->getRootNode()); |
214 | 217 | $node_child = $this->buildLineage($node_child); |
215 | - if($node_child) $node->addChild($family, $node_child); |
|
216 | - } |
|
217 | - else { |
|
218 | + if($node_child) { |
|
219 | + $node->addChild($family, $node_child); |
|
220 | + } |
|
221 | + } else { |
|
218 | 222 | $nbNatural++; |
219 | 223 | $node_child = new LineageNode($child, $node->getRootNode(), $child_surname); |
220 | - if($node_child) $node->addChild($family, $node_child); |
|
224 | + if($node_child) { |
|
225 | + $node->addChild($family, $node_child); |
|
226 | + } |
|
221 | 227 | } |
222 | 228 | } |
223 | 229 | } |
@@ -88,7 +88,9 @@ |
||
88 | 88 | global $WT_TREE; |
89 | 89 | |
90 | 90 | $action = Filter::post('action'); |
91 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
91 | + if($action == 'update' && Filter::checkCsrf()) { |
|
92 | + $this->update(); |
|
93 | + } |
|
92 | 94 | |
93 | 95 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
94 | 96 | $ctrl = new PageController(); |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
163 | + if($isStrong) { |
|
164 | + $tag = 'strong'; |
|
165 | + } |
|
164 | 166 | if($individual && $individual->canShow()){ |
165 | 167 | $dindi = new Individual($individual); |
166 | 168 | $html = $individual->getSexImage(); |
@@ -174,8 +176,7 @@ discard block |
||
174 | 176 | $html .= ' <span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
175 | 177 | $html .= ' <span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
176 | 178 | $html .= '</a>'; |
177 | - } |
|
178 | - else { |
|
179 | + } else { |
|
179 | 180 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
180 | 181 | } |
181 | 182 | return $html; |
@@ -195,8 +196,7 @@ discard block |
||
195 | 196 | $date = $fact->getDate(); |
196 | 197 | if($date->isOK()){ |
197 | 198 | $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
198 | - } |
|
199 | - else{ |
|
199 | + } else{ |
|
200 | 200 | // 1 DEAT Y with no DATE => print YES |
201 | 201 | // 1 BIRT 2 SOUR @S1@ => print YES |
202 | 202 | // 1 DEAT N is not allowed |
@@ -220,7 +220,9 @@ discard block |
||
220 | 220 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
221 | 221 | $html=''; |
222 | 222 | |
223 | - if ($fact === null) return $html; |
|
223 | + if ($fact === null) { |
|
224 | + return $html; |
|
225 | + } |
|
224 | 226 | $place = $fact->getPlace(); |
225 | 227 | if($place){ |
226 | 228 | $dplace = new Place($place); |
@@ -339,7 +341,9 @@ discard block |
||
339 | 341 | default: |
340 | 342 | break; |
341 | 343 | } |
342 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
344 | + if($image && $title) { |
|
345 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
346 | + } |
|
343 | 347 | break; |
344 | 348 | default: |
345 | 349 | break; |
@@ -124,7 +124,9 @@ |
||
124 | 124 | |
125 | 125 | $cid = Filter::get('cid'); |
126 | 126 | $certificate = null; |
127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
127 | + if(!empty($cid)) { |
|
128 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $imageBuilder = new ImageBuilder($certificate); |
130 | 132 |
@@ -45,7 +45,9 @@ |
||
45 | 45 | * @return int Level of sources |
46 | 46 | * */ |
47 | 47 | function isMarriageSourced(){ |
48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
48 | + if($this->is_marriage_sourced !== null) { |
|
49 | + return $this->is_marriage_sourced; |
|
50 | + } |
|
49 | 51 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
50 | 52 | return $this->is_marriage_sourced; |
51 | 53 | } |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
66 | 66 | if($ct2>0){ |
67 | 67 | $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
68 | - } |
|
69 | - else{ |
|
68 | + } else{ |
|
70 | 69 | $this->titles[$titlefact->getValue()][]=''; |
71 | 70 | } |
72 | 71 | } |
@@ -98,8 +97,7 @@ discard block |
||
98 | 97 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
99 | 98 | if($perc){ |
100 | 99 | return array ($bplace, 1); |
101 | - } |
|
102 | - else{ |
|
100 | + } else{ |
|
103 | 101 | return $bplace; |
104 | 102 | } |
105 | 103 | } |
@@ -168,7 +166,9 @@ discard block |
||
168 | 166 | * @return int Level of sources |
169 | 167 | * */ |
170 | 168 | public function isBirthSourced(){ |
171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
169 | + if($this->is_birth_sourced !== null) { |
|
170 | + return $this->is_birth_sourced; |
|
171 | + } |
|
172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
173 | 173 | return $this->is_birth_sourced; |
174 | 174 | } |
@@ -179,7 +179,9 @@ discard block |
||
179 | 179 | * @return int Level of sources |
180 | 180 | * */ |
181 | 181 | public function isDeathSourced(){ |
182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
182 | + if($this->is_death_sourced !== null) { |
|
183 | + return $this->is_death_sourced; |
|
184 | + } |
|
183 | 185 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
184 | 186 | return $this->is_death_sourced; |
185 | 187 | } |
@@ -114,16 +114,18 @@ discard block |
||
114 | 114 | $len_chars = count($chars); |
115 | 115 | $token = ''; |
116 | 116 | |
117 | - for ($i = 0; $i < $length; $i++) |
|
118 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
117 | + for ($i = 0; $i < $length; $i++) { |
|
118 | + $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
119 | + } |
|
119 | 120 | |
120 | 121 | # Number of 32 char chunks |
121 | 122 | $chunks = ceil( strlen($token) / 32 ); |
122 | 123 | $md5token = ''; |
123 | 124 | |
124 | 125 | # Run each chunk through md5 |
125 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
126 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
126 | + for ( $i=1; $i<=$chunks; $i++ ) { |
|
127 | + $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
128 | + } |
|
127 | 129 | |
128 | 130 | # Trim the token |
129 | 131 | return substr($md5token, 0, $length); |
@@ -146,12 +148,14 @@ discard block |
||
146 | 148 | * @return string Encrypted and encoded text |
147 | 149 | */ |
148 | 150 | public static function encryptToSafeBase64($data){ |
149 | - if(!self::isEncryptionCompatible()) |
|
150 | - throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
151 | + if(!self::isEncryptionCompatible()) { |
|
152 | + throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
153 | + } |
|
151 | 154 | |
152 | 155 | $key = 'STANDARDKEYIFNOSERVER'; |
153 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
154 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
156 | + if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) { |
|
157 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
158 | + } |
|
155 | 159 | $iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND); |
156 | 160 | $id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv); |
157 | 161 | $encrypted = base64_encode($iv.$id); |
@@ -169,20 +173,24 @@ discard block |
||
169 | 173 | * @return string Decrypted text |
170 | 174 | */ |
171 | 175 | public static function decryptFromSafeBase64($encrypted){ |
172 | - if(!self::isEncryptionCompatible()) |
|
173 | - throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
176 | + if(!self::isEncryptionCompatible()) { |
|
177 | + throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
178 | + } |
|
174 | 179 | |
175 | 180 | $key = 'STANDARDKEYIFNOSERVER'; |
176 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
177 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
181 | + if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) { |
|
182 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
183 | + } |
|
178 | 184 | $encrypted = str_replace('-', '+', $encrypted); |
179 | 185 | $encrypted = str_replace('_', '/', $encrypted); |
180 | 186 | $encrypted = str_replace('*', '=', $encrypted); |
181 | 187 | $encrypted = base64_decode($encrypted); |
182 | - if(!$encrypted) |
|
183 | - throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
184 | - if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) |
|
185 | - throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
188 | + if(!$encrypted) { |
|
189 | + throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
190 | + } |
|
191 | + if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) { |
|
192 | + throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
193 | + } |
|
186 | 194 | $iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE); |
187 | 195 | $encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE); |
188 | 196 | $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec); |
@@ -223,7 +231,9 @@ discard block |
||
223 | 231 | * @return boolean True if path valid |
224 | 232 | */ |
225 | 233 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
226 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
234 | + if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) { |
|
235 | + return true; |
|
236 | + } |
|
227 | 237 | return false; |
228 | 238 | } |
229 | 239 |
@@ -71,19 +71,16 @@ |
||
71 | 71 | if(method_exists($ctrl, $method)) { |
72 | 72 | try { |
73 | 73 | call_user_func_array(array($ctrl, $method), array()); |
74 | - } |
|
75 | - catch (MvcException $ex) { |
|
74 | + } catch (MvcException $ex) { |
|
76 | 75 | if(!headers_sent()) { |
77 | 76 | http_response_code($ex->getHttpCode()); |
78 | 77 | } |
79 | 78 | echo $ex->getMessage(); |
80 | 79 | } |
81 | - } |
|
82 | - else { |
|
80 | + } else { |
|
83 | 81 | throw new \Exception('The page requested does not exist'); |
84 | 82 | } |
85 | - } |
|
86 | - else { |
|
83 | + } else { |
|
87 | 84 | throw new \Exception('The page requested does not exist'); |
88 | 85 | } |
89 | 86 | } |
@@ -58,8 +58,9 @@ |
||
58 | 58 | * @throws InvalidArgumentException Thrown if not valid Http code |
59 | 59 | */ |
60 | 60 | public function setHttpCode($http_code) { |
61 | - if(!in_array($http_code, self::$VALID_HTTP)) |
|
62 | - throw new \InvalidArgumentException('Invalid HTTP code'); |
|
61 | + if(!in_array($http_code, self::$VALID_HTTP)) { |
|
62 | + throw new \InvalidArgumentException('Invalid HTTP code'); |
|
63 | + } |
|
63 | 64 | $this->http_code= $http_code; |
64 | 65 | } |
65 | 66 |