@@ -61,7 +61,9 @@ |
||
61 | 61 | */ |
62 | 62 | public function index() { |
63 | 63 | $action = Filter::post('action'); |
64 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
64 | + if($action == 'update' && Filter::checkCsrf()) { |
|
65 | + $this->update(); |
|
66 | + } |
|
65 | 67 | |
66 | 68 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
67 | 69 | $ctrl = new PageController(); |
@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | $sid=null; |
116 | 116 | |
117 | 117 | if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)){ |
118 | - if (!$srec || strlen($srec) == 0) return $html; |
|
118 | + if (!$srec || strlen($srec) == 0) { |
|
119 | + return $html; |
|
120 | + } |
|
119 | 121 | |
120 | 122 | $certificate = null; |
121 | 123 | $subrecords = explode("\n", $srec); |
@@ -129,11 +131,14 @@ discard block |
||
129 | 131 | $subrecords[$i] = trim($subrecords[$i]); |
130 | 132 | $tag = substr($subrecords[$i], 2, 4); |
131 | 133 | $text = substr($subrecords[$i], 7); |
132 | - if($tag == '_ACT') $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
134 | + if($tag == '_ACT') { |
|
135 | + $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
136 | + } |
|
133 | 137 | } |
134 | 138 | |
135 | - if($certificate && $certificate->canShow()) |
|
136 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
139 | + if($certificate && $certificate->canShow()) { |
|
140 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
141 | + } |
|
137 | 142 | |
138 | 143 | } |
139 | 144 | return $html; |
@@ -161,7 +166,9 @@ discard block |
||
161 | 166 | $html = ''; |
162 | 167 | switch($tag){ |
163 | 168 | case '_ACT': |
164 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
169 | + if($context == 'SOUR') { |
|
170 | + $html = $this->getDisplay_ACT($value, $contextid); |
|
171 | + } |
|
165 | 172 | break; |
166 | 173 | } |
167 | 174 | return $html; |
@@ -189,7 +196,9 @@ discard block |
||
189 | 196 | $html .= '<select id="certifCity'.$element_id.'" class="_CITY">'; |
190 | 197 | foreach ($tabCities as $cities){ |
191 | 198 | $selectedCity=''; |
192 | - if($certificate && $cities== $certificate->getCity()) $selectedCity='selected="true"'; |
|
199 | + if($certificate && $cities== $certificate->getCity()) { |
|
200 | + $selectedCity='selected="true"'; |
|
201 | + } |
|
193 | 202 | $html .= '<option value="'.$cities.'" '.$selectedCity.' />'.$cities.'</option>'; |
194 | 203 | } |
195 | 204 | $html .= '</select>'; |
@@ -104,7 +104,9 @@ discard block |
||
104 | 104 | }'); |
105 | 105 | |
106 | 106 | $action = Filter::post('action'); |
107 | - if($action === 'update') $this->update($controller); |
|
107 | + if($action === 'update') { |
|
108 | + $this->update($controller); |
|
109 | + } |
|
108 | 110 | |
109 | 111 | $view_bag = new ViewBag(); |
110 | 112 | $view_bag->set('title', $controller->getPageTitle()); |
@@ -149,7 +151,9 @@ discard block |
||
149 | 151 | $user = User::find(Filter::getInteger('userid', -1)); |
150 | 152 | if($user) { |
151 | 153 | $calculator = new SosaCalculator(Globals::getTree(), $user); |
152 | - if($calculator->computeAll()) $view_bag->set('is_success', true); |
|
154 | + if($calculator->computeAll()) { |
|
155 | + $view_bag->set('is_success', true); |
|
156 | + } |
|
153 | 157 | } |
154 | 158 | ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render(); |
155 | 159 | } |
@@ -170,9 +174,10 @@ discard block |
||
170 | 174 | |
171 | 175 | if($user && $indi) { |
172 | 176 | $calculator = new SosaCalculator($wt_tree, $user); |
173 | - if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true); |
|
174 | - } |
|
175 | - else { |
|
177 | + if($calculator->computeFromIndividual($indi)) { |
|
178 | + $view_bag->set('is_success', true); |
|
179 | + } |
|
180 | + } else { |
|
176 | 181 | $view_bag->set('error', I18N::translate('Non existing individual')); |
177 | 182 | } |
178 | 183 |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | $array_hook = explode('#', $ihook); |
48 | 48 | //Update status |
49 | 49 | $new_status= Filter::postBool('status-' . $params['id']); |
50 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | + if(in_array($array_hook[0], $module_names)) { |
|
51 | + $new_status = false; |
|
52 | + } |
|
51 | 53 | $previous_status = $params['status']; |
52 | 54 | if ($new_status !== null) { |
53 | 55 | $new_status= $new_status ? 'enabled' : 'disabled'; |
@@ -92,7 +94,9 @@ discard block |
||
92 | 94 | HookProvider::getInstance()->updateHooks(); |
93 | 95 | |
94 | 96 | $action = Filter::post('action'); |
95 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
97 | + if($action == 'update' && Filter::checkCsrf()) { |
|
98 | + $this->update(); |
|
99 | + } |
|
96 | 100 | |
97 | 101 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
98 | 102 | $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->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
175 | 177 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(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; |
@@ -193,8 +194,7 @@ discard block |
||
193 | 194 | $date = $fact->getDate(); |
194 | 195 | if($date->isOK()){ |
195 | 196 | $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
196 | - } |
|
197 | - else{ |
|
197 | + } else{ |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
@@ -218,7 +218,9 @@ discard block |
||
218 | 218 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
219 | 219 | $html=''; |
220 | 220 | |
221 | - if ($fact === null) return $html; |
|
221 | + if ($fact === null) { |
|
222 | + return $html; |
|
223 | + } |
|
222 | 224 | $place = $fact->getPlace(); |
223 | 225 | if($place){ |
224 | 226 | $dplace = new Place($place); |
@@ -336,7 +338,9 @@ discard block |
||
336 | 338 | default: |
337 | 339 | break; |
338 | 340 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
341 | + if($image && $title) { |
|
342 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
343 | + } |
|
340 | 344 | break; |
341 | 345 | default: |
342 | 346 | break; |
@@ -84,21 +84,25 @@ discard block |
||
84 | 84 | * @param User $user |
85 | 85 | */ |
86 | 86 | public function __construct(Tree $tree, User $user = null) { |
87 | - if(self::$default_user === null) |
|
88 | - self::$default_user = User::find(-1); |
|
87 | + if(self::$default_user === null) { |
|
88 | + self::$default_user = User::find(-1); |
|
89 | + } |
|
89 | 90 | |
90 | 91 | $this->tree = $tree; |
91 | 92 | $this->user = $user; |
92 | 93 | $this->is_setup = true; |
93 | - if($this->user === null) $this->user = Auth::user(); |
|
94 | - if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user; |
|
94 | + if($this->user === null) { |
|
95 | + $this->user = Auth::user(); |
|
96 | + } |
|
97 | + if(strlen($this->user->getUserId()) == 0) { |
|
98 | + $this->user = self::$default_user; |
|
99 | + } |
|
95 | 100 | |
96 | 101 | // Check if the user, or the default user, has a root already setup; |
97 | 102 | if(empty($this->getRootIndiId())) { |
98 | 103 | if($this->user == self::$default_user) { // If the default user is not setup |
99 | 104 | $this->is_setup = false; |
100 | - } |
|
101 | - else { |
|
105 | + } else { |
|
102 | 106 | $this->user = self::$default_user; |
103 | 107 | $this->is_setup = $this->getRootIndiId() === null; |
104 | 108 | } |
@@ -141,7 +145,9 @@ discard block |
||
141 | 145 | * Remove all Sosa entries related to the gedcom file and user |
142 | 146 | */ |
143 | 147 | public function deleteAll() { |
144 | - if(!$this->is_setup) return; |
|
148 | + if(!$this->is_setup) { |
|
149 | + return; |
|
150 | + } |
|
145 | 151 | Database::prepare( |
146 | 152 | 'DELETE FROM `##maj_sosa`'. |
147 | 153 | ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ') |
@@ -157,7 +163,9 @@ discard block |
||
157 | 163 | * @param int $sosa |
158 | 164 | */ |
159 | 165 | public function deleteAncestors($sosa) { |
160 | - if(!$this->is_setup) return; |
|
166 | + if(!$this->is_setup) { |
|
167 | + return; |
|
168 | + } |
|
161 | 169 | $gen = Functions::getGeneration($sosa); |
162 | 170 | Database::prepare( |
163 | 171 | 'DELETE FROM `##maj_sosa`'. |
@@ -177,7 +185,9 @@ discard block |
||
177 | 185 | * @param array $sosa_records |
178 | 186 | */ |
179 | 187 | public function insertOrUpdate($sosa_records) { |
180 | - if(!$this->is_setup) return; |
|
188 | + if(!$this->is_setup) { |
|
189 | + return; |
|
190 | + } |
|
181 | 191 | |
182 | 192 | $treeid = $this->tree->getTreeId(); |
183 | 193 | $userid = $this->user->getUserId(); |
@@ -224,7 +234,9 @@ discard block |
||
224 | 234 | * @return array Array of sosa numbers |
225 | 235 | */ |
226 | 236 | public function getSosaNumbers(Individual $indi) { |
227 | - if(!$this->is_setup) return array(); |
|
237 | + if(!$this->is_setup) { |
|
238 | + return array(); |
|
239 | + } |
|
228 | 240 | return Database::prepare( |
229 | 241 | 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'. |
230 | 242 | ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
@@ -241,7 +253,9 @@ discard block |
||
241 | 253 | * @return number Last generation if found, 1 otherwise |
242 | 254 | */ |
243 | 255 | public function getLastGeneration() { |
244 | - if(!$this->is_setup) return; |
|
256 | + if(!$this->is_setup) { |
|
257 | + return; |
|
258 | + } |
|
245 | 259 | return Database::prepare( |
246 | 260 | 'SELECT MAX(majs_gen) FROM `##maj_sosa`'. |
247 | 261 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
@@ -261,7 +275,9 @@ discard block |
||
261 | 275 | * @return array Associative array of Sosa ancestors, with their generation, comma separated |
262 | 276 | */ |
263 | 277 | public function getAllSosaWithGenerations(){ |
264 | - if(!$this->is_setup) return array(); |
|
278 | + if(!$this->is_setup) { |
|
279 | + return array(); |
|
280 | + } |
|
265 | 281 | return Database::prepare( |
266 | 282 | 'SELECT majs_i_id AS indi,' . |
267 | 283 | ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' . |
@@ -281,9 +297,12 @@ discard block |
||
281 | 297 | * @return array Array of Sosa individuals |
282 | 298 | */ |
283 | 299 | public function getSosaListAtGeneration($gen){ |
284 | - if(!$this->is_setup) return array(); |
|
285 | - if(!$this->sosa_list_by_gen) |
|
286 | - $this->sosa_list_by_gen = array(); |
|
300 | + if(!$this->is_setup) { |
|
301 | + return array(); |
|
302 | + } |
|
303 | + if(!$this->sosa_list_by_gen) { |
|
304 | + $this->sosa_list_by_gen = array(); |
|
305 | + } |
|
287 | 306 | |
288 | 307 | if($gen){ |
289 | 308 | if(!isset($this->sosa_list_by_gen[$gen])){ |
@@ -312,9 +331,12 @@ discard block |
||
312 | 331 | * @return array Array of Sosa families |
313 | 332 | */ |
314 | 333 | public function getFamilySosaListAtGeneration($gen){ |
315 | - if(!$this->is_setup) return array(); |
|
316 | - if(!$this->sosa_fam_list_by_gen) |
|
317 | - $this->sosa_fam_list_by_gen = array(); |
|
334 | + if(!$this->is_setup) { |
|
335 | + return array(); |
|
336 | + } |
|
337 | + if(!$this->sosa_fam_list_by_gen) { |
|
338 | + $this->sosa_fam_list_by_gen = array(); |
|
339 | + } |
|
318 | 340 | |
319 | 341 | if($gen){ |
320 | 342 | if(!isset($this->sosa_fam_list_by_gen[$gen])){ |
@@ -348,7 +370,9 @@ discard block |
||
348 | 370 | * @return array Array of Sosa individuals |
349 | 371 | */ |
350 | 372 | public function getMissingSosaListAtGeneration($gen){ |
351 | - if(!$this->is_setup) return array(); |
|
373 | + if(!$this->is_setup) { |
|
374 | + return array(); |
|
375 | + } |
|
352 | 376 | if($gen){ |
353 | 377 | return $this->sosa_list_by_gen[$gen] = Database::prepare( |
354 | 378 | 'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'. |
@@ -386,7 +410,9 @@ discard block |
||
386 | 410 | * @return array Statistics array |
387 | 411 | */ |
388 | 412 | public function getStatisticsByGeneration() { |
389 | - if(!$this->is_setup) return array(); |
|
413 | + if(!$this->is_setup) { |
|
414 | + return array(); |
|
415 | + } |
|
390 | 416 | if(!$this->statistics_tab) { |
391 | 417 | $this->statistics_tab = array(); |
392 | 418 | if($maxGeneration = $this->getLastGeneration()) { |
@@ -412,7 +438,9 @@ discard block |
||
412 | 438 | * @return int |
413 | 439 | */ |
414 | 440 | public function getTotalIndividuals() { |
415 | - if(!$this->is_setup) return 0; |
|
441 | + if(!$this->is_setup) { |
|
442 | + return 0; |
|
443 | + } |
|
416 | 444 | return Database::prepare( |
417 | 445 | 'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' . |
418 | 446 | ' WHERE i_file = :tree_id') |
@@ -426,7 +454,9 @@ discard block |
||
426 | 454 | * @return number Number of Sosas |
427 | 455 | */ |
428 | 456 | public function getSosaCount(){ |
429 | - if(!$this->is_setup) return 0; |
|
457 | + if(!$this->is_setup) { |
|
458 | + return 0; |
|
459 | + } |
|
430 | 460 | return Database::prepare( |
431 | 461 | 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
432 | 462 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
@@ -443,7 +473,9 @@ discard block |
||
443 | 473 | * @return number Number of Sosas in generation |
444 | 474 | */ |
445 | 475 | public function getSosaCountAtGeneration($gen){ |
446 | - if(!$this->is_setup) return 0; |
|
476 | + if(!$this->is_setup) { |
|
477 | + return 0; |
|
478 | + } |
|
447 | 479 | return Database::prepare( |
448 | 480 | 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
449 | 481 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
@@ -462,7 +494,9 @@ discard block |
||
462 | 494 | * @return number Total number of Sosas up to generation |
463 | 495 | */ |
464 | 496 | public function getSosaCountUpToGeneration($gen){ |
465 | - if(!$this->is_setup) return 0; |
|
497 | + if(!$this->is_setup) { |
|
498 | + return 0; |
|
499 | + } |
|
466 | 500 | return Database::prepare( |
467 | 501 | 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
468 | 502 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
@@ -480,7 +514,9 @@ discard block |
||
480 | 514 | * @return number Total number of distinct individual |
481 | 515 | */ |
482 | 516 | public function getDifferentSosaCount(){ |
483 | - if(!$this->is_setup) return 0; |
|
517 | + if(!$this->is_setup) { |
|
518 | + return 0; |
|
519 | + } |
|
484 | 520 | return Database::prepare( |
485 | 521 | 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
486 | 522 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
@@ -497,7 +533,9 @@ discard block |
||
497 | 533 | * @return number Number of distinct Sosa individuals up to generation |
498 | 534 | */ |
499 | 535 | public function getDifferentSosaCountUpToGeneration($gen){ |
500 | - if(!$this->is_setup) return 0; |
|
536 | + if(!$this->is_setup) { |
|
537 | + return 0; |
|
538 | + } |
|
501 | 539 | return Database::prepare( |
502 | 540 | 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
503 | 541 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
@@ -520,7 +558,9 @@ discard block |
||
520 | 558 | * @return array Birth statistics array |
521 | 559 | */ |
522 | 560 | public function getStatsBirthYearInGeneration($gen){ |
523 | - if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
561 | + if(!$this->is_setup) { |
|
562 | + return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
563 | + } |
|
524 | 564 | return Database::prepare( |
525 | 565 | 'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'. |
526 | 566 | ' FROM `##maj_sosa`' . |
@@ -540,7 +580,9 @@ discard block |
||
540 | 580 | * @return number|NULL Mean generation time |
541 | 581 | */ |
542 | 582 | public function getMeanGenerationTime(){ |
543 | - if(!$this->is_setup) return; |
|
583 | + if(!$this->is_setup) { |
|
584 | + return; |
|
585 | + } |
|
544 | 586 | if(!$this->statistics_tab){ |
545 | 587 | $this->getStatisticsByGeneration(); |
546 | 588 | } |
@@ -586,7 +628,10 @@ discard block |
||
586 | 628 | * @return array |
587 | 629 | */ |
588 | 630 | public function getAncestorDispersionForGen($gen) { |
589 | - if(!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query |
|
631 | + if(!$this->is_setup || $gen > 11) { |
|
632 | + return array(); |
|
633 | + } |
|
634 | + // Going further than 11 gen will be out of range in the query |
|
590 | 635 | return Database::prepare( |
591 | 636 | 'SELECT branches, count(i_id)'. |
592 | 637 | ' FROM ('. |
@@ -626,7 +671,9 @@ discard block |
||
626 | 671 | * @return array |
627 | 672 | */ |
628 | 673 | public function getTopMultiSosaAncestorsNoTies($limit) { |
629 | - if(!$this->is_setup) return array(); |
|
674 | + if(!$this->is_setup) { |
|
675 | + return array(); |
|
676 | + } |
|
630 | 677 | return Database::prepare( |
631 | 678 | 'SELECT sosa_i_id, sosa_count FROM ('. |
632 | 679 | ' SELECT'. |