@@ -86,9 +86,12 @@ discard block |
||
| 86 | 86 | * @return boolean |
| 87 | 87 | */ |
| 88 | 88 | public function canDisplayIsSourced($access_level = null){ |
| 89 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 90 | - if($access_level === null ) |
|
| 91 | - $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 89 | + if(!$this->gedcomrecord->canShow($access_level)) { |
|
| 90 | + return false; |
|
| 91 | + } |
|
| 92 | + if($access_level === null ) { |
|
| 93 | + $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 94 | + } |
|
| 92 | 95 | |
| 93 | 96 | $global_facts = Globals::getGlobalFacts(); |
| 94 | 97 | if (isset($global_facts['SOUR'])) { |
@@ -108,7 +111,9 @@ discard block |
||
| 108 | 111 | * @return int Level of sources |
| 109 | 112 | */ |
| 110 | 113 | public function isSourced(){ |
| 111 | - if($this->_issourced !== null) return $this->_issourced; |
|
| 114 | + if($this->_issourced !== null) { |
|
| 115 | + return $this->_issourced; |
|
| 116 | + } |
|
| 112 | 117 | $this->_issourced=-1; |
| 113 | 118 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
| 114 | 119 | foreach($sourcesfacts as $sourcefact){ |
@@ -127,7 +132,9 @@ discard block |
||
| 127 | 132 | * @return int Level of sources |
| 128 | 133 | */ |
| 129 | 134 | public function isFactSourced($eventslist){ |
| 130 | - if(empty($eventslist)) return 0; |
|
| 135 | + if(empty($eventslist)) { |
|
| 136 | + return 0; |
|
| 137 | + } |
|
| 131 | 138 | $isSourced=0; |
| 132 | 139 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 133 | 140 | foreach($facts as $fact){ |
@@ -137,8 +144,7 @@ discard block |
||
| 137 | 144 | if($tmpIsSourced != 0) { |
| 138 | 145 | if($isSourced==0) { |
| 139 | 146 | $isSourced = $tmpIsSourced; |
| 140 | - } |
|
| 141 | - else{ |
|
| 147 | + } else{ |
|
| 142 | 148 | $isSourced = max($isSourced, $tmpIsSourced); |
| 143 | 149 | } |
| 144 | 150 | } |
@@ -123,7 +123,9 @@ |
||
| 123 | 123 | $tree = Globals::getTree(); |
| 124 | 124 | $cid = Filter::get('cid'); |
| 125 | 125 | $certificate = null; |
| 126 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $tree, null, $this->provider); |
|
| 126 | + if(!empty($cid)) { |
|
| 127 | + $certificate = Certificate::getInstance($cid, $tree, null, $this->provider); |
|
| 128 | + } |
|
| 127 | 129 | |
| 128 | 130 | $imageBuilder = new ImageBuilder($certificate); |
| 129 | 131 | |
@@ -85,7 +85,9 @@ |
||
| 85 | 85 | */ |
| 86 | 86 | public function index() { |
| 87 | 87 | $action = Filter::post('action'); |
| 88 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 88 | + if($action == 'update' && Filter::checkCsrf()) { |
|
| 89 | + $this->update(); |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
| 91 | 93 | $ctrl = new PageController(); |
@@ -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; |
@@ -108,16 +108,18 @@ discard block |
||
| 108 | 108 | $len_chars = count($chars); |
| 109 | 109 | $token = ''; |
| 110 | 110 | |
| 111 | - for ($i = 0; $i < $length; $i++) |
|
| 112 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
| 111 | + for ($i = 0; $i < $length; $i++) { |
|
| 112 | + $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
| 113 | + } |
|
| 113 | 114 | |
| 114 | 115 | # Number of 32 char chunks |
| 115 | 116 | $chunks = ceil( strlen($token) / 32 ); |
| 116 | 117 | $md5token = ''; |
| 117 | 118 | |
| 118 | 119 | # Run each chunk through md5 |
| 119 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
| 120 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
| 120 | + for ( $i=1; $i<=$chunks; $i++ ) { |
|
| 121 | + $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
| 122 | + } |
|
| 121 | 123 | |
| 122 | 124 | # Trim the token |
| 123 | 125 | return substr($md5token, 0, $length); |
@@ -130,8 +132,9 @@ discard block |
||
| 130 | 132 | */ |
| 131 | 133 | protected static function getBase64EncryptionKey() { |
| 132 | 134 | $key = 'STANDARDKEYIFNOSERVER'; |
| 133 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
| 134 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 135 | + if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) { |
|
| 136 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 137 | + } |
|
| 135 | 138 | |
| 136 | 139 | return $key; |
| 137 | 140 | } |
@@ -168,11 +171,13 @@ discard block |
||
| 168 | 171 | $encrypted = str_replace('_', '/', $encrypted); |
| 169 | 172 | $encrypted = str_replace('*', '=', $encrypted); |
| 170 | 173 | $encrypted = base64_decode($encrypted); |
| 171 | - if($encrypted === false) |
|
| 172 | - throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
| 174 | + if($encrypted === false) { |
|
| 175 | + throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
| 176 | + } |
|
| 173 | 177 | |
| 174 | - if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) |
|
| 175 | - throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 178 | + if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) { |
|
| 179 | + throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 180 | + } |
|
| 176 | 181 | |
| 177 | 182 | $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); |
| 178 | 183 | $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); |
@@ -222,7 +227,9 @@ discard block |
||
| 222 | 227 | * @return boolean True if path valid |
| 223 | 228 | */ |
| 224 | 229 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
| 225 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
| 230 | + if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) { |
|
| 231 | + return true; |
|
| 232 | + } |
|
| 226 | 233 | return false; |
| 227 | 234 | } |
| 228 | 235 | |