@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 1 to version 2. |
24 | 24 | */ |
25 | -class Migration1 implements MigrationInterface { |
|
25 | +class Migration1 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // Add the new columns |
29 | 31 | try { |
30 | 32 | Database::exec( |
@@ -21,9 +21,11 @@ |
||
21 | 21 | /** |
22 | 22 | * Upgrade the database schema from version 0 (empty database) to version 1. |
23 | 23 | */ |
24 | -class Migration0 implements MigrationInterface { |
|
24 | +class Migration0 implements MigrationInterface |
|
25 | +{ |
|
25 | 26 | /** {@inheritDoc} */ |
26 | - public function upgrade() { |
|
27 | + public function upgrade() |
|
28 | + { |
|
27 | 29 | // Create the tables, as per PhpGedView 4.2.1 |
28 | 30 | Database::exec( |
29 | 31 | "CREATE TABLE IF NOT EXISTS `##favorites` (" . |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 3 to version 4. |
24 | 24 | */ |
25 | -class Migration3 implements MigrationInterface { |
|
25 | +class Migration3 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // An earlier update mistakenly made the fv_note column too short. |
29 | 31 | // Add the new constraints |
30 | 32 | try { |
@@ -28,14 +28,17 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Class SlideShowModule |
30 | 30 | */ |
31 | -class SlideShowModule extends AbstractModule implements ModuleBlockInterface { |
|
31 | +class SlideShowModule extends AbstractModule implements ModuleBlockInterface |
|
32 | +{ |
|
32 | 33 | /** {@inheritdoc} */ |
33 | - public function getTitle() { |
|
34 | + public function getTitle() |
|
35 | + { |
|
34 | 36 | return /* I18N: Name of a module */ I18N::translate('Slide show'); |
35 | 37 | } |
36 | 38 | |
37 | 39 | /** {@inheritdoc} */ |
38 | - public function getDescription() { |
|
40 | + public function getDescription() |
|
41 | + { |
|
39 | 42 | return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.'); |
40 | 43 | } |
41 | 44 | |
@@ -48,7 +51,8 @@ discard block |
||
48 | 51 | * |
49 | 52 | * @return string |
50 | 53 | */ |
51 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
54 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
55 | + { |
|
52 | 56 | global $ctype, $WT_TREE; |
53 | 57 | |
54 | 58 | $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
@@ -199,17 +203,20 @@ discard block |
||
199 | 203 | } |
200 | 204 | |
201 | 205 | /** {@inheritdoc} */ |
202 | - public function loadAjax() { |
|
206 | + public function loadAjax() |
|
207 | + { |
|
203 | 208 | return true; |
204 | 209 | } |
205 | 210 | |
206 | 211 | /** {@inheritdoc} */ |
207 | - public function isUserBlock() { |
|
212 | + public function isUserBlock() |
|
213 | + { |
|
208 | 214 | return true; |
209 | 215 | } |
210 | 216 | |
211 | 217 | /** {@inheritdoc} */ |
212 | - public function isGedcomBlock() { |
|
218 | + public function isGedcomBlock() |
|
219 | + { |
|
213 | 220 | return true; |
214 | 221 | } |
215 | 222 | |
@@ -218,7 +225,8 @@ discard block |
||
218 | 225 | * |
219 | 226 | * @param int $block_id |
220 | 227 | */ |
221 | - public function configureBlock($block_id) { |
|
228 | + public function configureBlock($block_id) |
|
229 | + { |
|
222 | 230 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
223 | 231 | $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); |
224 | 232 | $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); |
@@ -23,13 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class FanChartModule |
25 | 25 | */ |
26 | -class FanChartModule extends AbstractModule implements ModuleChartInterface { |
|
26 | +class FanChartModule extends AbstractModule implements ModuleChartInterface |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * How should this module be labelled on tabs, menus, etc.? |
29 | 30 | * |
30 | 31 | * @return string |
31 | 32 | */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); |
34 | 36 | } |
35 | 37 | |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string |
40 | 42 | */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “Fan Chart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); |
43 | 46 | } |
44 | 47 | |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | * |
50 | 53 | * @return int |
51 | 54 | */ |
52 | - public function defaultAccessLevel() { |
|
55 | + public function defaultAccessLevel() |
|
56 | + { |
|
53 | 57 | return Auth::PRIV_PRIVATE; |
54 | 58 | } |
55 | 59 | |
@@ -60,7 +64,8 @@ discard block |
||
60 | 64 | * |
61 | 65 | * @return Menu|null |
62 | 66 | */ |
63 | - public function getChartMenu(Individual $individual) { |
|
67 | + public function getChartMenu(Individual $individual) |
|
68 | + { |
|
64 | 69 | if (function_exists('imagettftext')) { |
65 | 70 | return new Menu( |
66 | 71 | $this->getTitle(), |
@@ -78,7 +83,8 @@ discard block |
||
78 | 83 | * |
79 | 84 | * @return Menu|null |
80 | 85 | */ |
81 | - public function getBoxChartMenu(Individual $individual) { |
|
86 | + public function getBoxChartMenu(Individual $individual) |
|
87 | + { |
|
82 | 88 | return $this->getChartMenu($individual); |
83 | 89 | } |
84 | 90 | } |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return string |
45 | 45 | */ |
46 | - public function getTitle() { |
|
46 | + public function getTitle() |
|
47 | + { |
|
47 | 48 | return /* I18N: Name of a module/chart */ I18N::translate('Relationships'); |
48 | 49 | } |
49 | 50 | |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | * |
53 | 54 | * @return string |
54 | 55 | */ |
55 | - public function getDescription() { |
|
56 | + public function getDescription() |
|
57 | + { |
|
56 | 58 | return /* I18N: Description of the “RelationshipsChart” module */ I18N::translate('A chart displaying relationships between two individuals.'); |
57 | 59 | } |
58 | 60 | |
@@ -63,7 +65,8 @@ discard block |
||
63 | 65 | * |
64 | 66 | * @return int |
65 | 67 | */ |
66 | - public function defaultAccessLevel() { |
|
68 | + public function defaultAccessLevel() |
|
69 | + { |
|
67 | 70 | return Auth::PRIV_PRIVATE; |
68 | 71 | } |
69 | 72 | |
@@ -74,7 +77,8 @@ discard block |
||
74 | 77 | * |
75 | 78 | * @return Menu|null |
76 | 79 | */ |
77 | - public function getChartMenu(Individual $individual) { |
|
80 | + public function getChartMenu(Individual $individual) |
|
81 | + { |
|
78 | 82 | $tree = $individual->getTree(); |
79 | 83 | $gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid'); |
80 | 84 | |
@@ -102,7 +106,8 @@ discard block |
||
102 | 106 | * |
103 | 107 | * @return Menu|null |
104 | 108 | */ |
105 | - public function getBoxChartMenu(Individual $individual) { |
|
109 | + public function getBoxChartMenu(Individual $individual) |
|
110 | + { |
|
106 | 111 | return $this->getChartMenu($individual); |
107 | 112 | } |
108 | 113 | |
@@ -112,7 +117,8 @@ discard block |
||
112 | 117 | * |
113 | 118 | * @param string $mod_action |
114 | 119 | */ |
115 | - public function modAction($mod_action) { |
|
120 | + public function modAction($mod_action) |
|
121 | + { |
|
116 | 122 | switch ($mod_action) { |
117 | 123 | case 'admin': |
118 | 124 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
@@ -129,7 +135,8 @@ discard block |
||
129 | 135 | /** |
130 | 136 | * Possible options for the ancestors option |
131 | 137 | */ |
132 | - private function ancestorsOptions() { |
|
138 | + private function ancestorsOptions() |
|
139 | + { |
|
133 | 140 | return array( |
134 | 141 | 0 => I18N::translate('Find any relationship'), |
135 | 142 | 1 => I18N::translate('Find relationships via ancestors'), |
@@ -139,7 +146,8 @@ discard block |
||
139 | 146 | /** |
140 | 147 | * Possible options for the recursion option |
141 | 148 | */ |
142 | - private function recursionOptions() { |
|
149 | + private function recursionOptions() |
|
150 | + { |
|
143 | 151 | return array( |
144 | 152 | 0 => I18N::translate('none'), |
145 | 153 | 1 => I18N::number(1), |
@@ -152,7 +160,8 @@ discard block |
||
152 | 160 | /** |
153 | 161 | * Display a form to edit configuration settings. |
154 | 162 | */ |
155 | - private function editConfig() { |
|
163 | + private function editConfig() |
|
164 | + { |
|
156 | 165 | $controller = new PageController; |
157 | 166 | $controller |
158 | 167 | ->restrictAccess(Auth::isAdmin()) |
@@ -208,7 +217,8 @@ discard block |
||
208 | 217 | /** |
209 | 218 | * Save updated configuration settings. |
210 | 219 | */ |
211 | - private function saveConfig() { |
|
220 | + private function saveConfig() |
|
221 | + { |
|
212 | 222 | if (Auth::isAdmin()) { |
213 | 223 | foreach (Tree::getAll() as $tree) { |
214 | 224 | $tree->setPreference('RELATIONSHIP_RECURSION', Filter::post('relationship-recursion-' . $tree->getTreeId())); |
@@ -226,7 +236,8 @@ discard block |
||
226 | 236 | * |
227 | 237 | * @return string |
228 | 238 | */ |
229 | - public function getConfigLink() { |
|
239 | + public function getConfigLink() |
|
240 | + { |
|
230 | 241 | return 'module.php?mod=' . $this->getName() . '&mod_action=admin'; |
231 | 242 | } |
232 | 243 | } |
@@ -23,13 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class LifespansChartModule |
25 | 25 | */ |
26 | -class LifespansChartModule extends AbstractModule implements ModuleChartInterface { |
|
26 | +class LifespansChartModule extends AbstractModule implements ModuleChartInterface |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * How should this module be labelled on tabs, menus, etc.? |
29 | 30 | * |
30 | 31 | * @return string |
31 | 32 | */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module/chart */ I18N::translate('Lifespans'); |
34 | 36 | } |
35 | 37 | |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string |
40 | 42 | */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “LifespansChart” module */ I18N::translate('A chart of individuals’ lifespans.'); |
43 | 46 | } |
44 | 47 | |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | * |
50 | 53 | * @return int |
51 | 54 | */ |
52 | - public function defaultAccessLevel() { |
|
55 | + public function defaultAccessLevel() |
|
56 | + { |
|
53 | 57 | return Auth::PRIV_PRIVATE; |
54 | 58 | } |
55 | 59 | |
@@ -58,7 +62,8 @@ discard block |
||
58 | 62 | * |
59 | 63 | * @return Menu|null |
60 | 64 | */ |
61 | - public function getChartMenu(Individual $individual) { |
|
65 | + public function getChartMenu(Individual $individual) |
|
66 | + { |
|
62 | 67 | return new Menu( |
63 | 68 | $this->getTitle(), |
64 | 69 | 'lifespan.php', |
@@ -72,7 +77,8 @@ discard block |
||
72 | 77 | * |
73 | 78 | * @return Menu|null |
74 | 79 | */ |
75 | - public function getBoxChartMenu(Individual $individual) { |
|
80 | + public function getBoxChartMenu(Individual $individual) |
|
81 | + { |
|
76 | 82 | return null; |
77 | 83 | } |
78 | 84 | } |
@@ -18,13 +18,15 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Temporary class to migrate to Symfony-based sessions, which need PHP 5.4. |
20 | 20 | */ |
21 | -class Session { |
|
21 | +class Session |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * Start a session |
24 | 25 | * |
25 | 26 | * @param array $config |
26 | 27 | */ |
27 | - public static function start(array $config = array()) { |
|
28 | + public static function start(array $config = array()) |
|
29 | + { |
|
28 | 30 | $default_config = array( |
29 | 31 | 'use_cookies' => 1, |
30 | 32 | 'name' => 'WT_SESSION', |
@@ -50,7 +52,8 @@ discard block |
||
50 | 52 | * |
51 | 53 | * @return mixed |
52 | 54 | */ |
53 | - public static function get($name, $default = null) { |
|
55 | + public static function get($name, $default = null) |
|
56 | + { |
|
54 | 57 | if (isset($_SESSION[$name])) { |
55 | 58 | return $_SESSION[$name]; |
56 | 59 | } else { |
@@ -64,7 +67,8 @@ discard block |
||
64 | 67 | * @param string $name |
65 | 68 | * @param mixed $value |
66 | 69 | */ |
67 | - public static function put($name, $value) { |
|
70 | + public static function put($name, $value) |
|
71 | + { |
|
68 | 72 | $_SESSION[$name] = $value; |
69 | 73 | } |
70 | 74 | |
@@ -73,7 +77,8 @@ discard block |
||
73 | 77 | * |
74 | 78 | * @param string $name |
75 | 79 | */ |
76 | - public static function forget($name) { |
|
80 | + public static function forget($name) |
|
81 | + { |
|
77 | 82 | unset($_SESSION[$name]); |
78 | 83 | } |
79 | 84 | |
@@ -84,14 +89,16 @@ discard block |
||
84 | 89 | * |
85 | 90 | * @return bool |
86 | 91 | */ |
87 | - public static function has($name) { |
|
92 | + public static function has($name) |
|
93 | + { |
|
88 | 94 | return isset($_SESSION[$name]); |
89 | 95 | } |
90 | 96 | |
91 | 97 | /** |
92 | 98 | * Remove all stored data from the session. |
93 | 99 | */ |
94 | - public static function clear() { |
|
100 | + public static function clear() |
|
101 | + { |
|
95 | 102 | $_SESSION = array(); |
96 | 103 | } |
97 | 104 | |
@@ -100,7 +107,8 @@ discard block |
||
100 | 107 | * |
101 | 108 | * @param bool $destroy |
102 | 109 | */ |
103 | - public static function regenerate($destroy = false) { |
|
110 | + public static function regenerate($destroy = false) |
|
111 | + { |
|
104 | 112 | if ($destroy) { |
105 | 113 | self::clear(); |
106 | 114 | } |
@@ -112,7 +120,8 @@ discard block |
||
112 | 120 | * |
113 | 121 | * @param string $id |
114 | 122 | */ |
115 | - public static function setId($id) { |
|
123 | + public static function setId($id) |
|
124 | + { |
|
116 | 125 | session_id($id); |
117 | 126 | } |
118 | 127 | } |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Generate lists for indilist.php and famlist.php |
26 | 26 | */ |
27 | -class QueryName { |
|
27 | +class QueryName |
|
28 | +{ |
|
28 | 29 | /** |
29 | 30 | * Get a list of initial letters, for lists of names. |
30 | 31 | * |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | * |
33 | 34 | * @return string[] |
34 | 35 | */ |
35 | - private static function getAlphabetForLocale($locale) { |
|
36 | + private static function getAlphabetForLocale($locale) |
|
37 | + { |
|
36 | 38 | switch ($locale) { |
37 | 39 | case 'ar': |
38 | 40 | return array( |
@@ -123,7 +125,8 @@ discard block |
||
123 | 125 | * |
124 | 126 | * @return string |
125 | 127 | */ |
126 | - public static function initialLetter($name) { |
|
128 | + public static function initialLetter($name) |
|
129 | + { |
|
127 | 130 | $name = I18N::strtoupper($name); |
128 | 131 | switch (WT_LOCALE) { |
129 | 132 | case 'cs': |
@@ -189,7 +192,8 @@ discard block |
||
189 | 192 | * |
190 | 193 | * @return string |
191 | 194 | */ |
192 | - private static function getInitialSql($field, $letter) { |
|
195 | + private static function getInitialSql($field, $letter) |
|
196 | + { |
|
193 | 197 | switch (WT_LOCALE) { |
194 | 198 | case 'cs': |
195 | 199 | switch ($letter) { |
@@ -239,7 +243,8 @@ discard block |
||
239 | 243 | * |
240 | 244 | * @return int[] |
241 | 245 | */ |
242 | - public static function surnameAlpha(Tree $tree, $marnm, $fams, $totals = true) { |
|
246 | + public static function surnameAlpha(Tree $tree, $marnm, $fams, $totals = true) |
|
247 | + { |
|
243 | 248 | $alphas = array(); |
244 | 249 | |
245 | 250 | $sql = |
@@ -315,7 +320,8 @@ discard block |
||
315 | 320 | * |
316 | 321 | * @return int[] |
317 | 322 | */ |
318 | - public static function givenAlpha(Tree $tree, $surn, $salpha, $marnm, $fams) { |
|
323 | + public static function givenAlpha(Tree $tree, $surn, $salpha, $marnm, $fams) |
|
324 | + { |
|
319 | 325 | $alphas = array(); |
320 | 326 | |
321 | 327 | $sql = |
@@ -397,7 +403,8 @@ discard block |
||
397 | 403 | * |
398 | 404 | * @return array |
399 | 405 | */ |
400 | - public static function surnames(Tree $tree, $surn, $salpha, $marnm, $fams) { |
|
406 | + public static function surnames(Tree $tree, $surn, $salpha, $marnm, $fams) |
|
407 | + { |
|
401 | 408 | $sql = |
402 | 409 | "SELECT n2.n_surn, n1.n_surname, n1.n_id" . |
403 | 410 | " FROM `##name` n1 " . |
@@ -452,7 +459,8 @@ discard block |
||
452 | 459 | * |
453 | 460 | * @return Individual[] |
454 | 461 | */ |
455 | - public static function individuals(Tree $tree, $surn, $salpha, $galpha, $marnm, $fams) { |
|
462 | + public static function individuals(Tree $tree, $surn, $salpha, $galpha, $marnm, $fams) |
|
463 | + { |
|
456 | 464 | $sql = |
457 | 465 | "SELECT i_id AS xref, i_gedcom AS gedcom, n_full " . |
458 | 466 | "FROM `##individuals` " . |
@@ -521,7 +529,8 @@ discard block |
||
521 | 529 | * |
522 | 530 | * @return Family[] |
523 | 531 | */ |
524 | - public static function families(Tree $tree, $surn, $salpha, $galpha, $marnm) { |
|
532 | + public static function families(Tree $tree, $surn, $salpha, $galpha, $marnm) |
|
533 | + { |
|
525 | 534 | $list = array(); |
526 | 535 | foreach (self::individuals($tree, $surn, $salpha, $galpha, $marnm, true) as $indi) { |
527 | 536 | foreach ($indi->getSpouseFamilies() as $family) { |