@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * System for generating menus. |
22 | 22 | */ |
23 | -class Menu { |
|
23 | +class Menu |
|
24 | +{ |
|
24 | 25 | /** @var string The text to be displayed in the mneu */ |
25 | 26 | private $label; |
26 | 27 | |
@@ -54,7 +55,8 @@ discard block |
||
54 | 55 | * @param string[] $attrs Optional attributes, such as onclick or data-xxx |
55 | 56 | * @param Menu[] $submenus Any submenus |
56 | 57 | */ |
57 | - public function __construct($label, $link = '#', $class = '', array $attrs = array(), array $submenus = array()) { |
|
58 | + public function __construct($label, $link = '#', $class = '', array $attrs = array(), array $submenus = array()) |
|
59 | + { |
|
58 | 60 | $this |
59 | 61 | ->setLabel($label) |
60 | 62 | ->setLink($link) |
@@ -69,7 +71,8 @@ discard block |
||
69 | 71 | * |
70 | 72 | * @return string |
71 | 73 | */ |
72 | - public function __toString() { |
|
74 | + public function __toString() |
|
75 | + { |
|
73 | 76 | return $this->getMenuAsList(); |
74 | 77 | } |
75 | 78 | |
@@ -78,7 +81,8 @@ discard block |
||
78 | 81 | * |
79 | 82 | * @return string |
80 | 83 | */ |
81 | - public function bootstrap() { |
|
84 | + public function bootstrap() |
|
85 | + { |
|
82 | 86 | if ($this->submenus) { |
83 | 87 | $submenus = ''; |
84 | 88 | foreach ($this->submenus as $submenu) { |
@@ -109,7 +113,8 @@ discard block |
||
109 | 113 | * |
110 | 114 | * @return string[] |
111 | 115 | */ |
112 | - public function getAttrs() { |
|
116 | + public function getAttrs() |
|
117 | + { |
|
113 | 118 | return $this->attrs; |
114 | 119 | } |
115 | 120 | |
@@ -120,7 +125,8 @@ discard block |
||
120 | 125 | * |
121 | 126 | * @return $this |
122 | 127 | */ |
123 | - public function setAttrs(array $attrs) { |
|
128 | + public function setAttrs(array $attrs) |
|
129 | + { |
|
124 | 130 | $this->attrs = $attrs; |
125 | 131 | |
126 | 132 | return $this; |
@@ -132,7 +138,8 @@ discard block |
||
132 | 138 | * @param string $menuclass |
133 | 139 | * @param string $submenuclass |
134 | 140 | */ |
135 | - public function addClass($menuclass, $submenuclass = '') { |
|
141 | + public function addClass($menuclass, $submenuclass = '') |
|
142 | + { |
|
136 | 143 | $this->menuclass = $menuclass; |
137 | 144 | $this->submenuclass = $submenuclass; |
138 | 145 | } |
@@ -142,7 +149,8 @@ discard block |
||
142 | 149 | * |
143 | 150 | * @return string |
144 | 151 | */ |
145 | - public function getClass() { |
|
152 | + public function getClass() |
|
153 | + { |
|
146 | 154 | return $this->class; |
147 | 155 | } |
148 | 156 | |
@@ -153,7 +161,8 @@ discard block |
||
153 | 161 | * |
154 | 162 | * @return $this |
155 | 163 | */ |
156 | - public function setClass($class) { |
|
164 | + public function setClass($class) |
|
165 | + { |
|
157 | 166 | $this->class = $class; |
158 | 167 | |
159 | 168 | return $this; |
@@ -164,7 +173,8 @@ discard block |
||
164 | 173 | * |
165 | 174 | * @return string |
166 | 175 | */ |
167 | - public function getLabel() { |
|
176 | + public function getLabel() |
|
177 | + { |
|
168 | 178 | return $this->label; |
169 | 179 | } |
170 | 180 | |
@@ -175,7 +185,8 @@ discard block |
||
175 | 185 | * |
176 | 186 | * @return $this |
177 | 187 | */ |
178 | - public function setLabel($label) { |
|
188 | + public function setLabel($label) |
|
189 | + { |
|
179 | 190 | $this->label = $label; |
180 | 191 | |
181 | 192 | return $this; |
@@ -186,7 +197,8 @@ discard block |
||
186 | 197 | * |
187 | 198 | * @return string |
188 | 199 | */ |
189 | - public function getLink() { |
|
200 | + public function getLink() |
|
201 | + { |
|
190 | 202 | return $this->link; |
191 | 203 | } |
192 | 204 | |
@@ -197,7 +209,8 @@ discard block |
||
197 | 209 | * |
198 | 210 | * @return $this |
199 | 211 | */ |
200 | - public function setLink($link) { |
|
212 | + public function setLink($link) |
|
213 | + { |
|
201 | 214 | $this->link = $link; |
202 | 215 | |
203 | 216 | return $this; |
@@ -210,7 +223,8 @@ discard block |
||
210 | 223 | * |
211 | 224 | * @return $this |
212 | 225 | */ |
213 | - public function addSubmenu($menu) { |
|
226 | + public function addSubmenu($menu) |
|
227 | + { |
|
214 | 228 | $this->submenus[] = $menu; |
215 | 229 | |
216 | 230 | return $this; |
@@ -221,7 +235,8 @@ discard block |
||
221 | 235 | * |
222 | 236 | * @return string |
223 | 237 | */ |
224 | - public function getMenu() { |
|
238 | + public function getMenu() |
|
239 | + { |
|
225 | 240 | $menu_id = 'menu-' . Uuid::uuid4(); |
226 | 241 | $sub_menu_id = 'sub-' . $menu_id; |
227 | 242 | |
@@ -255,7 +270,8 @@ discard block |
||
255 | 270 | * |
256 | 271 | * @return string |
257 | 272 | */ |
258 | - public function getMenuAsList() { |
|
273 | + public function getMenuAsList() |
|
274 | + { |
|
259 | 275 | $attrs = ''; |
260 | 276 | foreach ($this->attrs as $key => $value) { |
261 | 277 | $attrs .= ' ' . $key . '="' . Filter::escapeHtml($value) . '"'; |
@@ -282,7 +298,8 @@ discard block |
||
282 | 298 | * |
283 | 299 | * @return Menu[] |
284 | 300 | */ |
285 | - public function getSubmenus() { |
|
301 | + public function getSubmenus() |
|
302 | + { |
|
286 | 303 | return $this->submenus; |
287 | 304 | } |
288 | 305 | |
@@ -293,7 +310,8 @@ discard block |
||
293 | 310 | * |
294 | 311 | * @return $this |
295 | 312 | */ |
296 | - public function setSubmenus(array $submenus) { |
|
313 | + public function setSubmenus(array $submenus) |
|
314 | + { |
|
297 | 315 | $this->submenus = $submenus; |
298 | 316 | |
299 | 317 | return $this; |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Record webtrees events in the database |
20 | 20 | */ |
21 | -class Log { |
|
21 | +class Log |
|
22 | +{ |
|
22 | 23 | // We can log the following types of message in the wt_log table. |
23 | 24 | const TYPE_AUTHENTICATION = 'auth'; |
24 | 25 | const TYPE_CONFIGURATION = 'config'; |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | * @param string $log_type |
36 | 37 | * @param Tree|null $tree |
37 | 38 | */ |
38 | - private static function addLog($message, $log_type, Tree $tree = null) { |
|
39 | + private static function addLog($message, $log_type, Tree $tree = null) |
|
40 | + { |
|
39 | 41 | global $WT_TREE; |
40 | 42 | |
41 | 43 | if (!$tree) { |
@@ -58,7 +60,8 @@ discard block |
||
58 | 60 | * |
59 | 61 | * @param string $message |
60 | 62 | */ |
61 | - public static function addAuthenticationLog($message) { |
|
63 | + public static function addAuthenticationLog($message) |
|
64 | + { |
|
62 | 65 | self::addLog($message, self::TYPE_AUTHENTICATION); |
63 | 66 | } |
64 | 67 | |
@@ -68,7 +71,8 @@ discard block |
||
68 | 71 | * @param string $message |
69 | 72 | * @param Tree|null $tree |
70 | 73 | */ |
71 | - public static function addConfigurationLog($message, Tree $tree = null) { |
|
74 | + public static function addConfigurationLog($message, Tree $tree = null) |
|
75 | + { |
|
72 | 76 | self::addLog($message, self::TYPE_CONFIGURATION, $tree); |
73 | 77 | } |
74 | 78 | |
@@ -77,7 +81,8 @@ discard block |
||
77 | 81 | * |
78 | 82 | * @param string $message |
79 | 83 | */ |
80 | - public static function addDebugLog($message) { |
|
84 | + public static function addDebugLog($message) |
|
85 | + { |
|
81 | 86 | self::addLog($message, self::TYPE_DEBUG); |
82 | 87 | } |
83 | 88 | |
@@ -86,7 +91,8 @@ discard block |
||
86 | 91 | * |
87 | 92 | * @param string $message |
88 | 93 | */ |
89 | - public static function addEditLog($message) { |
|
94 | + public static function addEditLog($message) |
|
95 | + { |
|
90 | 96 | self::addLog($message, self::TYPE_EDIT); |
91 | 97 | } |
92 | 98 | |
@@ -95,7 +101,8 @@ discard block |
||
95 | 101 | * |
96 | 102 | * @param string $message |
97 | 103 | */ |
98 | - public static function addErrorLog($message) { |
|
104 | + public static function addErrorLog($message) |
|
105 | + { |
|
99 | 106 | self::addLog($message, self::TYPE_ERROR); |
100 | 107 | } |
101 | 108 | |
@@ -104,7 +111,8 @@ discard block |
||
104 | 111 | * |
105 | 112 | * @param string $message |
106 | 113 | */ |
107 | - public static function addMediaLog($message) { |
|
114 | + public static function addMediaLog($message) |
|
115 | + { |
|
108 | 116 | self::addLog($message, self::TYPE_MEDIA); |
109 | 117 | } |
110 | 118 | |
@@ -117,7 +125,8 @@ discard block |
||
117 | 125 | * @param string $message |
118 | 126 | * @param Tree[] $trees Which trees were searched |
119 | 127 | */ |
120 | - public static function addSearchLog($message, array $trees) { |
|
128 | + public static function addSearchLog($message, array $trees) |
|
129 | + { |
|
121 | 130 | foreach ($trees as $tree) { |
122 | 131 | self::addLog($message, self::TYPE_SEARCH, $tree); |
123 | 132 | } |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Static GEDCOM data for tags |
22 | 22 | */ |
23 | -class GedcomTag { |
|
23 | +class GedcomTag |
|
24 | +{ |
|
24 | 25 | /** @var string[] All tags that webtrees knows how to translate - including special/internal tags */ |
25 | 26 | private static $ALL_TAGS = array( |
26 | 27 | 'ABBR', 'ADDR', 'ADR1', 'ADR2', 'ADOP', 'ADOP:DATE', 'ADOP:PLAC', |
@@ -92,7 +93,8 @@ discard block |
||
92 | 93 | * |
93 | 94 | * @return bool |
94 | 95 | */ |
95 | - public static function isTag($tag) { |
|
96 | + public static function isTag($tag) |
|
97 | + { |
|
96 | 98 | return in_array($tag, self::$ALL_TAGS); |
97 | 99 | } |
98 | 100 | |
@@ -104,7 +106,8 @@ discard block |
||
104 | 106 | * |
105 | 107 | * @return string |
106 | 108 | */ |
107 | - public static function getLabel($tag, GedcomRecord $record = null) { |
|
109 | + public static function getLabel($tag, GedcomRecord $record = null) |
|
110 | + { |
|
108 | 111 | if ($record instanceof Individual) { |
109 | 112 | $sex = $record->getSex(); |
110 | 113 | } else { |
@@ -1808,7 +1811,8 @@ discard block |
||
1808 | 1811 | * |
1809 | 1812 | * @return string |
1810 | 1813 | */ |
1811 | - public static function getLabelValue($tag, $value, GedcomRecord $record = null, $element = 'div') { |
|
1814 | + public static function getLabelValue($tag, $value, GedcomRecord $record = null, $element = 'div') |
|
1815 | + { |
|
1812 | 1816 | return |
1813 | 1817 | '<' . $element . ' class="fact_' . $tag . '">' . |
1814 | 1818 | /* I18N: a label/value pair, such as “Occupation: Farmer”. Some languages may need to change the punctuation. */ |
@@ -1821,7 +1825,8 @@ discard block |
||
1821 | 1825 | * |
1822 | 1826 | * @return string[] |
1823 | 1827 | */ |
1824 | - public static function getPicklistFacts($fact_type) { |
|
1828 | + public static function getPicklistFacts($fact_type) |
|
1829 | + { |
|
1825 | 1830 | switch ($fact_type) { |
1826 | 1831 | case 'INDI': |
1827 | 1832 | $tags = array( |
@@ -1904,7 +1909,8 @@ discard block |
||
1904 | 1909 | * |
1905 | 1910 | * @return string |
1906 | 1911 | */ |
1907 | - public static function getFileFormTypeValue($type) { |
|
1912 | + public static function getFileFormTypeValue($type) |
|
1913 | + { |
|
1908 | 1914 | switch (strtolower($type)) { |
1909 | 1915 | case 'audio': |
1910 | 1916 | return /* I18N: Type of media object */ I18N::translate('Audio'); |
@@ -1950,7 +1956,8 @@ discard block |
||
1950 | 1956 | * |
1951 | 1957 | * @return string[] |
1952 | 1958 | */ |
1953 | - public static function getFileFormTypes() { |
|
1959 | + public static function getFileFormTypes() |
|
1960 | + { |
|
1954 | 1961 | $values = array(); |
1955 | 1962 | foreach (self::$OBJE_FILE_FORM_TYPE as $type) { |
1956 | 1963 | $values[$type] = self::getFileFormTypeValue($type); |
@@ -1969,7 +1976,8 @@ discard block |
||
1969 | 1976 | * |
1970 | 1977 | * @return string |
1971 | 1978 | */ |
1972 | - public static function createUid() { |
|
1979 | + public static function createUid() |
|
1980 | + { |
|
1973 | 1981 | $uid = str_replace('-', '', Uuid::uuid4()); |
1974 | 1982 | |
1975 | 1983 | $checksum_a = 0; // a sum of the bytes |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Generate messages in one request and display them in the next. |
20 | 20 | */ |
21 | -class FlashMessages { |
|
21 | +class FlashMessages |
|
22 | +{ |
|
22 | 23 | // Session storage key |
23 | 24 | const FLASH_KEY = 'flash_messages'; |
24 | 25 | |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * @param string $text |
29 | 30 | * @param string $status "success", "info", "warning" or "danger" |
30 | 31 | */ |
31 | - public static function addMessage($text, $status = 'info') { |
|
32 | + public static function addMessage($text, $status = 'info') |
|
33 | + { |
|
32 | 34 | $message = new \stdClass; |
33 | 35 | $message->text = $text; |
34 | 36 | $message->status = $status; |
@@ -43,7 +45,8 @@ discard block |
||
43 | 45 | * |
44 | 46 | * @return string[] |
45 | 47 | */ |
46 | - public static function getMessages() { |
|
48 | + public static function getMessages() |
|
49 | + { |
|
47 | 50 | $messages = Session::get(self::FLASH_KEY, array()); |
48 | 51 | Session::forget(self::FLASH_KEY); |
49 | 52 |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Provide an interface to the wt_user table. |
20 | 20 | */ |
21 | -class User { |
|
21 | +class User |
|
22 | +{ |
|
22 | 23 | /** @var string The primary key of this user. */ |
23 | 24 | private $user_id; |
24 | 25 | |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | * |
45 | 46 | * @return User|null |
46 | 47 | */ |
47 | - public static function find($user_id) { |
|
48 | + public static function find($user_id) |
|
49 | + { |
|
48 | 50 | if (!array_key_exists($user_id, self::$cache)) { |
49 | 51 | $row = Database::prepare( |
50 | 52 | "SELECT user_id, user_name, real_name, email FROM `##user` WHERE user_id = ?" |
@@ -66,7 +68,8 @@ discard block |
||
66 | 68 | * |
67 | 69 | * @return User|null |
68 | 70 | */ |
69 | - public static function findByUserName($user_name) { |
|
71 | + public static function findByUserName($user_name) |
|
72 | + { |
|
70 | 73 | $user_id = Database::prepare( |
71 | 74 | "SELECT user_id FROM `##user` WHERE user_name = :user_name" |
72 | 75 | )->execute(array( |
@@ -83,7 +86,8 @@ discard block |
||
83 | 86 | * |
84 | 87 | * @return User|null |
85 | 88 | */ |
86 | - public static function findByEmail($email) { |
|
89 | + public static function findByEmail($email) |
|
90 | + { |
|
87 | 91 | $user_id = Database::prepare( |
88 | 92 | "SELECT user_id FROM `##user` WHERE email = :email" |
89 | 93 | )->execute(array( |
@@ -100,7 +104,8 @@ discard block |
||
100 | 104 | * |
101 | 105 | * @return User|null |
102 | 106 | */ |
103 | - public static function findByIdentifier($identifier) { |
|
107 | + public static function findByIdentifier($identifier) |
|
108 | + { |
|
104 | 109 | $user_id = Database::prepare( |
105 | 110 | "SELECT user_id FROM `##user` WHERE ? IN (user_name, email)" |
106 | 111 | )->execute(array($identifier))->fetchOne(); |
@@ -115,7 +120,8 @@ discard block |
||
115 | 120 | * |
116 | 121 | * @return User|null |
117 | 122 | */ |
118 | - public static function findByGenealogyRecord(Individual $individual) { |
|
123 | + public static function findByGenealogyRecord(Individual $individual) |
|
124 | + { |
|
119 | 125 | $user_id = Database::prepare( |
120 | 126 | "SELECT user_id" . |
121 | 127 | " FROM `##user_gedcom_setting`" . |
@@ -133,7 +139,8 @@ discard block |
||
133 | 139 | * |
134 | 140 | * @return User|null |
135 | 141 | */ |
136 | - public static function findLatestToRegister() { |
|
142 | + public static function findLatestToRegister() |
|
143 | + { |
|
137 | 144 | $user_id = Database::prepare( |
138 | 145 | "SELECT u.user_id" . |
139 | 146 | " FROM `##user` u" . |
@@ -157,7 +164,8 @@ discard block |
||
157 | 164 | * |
158 | 165 | * @return User |
159 | 166 | */ |
160 | - public static function create($user_name, $real_name, $email, $password) { |
|
167 | + public static function create($user_name, $real_name, $email, $password) |
|
168 | + { |
|
161 | 169 | Database::prepare( |
162 | 170 | "INSERT INTO `##user` (user_name, real_name, email, password) VALUES (:user_name, :real_name, :email, :password)" |
163 | 171 | )->execute(array( |
@@ -182,7 +190,8 @@ discard block |
||
182 | 190 | * |
183 | 191 | * @return int |
184 | 192 | */ |
185 | - public static function count() { |
|
193 | + public static function count() |
|
194 | + { |
|
186 | 195 | return (int) Database::prepare( |
187 | 196 | "SELECT COUNT(*)" . |
188 | 197 | " FROM `##user`" . |
@@ -195,7 +204,8 @@ discard block |
||
195 | 204 | * |
196 | 205 | * @return User[] |
197 | 206 | */ |
198 | - public static function all() { |
|
207 | + public static function all() |
|
208 | + { |
|
199 | 209 | $users = array(); |
200 | 210 | |
201 | 211 | $rows = Database::prepare( |
@@ -217,7 +227,8 @@ discard block |
||
217 | 227 | * |
218 | 228 | * @return User[] |
219 | 229 | */ |
220 | - public static function allAdmins() { |
|
230 | + public static function allAdmins() |
|
231 | + { |
|
221 | 232 | $rows = Database::prepare( |
222 | 233 | "SELECT user_id, user_name, real_name, email" . |
223 | 234 | " FROM `##user`" . |
@@ -240,7 +251,8 @@ discard block |
||
240 | 251 | * |
241 | 252 | * @return User[] |
242 | 253 | */ |
243 | - public static function allVerified() { |
|
254 | + public static function allVerified() |
|
255 | + { |
|
244 | 256 | $rows = Database::prepare( |
245 | 257 | "SELECT user_id, user_name, real_name, email" . |
246 | 258 | " FROM `##user`" . |
@@ -263,7 +275,8 @@ discard block |
||
263 | 275 | * |
264 | 276 | * @return User[] |
265 | 277 | */ |
266 | - public static function allLoggedIn() { |
|
278 | + public static function allLoggedIn() |
|
279 | + { |
|
267 | 280 | $rows = Database::prepare( |
268 | 281 | "SELECT DISTINCT user_id, user_name, real_name, email" . |
269 | 282 | " FROM `##user`" . |
@@ -283,7 +296,8 @@ discard block |
||
283 | 296 | * |
284 | 297 | * @param \stdclass $user A row from the wt_user table |
285 | 298 | */ |
286 | - public function __construct(\stdClass $user) { |
|
299 | + public function __construct(\stdClass $user) |
|
300 | + { |
|
287 | 301 | $this->user_id = $user->user_id; |
288 | 302 | $this->user_name = $user->user_name; |
289 | 303 | $this->real_name = $user->real_name; |
@@ -293,7 +307,8 @@ discard block |
||
293 | 307 | /** |
294 | 308 | * Delete a user |
295 | 309 | */ |
296 | - public function delete() { |
|
310 | + public function delete() |
|
311 | + { |
|
297 | 312 | // Don't delete the logs. |
298 | 313 | Database::prepare("UPDATE `##log` SET user_id=NULL WHERE user_id =?")->execute(array($this->user_id)); |
299 | 314 | // Take over the user’s pending changes. (What else could we do with them?) |
@@ -313,7 +328,8 @@ discard block |
||
313 | 328 | * |
314 | 329 | * @return bool |
315 | 330 | */ |
316 | - public function checkPassword($password) { |
|
331 | + public function checkPassword($password) |
|
332 | + { |
|
317 | 333 | $password_hash = Database::prepare( |
318 | 334 | "SELECT password FROM `##user` WHERE user_id = ?" |
319 | 335 | )->execute(array($this->user_id))->fetchOne(); |
@@ -334,7 +350,8 @@ discard block |
||
334 | 350 | * |
335 | 351 | * @return string |
336 | 352 | */ |
337 | - public function getUserId() { |
|
353 | + public function getUserId() |
|
354 | + { |
|
338 | 355 | return $this->user_id; |
339 | 356 | } |
340 | 357 | |
@@ -343,7 +360,8 @@ discard block |
||
343 | 360 | * |
344 | 361 | * @return string |
345 | 362 | */ |
346 | - public function getUserName() { |
|
363 | + public function getUserName() |
|
364 | + { |
|
347 | 365 | return $this->user_name; |
348 | 366 | } |
349 | 367 | |
@@ -354,7 +372,8 @@ discard block |
||
354 | 372 | * |
355 | 373 | * @return $this |
356 | 374 | */ |
357 | - public function setUserName($user_name) { |
|
375 | + public function setUserName($user_name) |
|
376 | + { |
|
358 | 377 | if ($this->user_name !== $user_name) { |
359 | 378 | $this->user_name = $user_name; |
360 | 379 | Database::prepare( |
@@ -370,7 +389,8 @@ discard block |
||
370 | 389 | * |
371 | 390 | * @return string |
372 | 391 | */ |
373 | - public function getRealName() { |
|
392 | + public function getRealName() |
|
393 | + { |
|
374 | 394 | return $this->real_name; |
375 | 395 | } |
376 | 396 | |
@@ -379,7 +399,8 @@ discard block |
||
379 | 399 | * |
380 | 400 | * @return string |
381 | 401 | */ |
382 | - public function getRealNameHtml() { |
|
402 | + public function getRealNameHtml() |
|
403 | + { |
|
383 | 404 | return '<span dir="auto">' . Filter::escapeHtml($this->real_name) . '</span>'; |
384 | 405 | } |
385 | 406 | |
@@ -390,7 +411,8 @@ discard block |
||
390 | 411 | * |
391 | 412 | * @return User |
392 | 413 | */ |
393 | - public function setRealName($real_name) { |
|
414 | + public function setRealName($real_name) |
|
415 | + { |
|
394 | 416 | if ($this->real_name !== $real_name) { |
395 | 417 | $this->real_name = $real_name; |
396 | 418 | Database::prepare( |
@@ -406,7 +428,8 @@ discard block |
||
406 | 428 | * |
407 | 429 | * @return string |
408 | 430 | */ |
409 | - public function getEmail() { |
|
431 | + public function getEmail() |
|
432 | + { |
|
410 | 433 | return $this->email; |
411 | 434 | } |
412 | 435 | |
@@ -417,7 +440,8 @@ discard block |
||
417 | 440 | * |
418 | 441 | * @return User |
419 | 442 | */ |
420 | - public function setEmail($email) { |
|
443 | + public function setEmail($email) |
|
444 | + { |
|
421 | 445 | if ($this->email !== $email) { |
422 | 446 | $this->email = $email; |
423 | 447 | Database::prepare( |
@@ -435,7 +459,8 @@ discard block |
||
435 | 459 | * |
436 | 460 | * @return User |
437 | 461 | */ |
438 | - public function setPassword($password) { |
|
462 | + public function setPassword($password) |
|
463 | + { |
|
439 | 464 | Database::prepare( |
440 | 465 | "UPDATE `##user` SET password = ? WHERE user_id = ?" |
441 | 466 | )->execute(array($this->passwordHash($password), $this->user_id)); |
@@ -454,7 +479,8 @@ discard block |
||
454 | 479 | * |
455 | 480 | * @return string|null |
456 | 481 | */ |
457 | - public function getPreference($setting_name, $default = null) { |
|
482 | + public function getPreference($setting_name, $default = null) |
|
483 | + { |
|
458 | 484 | if ($this->preferences === null) { |
459 | 485 | if ($this->user_id) { |
460 | 486 | $this->preferences = Database::prepare( |
@@ -481,7 +507,8 @@ discard block |
||
481 | 507 | * |
482 | 508 | * @return User |
483 | 509 | */ |
484 | - public function setPreference($setting_name, $setting_value) { |
|
510 | + public function setPreference($setting_name, $setting_value) |
|
511 | + { |
|
485 | 512 | if ($this->user_id && $this->getPreference($setting_name) !== $setting_value) { |
486 | 513 | Database::prepare("REPLACE INTO `##user_setting` (user_id, setting_name, setting_value) VALUES (?, ?, LEFT(?, 255))") |
487 | 514 | ->execute(array($this->user_id, $setting_name, $setting_value)); |
@@ -498,7 +525,8 @@ discard block |
||
498 | 525 | * |
499 | 526 | * @return User |
500 | 527 | */ |
501 | - public function deletePreference($setting_name) { |
|
528 | + public function deletePreference($setting_name) |
|
529 | + { |
|
502 | 530 | if ($this->user_id && $this->getPreference($setting_name) !== null) { |
503 | 531 | Database::prepare("DELETE FROM `##user_setting` WHERE user_id = ? AND setting_name = ?") |
504 | 532 | ->execute(array($this->user_id, $setting_name)); |
@@ -514,7 +542,8 @@ discard block |
||
514 | 542 | * |
515 | 543 | * @return bool |
516 | 544 | */ |
517 | - private static function isPhpCryptBroken() { |
|
545 | + private static function isPhpCryptBroken() |
|
546 | + { |
|
518 | 547 | return PHP_VERSION_ID < 50307 && password_hash('foo', PASSWORD_DEFAULT) === false; |
519 | 548 | } |
520 | 549 | |
@@ -523,7 +552,8 @@ discard block |
||
523 | 552 | * |
524 | 553 | * @return string |
525 | 554 | */ |
526 | - private static function passwordHash($password) { |
|
555 | + private static function passwordHash($password) |
|
556 | + { |
|
527 | 557 | if (self::isPhpCryptBroken()) { |
528 | 558 | return crypt($password); |
529 | 559 | } else { |
@@ -536,7 +566,8 @@ discard block |
||
536 | 566 | * |
537 | 567 | * @return bool |
538 | 568 | */ |
539 | - private static function passwordNeedsRehash($hash) { |
|
569 | + private static function passwordNeedsRehash($hash) |
|
570 | + { |
|
540 | 571 | if (self::isPhpCryptBroken()) { |
541 | 572 | return false; |
542 | 573 | } else { |
@@ -550,7 +581,8 @@ discard block |
||
550 | 581 | * |
551 | 582 | * @return bool |
552 | 583 | */ |
553 | - private static function passwordVerify($password, $hash) { |
|
584 | + private static function passwordVerify($password, $hash) |
|
585 | + { |
|
554 | 586 | if (self::isPhpCryptBroken()) { |
555 | 587 | return crypt($password, $hash) === $hash; |
556 | 588 | } else { |
@@ -20,12 +20,14 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Provide access to the current theme. |
22 | 22 | */ |
23 | -class Theme { |
|
23 | +class Theme |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * PHP 5.3.2 requires a constructor when there is also a method |
26 | 27 | * called theme() |
27 | 28 | */ |
28 | - private function __construct() { |
|
29 | + private function __construct() |
|
30 | + { |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | /** @var ThemeInterface The current theme*/ |
@@ -40,7 +42,8 @@ discard block |
||
40 | 42 | * |
41 | 43 | * @return ThemeInterface[] |
42 | 44 | */ |
43 | - public static function installedThemes() { |
|
45 | + public static function installedThemes() |
|
46 | + { |
|
44 | 47 | if (self::$installed_themes === null) { |
45 | 48 | self::$installed_themes = array(); |
46 | 49 | foreach (glob(WT_ROOT . '/themes/*/theme.php') as $theme_path) { |
@@ -64,7 +67,8 @@ discard block |
||
64 | 67 | * |
65 | 68 | * @return string[] |
66 | 69 | */ |
67 | - public static function themeNames() { |
|
70 | + public static function themeNames() |
|
71 | + { |
|
68 | 72 | $theme_names = array(); |
69 | 73 | foreach (self::installedThemes() as $theme) { |
70 | 74 | $theme_names[$theme->themeId()] = $theme->themeName(); |
@@ -82,7 +86,8 @@ discard block |
||
82 | 86 | * |
83 | 87 | * @return ThemeInterface |
84 | 88 | */ |
85 | - public static function theme(ThemeInterface $theme = null) { |
|
89 | + public static function theme(ThemeInterface $theme = null) |
|
90 | + { |
|
86 | 91 | |
87 | 92 | if ($theme) { |
88 | 93 | self::$theme = $theme; |
@@ -25,13 +25,15 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class UserJournalModule |
27 | 27 | */ |
28 | -class UserJournalModule extends AbstractModule implements ModuleBlockInterface { |
|
28 | +class UserJournalModule extends AbstractModule implements ModuleBlockInterface |
|
29 | +{ |
|
29 | 30 | /** |
30 | 31 | * Create a new module. |
31 | 32 | * |
32 | 33 | * @param string $directory Where is this module installed |
33 | 34 | */ |
34 | - public function __construct($directory) { |
|
35 | + public function __construct($directory) |
|
36 | + { |
|
35 | 37 | parent::__construct($directory); |
36 | 38 | |
37 | 39 | // Create/update the database tables. |
@@ -43,7 +45,8 @@ discard block |
||
43 | 45 | * |
44 | 46 | * @return string |
45 | 47 | */ |
46 | - public function getTitle() { |
|
48 | + public function getTitle() |
|
49 | + { |
|
47 | 50 | return /* I18N: Name of a module */ I18N::translate('Journal'); |
48 | 51 | } |
49 | 52 | |
@@ -52,7 +55,8 @@ discard block |
||
52 | 55 | * |
53 | 56 | * @return string |
54 | 57 | */ |
55 | - public function getDescription() { |
|
58 | + public function getDescription() |
|
59 | + { |
|
56 | 60 | return /* I18N: Description of the “Journal” module */ I18N::translate('A private area to record notes or keep a journal.'); |
57 | 61 | } |
58 | 62 | |
@@ -65,7 +69,8 @@ discard block |
||
65 | 69 | * |
66 | 70 | * @return string |
67 | 71 | */ |
68 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
72 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
73 | + { |
|
69 | 74 | global $ctype, $WT_TREE; |
70 | 75 | |
71 | 76 | switch (Filter::get('action')) { |
@@ -117,17 +122,20 @@ discard block |
||
117 | 122 | } |
118 | 123 | |
119 | 124 | /** {@inheritdoc} */ |
120 | - public function loadAjax() { |
|
125 | + public function loadAjax() |
|
126 | + { |
|
121 | 127 | return false; |
122 | 128 | } |
123 | 129 | |
124 | 130 | /** {@inheritdoc} */ |
125 | - public function isUserBlock() { |
|
131 | + public function isUserBlock() |
|
132 | + { |
|
126 | 133 | return true; |
127 | 134 | } |
128 | 135 | |
129 | 136 | /** {@inheritdoc} */ |
130 | - public function isGedcomBlock() { |
|
137 | + public function isGedcomBlock() |
|
138 | + { |
|
131 | 139 | return false; |
132 | 140 | } |
133 | 141 | |
@@ -136,6 +144,7 @@ discard block |
||
136 | 144 | * |
137 | 145 | * @param int $block_id |
138 | 146 | */ |
139 | - public function configureBlock($block_id) { |
|
147 | + public function configureBlock($block_id) |
|
148 | + { |
|
140 | 149 | } |
141 | 150 | } |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class DeathReportModule |
24 | 24 | */ |
25 | -class DeathReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class DeathReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Deaths'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Deaths” module */ I18N::translate('A report of individuals who died in a given time or place.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_PRIVATE; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -29,22 +29,26 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface { |
31 | 31 | /** {@inheritdoc} */ |
32 | - public function getTitle() { |
|
32 | + public function getTitle() |
|
33 | + { |
|
33 | 34 | return /* I18N: Name of a module */ I18N::translate('Interactive tree'); |
34 | 35 | } |
35 | 36 | |
36 | 37 | /** {@inheritdoc} */ |
37 | - public function getDescription() { |
|
38 | + public function getDescription() |
|
39 | + { |
|
38 | 40 | return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.'); |
39 | 41 | } |
40 | 42 | |
41 | 43 | /** {@inheritdoc} */ |
42 | - public function defaultTabOrder() { |
|
44 | + public function defaultTabOrder() |
|
45 | + { |
|
43 | 46 | return 68; |
44 | 47 | } |
45 | 48 | |
46 | 49 | /** {@inheritdoc} */ |
47 | - public function getTabContent() { |
|
50 | + public function getTabContent() |
|
51 | + { |
|
48 | 52 | global $controller; |
49 | 53 | |
50 | 54 | $tv = new TreeView('tvTab'); |
@@ -58,17 +62,20 @@ discard block |
||
58 | 62 | } |
59 | 63 | |
60 | 64 | /** {@inheritdoc} */ |
61 | - public function hasTabContent() { |
|
65 | + public function hasTabContent() |
|
66 | + { |
|
62 | 67 | return !Auth::isSearchEngine(); |
63 | 68 | } |
64 | 69 | |
65 | 70 | /** {@inheritdoc} */ |
66 | - public function isGrayedOut() { |
|
71 | + public function isGrayedOut() |
|
72 | + { |
|
67 | 73 | return false; |
68 | 74 | } |
69 | 75 | |
70 | 76 | /** {@inheritdoc} */ |
71 | - public function canLoadAjax() { |
|
77 | + public function canLoadAjax() |
|
78 | + { |
|
72 | 79 | return true; |
73 | 80 | } |
74 | 81 | |
@@ -77,7 +84,8 @@ discard block |
||
77 | 84 | * |
78 | 85 | * @return Menu|null |
79 | 86 | */ |
80 | - public function getChartMenu(Individual $individual) { |
|
87 | + public function getChartMenu(Individual $individual) |
|
88 | + { |
|
81 | 89 | return new Menu( |
82 | 90 | $this->getTitle(), |
83 | 91 | 'module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
@@ -91,12 +99,14 @@ discard block |
||
91 | 99 | * |
92 | 100 | * @return Menu|null |
93 | 101 | */ |
94 | - public function getBoxChartMenu(Individual $individual) { |
|
102 | + public function getBoxChartMenu(Individual $individual) |
|
103 | + { |
|
95 | 104 | return $this->getChartMenu($individual); |
96 | 105 | } |
97 | 106 | |
98 | 107 | /** {@inheritdoc} */ |
99 | - public function getPreLoadContent() { |
|
108 | + public function getPreLoadContent() |
|
109 | + { |
|
100 | 110 | // We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time |
101 | 111 | return |
102 | 112 | '<script> |
@@ -118,7 +128,8 @@ discard block |
||
118 | 128 | * |
119 | 129 | * @param string $mod_action |
120 | 130 | */ |
121 | - public function modAction($mod_action) { |
|
131 | + public function modAction($mod_action) |
|
132 | + { |
|
122 | 133 | global $controller, $WT_TREE; |
123 | 134 | |
124 | 135 | switch ($mod_action) { |
@@ -177,7 +188,8 @@ discard block |
||
177 | 188 | * |
178 | 189 | * @return string |
179 | 190 | */ |
180 | - public function css() { |
|
191 | + public function css() |
|
192 | + { |
|
181 | 193 | return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css'; |
182 | 194 | } |
183 | 195 | |
@@ -186,7 +198,8 @@ discard block |
||
186 | 198 | * |
187 | 199 | * @return string |
188 | 200 | */ |
189 | - public function js() { |
|
201 | + public function js() |
|
202 | + { |
|
190 | 203 | return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js'; |
191 | 204 | } |
192 | 205 | } |