@@ -68,89 +68,89 @@ discard block |
||
68 | 68 | $message = ''; |
69 | 69 | |
70 | 70 | switch ($action) { |
71 | -case 'login': |
|
72 | - try { |
|
73 | - if (!$_COOKIE) { |
|
74 | - Log::addAuthenticationLog('Login failed (no session cookies): ' . $username); |
|
75 | - throw new \Exception(I18N::translate('You cannot sign in because your browser does not accept cookies.')); |
|
76 | - } |
|
71 | + case 'login': |
|
72 | + try { |
|
73 | + if (!$_COOKIE) { |
|
74 | + Log::addAuthenticationLog('Login failed (no session cookies): ' . $username); |
|
75 | + throw new \Exception(I18N::translate('You cannot sign in because your browser does not accept cookies.')); |
|
76 | + } |
|
77 | 77 | |
78 | - $user = User::findByIdentifier($username); |
|
78 | + $user = User::findByIdentifier($username); |
|
79 | 79 | |
80 | - if (!$user) { |
|
81 | - Log::addAuthenticationLog('Login failed (no such user/email): ' . $username); |
|
82 | - throw new \Exception(I18N::translate('The username or password is incorrect.')); |
|
83 | - } |
|
80 | + if (!$user) { |
|
81 | + Log::addAuthenticationLog('Login failed (no such user/email): ' . $username); |
|
82 | + throw new \Exception(I18N::translate('The username or password is incorrect.')); |
|
83 | + } |
|
84 | 84 | |
85 | - if (!$user->checkPassword($password)) { |
|
86 | - Log::addAuthenticationLog('Login failed (incorrect password): ' . $username); |
|
87 | - throw new \Exception(I18N::translate('The username or password is incorrect.')); |
|
88 | - } |
|
85 | + if (!$user->checkPassword($password)) { |
|
86 | + Log::addAuthenticationLog('Login failed (incorrect password): ' . $username); |
|
87 | + throw new \Exception(I18N::translate('The username or password is incorrect.')); |
|
88 | + } |
|
89 | 89 | |
90 | - if (!$user->getPreference('verified')) { |
|
91 | - Log::addAuthenticationLog('Login failed (not verified by user): ' . $username); |
|
92 | - throw new \Exception(I18N::translate('This account has not been verified. Please check your email for a verification message.')); |
|
93 | - } |
|
90 | + if (!$user->getPreference('verified')) { |
|
91 | + Log::addAuthenticationLog('Login failed (not verified by user): ' . $username); |
|
92 | + throw new \Exception(I18N::translate('This account has not been verified. Please check your email for a verification message.')); |
|
93 | + } |
|
94 | 94 | |
95 | - if (!$user->getPreference('verified_by_admin')) { |
|
96 | - Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username); |
|
97 | - throw new \Exception(I18N::translate('This account has not been approved. Please wait for an administrator to approve it.')); |
|
98 | - } |
|
95 | + if (!$user->getPreference('verified_by_admin')) { |
|
96 | + Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username); |
|
97 | + throw new \Exception(I18N::translate('This account has not been approved. Please wait for an administrator to approve it.')); |
|
98 | + } |
|
99 | 99 | |
100 | - Auth::login($user); |
|
101 | - Log::addAuthenticationLog('Login: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName()); |
|
102 | - Auth::user()->setPreference('sessiontime', WT_TIMESTAMP); |
|
103 | - |
|
104 | - Session::put('locale', Auth::user()->getPreference('language')); |
|
105 | - Session::put('theme_id', Auth::user()->getPreference('theme')); |
|
106 | - I18N::init(Auth::user()->getPreference('language')); |
|
107 | - |
|
108 | - // We're logging in as an administrator |
|
109 | - if (Auth::isAdmin()) { |
|
110 | - // Check for updates |
|
111 | - $latest_version_txt = Functions::fetchLatestVersion(); |
|
112 | - if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
|
113 | - list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt); |
|
114 | - if (version_compare(WT_VERSION, $latest_version) < 0) { |
|
115 | - FlashMessages::addMessage( |
|
116 | - I18N::translate('A new version of webtrees is available.') . |
|
117 | - ' <a href="admin_site_upgrade.php"><b>' . |
|
118 | - I18N::translate('Upgrade to webtrees %s.', '<span dir="ltr">' . $latest_version . '</span>') . |
|
119 | - '</b></a>' |
|
120 | - ); |
|
100 | + Auth::login($user); |
|
101 | + Log::addAuthenticationLog('Login: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName()); |
|
102 | + Auth::user()->setPreference('sessiontime', WT_TIMESTAMP); |
|
103 | + |
|
104 | + Session::put('locale', Auth::user()->getPreference('language')); |
|
105 | + Session::put('theme_id', Auth::user()->getPreference('theme')); |
|
106 | + I18N::init(Auth::user()->getPreference('language')); |
|
107 | + |
|
108 | + // We're logging in as an administrator |
|
109 | + if (Auth::isAdmin()) { |
|
110 | + // Check for updates |
|
111 | + $latest_version_txt = Functions::fetchLatestVersion(); |
|
112 | + if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
|
113 | + list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt); |
|
114 | + if (version_compare(WT_VERSION, $latest_version) < 0) { |
|
115 | + FlashMessages::addMessage( |
|
116 | + I18N::translate('A new version of webtrees is available.') . |
|
117 | + ' <a href="admin_site_upgrade.php"><b>' . |
|
118 | + I18N::translate('Upgrade to webtrees %s.', '<span dir="ltr">' . $latest_version . '</span>') . |
|
119 | + '</b></a>' |
|
120 | + ); |
|
121 | + } |
|
121 | 122 | } |
122 | 123 | } |
123 | - } |
|
124 | 124 | |
125 | - // If we were on a "home page", redirect to "my page" |
|
126 | - if ($url === '' || strpos($url, 'index.php?ctype=gedcom') === 0) { |
|
127 | - $url = 'index.php?ctype=user'; |
|
128 | - // Switch to a tree where we have a genealogy record (or keep to the current/default). |
|
129 | - $tree = Database::prepare( |
|
130 | - "SELECT gedcom_name FROM `##gedcom` JOIN `##user_gedcom_setting` USING (gedcom_id)" . |
|
131 | - " WHERE setting_name = 'gedcomid' AND user_id = :user_id" . |
|
132 | - " ORDER BY gedcom_id = :tree_id DESC" |
|
133 | - )->execute(array( |
|
134 | - 'user_id' => Auth::user()->getUserId(), |
|
135 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
136 | - ))->fetchOne(); |
|
137 | - $url .= '&ged=' . Filter::escapeUrl($tree); |
|
138 | - } |
|
125 | + // If we were on a "home page", redirect to "my page" |
|
126 | + if ($url === '' || strpos($url, 'index.php?ctype=gedcom') === 0) { |
|
127 | + $url = 'index.php?ctype=user'; |
|
128 | + // Switch to a tree where we have a genealogy record (or keep to the current/default). |
|
129 | + $tree = Database::prepare( |
|
130 | + "SELECT gedcom_name FROM `##gedcom` JOIN `##user_gedcom_setting` USING (gedcom_id)" . |
|
131 | + " WHERE setting_name = 'gedcomid' AND user_id = :user_id" . |
|
132 | + " ORDER BY gedcom_id = :tree_id DESC" |
|
133 | + )->execute(array( |
|
134 | + 'user_id' => Auth::user()->getUserId(), |
|
135 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
136 | + ))->fetchOne(); |
|
137 | + $url .= '&ged=' . Filter::escapeUrl($tree); |
|
138 | + } |
|
139 | 139 | |
140 | - // Redirect to the target URL |
|
141 | - header('Location: ' . WT_BASE_URL . $url); |
|
140 | + // Redirect to the target URL |
|
141 | + header('Location: ' . WT_BASE_URL . $url); |
|
142 | 142 | |
143 | - return; |
|
144 | - } catch (\Exception $ex) { |
|
145 | - $message = $ex->getMessage(); |
|
146 | - } |
|
147 | - // No break; |
|
148 | - |
|
149 | -default: |
|
150 | - $controller |
|
151 | - ->setPageTitle(I18N::translate('Sign in')) |
|
152 | - ->pageHeader() |
|
153 | - ->addInlineJavascript(' |
|
143 | + return; |
|
144 | + } catch (\Exception $ex) { |
|
145 | + $message = $ex->getMessage(); |
|
146 | + } |
|
147 | + // No break; |
|
148 | + |
|
149 | + default: |
|
150 | + $controller |
|
151 | + ->setPageTitle(I18N::translate('Sign in')) |
|
152 | + ->pageHeader() |
|
153 | + ->addInlineJavascript(' |
|
154 | 154 | jQuery("#new_passwd_form").hide(); |
155 | 155 | jQuery("#passwd_click").click(function() { |
156 | 156 | jQuery("#new_passwd_form").slideToggle(100, function() { |
@@ -160,25 +160,25 @@ discard block |
||
160 | 160 | }); |
161 | 161 | '); |
162 | 162 | |
163 | - echo '<div id="login-page">'; |
|
164 | - echo '<div id="login-text">'; |
|
165 | - |
|
166 | - echo '<p class="center"><strong>' . I18N::translate('Welcome to this genealogy website') . '</strong></p>'; |
|
167 | - |
|
168 | - switch (Site::getPreference('WELCOME_TEXT_AUTH_MODE')) { |
|
169 | - case 1: |
|
170 | - echo '<p>' . I18N::translate('Anyone with a user account can access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
171 | - break; |
|
172 | - case 2: |
|
173 | - echo '<p>' . I18N::translate('You need to be an authorized user to access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
174 | - break; |
|
175 | - case 3: |
|
176 | - echo '<p>' . I18N::translate('You need to be a family member to access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
177 | - break; |
|
178 | - case 4: |
|
179 | - echo '<p style="white-space: pre-wrap;">', Site::getPreference('WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE), '</p>'; |
|
180 | - break; |
|
181 | - } |
|
163 | + echo '<div id="login-page">'; |
|
164 | + echo '<div id="login-text">'; |
|
165 | + |
|
166 | + echo '<p class="center"><strong>' . I18N::translate('Welcome to this genealogy website') . '</strong></p>'; |
|
167 | + |
|
168 | + switch (Site::getPreference('WELCOME_TEXT_AUTH_MODE')) { |
|
169 | + case 1: |
|
170 | + echo '<p>' . I18N::translate('Anyone with a user account can access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
171 | + break; |
|
172 | + case 2: |
|
173 | + echo '<p>' . I18N::translate('You need to be an authorized user to access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
174 | + break; |
|
175 | + case 3: |
|
176 | + echo '<p>' . I18N::translate('You need to be a family member to access this website.') . ' ' . I18N::translate('You can apply for an account using the link below.') . '</p>'; |
|
177 | + break; |
|
178 | + case 4: |
|
179 | + echo '<p style="white-space: pre-wrap;">', Site::getPreference('WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE), '</p>'; |
|
180 | + break; |
|
181 | + } |
|
182 | 182 | |
183 | 183 | echo '</div>'; |
184 | 184 | echo '<div id="login-box">'; |
@@ -233,181 +233,181 @@ discard block |
||
233 | 233 | echo '</div>'; |
234 | 234 | break; |
235 | 235 | |
236 | -case 'requestpw': |
|
237 | - $user_name = Filter::post('new_passwd_username'); |
|
238 | - $user = User::findByIdentifier($user_name); |
|
239 | - |
|
240 | - if ($user) { |
|
241 | - $passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; |
|
242 | - $user_new_pw = ''; |
|
243 | - $max = strlen($passchars) - 1; |
|
244 | - for ($i = 0; $i < 8; $i++) { |
|
245 | - $index = rand(0, $max); |
|
246 | - $user_new_pw .= $passchars{$index}; |
|
247 | - } |
|
236 | + case 'requestpw': |
|
237 | + $user_name = Filter::post('new_passwd_username'); |
|
238 | + $user = User::findByIdentifier($user_name); |
|
239 | + |
|
240 | + if ($user) { |
|
241 | + $passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; |
|
242 | + $user_new_pw = ''; |
|
243 | + $max = strlen($passchars) - 1; |
|
244 | + for ($i = 0; $i < 8; $i++) { |
|
245 | + $index = rand(0, $max); |
|
246 | + $user_new_pw .= $passchars{$index}; |
|
247 | + } |
|
248 | 248 | |
249 | - $user->setPassword($user_new_pw); |
|
250 | - Log::addAuthenticationLog('Password request was sent to user: ' . $user->getUserName()); |
|
251 | - |
|
252 | - Mail::systemMessage( |
|
253 | - $WT_TREE, |
|
254 | - $user, |
|
255 | - I18N::translate('Lost password request'), |
|
256 | - I18N::translate('Hello %s…', $user->getRealNameHtml()) . Mail::EOL . Mail::EOL . |
|
257 | - I18N::translate('A new password has been requested for your username.') . Mail::EOL . Mail::EOL . |
|
258 | - I18N::translate('Username') . ": " . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
259 | - I18N::translate('Password') . ": " . $user_new_pw . Mail::EOL . Mail::EOL . |
|
260 | - I18N::translate('After you have signed in, select the “My account” link under the “My pages” menu and fill in the password fields to change your password.') . Mail::EOL . Mail::EOL . |
|
261 | - '<a href="' . WT_BASE_URL . 'login.php?ged=' . $WT_TREE->getNameUrl() . '">' . WT_BASE_URL . 'login.php?ged=' . $WT_TREE->getNameUrl() . '</a>' |
|
262 | - ); |
|
263 | - |
|
264 | - FlashMessages::addMessage(I18N::translate('A new password has been created and emailed to %s. You can change this password after you sign in.', Filter::escapeHtml($user_name)), 'success'); |
|
265 | - } else { |
|
266 | - FlashMessages::addMessage(I18N::translate('There is no account with the username or email “%s”.', Filter::escapeHtml($user_name)), 'danger'); |
|
267 | - } |
|
268 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
249 | + $user->setPassword($user_new_pw); |
|
250 | + Log::addAuthenticationLog('Password request was sent to user: ' . $user->getUserName()); |
|
269 | 251 | |
270 | - return; |
|
271 | - break; |
|
252 | + Mail::systemMessage( |
|
253 | + $WT_TREE, |
|
254 | + $user, |
|
255 | + I18N::translate('Lost password request'), |
|
256 | + I18N::translate('Hello %s…', $user->getRealNameHtml()) . Mail::EOL . Mail::EOL . |
|
257 | + I18N::translate('A new password has been requested for your username.') . Mail::EOL . Mail::EOL . |
|
258 | + I18N::translate('Username') . ": " . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
259 | + I18N::translate('Password') . ": " . $user_new_pw . Mail::EOL . Mail::EOL . |
|
260 | + I18N::translate('After you have signed in, select the “My account” link under the “My pages” menu and fill in the password fields to change your password.') . Mail::EOL . Mail::EOL . |
|
261 | + '<a href="' . WT_BASE_URL . 'login.php?ged=' . $WT_TREE->getNameUrl() . '">' . WT_BASE_URL . 'login.php?ged=' . $WT_TREE->getNameUrl() . '</a>' |
|
262 | + ); |
|
272 | 263 | |
273 | -case 'register': |
|
274 | - if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
275 | - header('Location: ' . WT_BASE_URL); |
|
264 | + FlashMessages::addMessage(I18N::translate('A new password has been created and emailed to %s. You can change this password after you sign in.', Filter::escapeHtml($user_name)), 'success'); |
|
265 | + } else { |
|
266 | + FlashMessages::addMessage(I18N::translate('There is no account with the username or email “%s”.', Filter::escapeHtml($user_name)), 'danger'); |
|
267 | + } |
|
268 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
276 | 269 | |
277 | 270 | return; |
278 | - } |
|
279 | - |
|
280 | - $controller->setPageTitle(I18N::translate('Request a new user account')); |
|
281 | - |
|
282 | - // The form parameters are mandatory, and the validation errors are shown in the client. |
|
283 | - if (Session::get('good_to_send') && $user_name && $user_password01 && $user_password01 == $user_password02 && $user_realname && $user_email && $user_comments) { |
|
284 | - |
|
285 | - // These validation errors cannot be shown in the client. |
|
286 | - if (User::findByUserName($user_name)) { |
|
287 | - FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
288 | - } elseif (User::findByEmail($user_email)) { |
|
289 | - FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
290 | - } elseif (preg_match('/(?!' . preg_quote(WT_BASE_URL, '/') . ')(((?:ftp|http|https):\/\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) { |
|
291 | - FlashMessages::addMessage( |
|
292 | - I18N::translate('You are not allowed to send messages that contain external links.') . ' ' . |
|
293 | - I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1]) |
|
294 | - ); |
|
295 | - Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"'); |
|
296 | - } else { |
|
297 | - // Everything looks good - create the user |
|
298 | - $controller->pageHeader(); |
|
299 | - Log::addAuthenticationLog('User registration requested for: ' . $user_name); |
|
271 | + break; |
|
300 | 272 | |
301 | - $user = User::create($user_name, $user_realname, $user_email, $user_password01); |
|
302 | - $user |
|
303 | - ->setPreference('language', WT_LOCALE) |
|
304 | - ->setPreference('verified', '0') |
|
305 | - ->setPreference('verified_by_admin', 0) |
|
306 | - ->setPreference('reg_timestamp', date('U')) |
|
307 | - ->setPreference('reg_hashcode', md5(Uuid::uuid4())) |
|
308 | - ->setPreference('contactmethod', 'messaging2') |
|
309 | - ->setPreference('comment', $user_comments) |
|
310 | - ->setPreference('visibleonline', '1') |
|
311 | - ->setPreference('auto_accept', '0') |
|
312 | - ->setPreference('canadmin', '0') |
|
313 | - ->setPreference('sessiontime', '0'); |
|
314 | - |
|
315 | - // Generate an email in the admin’s language |
|
316 | - $webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')); |
|
317 | - I18N::init($webmaster->getPreference('language')); |
|
318 | - |
|
319 | - $mail1_body = |
|
320 | - I18N::translate('Hello administrator…') . Mail::EOL . Mail::EOL . |
|
321 | - /* I18N: %s is a server name/URL */ |
|
322 | - I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml()) . Mail::EOL . Mail::EOL . |
|
323 | - I18N::translate('Username') . ' ' . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
324 | - I18N::translate('Real name') . ' ' . $user->getRealNameHtml() . Mail::EOL . |
|
325 | - I18N::translate('Email address') . ' ' . Filter::escapeHtml($user->getEmail()) . Mail::EOL . |
|
326 | - I18N::translate('Comments') . ' ' . Filter::escapeHtml($user_comments) . Mail::EOL . Mail::EOL . |
|
327 | - I18N::translate('The user has been sent an email with the information necessary to confirm the access request.') . Mail::EOL . Mail::EOL . |
|
328 | - I18N::translate('You will be informed by email when this prospective user has confirmed the request. You can then complete the process by activating the username. The new user will not be able to sign in until you activate the account.'); |
|
329 | - |
|
330 | - $mail1_subject = /* I18N: %s is a server name/URL */ I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle()); |
|
331 | - I18N::init(WT_LOCALE); |
|
332 | - |
|
333 | - echo '<div id="login-register-page">'; |
|
334 | - |
|
335 | - // Generate an email in the user’s language |
|
336 | - $mail2_body = |
|
337 | - I18N::translate('Hello %s…', $user->getRealNameHtml()) . |
|
338 | - Mail::EOL . Mail::EOL . |
|
339 | - /* I18N: %1$s is the site URL and %2$s is an email address */ |
|
340 | - I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml(), $user->getEmail()) . |
|
341 | - Mail::EOL . Mail::EOL . |
|
342 | - I18N::translate('Follow this link to verify your email address.') . |
|
343 | - Mail::EOL . Mail::EOL . |
|
344 | - '<a href="' . WT_LOGIN_URL . '?user_name=' . Filter::escapeUrl($user->getUserName()) . '&user_hashcode=' . $user->getPreference('reg_hashcode') . '&action=userverify&ged=' . $WT_TREE->getNameUrl() . '">' . |
|
345 | - WT_LOGIN_URL . "?user_name=" . Filter::escapeHtml($user->getUserName()) . "&user_hashcode=" . urlencode($user->getPreference('reg_hashcode')) . '&action=userverify&ged=' . $WT_TREE->getNameHtml() . |
|
346 | - '</a>' . Mail::EOL . Mail::EOL . |
|
347 | - I18N::translate('Username') . " - " . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
348 | - I18N::translate('Comments') . " - " . $user->getPreference('comment') . Mail::EOL . |
|
349 | - I18N::translate('If you didn’t request an account, you can just delete this message.') . Mail::EOL; |
|
350 | - $mail2_subject = /* I18N: %s is a server name/URL */ I18N::translate('Your registration at %s', WT_BASE_URL); |
|
351 | - $mail2_to = $user->getEmail(); |
|
352 | - $mail2_from = $WT_TREE->getPreference('WEBTREES_EMAIL'); |
|
353 | - |
|
354 | - // Send user message by email only |
|
355 | - Mail::send( |
|
356 | - // “From:” header |
|
357 | - $WT_TREE, |
|
358 | - // “To:” header |
|
359 | - $mail2_to, |
|
360 | - $mail2_to, |
|
361 | - // “Reply-To:” header |
|
362 | - $mail2_from, |
|
363 | - $mail2_from, |
|
364 | - // Message body |
|
365 | - $mail2_subject, |
|
366 | - $mail2_body |
|
367 | - ); |
|
273 | + case 'register': |
|
274 | + if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
275 | + header('Location: ' . WT_BASE_URL); |
|
368 | 276 | |
369 | - // Send admin message by email and/or internal messaging |
|
370 | - Mail::send( |
|
371 | - // “From:” header |
|
372 | - $WT_TREE, |
|
373 | - // “To:” header |
|
374 | - $webmaster->getEmail(), |
|
375 | - $webmaster->getRealName(), |
|
376 | - // “Reply-To:” header |
|
377 | - $user->getEmail(), |
|
378 | - $user->getRealName(), |
|
379 | - // Message body |
|
380 | - $mail1_subject, |
|
381 | - $mail1_body |
|
382 | - ); |
|
383 | - $mail1_method = $webmaster->getPreference('contact_method'); |
|
384 | - if ($mail1_method != 'messaging3' && $mail1_method != 'mailto' && $mail1_method != 'none') { |
|
385 | - Database::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)") |
|
386 | - ->execute(array($user->getEmail(), WT_CLIENT_IP, $webmaster->getUserId(), $mail1_subject, Filter::unescapeHtml($mail1_body))); |
|
387 | - } |
|
277 | + return; |
|
278 | + } |
|
388 | 279 | |
389 | - echo '<div class="confirm"><p>', I18N::translate('Hello %s…<br>Thank you for your registration.', $user->getRealNameHtml()), '</p>'; |
|
390 | - echo '<p>', I18N::translate('We will now send a confirmation email to the address <b>%s</b>. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically. You will have to apply again.<br><br>After you have followed the instructions in the confirmation email, the administrator still has to approve your request before your account can be used.<br><br>To sign in to this website, you will need to know your username and password.', $user->getEmail()), '</p>'; |
|
391 | - echo '</div>'; |
|
392 | - echo '</div>'; |
|
280 | + $controller->setPageTitle(I18N::translate('Request a new user account')); |
|
281 | + |
|
282 | + // The form parameters are mandatory, and the validation errors are shown in the client. |
|
283 | + if (Session::get('good_to_send') && $user_name && $user_password01 && $user_password01 == $user_password02 && $user_realname && $user_email && $user_comments) { |
|
284 | + |
|
285 | + // These validation errors cannot be shown in the client. |
|
286 | + if (User::findByUserName($user_name)) { |
|
287 | + FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
288 | + } elseif (User::findByEmail($user_email)) { |
|
289 | + FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
290 | + } elseif (preg_match('/(?!' . preg_quote(WT_BASE_URL, '/') . ')(((?:ftp|http|https):\/\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) { |
|
291 | + FlashMessages::addMessage( |
|
292 | + I18N::translate('You are not allowed to send messages that contain external links.') . ' ' . |
|
293 | + I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1]) |
|
294 | + ); |
|
295 | + Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"'); |
|
296 | + } else { |
|
297 | + // Everything looks good - create the user |
|
298 | + $controller->pageHeader(); |
|
299 | + Log::addAuthenticationLog('User registration requested for: ' . $user_name); |
|
300 | + |
|
301 | + $user = User::create($user_name, $user_realname, $user_email, $user_password01); |
|
302 | + $user |
|
303 | + ->setPreference('language', WT_LOCALE) |
|
304 | + ->setPreference('verified', '0') |
|
305 | + ->setPreference('verified_by_admin', 0) |
|
306 | + ->setPreference('reg_timestamp', date('U')) |
|
307 | + ->setPreference('reg_hashcode', md5(Uuid::uuid4())) |
|
308 | + ->setPreference('contactmethod', 'messaging2') |
|
309 | + ->setPreference('comment', $user_comments) |
|
310 | + ->setPreference('visibleonline', '1') |
|
311 | + ->setPreference('auto_accept', '0') |
|
312 | + ->setPreference('canadmin', '0') |
|
313 | + ->setPreference('sessiontime', '0'); |
|
314 | + |
|
315 | + // Generate an email in the admin’s language |
|
316 | + $webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')); |
|
317 | + I18N::init($webmaster->getPreference('language')); |
|
318 | + |
|
319 | + $mail1_body = |
|
320 | + I18N::translate('Hello administrator…') . Mail::EOL . Mail::EOL . |
|
321 | + /* I18N: %s is a server name/URL */ |
|
322 | + I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml()) . Mail::EOL . Mail::EOL . |
|
323 | + I18N::translate('Username') . ' ' . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
324 | + I18N::translate('Real name') . ' ' . $user->getRealNameHtml() . Mail::EOL . |
|
325 | + I18N::translate('Email address') . ' ' . Filter::escapeHtml($user->getEmail()) . Mail::EOL . |
|
326 | + I18N::translate('Comments') . ' ' . Filter::escapeHtml($user_comments) . Mail::EOL . Mail::EOL . |
|
327 | + I18N::translate('The user has been sent an email with the information necessary to confirm the access request.') . Mail::EOL . Mail::EOL . |
|
328 | + I18N::translate('You will be informed by email when this prospective user has confirmed the request. You can then complete the process by activating the username. The new user will not be able to sign in until you activate the account.'); |
|
329 | + |
|
330 | + $mail1_subject = /* I18N: %s is a server name/URL */ I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle()); |
|
331 | + I18N::init(WT_LOCALE); |
|
332 | + |
|
333 | + echo '<div id="login-register-page">'; |
|
334 | + |
|
335 | + // Generate an email in the user’s language |
|
336 | + $mail2_body = |
|
337 | + I18N::translate('Hello %s…', $user->getRealNameHtml()) . |
|
338 | + Mail::EOL . Mail::EOL . |
|
339 | + /* I18N: %1$s is the site URL and %2$s is an email address */ |
|
340 | + I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml(), $user->getEmail()) . |
|
341 | + Mail::EOL . Mail::EOL . |
|
342 | + I18N::translate('Follow this link to verify your email address.') . |
|
343 | + Mail::EOL . Mail::EOL . |
|
344 | + '<a href="' . WT_LOGIN_URL . '?user_name=' . Filter::escapeUrl($user->getUserName()) . '&user_hashcode=' . $user->getPreference('reg_hashcode') . '&action=userverify&ged=' . $WT_TREE->getNameUrl() . '">' . |
|
345 | + WT_LOGIN_URL . "?user_name=" . Filter::escapeHtml($user->getUserName()) . "&user_hashcode=" . urlencode($user->getPreference('reg_hashcode')) . '&action=userverify&ged=' . $WT_TREE->getNameHtml() . |
|
346 | + '</a>' . Mail::EOL . Mail::EOL . |
|
347 | + I18N::translate('Username') . " - " . Filter::escapeHtml($user->getUserName()) . Mail::EOL . |
|
348 | + I18N::translate('Comments') . " - " . $user->getPreference('comment') . Mail::EOL . |
|
349 | + I18N::translate('If you didn’t request an account, you can just delete this message.') . Mail::EOL; |
|
350 | + $mail2_subject = /* I18N: %s is a server name/URL */ I18N::translate('Your registration at %s', WT_BASE_URL); |
|
351 | + $mail2_to = $user->getEmail(); |
|
352 | + $mail2_from = $WT_TREE->getPreference('WEBTREES_EMAIL'); |
|
353 | + |
|
354 | + // Send user message by email only |
|
355 | + Mail::send( |
|
356 | + // “From:” header |
|
357 | + $WT_TREE, |
|
358 | + // “To:” header |
|
359 | + $mail2_to, |
|
360 | + $mail2_to, |
|
361 | + // “Reply-To:” header |
|
362 | + $mail2_from, |
|
363 | + $mail2_from, |
|
364 | + // Message body |
|
365 | + $mail2_subject, |
|
366 | + $mail2_body |
|
367 | + ); |
|
368 | + |
|
369 | + // Send admin message by email and/or internal messaging |
|
370 | + Mail::send( |
|
371 | + // “From:” header |
|
372 | + $WT_TREE, |
|
373 | + // “To:” header |
|
374 | + $webmaster->getEmail(), |
|
375 | + $webmaster->getRealName(), |
|
376 | + // “Reply-To:” header |
|
377 | + $user->getEmail(), |
|
378 | + $user->getRealName(), |
|
379 | + // Message body |
|
380 | + $mail1_subject, |
|
381 | + $mail1_body |
|
382 | + ); |
|
383 | + $mail1_method = $webmaster->getPreference('contact_method'); |
|
384 | + if ($mail1_method != 'messaging3' && $mail1_method != 'mailto' && $mail1_method != 'none') { |
|
385 | + Database::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)") |
|
386 | + ->execute(array($user->getEmail(), WT_CLIENT_IP, $webmaster->getUserId(), $mail1_subject, Filter::unescapeHtml($mail1_body))); |
|
387 | + } |
|
393 | 388 | |
394 | - return; |
|
389 | + echo '<div class="confirm"><p>', I18N::translate('Hello %s…<br>Thank you for your registration.', $user->getRealNameHtml()), '</p>'; |
|
390 | + echo '<p>', I18N::translate('We will now send a confirmation email to the address <b>%s</b>. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically. You will have to apply again.<br><br>After you have followed the instructions in the confirmation email, the administrator still has to approve your request before your account can be used.<br><br>To sign in to this website, you will need to know your username and password.', $user->getEmail()), '</p>'; |
|
391 | + echo '</div>'; |
|
392 | + echo '</div>'; |
|
393 | + |
|
394 | + return; |
|
395 | + } |
|
395 | 396 | } |
396 | - } |
|
397 | 397 | |
398 | - Session::put('good_to_send', true); |
|
399 | - $controller |
|
400 | - ->pageHeader() |
|
401 | - ->addInlineJavascript('function regex_quote(str) {return str.replace(/[\\\\.?+*()[\](){}|]/g, "\\\\$&");}'); |
|
398 | + Session::put('good_to_send', true); |
|
399 | + $controller |
|
400 | + ->pageHeader() |
|
401 | + ->addInlineJavascript('function regex_quote(str) {return str.replace(/[\\\\.?+*()[\](){}|]/g, "\\\\$&");}'); |
|
402 | 402 | |
403 | - ?> |
|
403 | + ?> |
|
404 | 404 | <div id="login-register-page"> |
405 | 405 | <h2><?php echo $controller->getPageTitle(); ?></h2> |
406 | 406 | |
407 | 407 | <?php if (Site::getPreference('SHOW_REGISTER_CAUTION')): ?> |
408 | - <div id="register-text"> |
|
408 | + <div id="register-text"> |
|
409 | 409 | <?php echo I18N::translate('<div class="largeError">Notice:</div><div class="error">By completing and submitting this form, you agree:<ul><li>to protect the privacy of living individuals listed on our site;</li><li>and in the text box below, to explain to whom you are related, or to provide us with information on someone who should be listed on our website.</li></ul></div>'); ?> |
410 | - </div> |
|
410 | + </div> |
|
411 | 411 | <?php endif; ?> |
412 | 412 | <div id="register-box"> |
413 | 413 | <form id="register-form" name="register-form" method="post" onsubmit="return checkform(this);" autocomplete="off"> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | <div> |
419 | 419 | <label for="user_realname"> |
420 | 420 | <?php echo I18N::translate('Real name'); ?> |
421 | - <input type="text" id="user_realname" name="user_realname" required maxlength="64" value="<?php echo Filter::escapeHtml($user_realname); ?>" autofocus> |
|
421 | + <input type="text" id="user_realname" name="user_realname" required maxlength="64" value="<?php echo Filter::escapeHtml($user_realname); ?>" autofocus> |
|
422 | 422 | </label> |
423 | 423 | <p class="small text-muted"> |
424 | 424 | <?php echo I18N::translate('This is your real name, as you would like it displayed on screen.'); ?> |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <div> |
429 | 429 | <label for="user_email"> |
430 | 430 | <?php echo I18N::translate('Email address'); ?> |
431 | - <input type="email" id="user_email" name="user_email" required maxlength="64" value="<?php echo Filter::escapeHtml($user_email); ?>"> |
|
431 | + <input type="email" id="user_email" name="user_email" required maxlength="64" value="<?php echo Filter::escapeHtml($user_email); ?>"> |
|
432 | 432 | </label> |
433 | 433 | <p class="small text-muted"> |
434 | 434 | <?php echo I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.'); ?> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | <div> |
439 | 439 | <label for="username"> |
440 | 440 | <?php echo I18N::translate('Username'); ?> |
441 | - <input type="text" id="username" name="user_name" required maxlength="32" value="<?php Filter::escapeHtml($user_name); ?>"> |
|
441 | + <input type="text" id="username" name="user_name" required maxlength="32" value="<?php Filter::escapeHtml($user_name); ?>"> |
|
442 | 442 | </label> |
443 | 443 | <p class="small text-muted"> |
444 | 444 | <?php echo I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.'); ?> |
@@ -501,24 +501,24 @@ discard block |
||
501 | 501 | </div> |
502 | 502 | </div> |
503 | 503 | <?php |
504 | - break; |
|
504 | + break; |
|
505 | 505 | |
506 | -case 'userverify': |
|
507 | - if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
508 | - header('Location: ' . WT_BASE_URL); |
|
506 | + case 'userverify': |
|
507 | + if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
508 | + header('Location: ' . WT_BASE_URL); |
|
509 | 509 | |
510 | - return; |
|
511 | - } |
|
510 | + return; |
|
511 | + } |
|
512 | 512 | |
513 | - // Change to the new user’s language |
|
514 | - $user = User::findByUserName($user_name); |
|
513 | + // Change to the new user’s language |
|
514 | + $user = User::findByUserName($user_name); |
|
515 | 515 | |
516 | - I18N::init($user->getPreference('language')); |
|
516 | + I18N::init($user->getPreference('language')); |
|
517 | 517 | |
518 | - $controller->setPageTitle(I18N::translate('User verification')); |
|
519 | - $controller->pageHeader(); |
|
518 | + $controller->setPageTitle(I18N::translate('User verification')); |
|
519 | + $controller->pageHeader(); |
|
520 | 520 | |
521 | - echo '<div id="login-register-page"> |
|
521 | + echo '<div id="login-register-page"> |
|
522 | 522 | <form id="verify-form" name="verify-form" method="post" action="', WT_LOGIN_URL, '"> |
523 | 523 | <input type="hidden" name="action" value="verify_hash"> |
524 | 524 | <h4>', I18N::translate('User verification'), '</h4> |
@@ -539,87 +539,87 @@ discard block |
||
539 | 539 | </div> |
540 | 540 | </form> |
541 | 541 | </div>'; |
542 | - break; |
|
542 | + break; |
|
543 | 543 | |
544 | -case 'verify_hash': |
|
545 | - if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
546 | - header('Location: ' . WT_BASE_URL); |
|
544 | + case 'verify_hash': |
|
545 | + if (!Site::getPreference('USE_REGISTRATION_MODULE')) { |
|
546 | + header('Location: ' . WT_BASE_URL); |
|
547 | 547 | |
548 | - return; |
|
549 | - } |
|
550 | - |
|
551 | - // switch language to webmaster settings |
|
552 | - $webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')); |
|
553 | - I18N::init($webmaster->getPreference('language')); |
|
554 | - |
|
555 | - $user = User::findByUserName($user_name); |
|
556 | - $edit_user_url = WT_BASE_URL . "admin_users.php?action=edit&user_id=" . $user->getUserId(); |
|
557 | - $mail1_body = |
|
558 | - I18N::translate('Hello administrator…') . |
|
559 | - Mail::EOL . Mail::EOL . |
|
560 | - /* I18N: %1$s is a real-name, %2$s is a username, %3$s is an email address */ I18N::translate( |
|
561 | - 'A new user (%1$s) has requested an account (%2$s) and verified an email address (%3$s).', |
|
562 | - $user->getRealNameHtml(), |
|
563 | - Filter::escapeHtml($user->getUserName()), |
|
564 | - Filter::escapeHtml($user->getEmail()) |
|
565 | - ) . |
|
566 | - Mail::EOL . Mail::EOL . |
|
567 | - I18N::translate('You need to review the account details.') . |
|
568 | - Mail::EOL . Mail::EOL . |
|
569 | - '<a href="' . $edit_user_url . '">' . $edit_user_url . '</a>' . |
|
570 | - Mail::EOL . Mail::EOL . |
|
571 | - /* I18N: You need to: */ I18N::translate('Set the status to “approved”.') . |
|
572 | - Mail::EOL . |
|
573 | - /* I18N: You need to: */ I18N::translate('Set the access level for each tree.') . |
|
574 | - Mail::EOL . |
|
575 | - /* I18N: You need to: */ I18N::translate('Link the user account to an individual.'); |
|
576 | - |
|
577 | - $mail1_subject = /* I18N: %s is a server name/URL */ I18N::translate('New user at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle()); |
|
578 | - |
|
579 | - // Change to the new user’s language |
|
580 | - I18N::init($user->getPreference('language')); |
|
581 | - |
|
582 | - $controller->setPageTitle(I18N::translate('User verification')); |
|
583 | - $controller->pageHeader(); |
|
584 | - |
|
585 | - echo '<div id="login-register-page">'; |
|
586 | - echo '<h2>' . I18N::translate('User verification') . '</h2>'; |
|
587 | - echo '<div id="user-verify">'; |
|
588 | - if ($user && $user->checkPassword($user_password) && $user->getPreference('reg_hashcode') === $user_hashcode) { |
|
589 | - Mail::send( |
|
590 | - // “From:” header |
|
591 | - $WT_TREE, |
|
592 | - // “To:” header |
|
593 | - $webmaster->getEmail(), |
|
594 | - $webmaster->getRealName(), |
|
595 | - // “Reply-To:” header |
|
596 | - $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
597 | - $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
598 | - // Message body |
|
599 | - $mail1_subject, |
|
600 | - $mail1_body |
|
601 | - ); |
|
602 | - $mail1_method = $webmaster->getPreference('CONTACT_METHOD'); |
|
603 | - if ($mail1_method != 'messaging3' && $mail1_method != 'mailto' && $mail1_method != 'none') { |
|
604 | - Database::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)") |
|
605 | - ->execute(array($user_name, WT_CLIENT_IP, $webmaster->getUserId(), $mail1_subject, Filter::unescapeHtml($mail1_body))); |
|
548 | + return; |
|
606 | 549 | } |
607 | 550 | |
608 | - $user |
|
609 | - ->setPreference('verified', '1') |
|
610 | - ->setPreference('reg_timestamp', date('U')) |
|
611 | - ->deletePreference('reg_hashcode'); |
|
551 | + // switch language to webmaster settings |
|
552 | + $webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')); |
|
553 | + I18N::init($webmaster->getPreference('language')); |
|
554 | + |
|
555 | + $user = User::findByUserName($user_name); |
|
556 | + $edit_user_url = WT_BASE_URL . "admin_users.php?action=edit&user_id=" . $user->getUserId(); |
|
557 | + $mail1_body = |
|
558 | + I18N::translate('Hello administrator…') . |
|
559 | + Mail::EOL . Mail::EOL . |
|
560 | + /* I18N: %1$s is a real-name, %2$s is a username, %3$s is an email address */ I18N::translate( |
|
561 | + 'A new user (%1$s) has requested an account (%2$s) and verified an email address (%3$s).', |
|
562 | + $user->getRealNameHtml(), |
|
563 | + Filter::escapeHtml($user->getUserName()), |
|
564 | + Filter::escapeHtml($user->getEmail()) |
|
565 | + ) . |
|
566 | + Mail::EOL . Mail::EOL . |
|
567 | + I18N::translate('You need to review the account details.') . |
|
568 | + Mail::EOL . Mail::EOL . |
|
569 | + '<a href="' . $edit_user_url . '">' . $edit_user_url . '</a>' . |
|
570 | + Mail::EOL . Mail::EOL . |
|
571 | + /* I18N: You need to: */ I18N::translate('Set the status to “approved”.') . |
|
572 | + Mail::EOL . |
|
573 | + /* I18N: You need to: */ I18N::translate('Set the access level for each tree.') . |
|
574 | + Mail::EOL . |
|
575 | + /* I18N: You need to: */ I18N::translate('Link the user account to an individual.'); |
|
576 | + |
|
577 | + $mail1_subject = /* I18N: %s is a server name/URL */ I18N::translate('New user at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle()); |
|
578 | + |
|
579 | + // Change to the new user’s language |
|
580 | + I18N::init($user->getPreference('language')); |
|
581 | + |
|
582 | + $controller->setPageTitle(I18N::translate('User verification')); |
|
583 | + $controller->pageHeader(); |
|
584 | + |
|
585 | + echo '<div id="login-register-page">'; |
|
586 | + echo '<h2>' . I18N::translate('User verification') . '</h2>'; |
|
587 | + echo '<div id="user-verify">'; |
|
588 | + if ($user && $user->checkPassword($user_password) && $user->getPreference('reg_hashcode') === $user_hashcode) { |
|
589 | + Mail::send( |
|
590 | + // “From:” header |
|
591 | + $WT_TREE, |
|
592 | + // “To:” header |
|
593 | + $webmaster->getEmail(), |
|
594 | + $webmaster->getRealName(), |
|
595 | + // “Reply-To:” header |
|
596 | + $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
597 | + $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
598 | + // Message body |
|
599 | + $mail1_subject, |
|
600 | + $mail1_body |
|
601 | + ); |
|
602 | + $mail1_method = $webmaster->getPreference('CONTACT_METHOD'); |
|
603 | + if ($mail1_method != 'messaging3' && $mail1_method != 'mailto' && $mail1_method != 'none') { |
|
604 | + Database::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)") |
|
605 | + ->execute(array($user_name, WT_CLIENT_IP, $webmaster->getUserId(), $mail1_subject, Filter::unescapeHtml($mail1_body))); |
|
606 | + } |
|
612 | 607 | |
613 | - Log::addAuthenticationLog('User ' . $user_name . ' verified their email address'); |
|
608 | + $user |
|
609 | + ->setPreference('verified', '1') |
|
610 | + ->setPreference('reg_timestamp', date('U')) |
|
611 | + ->deletePreference('reg_hashcode'); |
|
614 | 612 | |
615 | - echo '<p>', I18N::translate('You have confirmed your request to become a registered user.'), '</p>'; |
|
616 | - echo '<p>', I18N::translate('The administrator has been informed. As soon as they give you permission to sign in, you can sign in with your username and password.'), '</p>'; |
|
617 | - } else { |
|
618 | - echo '<p class="warning">'; |
|
619 | - echo I18N::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.'); |
|
620 | - echo '</p>'; |
|
621 | - } |
|
622 | - echo '</div>'; |
|
623 | - echo '</div>'; |
|
624 | - break; |
|
613 | + Log::addAuthenticationLog('User ' . $user_name . ' verified their email address'); |
|
614 | + |
|
615 | + echo '<p>', I18N::translate('You have confirmed your request to become a registered user.'), '</p>'; |
|
616 | + echo '<p>', I18N::translate('The administrator has been informed. As soon as they give you permission to sign in, you can sign in with your username and password.'), '</p>'; |
|
617 | + } else { |
|
618 | + echo '<p class="warning">'; |
|
619 | + echo I18N::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.'); |
|
620 | + echo '</p>'; |
|
621 | + } |
|
622 | + echo '</div>'; |
|
623 | + echo '</div>'; |
|
624 | + break; |
|
625 | 625 | } |
@@ -96,25 +96,25 @@ |
||
96 | 96 | echo '<p class="ui-state-error">', $controller->error_message, '</p>'; |
97 | 97 | } else { |
98 | 98 | switch ($controller->chart_style) { |
99 | - case 0: // List |
|
100 | - echo '<ul id="descendancy_chart" class="chart_common">'; |
|
101 | - $controller->printChildDescendancy($controller->root, $controller->generations); |
|
102 | - echo '</ul>'; |
|
103 | - break; |
|
104 | - case 1: // Booklet |
|
105 | - $show_cousins = true; |
|
106 | - echo '<div id="descendancy_booklet">'; |
|
107 | - $controller->printChildFamily($controller->root, $controller->generations); |
|
108 | - echo '</div>'; |
|
109 | - break; |
|
110 | - case 2: // Individual list |
|
111 | - $descendants = $controller->individualDescendancy($controller->root, $controller->generations, array()); |
|
112 | - echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>'; |
|
113 | - break; |
|
114 | - case 3: // Family list |
|
115 | - $descendants = $controller->familyDescendancy($controller->root, $controller->generations, array()); |
|
116 | - echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>'; |
|
117 | - break; |
|
99 | + case 0: // List |
|
100 | + echo '<ul id="descendancy_chart" class="chart_common">'; |
|
101 | + $controller->printChildDescendancy($controller->root, $controller->generations); |
|
102 | + echo '</ul>'; |
|
103 | + break; |
|
104 | + case 1: // Booklet |
|
105 | + $show_cousins = true; |
|
106 | + echo '<div id="descendancy_booklet">'; |
|
107 | + $controller->printChildFamily($controller->root, $controller->generations); |
|
108 | + echo '</div>'; |
|
109 | + break; |
|
110 | + case 2: // Individual list |
|
111 | + $descendants = $controller->individualDescendancy($controller->root, $controller->generations, array()); |
|
112 | + echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>'; |
|
113 | + break; |
|
114 | + case 3: // Family list |
|
115 | + $descendants = $controller->familyDescendancy($controller->root, $controller->generations, array()); |
|
116 | + echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>'; |
|
117 | + break; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | ?> |
@@ -51,170 +51,170 @@ |
||
51 | 51 | echo '<div id="place-hierarchy">'; |
52 | 52 | |
53 | 53 | switch ($display) { |
54 | -case 'list': |
|
55 | - echo '<h2>', $controller->getPageTitle(), '</h2>'; |
|
56 | - $list_places = Place::allPlaces($WT_TREE); |
|
57 | - $numfound = count($list_places); |
|
54 | + case 'list': |
|
55 | + echo '<h2>', $controller->getPageTitle(), '</h2>'; |
|
56 | + $list_places = Place::allPlaces($WT_TREE); |
|
57 | + $numfound = count($list_places); |
|
58 | 58 | |
59 | - $divisor = $numfound > 20 ? 3 : 2; |
|
59 | + $divisor = $numfound > 20 ? 3 : 2; |
|
60 | 60 | |
61 | - if ($numfound === 0) { |
|
62 | - echo '<b>', I18N::translate('No results found.'), '</b><br>'; |
|
63 | - } else { |
|
64 | - $columns = array_chunk($list_places, ceil($numfound / $divisor)); |
|
65 | - |
|
66 | - $html = '<table class="list_table"><thead>'; |
|
67 | - $html .= '<tr><th class="list_label" colspan="' . $divisor . '">'; |
|
68 | - $html .= '<i class="icon-place"></i> ' . I18N::translate('Place list'); |
|
69 | - $html .= '</th></tr></thead>'; |
|
70 | - $html .= '<tbody><tr>'; |
|
71 | - foreach ($columns as $column) { |
|
72 | - $html .= '<td class="list_value_wrap"><ul>'; |
|
73 | - foreach ($column as $item) { |
|
74 | - $html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>'; |
|
61 | + if ($numfound === 0) { |
|
62 | + echo '<b>', I18N::translate('No results found.'), '</b><br>'; |
|
63 | + } else { |
|
64 | + $columns = array_chunk($list_places, ceil($numfound / $divisor)); |
|
65 | + |
|
66 | + $html = '<table class="list_table"><thead>'; |
|
67 | + $html .= '<tr><th class="list_label" colspan="' . $divisor . '">'; |
|
68 | + $html .= '<i class="icon-place"></i> ' . I18N::translate('Place list'); |
|
69 | + $html .= '</th></tr></thead>'; |
|
70 | + $html .= '<tbody><tr>'; |
|
71 | + foreach ($columns as $column) { |
|
72 | + $html .= '<td class="list_value_wrap"><ul>'; |
|
73 | + foreach ($column as $item) { |
|
74 | + $html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>'; |
|
75 | + } |
|
76 | + $html .= '</ul></td>'; |
|
75 | 77 | } |
76 | - $html .= '</ul></td>'; |
|
78 | + $html .= '</tr></tbody></table>'; |
|
79 | + echo $html; |
|
77 | 80 | } |
78 | - $html .= '</tr></tbody></table>'; |
|
79 | - echo $html; |
|
80 | - } |
|
81 | - echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>'; |
|
82 | - break; |
|
83 | -case 'hierarchy': |
|
84 | - $gm_module = Module::getModuleByName('googlemap'); |
|
81 | + echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>'; |
|
82 | + break; |
|
83 | + case 'hierarchy': |
|
84 | + $gm_module = Module::getModuleByName('googlemap'); |
|
85 | 85 | |
86 | - // Find this place and its ID |
|
87 | - $place = new Place(implode(', ', array_reverse($parent)), $WT_TREE); |
|
88 | - $place_id = $place->getPlaceId(); |
|
86 | + // Find this place and its ID |
|
87 | + $place = new Place(implode(', ', array_reverse($parent)), $WT_TREE); |
|
88 | + $place_id = $place->getPlaceId(); |
|
89 | 89 | |
90 | - $child_places = $place->getChildPlaces(); |
|
90 | + $child_places = $place->getChildPlaces(); |
|
91 | 91 | |
92 | - $numfound = count($child_places); |
|
92 | + $numfound = count($child_places); |
|
93 | 93 | |
94 | - //-- if the number of places found is 0 then automatically redirect to search page |
|
95 | - if ($numfound === 0) { |
|
96 | - $action = 'show'; |
|
97 | - } |
|
98 | - |
|
99 | - echo '<h2>', $controller->getPageTitle(); |
|
100 | - // Breadcrumbs |
|
101 | - if ($place_id) { |
|
102 | - $parent_place = $place->getParentPlace(); |
|
103 | - while ($parent_place->getPlaceId()) { |
|
104 | - echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; |
|
105 | - $parent_place = $parent_place->getParentPlace(); |
|
94 | + //-- if the number of places found is 0 then automatically redirect to search page |
|
95 | + if ($numfound === 0) { |
|
96 | + $action = 'show'; |
|
106 | 97 | } |
107 | - echo ', <a href="', WT_SCRIPT_NAME, '">', I18N::translate('Top level'), '</a>'; |
|
108 | - } |
|
109 | - echo '</h2>'; |
|
110 | 98 | |
111 | - if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
112 | - $linklevels = ''; |
|
113 | - $place_names = array(); |
|
114 | - for ($j = 0; $j < $level; $j++) { |
|
115 | - $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); |
|
99 | + echo '<h2>', $controller->getPageTitle(); |
|
100 | + // Breadcrumbs |
|
101 | + if ($place_id) { |
|
102 | + $parent_place = $place->getParentPlace(); |
|
103 | + while ($parent_place->getPlaceId()) { |
|
104 | + echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; |
|
105 | + $parent_place = $parent_place->getParentPlace(); |
|
106 | + } |
|
107 | + echo ', <a href="', WT_SCRIPT_NAME, '">', I18N::translate('Top level'), '</a>'; |
|
116 | 108 | } |
109 | + echo '</h2>'; |
|
117 | 110 | |
118 | - $gm_module->createMap(); |
|
119 | - } elseif (Module::getModuleByName('places_assistant')) { |
|
120 | - // Places Assistant is a custom/add-on module that was once part of the core code. |
|
121 | - \PlacesAssistantModule::display_map($level, $parent); |
|
122 | - } |
|
111 | + if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
112 | + $linklevels = ''; |
|
113 | + $place_names = array(); |
|
114 | + for ($j = 0; $j < $level; $j++) { |
|
115 | + $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); |
|
116 | + } |
|
123 | 117 | |
124 | - if ($numfound > 0) { |
|
125 | - if ($numfound > 20) { |
|
126 | - $divisor = 3; |
|
127 | - } elseif ($numfound > 4) { |
|
128 | - $divisor = 2; |
|
129 | - } else { |
|
130 | - $divisor = 1; |
|
118 | + $gm_module->createMap(); |
|
119 | + } elseif (Module::getModuleByName('places_assistant')) { |
|
120 | + // Places Assistant is a custom/add-on module that was once part of the core code. |
|
121 | + \PlacesAssistantModule::display_map($level, $parent); |
|
131 | 122 | } |
132 | 123 | |
133 | - $columns = array_chunk($child_places, ceil($numfound / $divisor)); |
|
134 | - $html = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">'; |
|
135 | - $html .= '<i class="icon-place"></i> '; |
|
136 | - if ($place_id) { |
|
137 | - $html .= I18N::translate('Places in %s', $place->getPlaceName()); |
|
138 | - } else { |
|
139 | - $html .= I18N::translate('Place hierarchy'); |
|
140 | - } |
|
141 | - $html .= '</th></tr></thead>'; |
|
142 | - $html .= '<tbody><tr>'; |
|
143 | - foreach ($columns as $column) { |
|
144 | - $html .= '<td class="list_value"><ul>'; |
|
145 | - foreach ($column as $item) { |
|
146 | - $html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>'; |
|
147 | - if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
148 | - list($tmp) = explode(', ', $item->getGedcomName(), 2); |
|
149 | - $place_names[] = $tmp; |
|
124 | + if ($numfound > 0) { |
|
125 | + if ($numfound > 20) { |
|
126 | + $divisor = 3; |
|
127 | + } elseif ($numfound > 4) { |
|
128 | + $divisor = 2; |
|
129 | + } else { |
|
130 | + $divisor = 1; |
|
131 | + } |
|
132 | + |
|
133 | + $columns = array_chunk($child_places, ceil($numfound / $divisor)); |
|
134 | + $html = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">'; |
|
135 | + $html .= '<i class="icon-place"></i> '; |
|
136 | + if ($place_id) { |
|
137 | + $html .= I18N::translate('Places in %s', $place->getPlaceName()); |
|
138 | + } else { |
|
139 | + $html .= I18N::translate('Place hierarchy'); |
|
140 | + } |
|
141 | + $html .= '</th></tr></thead>'; |
|
142 | + $html .= '<tbody><tr>'; |
|
143 | + foreach ($columns as $column) { |
|
144 | + $html .= '<td class="list_value"><ul>'; |
|
145 | + foreach ($column as $item) { |
|
146 | + $html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>'; |
|
147 | + if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
148 | + list($tmp) = explode(', ', $item->getGedcomName(), 2); |
|
149 | + $place_names[] = $tmp; |
|
150 | + } |
|
150 | 151 | } |
152 | + $html .= '</ul></td>'; |
|
151 | 153 | } |
152 | - $html .= '</ul></td>'; |
|
153 | - } |
|
154 | - $html .= '</tr></tbody>'; |
|
155 | - if ($numfound > 0 && $action == 'find' && $place_id) { |
|
156 | - $html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">'; |
|
157 | - $html .= I18N::translate('View all records found in this place'); |
|
158 | - $html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">'; |
|
159 | - $html .= '<a href="' . $place->getURL() . '&action=show" class="formField">' . $place->getPlaceName() . '</a>'; |
|
160 | - $html .= '</td></tr></tfoot>'; |
|
154 | + $html .= '</tr></tbody>'; |
|
155 | + if ($numfound > 0 && $action == 'find' && $place_id) { |
|
156 | + $html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">'; |
|
157 | + $html .= I18N::translate('View all records found in this place'); |
|
158 | + $html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">'; |
|
159 | + $html .= '<a href="' . $place->getURL() . '&action=show" class="formField">' . $place->getPlaceName() . '</a>'; |
|
160 | + $html .= '</td></tr></tfoot>'; |
|
161 | + } |
|
162 | + $html .= '</table>'; |
|
163 | + // -- echo the array |
|
164 | + echo $html; |
|
161 | 165 | } |
162 | - $html .= '</table>'; |
|
163 | - // -- echo the array |
|
164 | - echo $html; |
|
165 | - } |
|
166 | - if ($place_id && $action == 'show') { |
|
167 | - // -- array of names |
|
168 | - $myindilist = array(); |
|
169 | - $myfamlist = array(); |
|
170 | - |
|
171 | - $positions = |
|
172 | - Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") |
|
173 | - ->execute(array($place_id, $WT_TREE->getTreeId())) |
|
174 | - ->fetchOneColumn(); |
|
175 | - |
|
176 | - foreach ($positions as $position) { |
|
177 | - $record = GedcomRecord::getInstance($position, $WT_TREE); |
|
178 | - if ($record && $record->canShow()) { |
|
179 | - if ($record instanceof Individual) { |
|
180 | - $myindilist[] = $record; |
|
181 | - } |
|
182 | - if ($record instanceof Family) { |
|
183 | - $myfamlist[] = $record; |
|
166 | + if ($place_id && $action == 'show') { |
|
167 | + // -- array of names |
|
168 | + $myindilist = array(); |
|
169 | + $myfamlist = array(); |
|
170 | + |
|
171 | + $positions = |
|
172 | + Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") |
|
173 | + ->execute(array($place_id, $WT_TREE->getTreeId())) |
|
174 | + ->fetchOneColumn(); |
|
175 | + |
|
176 | + foreach ($positions as $position) { |
|
177 | + $record = GedcomRecord::getInstance($position, $WT_TREE); |
|
178 | + if ($record && $record->canShow()) { |
|
179 | + if ($record instanceof Individual) { |
|
180 | + $myindilist[] = $record; |
|
181 | + } |
|
182 | + if ($record instanceof Family) { |
|
183 | + $myfamlist[] = $record; |
|
184 | + } |
|
184 | 185 | } |
185 | 186 | } |
187 | + echo '<br>'; |
|
188 | + |
|
189 | + //-- display results |
|
190 | + $controller |
|
191 | + ->addInlineJavascript('jQuery("#places-tabs").tabs();') |
|
192 | + ->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");') |
|
193 | + ->addInlineJavascript('jQuery(".loading-image").css("display", "none");'); |
|
194 | + |
|
195 | + echo '<div class="loading-image"></div>'; |
|
196 | + echo '<div id="places-tabs"><ul>'; |
|
197 | + if (!empty($myindilist)) { |
|
198 | + echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>'; |
|
199 | + } |
|
200 | + if (!empty($myfamlist)) { |
|
201 | + echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>'; |
|
202 | + } |
|
203 | + echo '</ul>'; |
|
204 | + if (!empty($myindilist)) { |
|
205 | + echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>'; |
|
206 | + } |
|
207 | + if (!empty($myfamlist)) { |
|
208 | + echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>'; |
|
209 | + } |
|
210 | + echo '</div>'; // <div id="places-tabs"> |
|
186 | 211 | } |
187 | - echo '<br>'; |
|
188 | - |
|
189 | - //-- display results |
|
190 | - $controller |
|
191 | - ->addInlineJavascript('jQuery("#places-tabs").tabs();') |
|
192 | - ->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");') |
|
193 | - ->addInlineJavascript('jQuery(".loading-image").css("display", "none");'); |
|
194 | - |
|
195 | - echo '<div class="loading-image"></div>'; |
|
196 | - echo '<div id="places-tabs"><ul>'; |
|
197 | - if (!empty($myindilist)) { |
|
198 | - echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>'; |
|
199 | - } |
|
200 | - if (!empty($myfamlist)) { |
|
201 | - echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>'; |
|
202 | - } |
|
203 | - echo '</ul>'; |
|
204 | - if (!empty($myindilist)) { |
|
205 | - echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>'; |
|
206 | - } |
|
207 | - if (!empty($myfamlist)) { |
|
208 | - echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>'; |
|
209 | - } |
|
210 | - echo '</div>'; // <div id="places-tabs"> |
|
211 | - } |
|
212 | - echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
|
212 | + echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
|
213 | 213 | |
214 | - if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
215 | - $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
|
216 | - } |
|
217 | - break; |
|
214 | + if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { |
|
215 | + $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
|
216 | + } |
|
217 | + break; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | echo '</div>'; // <div id="place-hierarchy"> |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | $show_marnm = Filter::get('show_marnm', 'no|yes'); |
48 | 48 | switch ($show_marnm) { |
49 | -case 'no': |
|
50 | -case 'yes': |
|
51 | - Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | - break; |
|
53 | -default: |
|
54 | - $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
49 | + case 'no': |
|
50 | + case 'yes': |
|
51 | + Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | + break; |
|
53 | + default: |
|
54 | + $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Make sure selections are consistent. |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | } |
92 | 92 | $url = WT_SCRIPT_NAME . '?surname=' . rawurlencode($surname) . '&ged=' . $WT_TREE->getNameUrl(); |
93 | 93 | switch ($falpha) { |
94 | - case '': |
|
95 | - break; |
|
96 | - case '@': |
|
97 | - $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | - break; |
|
100 | - default: |
|
101 | - $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | - break; |
|
94 | + case '': |
|
95 | + break; |
|
96 | + case '@': |
|
97 | + $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | + break; |
|
100 | + default: |
|
101 | + $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | + break; |
|
104 | 104 | } |
105 | 105 | $show = 'indi'; // SURN list makes no sense here |
106 | 106 | } elseif ($alpha === '@') { |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | $list = array(); |
137 | 137 | foreach (QueryName::surnameAlpha($WT_TREE, $show_marnm === 'yes', false) as $letter => $count) { |
138 | 138 | switch ($letter) { |
139 | - case '@': |
|
140 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | - break; |
|
142 | - case ',': |
|
143 | - $html = I18N::translate('None'); |
|
144 | - break; |
|
145 | - default: |
|
146 | - $html = Filter::escapeHtml($letter); |
|
147 | - break; |
|
139 | + case '@': |
|
140 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | + break; |
|
142 | + case ',': |
|
143 | + $html = I18N::translate('None'); |
|
144 | + break; |
|
145 | + default: |
|
146 | + $html = Filter::escapeHtml($letter); |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | if ($count) { |
150 | 150 | if ($letter == $alpha) { |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | if ($show === 'surn') { |
195 | 195 | // Show the surname list |
196 | 196 | switch ($WT_TREE->getPreference('SURNAME_LIST_STYLE')) { |
197 | - case 'style1': |
|
198 | - echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | - break; |
|
200 | - case 'style3': |
|
201 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | - break; |
|
203 | - case 'style2': |
|
204 | - default: |
|
205 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | - break; |
|
197 | + case 'style1': |
|
198 | + echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | + break; |
|
200 | + case 'style3': |
|
201 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | + break; |
|
203 | + case 'style2': |
|
204 | + default: |
|
205 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | + break; |
|
207 | 207 | } |
208 | 208 | } else { |
209 | 209 | // Show the list |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | $list = array(); |
227 | 227 | foreach ($givn_initials as $givn_initial => $count) { |
228 | 228 | switch ($givn_initial) { |
229 | - case '@': |
|
230 | - $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | - break; |
|
232 | - default: |
|
233 | - $html = Filter::escapeHtml($givn_initial); |
|
234 | - break; |
|
229 | + case '@': |
|
230 | + $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | + break; |
|
232 | + default: |
|
233 | + $html = Filter::escapeHtml($givn_initial); |
|
234 | + break; |
|
235 | 235 | } |
236 | 236 | if ($count) { |
237 | 237 | if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') { |
@@ -47,60 +47,60 @@ |
||
47 | 47 | $embed = substr($choose, 0, 1) === '1'; |
48 | 48 | |
49 | 49 | switch ($type) { |
50 | -case 'indi': |
|
51 | - $controller->setPageTitle(I18N::translate('Find an individual')); |
|
52 | - break; |
|
53 | -case 'fam': |
|
54 | - $controller->setPageTitle(I18N::translate('Find a family')); |
|
55 | - break; |
|
56 | -case 'media': |
|
57 | - $controller->setPageTitle(I18N::translate('Find a media object')); |
|
58 | - break; |
|
59 | -case 'place': |
|
60 | - $controller->setPageTitle(I18N::translate('Find a place')); |
|
61 | - break; |
|
62 | -case 'repo': |
|
63 | - $controller->setPageTitle(I18N::translate('Find a repository')); |
|
64 | - break; |
|
65 | -case 'note': |
|
66 | - $controller->setPageTitle(I18N::translate('Find a shared note')); |
|
67 | - break; |
|
68 | -case 'source': |
|
69 | - $controller->setPageTitle(I18N::translate('Find a source')); |
|
70 | - break; |
|
71 | -case 'specialchar': |
|
72 | - $controller->setPageTitle(I18N::translate('Find a special character')); |
|
73 | - break; |
|
74 | -case 'factINDI': |
|
75 | - $controller |
|
76 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
77 | - ->addInlineJavascript('initPickFact("INDI");'); |
|
78 | - break; |
|
79 | -case 'factFAM': |
|
80 | - $controller |
|
81 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
82 | - ->addInlineJavascript('initPickFact("FAM");'); |
|
83 | - break; |
|
84 | -case 'factSOUR': |
|
85 | - $controller |
|
86 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
87 | - ->addInlineJavascript('initPickFact("SOUR");'); |
|
88 | - break; |
|
89 | -case 'factREPO': |
|
90 | - $controller |
|
91 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
92 | - ->addInlineJavascript('initPickFact("REPO");'); |
|
93 | - break; |
|
94 | -case 'factNAME': |
|
95 | - $controller |
|
96 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
97 | - ->addInlineJavascript('initPickFact("NAME");'); |
|
98 | - break; |
|
99 | -case 'factPLAC': |
|
100 | - $controller |
|
101 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
102 | - ->addInlineJavascript('initPickFact("PLAC");'); |
|
103 | - break; |
|
50 | + case 'indi': |
|
51 | + $controller->setPageTitle(I18N::translate('Find an individual')); |
|
52 | + break; |
|
53 | + case 'fam': |
|
54 | + $controller->setPageTitle(I18N::translate('Find a family')); |
|
55 | + break; |
|
56 | + case 'media': |
|
57 | + $controller->setPageTitle(I18N::translate('Find a media object')); |
|
58 | + break; |
|
59 | + case 'place': |
|
60 | + $controller->setPageTitle(I18N::translate('Find a place')); |
|
61 | + break; |
|
62 | + case 'repo': |
|
63 | + $controller->setPageTitle(I18N::translate('Find a repository')); |
|
64 | + break; |
|
65 | + case 'note': |
|
66 | + $controller->setPageTitle(I18N::translate('Find a shared note')); |
|
67 | + break; |
|
68 | + case 'source': |
|
69 | + $controller->setPageTitle(I18N::translate('Find a source')); |
|
70 | + break; |
|
71 | + case 'specialchar': |
|
72 | + $controller->setPageTitle(I18N::translate('Find a special character')); |
|
73 | + break; |
|
74 | + case 'factINDI': |
|
75 | + $controller |
|
76 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
77 | + ->addInlineJavascript('initPickFact("INDI");'); |
|
78 | + break; |
|
79 | + case 'factFAM': |
|
80 | + $controller |
|
81 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
82 | + ->addInlineJavascript('initPickFact("FAM");'); |
|
83 | + break; |
|
84 | + case 'factSOUR': |
|
85 | + $controller |
|
86 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
87 | + ->addInlineJavascript('initPickFact("SOUR");'); |
|
88 | + break; |
|
89 | + case 'factREPO': |
|
90 | + $controller |
|
91 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
92 | + ->addInlineJavascript('initPickFact("REPO");'); |
|
93 | + break; |
|
94 | + case 'factNAME': |
|
95 | + $controller |
|
96 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
97 | + ->addInlineJavascript('initPickFact("NAME");'); |
|
98 | + break; |
|
99 | + case 'factPLAC': |
|
100 | + $controller |
|
101 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
102 | + ->addInlineJavascript('initPickFact("PLAC");'); |
|
103 | + break; |
|
104 | 104 | } |
105 | 105 | $controller->pageHeader(); |
106 | 106 |
@@ -86,143 +86,143 @@ |
||
86 | 86 | ); |
87 | 87 | $new_xref = $WT_TREE->getNewXref($type); |
88 | 88 | switch ($type) { |
89 | - case 'INDI': |
|
90 | - Database::prepare( |
|
91 | - "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
92 | - )->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId())); |
|
93 | - Database::prepare( |
|
94 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
95 | - )->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId())); |
|
96 | - Database::prepare( |
|
97 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
98 | - )->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId())); |
|
99 | - Database::prepare( |
|
100 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
101 | - )->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId())); |
|
102 | - Database::prepare( |
|
103 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
104 | - )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
105 | - Database::prepare( |
|
106 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
107 | - )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
108 | - Database::prepare( |
|
109 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
110 | - )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
111 | - Database::prepare( |
|
112 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
113 | - )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
114 | - Database::prepare( |
|
115 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
116 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
117 | - Database::prepare( |
|
118 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
119 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
120 | - Database::prepare( |
|
121 | - "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
122 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
123 | - break; |
|
124 | - case 'FAM': |
|
125 | - Database::prepare( |
|
126 | - "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
127 | - )->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId())); |
|
128 | - Database::prepare( |
|
129 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
130 | - )->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId())); |
|
131 | - Database::prepare( |
|
132 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
133 | - )->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId())); |
|
134 | - Database::prepare( |
|
135 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
136 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
137 | - Database::prepare( |
|
138 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
139 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
140 | - break; |
|
141 | - case 'SOUR': |
|
142 | - Database::prepare( |
|
143 | - "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
144 | - )->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId())); |
|
145 | - Database::prepare( |
|
146 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
147 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
148 | - Database::prepare( |
|
149 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
150 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
151 | - Database::prepare( |
|
152 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
153 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
154 | - Database::prepare( |
|
155 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
156 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
157 | - break; |
|
158 | - case 'REPO': |
|
159 | - Database::prepare( |
|
160 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
161 | - )->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId())); |
|
162 | - Database::prepare( |
|
163 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
164 | - )->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId())); |
|
165 | - break; |
|
166 | - case 'NOTE': |
|
167 | - Database::prepare( |
|
168 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
169 | - )->execute(array($new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId())); |
|
170 | - Database::prepare( |
|
171 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
172 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
173 | - Database::prepare( |
|
174 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
175 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
176 | - Database::prepare( |
|
177 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
178 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
179 | - Database::prepare( |
|
180 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
181 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
182 | - Database::prepare( |
|
183 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
184 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
185 | - break; |
|
186 | - case 'OBJE': |
|
187 | - Database::prepare( |
|
188 | - "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
189 | - )->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId())); |
|
190 | - Database::prepare( |
|
191 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
192 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
193 | - Database::prepare( |
|
194 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
195 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
196 | - Database::prepare( |
|
197 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
198 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
199 | - Database::prepare( |
|
200 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
201 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
202 | - Database::prepare( |
|
203 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
204 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
205 | - break; |
|
206 | - default: |
|
207 | - Database::prepare( |
|
208 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
209 | - )->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId())); |
|
210 | - Database::prepare( |
|
211 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
212 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
213 | - Database::prepare( |
|
214 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
215 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
216 | - Database::prepare( |
|
217 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
218 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
219 | - Database::prepare( |
|
220 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
221 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
222 | - Database::prepare( |
|
223 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
224 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
225 | - break; |
|
89 | + case 'INDI': |
|
90 | + Database::prepare( |
|
91 | + "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
92 | + )->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId())); |
|
93 | + Database::prepare( |
|
94 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
95 | + )->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId())); |
|
96 | + Database::prepare( |
|
97 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
98 | + )->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId())); |
|
99 | + Database::prepare( |
|
100 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
101 | + )->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId())); |
|
102 | + Database::prepare( |
|
103 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
104 | + )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
105 | + Database::prepare( |
|
106 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
107 | + )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
108 | + Database::prepare( |
|
109 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
110 | + )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
111 | + Database::prepare( |
|
112 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
113 | + )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
114 | + Database::prepare( |
|
115 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
116 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
117 | + Database::prepare( |
|
118 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
119 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
120 | + Database::prepare( |
|
121 | + "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
122 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
123 | + break; |
|
124 | + case 'FAM': |
|
125 | + Database::prepare( |
|
126 | + "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
127 | + )->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId())); |
|
128 | + Database::prepare( |
|
129 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
130 | + )->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId())); |
|
131 | + Database::prepare( |
|
132 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
133 | + )->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId())); |
|
134 | + Database::prepare( |
|
135 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
136 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
137 | + Database::prepare( |
|
138 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
139 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
140 | + break; |
|
141 | + case 'SOUR': |
|
142 | + Database::prepare( |
|
143 | + "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
144 | + )->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId())); |
|
145 | + Database::prepare( |
|
146 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
147 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
148 | + Database::prepare( |
|
149 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
150 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
151 | + Database::prepare( |
|
152 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
153 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
154 | + Database::prepare( |
|
155 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
156 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
157 | + break; |
|
158 | + case 'REPO': |
|
159 | + Database::prepare( |
|
160 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
161 | + )->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId())); |
|
162 | + Database::prepare( |
|
163 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
164 | + )->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId())); |
|
165 | + break; |
|
166 | + case 'NOTE': |
|
167 | + Database::prepare( |
|
168 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
169 | + )->execute(array($new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId())); |
|
170 | + Database::prepare( |
|
171 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
172 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
173 | + Database::prepare( |
|
174 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
175 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
176 | + Database::prepare( |
|
177 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
178 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
179 | + Database::prepare( |
|
180 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
181 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
182 | + Database::prepare( |
|
183 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
184 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
185 | + break; |
|
186 | + case 'OBJE': |
|
187 | + Database::prepare( |
|
188 | + "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
189 | + )->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId())); |
|
190 | + Database::prepare( |
|
191 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
192 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
193 | + Database::prepare( |
|
194 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
195 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
196 | + Database::prepare( |
|
197 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
198 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
199 | + Database::prepare( |
|
200 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
201 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
202 | + Database::prepare( |
|
203 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
204 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
205 | + break; |
|
206 | + default: |
|
207 | + Database::prepare( |
|
208 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
209 | + )->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId())); |
|
210 | + Database::prepare( |
|
211 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
212 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
213 | + Database::prepare( |
|
214 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
215 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
216 | + Database::prepare( |
|
217 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
218 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
219 | + Database::prepare( |
|
220 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
221 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
222 | + Database::prepare( |
|
223 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
224 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
225 | + break; |
|
226 | 226 | } |
227 | 227 | Database::prepare( |
228 | 228 | "UPDATE `##name` SET n_id = ? WHERE n_id = ? AND n_file = ?" |
@@ -125,75 +125,75 @@ |
||
125 | 125 | // MySQL supports a wide range of collation conversions. These are ones that |
126 | 126 | // have been encountered "in the wild". |
127 | 127 | switch ($charset) { |
128 | - case 'ASCII': |
|
129 | - Database::prepare( |
|
130 | - "UPDATE `##gedcom_chunk`" . |
|
131 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" . |
|
132 | - " WHERE gedcom_id=?" |
|
133 | - )->execute(array($gedcom_id)); |
|
134 | - break; |
|
135 | - case 'IBMPC': // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850. |
|
136 | - case 'IBM WINDOWS': |
|
137 | - case 'MS-DOS': |
|
138 | - case 'CP437': |
|
139 | - case 'CP850': |
|
140 | - // CP850 has extra letters with diacritics to replace box-drawing chars in CP437. |
|
141 | - Database::prepare( |
|
142 | - "UPDATE `##gedcom_chunk`" . |
|
143 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" . |
|
144 | - " WHERE gedcom_id=?" |
|
145 | - )->execute(array($gedcom_id)); |
|
146 | - break; |
|
147 | - case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1. |
|
148 | - $controller->addInlineJavascript( |
|
149 | - 'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */ |
|
150 | - I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");' |
|
151 | - ); |
|
152 | - // no break; |
|
153 | - case 'WINDOWS': |
|
154 | - case 'CP1252': |
|
155 | - case 'ISO8859-1': |
|
156 | - case 'ISO-8859-1': |
|
157 | - case 'LATIN1': |
|
158 | - case 'LATIN-1': |
|
159 | - // Convert from ISO-8859-1 (western european) to UTF8. |
|
160 | - Database::prepare( |
|
161 | - "UPDATE `##gedcom_chunk`" . |
|
162 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" . |
|
163 | - " WHERE gedcom_id=?" |
|
164 | - )->execute(array($gedcom_id)); |
|
165 | - break; |
|
166 | - case 'CP1250': |
|
167 | - case 'ISO8859-2': |
|
168 | - case 'ISO-8859-2': |
|
169 | - case 'LATIN2': |
|
170 | - case 'LATIN-2': |
|
171 | - // Convert from ISO-8859-2 (eastern european) to UTF8. |
|
172 | - Database::prepare( |
|
173 | - "UPDATE `##gedcom_chunk`" . |
|
174 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" . |
|
175 | - " WHERE gedcom_id=?" |
|
176 | - )->execute(array($gedcom_id)); |
|
177 | - break; |
|
178 | - case 'MACINTOSH': |
|
179 | - // Convert from MAC Roman to UTF8. |
|
180 | - Database::prepare( |
|
181 | - "UPDATE `##gedcom_chunk`" . |
|
182 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" . |
|
183 | - " WHERE gedcom_id=?" |
|
184 | - )->execute(array($gedcom_id)); |
|
185 | - break; |
|
186 | - case 'UTF8': |
|
187 | - case 'UTF-8': |
|
188 | - // Already UTF-8 so nothing to do! |
|
189 | - break; |
|
190 | - case 'ANSEL': |
|
191 | - default: |
|
192 | - Database::rollBack(); |
|
193 | - echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>'; |
|
194 | - $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");'); |
|
195 | - |
|
196 | - return; |
|
128 | + case 'ASCII': |
|
129 | + Database::prepare( |
|
130 | + "UPDATE `##gedcom_chunk`" . |
|
131 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" . |
|
132 | + " WHERE gedcom_id=?" |
|
133 | + )->execute(array($gedcom_id)); |
|
134 | + break; |
|
135 | + case 'IBMPC': // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850. |
|
136 | + case 'IBM WINDOWS': |
|
137 | + case 'MS-DOS': |
|
138 | + case 'CP437': |
|
139 | + case 'CP850': |
|
140 | + // CP850 has extra letters with diacritics to replace box-drawing chars in CP437. |
|
141 | + Database::prepare( |
|
142 | + "UPDATE `##gedcom_chunk`" . |
|
143 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" . |
|
144 | + " WHERE gedcom_id=?" |
|
145 | + )->execute(array($gedcom_id)); |
|
146 | + break; |
|
147 | + case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1. |
|
148 | + $controller->addInlineJavascript( |
|
149 | + 'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */ |
|
150 | + I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");' |
|
151 | + ); |
|
152 | + // no break; |
|
153 | + case 'WINDOWS': |
|
154 | + case 'CP1252': |
|
155 | + case 'ISO8859-1': |
|
156 | + case 'ISO-8859-1': |
|
157 | + case 'LATIN1': |
|
158 | + case 'LATIN-1': |
|
159 | + // Convert from ISO-8859-1 (western european) to UTF8. |
|
160 | + Database::prepare( |
|
161 | + "UPDATE `##gedcom_chunk`" . |
|
162 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" . |
|
163 | + " WHERE gedcom_id=?" |
|
164 | + )->execute(array($gedcom_id)); |
|
165 | + break; |
|
166 | + case 'CP1250': |
|
167 | + case 'ISO8859-2': |
|
168 | + case 'ISO-8859-2': |
|
169 | + case 'LATIN2': |
|
170 | + case 'LATIN-2': |
|
171 | + // Convert from ISO-8859-2 (eastern european) to UTF8. |
|
172 | + Database::prepare( |
|
173 | + "UPDATE `##gedcom_chunk`" . |
|
174 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" . |
|
175 | + " WHERE gedcom_id=?" |
|
176 | + )->execute(array($gedcom_id)); |
|
177 | + break; |
|
178 | + case 'MACINTOSH': |
|
179 | + // Convert from MAC Roman to UTF8. |
|
180 | + Database::prepare( |
|
181 | + "UPDATE `##gedcom_chunk`" . |
|
182 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" . |
|
183 | + " WHERE gedcom_id=?" |
|
184 | + )->execute(array($gedcom_id)); |
|
185 | + break; |
|
186 | + case 'UTF8': |
|
187 | + case 'UTF-8': |
|
188 | + // Already UTF-8 so nothing to do! |
|
189 | + break; |
|
190 | + case 'ANSEL': |
|
191 | + default: |
|
192 | + Database::rollBack(); |
|
193 | + echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>'; |
|
194 | + $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");'); |
|
195 | + |
|
196 | + return; |
|
197 | 197 | } |
198 | 198 | $first_time = false; |
199 | 199 |
@@ -852,528 +852,528 @@ |
||
852 | 852 | echo '<div class="statistics_chart" title="', I18N::translate('Statistics chart'), '">'; |
853 | 853 | |
854 | 854 | switch ($x_axis) { |
855 | -case '1': |
|
856 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN'))); |
|
857 | - break; |
|
858 | -case '2': |
|
859 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart')); |
|
860 | - break; |
|
861 | -case '3': |
|
862 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart')); |
|
863 | - break; |
|
864 | -case '4': |
|
865 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart')); |
|
866 | - break; |
|
867 | -case '11': |
|
868 | - $monthdata = array(); |
|
869 | - for ($i = 0; $i < 12; ++$i) { |
|
870 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
871 | - } |
|
872 | - $xgiven = true; |
|
873 | - $zgiven = false; |
|
874 | - $title = I18N::translate('Month of birth'); |
|
875 | - $xtitle = I18N::translate('month'); |
|
876 | - $ytitle = I18N::translate('numbers'); |
|
877 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
878 | - $xdata = $monthdata; |
|
879 | - $xmax = 12; |
|
880 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
881 | - calculate_legend($boundaries_z_axis); |
|
882 | - } |
|
883 | - $percentage = false; |
|
884 | - if ($y_axis === 201) { |
|
855 | + case '1': |
|
856 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN'))); |
|
857 | + break; |
|
858 | + case '2': |
|
859 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart')); |
|
860 | + break; |
|
861 | + case '3': |
|
862 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart')); |
|
863 | + break; |
|
864 | + case '4': |
|
865 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart')); |
|
866 | + break; |
|
867 | + case '11': |
|
868 | + $monthdata = array(); |
|
869 | + for ($i = 0; $i < 12; ++$i) { |
|
870 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
871 | + } |
|
872 | + $xgiven = true; |
|
873 | + $zgiven = false; |
|
874 | + $title = I18N::translate('Month of birth'); |
|
875 | + $xtitle = I18N::translate('month'); |
|
876 | + $ytitle = I18N::translate('numbers'); |
|
877 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
878 | + $xdata = $monthdata; |
|
879 | + $xmax = 12; |
|
880 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
881 | + calculate_legend($boundaries_z_axis); |
|
882 | + } |
|
885 | 883 | $percentage = false; |
886 | - $ytitle = I18N::translate('Individuals'); |
|
887 | - } elseif ($y_axis === 202) { |
|
888 | - $percentage = true; |
|
889 | - $ytitle = I18N::translate('percentage'); |
|
890 | - } |
|
891 | - $male_female = false; |
|
892 | - if ($z_axis === 300) { |
|
893 | - $zgiven = false; |
|
894 | - $legend[0] = 'all'; |
|
895 | - $zmax = 1; |
|
896 | - $z_boundaries[0] = 100000; |
|
897 | - } elseif ($z_axis === 301) { |
|
898 | - $male_female = true; |
|
899 | - $zgiven = true; |
|
900 | - $legend[0] = I18N::translate('Male'); |
|
901 | - $legend[1] = I18N::translate('Female'); |
|
902 | - $zmax = 2; |
|
903 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
904 | - } elseif ($z_axis === 302) { |
|
905 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
906 | - } |
|
907 | - //-- reset the data array |
|
908 | - for ($i = 0; $i < $zmax; $i++) { |
|
909 | - for ($j = 0; $j < $xmax; $j++) { |
|
910 | - $ydata[$i][$j] = 0; |
|
884 | + if ($y_axis === 201) { |
|
885 | + $percentage = false; |
|
886 | + $ytitle = I18N::translate('Individuals'); |
|
887 | + } elseif ($y_axis === 202) { |
|
888 | + $percentage = true; |
|
889 | + $ytitle = I18N::translate('percentage'); |
|
890 | + } |
|
891 | + $male_female = false; |
|
892 | + if ($z_axis === 300) { |
|
893 | + $zgiven = false; |
|
894 | + $legend[0] = 'all'; |
|
895 | + $zmax = 1; |
|
896 | + $z_boundaries[0] = 100000; |
|
897 | + } elseif ($z_axis === 301) { |
|
898 | + $male_female = true; |
|
899 | + $zgiven = true; |
|
900 | + $legend[0] = I18N::translate('Male'); |
|
901 | + $legend[1] = I18N::translate('Female'); |
|
902 | + $zmax = 2; |
|
903 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
904 | + } elseif ($z_axis === 302) { |
|
905 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
906 | + } |
|
907 | + //-- reset the data array |
|
908 | + for ($i = 0; $i < $zmax; $i++) { |
|
909 | + for ($j = 0; $j < $xmax; $j++) { |
|
910 | + $ydata[$i][$j] = 0; |
|
911 | + } |
|
912 | + } |
|
913 | + $total = month_of_birth($z_axis, $z_boundaries, $stats); |
|
914 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
915 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
916 | + break; |
|
917 | + case '12': |
|
918 | + $monthdata = array(); |
|
919 | + for ($i = 0; $i < 12; ++$i) { |
|
920 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
921 | + } |
|
922 | + $xgiven = true; |
|
923 | + $zgiven = false; |
|
924 | + $title = I18N::translate('Month of death'); |
|
925 | + $xtitle = I18N::translate('month'); |
|
926 | + $ytitle = I18N::translate('numbers'); |
|
927 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
928 | + $xdata = $monthdata; |
|
929 | + $xmax = 12; |
|
930 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
931 | + calculate_legend($boundaries_z_axis); |
|
911 | 932 | } |
912 | - } |
|
913 | - $total = month_of_birth($z_axis, $z_boundaries, $stats); |
|
914 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
915 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
916 | - break; |
|
917 | -case '12': |
|
918 | - $monthdata = array(); |
|
919 | - for ($i = 0; $i < 12; ++$i) { |
|
920 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
921 | - } |
|
922 | - $xgiven = true; |
|
923 | - $zgiven = false; |
|
924 | - $title = I18N::translate('Month of death'); |
|
925 | - $xtitle = I18N::translate('month'); |
|
926 | - $ytitle = I18N::translate('numbers'); |
|
927 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
928 | - $xdata = $monthdata; |
|
929 | - $xmax = 12; |
|
930 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
931 | - calculate_legend($boundaries_z_axis); |
|
932 | - } |
|
933 | - $percentage = false; |
|
934 | - if ($y_axis === 201) { |
|
935 | 933 | $percentage = false; |
936 | - $ytitle = I18N::translate('Individuals'); |
|
937 | - } elseif ($y_axis === 202) { |
|
938 | - $percentage = true; |
|
939 | - $ytitle = I18N::translate('percentage'); |
|
940 | - } |
|
941 | - $male_female = false; |
|
942 | - if ($z_axis === 300) { |
|
943 | - $zgiven = false; |
|
944 | - $legend[0] = 'all'; |
|
945 | - $zmax = 1; |
|
946 | - $z_boundaries[0] = 100000; |
|
947 | - } elseif ($z_axis === 301) { |
|
948 | - $male_female = true; |
|
949 | - $zgiven = true; |
|
950 | - $legend[0] = I18N::translate('Male'); |
|
951 | - $legend[1] = I18N::translate('Female'); |
|
952 | - $zmax = 2; |
|
953 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
954 | - } elseif ($z_axis === 302) { |
|
955 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
956 | - } |
|
957 | - //-- reset the data array |
|
958 | - for ($i = 0; $i < $zmax; $i++) { |
|
959 | - for ($j = 0; $j < $xmax; $j++) { |
|
960 | - $ydata[$i][$j] = 0; |
|
934 | + if ($y_axis === 201) { |
|
935 | + $percentage = false; |
|
936 | + $ytitle = I18N::translate('Individuals'); |
|
937 | + } elseif ($y_axis === 202) { |
|
938 | + $percentage = true; |
|
939 | + $ytitle = I18N::translate('percentage'); |
|
940 | + } |
|
941 | + $male_female = false; |
|
942 | + if ($z_axis === 300) { |
|
943 | + $zgiven = false; |
|
944 | + $legend[0] = 'all'; |
|
945 | + $zmax = 1; |
|
946 | + $z_boundaries[0] = 100000; |
|
947 | + } elseif ($z_axis === 301) { |
|
948 | + $male_female = true; |
|
949 | + $zgiven = true; |
|
950 | + $legend[0] = I18N::translate('Male'); |
|
951 | + $legend[1] = I18N::translate('Female'); |
|
952 | + $zmax = 2; |
|
953 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
954 | + } elseif ($z_axis === 302) { |
|
955 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
956 | + } |
|
957 | + //-- reset the data array |
|
958 | + for ($i = 0; $i < $zmax; $i++) { |
|
959 | + for ($j = 0; $j < $xmax; $j++) { |
|
960 | + $ydata[$i][$j] = 0; |
|
961 | + } |
|
962 | + } |
|
963 | + $total = month_of_death($z_axis, $z_boundaries, $stats); |
|
964 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
965 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
966 | + break; |
|
967 | + case '13': |
|
968 | + $monthdata = array(); |
|
969 | + for ($i = 0; $i < 12; ++$i) { |
|
970 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
961 | 971 | } |
962 | - } |
|
963 | - $total = month_of_death($z_axis, $z_boundaries, $stats); |
|
964 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
965 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
966 | - break; |
|
967 | -case '13': |
|
968 | - $monthdata = array(); |
|
969 | - for ($i = 0; $i < 12; ++$i) { |
|
970 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
971 | - } |
|
972 | 972 | |
973 | - if ($z_axis === 301) { |
|
974 | - $z_axis = 300; |
|
975 | - } |
|
976 | - $xgiven = true; |
|
977 | - $zgiven = false; |
|
978 | - $title = I18N::translate('Month of marriage'); |
|
979 | - $xtitle = I18N::translate('month'); |
|
980 | - $ytitle = I18N::translate('numbers'); |
|
981 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
982 | - $xdata = $monthdata; |
|
983 | - $xmax = 12; |
|
984 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
985 | - calculate_legend($boundaries_z_axis); |
|
986 | - } |
|
987 | - $percentage = false; |
|
988 | - if ($y_axis === 201) { |
|
973 | + if ($z_axis === 301) { |
|
974 | + $z_axis = 300; |
|
975 | + } |
|
976 | + $xgiven = true; |
|
977 | + $zgiven = false; |
|
978 | + $title = I18N::translate('Month of marriage'); |
|
979 | + $xtitle = I18N::translate('month'); |
|
980 | + $ytitle = I18N::translate('numbers'); |
|
981 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
982 | + $xdata = $monthdata; |
|
983 | + $xmax = 12; |
|
984 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
985 | + calculate_legend($boundaries_z_axis); |
|
986 | + } |
|
989 | 987 | $percentage = false; |
990 | - $ytitle = I18N::translate('Families'); |
|
991 | - } elseif ($y_axis === 202) { |
|
992 | - $percentage = true; |
|
993 | - $ytitle = I18N::translate('percentage'); |
|
994 | - } |
|
995 | - $male_female = false; |
|
996 | - if ($z_axis === 300) { |
|
997 | - $zgiven = false; |
|
998 | - $legend[0] = 'all'; |
|
999 | - $zmax = 1; |
|
1000 | - $z_boundaries[0] = 100000; |
|
1001 | - } elseif ($z_axis === 301) { |
|
1002 | - $male_female = true; |
|
1003 | - $zgiven = true; |
|
1004 | - $legend[0] = I18N::translate('Male'); |
|
1005 | - $legend[1] = I18N::translate('Female'); |
|
1006 | - $zmax = 2; |
|
1007 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1008 | - } elseif ($z_axis === 302) { |
|
1009 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1010 | - } |
|
1011 | - //-- reset the data array |
|
1012 | - for ($i = 0; $i < $zmax; $i++) { |
|
1013 | - for ($j = 0; $j < $xmax; $j++) { |
|
1014 | - $ydata[$i][$j] = 0; |
|
988 | + if ($y_axis === 201) { |
|
989 | + $percentage = false; |
|
990 | + $ytitle = I18N::translate('Families'); |
|
991 | + } elseif ($y_axis === 202) { |
|
992 | + $percentage = true; |
|
993 | + $ytitle = I18N::translate('percentage'); |
|
994 | + } |
|
995 | + $male_female = false; |
|
996 | + if ($z_axis === 300) { |
|
997 | + $zgiven = false; |
|
998 | + $legend[0] = 'all'; |
|
999 | + $zmax = 1; |
|
1000 | + $z_boundaries[0] = 100000; |
|
1001 | + } elseif ($z_axis === 301) { |
|
1002 | + $male_female = true; |
|
1003 | + $zgiven = true; |
|
1004 | + $legend[0] = I18N::translate('Male'); |
|
1005 | + $legend[1] = I18N::translate('Female'); |
|
1006 | + $zmax = 2; |
|
1007 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1008 | + } elseif ($z_axis === 302) { |
|
1009 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1010 | + } |
|
1011 | + //-- reset the data array |
|
1012 | + for ($i = 0; $i < $zmax; $i++) { |
|
1013 | + for ($j = 0; $j < $xmax; $j++) { |
|
1014 | + $ydata[$i][$j] = 0; |
|
1015 | + } |
|
1016 | + } |
|
1017 | + $total = month_of_marriage($z_axis, $z_boundaries, $stats); |
|
1018 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1019 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1020 | + break; |
|
1021 | + case '14': |
|
1022 | + $monthdata = array(); |
|
1023 | + for ($i = 0; $i < 12; ++$i) { |
|
1024 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1025 | + } |
|
1026 | + $xgiven = true; |
|
1027 | + $zgiven = false; |
|
1028 | + $title = I18N::translate('Month of birth of first child in a relation'); |
|
1029 | + $xtitle = I18N::translate('month'); |
|
1030 | + $ytitle = I18N::translate('numbers'); |
|
1031 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1032 | + $xdata = $monthdata; |
|
1033 | + $xmax = 12; |
|
1034 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1035 | + calculate_legend($boundaries_z_axis); |
|
1015 | 1036 | } |
1016 | - } |
|
1017 | - $total = month_of_marriage($z_axis, $z_boundaries, $stats); |
|
1018 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1019 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1020 | - break; |
|
1021 | -case '14': |
|
1022 | - $monthdata = array(); |
|
1023 | - for ($i = 0; $i < 12; ++$i) { |
|
1024 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1025 | - } |
|
1026 | - $xgiven = true; |
|
1027 | - $zgiven = false; |
|
1028 | - $title = I18N::translate('Month of birth of first child in a relation'); |
|
1029 | - $xtitle = I18N::translate('month'); |
|
1030 | - $ytitle = I18N::translate('numbers'); |
|
1031 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1032 | - $xdata = $monthdata; |
|
1033 | - $xmax = 12; |
|
1034 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1035 | - calculate_legend($boundaries_z_axis); |
|
1036 | - } |
|
1037 | - $percentage = false; |
|
1038 | - if ($y_axis === 201) { |
|
1039 | 1037 | $percentage = false; |
1040 | - $ytitle = I18N::translate('Children'); |
|
1041 | - } elseif ($y_axis === 202) { |
|
1042 | - $percentage = true; |
|
1043 | - $ytitle = I18N::translate('percentage'); |
|
1044 | - } |
|
1045 | - $male_female = false; |
|
1046 | - if ($z_axis === 300) { |
|
1047 | - $zgiven = false; |
|
1048 | - $legend[0] = 'all'; |
|
1049 | - $zmax = 1; |
|
1050 | - $z_boundaries[0] = 100000; |
|
1051 | - } elseif ($z_axis === 301) { |
|
1052 | - $male_female = true; |
|
1053 | - $zgiven = true; |
|
1054 | - $legend[0] = I18N::translate('Male'); |
|
1055 | - $legend[1] = I18N::translate('Female'); |
|
1056 | - $zmax = 2; |
|
1057 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1058 | - } elseif ($z_axis === 302) { |
|
1059 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1060 | - } |
|
1061 | - //-- reset the data array |
|
1062 | - for ($i = 0; $i < $zmax; $i++) { |
|
1063 | - for ($j = 0; $j < $xmax; $j++) { |
|
1064 | - $ydata[$i][$j] = 0; |
|
1038 | + if ($y_axis === 201) { |
|
1039 | + $percentage = false; |
|
1040 | + $ytitle = I18N::translate('Children'); |
|
1041 | + } elseif ($y_axis === 202) { |
|
1042 | + $percentage = true; |
|
1043 | + $ytitle = I18N::translate('percentage'); |
|
1044 | + } |
|
1045 | + $male_female = false; |
|
1046 | + if ($z_axis === 300) { |
|
1047 | + $zgiven = false; |
|
1048 | + $legend[0] = 'all'; |
|
1049 | + $zmax = 1; |
|
1050 | + $z_boundaries[0] = 100000; |
|
1051 | + } elseif ($z_axis === 301) { |
|
1052 | + $male_female = true; |
|
1053 | + $zgiven = true; |
|
1054 | + $legend[0] = I18N::translate('Male'); |
|
1055 | + $legend[1] = I18N::translate('Female'); |
|
1056 | + $zmax = 2; |
|
1057 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1058 | + } elseif ($z_axis === 302) { |
|
1059 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1060 | + } |
|
1061 | + //-- reset the data array |
|
1062 | + for ($i = 0; $i < $zmax; $i++) { |
|
1063 | + for ($j = 0; $j < $xmax; $j++) { |
|
1064 | + $ydata[$i][$j] = 0; |
|
1065 | + } |
|
1066 | + } |
|
1067 | + $total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats); |
|
1068 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1069 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1070 | + break; |
|
1071 | + case '15': |
|
1072 | + $monthdata = array(); |
|
1073 | + for ($i = 0; $i < 12; ++$i) { |
|
1074 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1065 | 1075 | } |
1066 | - } |
|
1067 | - $total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats); |
|
1068 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1069 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1070 | - break; |
|
1071 | -case '15': |
|
1072 | - $monthdata = array(); |
|
1073 | - for ($i = 0; $i < 12; ++$i) { |
|
1074 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1075 | - } |
|
1076 | 1076 | |
1077 | - if ($z_axis === 301) { |
|
1078 | - $z_axis = 300; |
|
1079 | - } |
|
1080 | - $xgiven = true; |
|
1081 | - $zgiven = false; |
|
1082 | - $title = I18N::translate('Month of first marriage'); |
|
1083 | - $xtitle = I18N::translate('month'); |
|
1084 | - $ytitle = I18N::translate('numbers'); |
|
1085 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1086 | - $xdata = $monthdata; |
|
1087 | - $xmax = 12; |
|
1088 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1089 | - calculate_legend($boundaries_z_axis); |
|
1090 | - } |
|
1091 | - $percentage = false; |
|
1092 | - if ($y_axis === 201) { |
|
1093 | - $percentage = false; |
|
1094 | - $ytitle = I18N::translate('Families'); |
|
1095 | - } elseif ($y_axis === 202) { |
|
1096 | - $percentage = true; |
|
1097 | - $ytitle = I18N::translate('percentage'); |
|
1098 | - } |
|
1099 | - $male_female = false; |
|
1100 | - if ($z_axis === 300) { |
|
1101 | - $zgiven = false; |
|
1102 | - $legend[0] = 'all'; |
|
1103 | - $zmax = 1; |
|
1104 | - $z_boundaries[0] = 100000; |
|
1105 | - } elseif ($z_axis === 301) { |
|
1106 | - $male_female = true; |
|
1107 | - $zgiven = true; |
|
1108 | - $legend[0] = I18N::translate('Male'); |
|
1109 | - $legend[1] = I18N::translate('Female'); |
|
1110 | - $zmax = 2; |
|
1111 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1112 | - } elseif ($z_axis === 302) { |
|
1113 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1114 | - } |
|
1115 | - //-- reset the data array |
|
1116 | - for ($i = 0; $i < $zmax; $i++) { |
|
1117 | - for ($j = 0; $j < $xmax; $j++) { |
|
1118 | - $ydata[$i][$j] = 0; |
|
1077 | + if ($z_axis === 301) { |
|
1078 | + $z_axis = 300; |
|
1079 | + } |
|
1080 | + $xgiven = true; |
|
1081 | + $zgiven = false; |
|
1082 | + $title = I18N::translate('Month of first marriage'); |
|
1083 | + $xtitle = I18N::translate('month'); |
|
1084 | + $ytitle = I18N::translate('numbers'); |
|
1085 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1086 | + $xdata = $monthdata; |
|
1087 | + $xmax = 12; |
|
1088 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1089 | + calculate_legend($boundaries_z_axis); |
|
1119 | 1090 | } |
1120 | - } |
|
1121 | - $total = month_of_first_marriage($z_axis, $z_boundaries, $stats); |
|
1122 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1123 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1124 | - break; |
|
1125 | -case '17': |
|
1126 | - $monthdata = array(); |
|
1127 | - for ($i = 0; $i < 12; ++$i) { |
|
1128 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1129 | - } |
|
1130 | - $xgiven = false; |
|
1131 | - $zgiven = false; |
|
1132 | - $title = I18N::translate('Age related to birth year'); |
|
1133 | - $xtitle = I18N::translate('age'); |
|
1134 | - $ytitle = I18N::translate('numbers'); |
|
1135 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1136 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1137 | - calculate_axis($boundaries_x_axis); |
|
1138 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1139 | - calculate_legend($boundaries_z_axis); |
|
1140 | - } |
|
1141 | - $percentage = false; |
|
1142 | - if ($y_axis === 201) { |
|
1143 | 1091 | $percentage = false; |
1144 | - $ytitle = I18N::translate('Individuals'); |
|
1145 | - } elseif ($y_axis === 202) { |
|
1146 | - $percentage = true; |
|
1147 | - $ytitle = I18N::translate('percentage'); |
|
1148 | - } |
|
1149 | - $male_female = false; |
|
1150 | - if ($z_axis === 300) { |
|
1151 | - $zgiven = false; |
|
1152 | - $legend[0] = 'all'; |
|
1153 | - $zmax = 1; |
|
1154 | - $z_boundaries[0] = 100000; |
|
1155 | - } elseif ($z_axis === 301) { |
|
1156 | - $male_female = true; |
|
1157 | - $zgiven = true; |
|
1158 | - $legend[0] = I18N::translate('Male'); |
|
1159 | - $legend[1] = I18N::translate('Female'); |
|
1160 | - $zmax = 2; |
|
1161 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1162 | - } elseif ($z_axis === 302) { |
|
1163 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1164 | - } |
|
1165 | - //-- reset the data array |
|
1166 | - for ($i = 0; $i < $zmax; $i++) { |
|
1167 | - for ($j = 0; $j < $xmax; $j++) { |
|
1168 | - $ydata[$i][$j] = 0; |
|
1092 | + if ($y_axis === 201) { |
|
1093 | + $percentage = false; |
|
1094 | + $ytitle = I18N::translate('Families'); |
|
1095 | + } elseif ($y_axis === 202) { |
|
1096 | + $percentage = true; |
|
1097 | + $ytitle = I18N::translate('percentage'); |
|
1098 | + } |
|
1099 | + $male_female = false; |
|
1100 | + if ($z_axis === 300) { |
|
1101 | + $zgiven = false; |
|
1102 | + $legend[0] = 'all'; |
|
1103 | + $zmax = 1; |
|
1104 | + $z_boundaries[0] = 100000; |
|
1105 | + } elseif ($z_axis === 301) { |
|
1106 | + $male_female = true; |
|
1107 | + $zgiven = true; |
|
1108 | + $legend[0] = I18N::translate('Male'); |
|
1109 | + $legend[1] = I18N::translate('Female'); |
|
1110 | + $zmax = 2; |
|
1111 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1112 | + } elseif ($z_axis === 302) { |
|
1113 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1114 | + } |
|
1115 | + //-- reset the data array |
|
1116 | + for ($i = 0; $i < $zmax; $i++) { |
|
1117 | + for ($j = 0; $j < $xmax; $j++) { |
|
1118 | + $ydata[$i][$j] = 0; |
|
1119 | + } |
|
1120 | + } |
|
1121 | + $total = month_of_first_marriage($z_axis, $z_boundaries, $stats); |
|
1122 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1123 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1124 | + break; |
|
1125 | + case '17': |
|
1126 | + $monthdata = array(); |
|
1127 | + for ($i = 0; $i < 12; ++$i) { |
|
1128 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1129 | + } |
|
1130 | + $xgiven = false; |
|
1131 | + $zgiven = false; |
|
1132 | + $title = I18N::translate('Age related to birth year'); |
|
1133 | + $xtitle = I18N::translate('age'); |
|
1134 | + $ytitle = I18N::translate('numbers'); |
|
1135 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1136 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1137 | + calculate_axis($boundaries_x_axis); |
|
1138 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1139 | + calculate_legend($boundaries_z_axis); |
|
1169 | 1140 | } |
1170 | - } |
|
1171 | - $total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats); |
|
1172 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1173 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1174 | - break; |
|
1175 | -case '18': |
|
1176 | - $monthdata = array(); |
|
1177 | - for ($i = 0; $i < 12; ++$i) { |
|
1178 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1179 | - } |
|
1180 | - $xgiven = false; |
|
1181 | - $zgiven = false; |
|
1182 | - $title = I18N::translate('Age related to death year'); |
|
1183 | - $xtitle = I18N::translate('age'); |
|
1184 | - $ytitle = I18N::translate('numbers'); |
|
1185 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1186 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1187 | - calculate_axis($boundaries_x_axis); |
|
1188 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1189 | - calculate_legend($boundaries_z_axis); |
|
1190 | - } |
|
1191 | - $percentage = false; |
|
1192 | - if ($y_axis === 201) { |
|
1193 | 1141 | $percentage = false; |
1194 | - $ytitle = I18N::translate('Individuals'); |
|
1195 | - } elseif ($y_axis === 202) { |
|
1196 | - $percentage = true; |
|
1197 | - $ytitle = I18N::translate('percentage'); |
|
1198 | - } |
|
1199 | - $male_female = false; |
|
1200 | - if ($z_axis === 300) { |
|
1201 | - $zgiven = false; |
|
1202 | - $legend[0] = 'all'; |
|
1203 | - $zmax = 1; |
|
1204 | - $z_boundaries[0] = 100000; |
|
1205 | - } elseif ($z_axis === 301) { |
|
1206 | - $male_female = true; |
|
1207 | - $zgiven = true; |
|
1208 | - $legend[0] = I18N::translate('Male'); |
|
1209 | - $legend[1] = I18N::translate('Female'); |
|
1210 | - $zmax = 2; |
|
1211 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1212 | - } elseif ($z_axis === 302) { |
|
1213 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1214 | - } |
|
1215 | - //-- reset the data array |
|
1216 | - for ($i = 0; $i < $zmax; $i++) { |
|
1217 | - for ($j = 0; $j < $xmax; $j++) { |
|
1218 | - $ydata[$i][$j] = 0; |
|
1142 | + if ($y_axis === 201) { |
|
1143 | + $percentage = false; |
|
1144 | + $ytitle = I18N::translate('Individuals'); |
|
1145 | + } elseif ($y_axis === 202) { |
|
1146 | + $percentage = true; |
|
1147 | + $ytitle = I18N::translate('percentage'); |
|
1148 | + } |
|
1149 | + $male_female = false; |
|
1150 | + if ($z_axis === 300) { |
|
1151 | + $zgiven = false; |
|
1152 | + $legend[0] = 'all'; |
|
1153 | + $zmax = 1; |
|
1154 | + $z_boundaries[0] = 100000; |
|
1155 | + } elseif ($z_axis === 301) { |
|
1156 | + $male_female = true; |
|
1157 | + $zgiven = true; |
|
1158 | + $legend[0] = I18N::translate('Male'); |
|
1159 | + $legend[1] = I18N::translate('Female'); |
|
1160 | + $zmax = 2; |
|
1161 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1162 | + } elseif ($z_axis === 302) { |
|
1163 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1164 | + } |
|
1165 | + //-- reset the data array |
|
1166 | + for ($i = 0; $i < $zmax; $i++) { |
|
1167 | + for ($j = 0; $j < $xmax; $j++) { |
|
1168 | + $ydata[$i][$j] = 0; |
|
1169 | + } |
|
1170 | + } |
|
1171 | + $total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats); |
|
1172 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1173 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1174 | + break; |
|
1175 | + case '18': |
|
1176 | + $monthdata = array(); |
|
1177 | + for ($i = 0; $i < 12; ++$i) { |
|
1178 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1179 | + } |
|
1180 | + $xgiven = false; |
|
1181 | + $zgiven = false; |
|
1182 | + $title = I18N::translate('Age related to death year'); |
|
1183 | + $xtitle = I18N::translate('age'); |
|
1184 | + $ytitle = I18N::translate('numbers'); |
|
1185 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1186 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1187 | + calculate_axis($boundaries_x_axis); |
|
1188 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1189 | + calculate_legend($boundaries_z_axis); |
|
1219 | 1190 | } |
1220 | - } |
|
1221 | - $total = lifespan_by_death_year($z_axis, $z_boundaries, $stats); |
|
1222 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1223 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1224 | - break; |
|
1225 | -case '19': |
|
1226 | - $monthdata = array(); |
|
1227 | - for ($i = 0; $i < 12; ++$i) { |
|
1228 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1229 | - } |
|
1230 | - $xgiven = false; |
|
1231 | - $zgiven = false; |
|
1232 | - $title = I18N::translate('Age in year of marriage'); |
|
1233 | - $xtitle = I18N::translate('age'); |
|
1234 | - $ytitle = I18N::translate('numbers'); |
|
1235 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1236 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1237 | - calculate_axis($boundaries_x_axis); |
|
1238 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1239 | - calculate_legend($boundaries_z_axis); |
|
1240 | - } |
|
1241 | - $percentage = false; |
|
1242 | - if ($y_axis === 201) { |
|
1243 | 1191 | $percentage = false; |
1244 | - $ytitle = I18N::translate('Individuals'); |
|
1245 | - } elseif ($y_axis === 202) { |
|
1246 | - $percentage = true; |
|
1247 | - $ytitle = I18N::translate('percentage'); |
|
1248 | - } |
|
1249 | - $male_female = false; |
|
1250 | - $z_boundaries[0] = 100000; |
|
1251 | - if ($z_axis === 300) { |
|
1252 | - $zgiven = false; |
|
1253 | - $legend[0] = 'all'; |
|
1254 | - $zmax = 1; |
|
1255 | - } elseif ($z_axis === 301) { |
|
1256 | - $male_female = true; |
|
1257 | - $zgiven = true; |
|
1258 | - $legend[0] = I18N::translate('Male'); |
|
1259 | - $legend[1] = I18N::translate('Female'); |
|
1260 | - $zmax = 2; |
|
1261 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1262 | - } elseif ($z_axis === 302) { |
|
1263 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1264 | - } |
|
1265 | - //-- reset the data array |
|
1266 | - for ($i = 0; $i < $zmax; $i++) { |
|
1267 | - for ($j = 0; $j < $xmax; $j++) { |
|
1268 | - $ydata[$i][$j] = 0; |
|
1192 | + if ($y_axis === 201) { |
|
1193 | + $percentage = false; |
|
1194 | + $ytitle = I18N::translate('Individuals'); |
|
1195 | + } elseif ($y_axis === 202) { |
|
1196 | + $percentage = true; |
|
1197 | + $ytitle = I18N::translate('percentage'); |
|
1198 | + } |
|
1199 | + $male_female = false; |
|
1200 | + if ($z_axis === 300) { |
|
1201 | + $zgiven = false; |
|
1202 | + $legend[0] = 'all'; |
|
1203 | + $zmax = 1; |
|
1204 | + $z_boundaries[0] = 100000; |
|
1205 | + } elseif ($z_axis === 301) { |
|
1206 | + $male_female = true; |
|
1207 | + $zgiven = true; |
|
1208 | + $legend[0] = I18N::translate('Male'); |
|
1209 | + $legend[1] = I18N::translate('Female'); |
|
1210 | + $zmax = 2; |
|
1211 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1212 | + } elseif ($z_axis === 302) { |
|
1213 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1214 | + } |
|
1215 | + //-- reset the data array |
|
1216 | + for ($i = 0; $i < $zmax; $i++) { |
|
1217 | + for ($j = 0; $j < $xmax; $j++) { |
|
1218 | + $ydata[$i][$j] = 0; |
|
1219 | + } |
|
1220 | + } |
|
1221 | + $total = lifespan_by_death_year($z_axis, $z_boundaries, $stats); |
|
1222 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1223 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1224 | + break; |
|
1225 | + case '19': |
|
1226 | + $monthdata = array(); |
|
1227 | + for ($i = 0; $i < 12; ++$i) { |
|
1228 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1229 | + } |
|
1230 | + $xgiven = false; |
|
1231 | + $zgiven = false; |
|
1232 | + $title = I18N::translate('Age in year of marriage'); |
|
1233 | + $xtitle = I18N::translate('age'); |
|
1234 | + $ytitle = I18N::translate('numbers'); |
|
1235 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1236 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1237 | + calculate_axis($boundaries_x_axis); |
|
1238 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1239 | + calculate_legend($boundaries_z_axis); |
|
1269 | 1240 | } |
1270 | - } |
|
1271 | - $total = age_at_marriage($z_axis, $z_boundaries, $stats); |
|
1272 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1273 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1274 | - break; |
|
1275 | -case '20': |
|
1276 | - $monthdata = array(); |
|
1277 | - for ($i = 0; $i < 12; ++$i) { |
|
1278 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1279 | - } |
|
1280 | - $xgiven = false; |
|
1281 | - $zgiven = false; |
|
1282 | - $title = I18N::translate('Age in year of first marriage'); |
|
1283 | - $xtitle = I18N::translate('age'); |
|
1284 | - $ytitle = I18N::translate('numbers'); |
|
1285 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1286 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1287 | - calculate_axis($boundaries_x_axis); |
|
1288 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1289 | - calculate_legend($boundaries_z_axis); |
|
1290 | - } |
|
1291 | - $percentage = false; |
|
1292 | - if ($y_axis === 201) { |
|
1293 | 1241 | $percentage = false; |
1294 | - $ytitle = I18N::translate('Individuals'); |
|
1295 | - } elseif ($y_axis === 202) { |
|
1296 | - $percentage = true; |
|
1297 | - $ytitle = I18N::translate('percentage'); |
|
1298 | - } |
|
1299 | - $male_female = false; |
|
1300 | - if ($z_axis === 300) { |
|
1301 | - $zgiven = false; |
|
1302 | - $legend[0] = 'all'; |
|
1303 | - $zmax = 1; |
|
1242 | + if ($y_axis === 201) { |
|
1243 | + $percentage = false; |
|
1244 | + $ytitle = I18N::translate('Individuals'); |
|
1245 | + } elseif ($y_axis === 202) { |
|
1246 | + $percentage = true; |
|
1247 | + $ytitle = I18N::translate('percentage'); |
|
1248 | + } |
|
1249 | + $male_female = false; |
|
1304 | 1250 | $z_boundaries[0] = 100000; |
1305 | - } elseif ($z_axis === 301) { |
|
1306 | - $male_female = true; |
|
1307 | - $zgiven = true; |
|
1308 | - $legend[0] = I18N::translate('Male'); |
|
1309 | - $legend[1] = I18N::translate('Female'); |
|
1310 | - $zmax = 2; |
|
1311 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1312 | - } elseif ($z_axis === 302) { |
|
1313 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1314 | - } |
|
1315 | - //-- reset the data array |
|
1316 | - for ($i = 0; $i < $zmax; $i++) { |
|
1317 | - for ($j = 0; $j < $xmax; $j++) { |
|
1318 | - $ydata[$i][$j] = 0; |
|
1251 | + if ($z_axis === 300) { |
|
1252 | + $zgiven = false; |
|
1253 | + $legend[0] = 'all'; |
|
1254 | + $zmax = 1; |
|
1255 | + } elseif ($z_axis === 301) { |
|
1256 | + $male_female = true; |
|
1257 | + $zgiven = true; |
|
1258 | + $legend[0] = I18N::translate('Male'); |
|
1259 | + $legend[1] = I18N::translate('Female'); |
|
1260 | + $zmax = 2; |
|
1261 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1262 | + } elseif ($z_axis === 302) { |
|
1263 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1264 | + } |
|
1265 | + //-- reset the data array |
|
1266 | + for ($i = 0; $i < $zmax; $i++) { |
|
1267 | + for ($j = 0; $j < $xmax; $j++) { |
|
1268 | + $ydata[$i][$j] = 0; |
|
1269 | + } |
|
1270 | + } |
|
1271 | + $total = age_at_marriage($z_axis, $z_boundaries, $stats); |
|
1272 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1273 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1274 | + break; |
|
1275 | + case '20': |
|
1276 | + $monthdata = array(); |
|
1277 | + for ($i = 0; $i < 12; ++$i) { |
|
1278 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1279 | + } |
|
1280 | + $xgiven = false; |
|
1281 | + $zgiven = false; |
|
1282 | + $title = I18N::translate('Age in year of first marriage'); |
|
1283 | + $xtitle = I18N::translate('age'); |
|
1284 | + $ytitle = I18N::translate('numbers'); |
|
1285 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1286 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1287 | + calculate_axis($boundaries_x_axis); |
|
1288 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1289 | + calculate_legend($boundaries_z_axis); |
|
1319 | 1290 | } |
1320 | - } |
|
1321 | - $total = age_at_first_marriage($z_axis, $z_boundaries, $stats); |
|
1322 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1323 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1324 | - break; |
|
1325 | -case '21': |
|
1326 | - $monthdata = array(); |
|
1327 | - for ($i = 0; $i < 12; ++$i) { |
|
1328 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1329 | - } |
|
1330 | - $xgiven = false; |
|
1331 | - $zgiven = false; |
|
1332 | - $title = I18N::translate('Number of children'); |
|
1333 | - $xtitle = I18N::translate('children'); |
|
1334 | - $ytitle = I18N::translate('numbers'); |
|
1335 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers'); |
|
1336 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1337 | - calculate_axis($boundaries_x_axis); |
|
1338 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1339 | - calculate_legend($boundaries_z_axis); |
|
1340 | - } |
|
1341 | - $percentage = false; |
|
1342 | - if ($y_axis === 201) { |
|
1343 | 1291 | $percentage = false; |
1344 | - $ytitle = I18N::translate('Families'); |
|
1345 | - } elseif ($y_axis === 202) { |
|
1346 | - $percentage = true; |
|
1347 | - $ytitle = I18N::translate('percentage'); |
|
1348 | - } |
|
1349 | - $male_female = false; |
|
1350 | - if ($z_axis === 300) { |
|
1351 | - $zgiven = false; |
|
1352 | - $legend[0] = 'all'; |
|
1353 | - $zmax = 1; |
|
1354 | - $z_boundaries[0] = 100000; |
|
1355 | - } elseif ($z_axis === 301) { |
|
1356 | - $male_female = true; |
|
1357 | - $zgiven = true; |
|
1358 | - $legend[0] = I18N::translate('Male'); |
|
1359 | - $legend[1] = I18N::translate('Female'); |
|
1360 | - $zmax = 2; |
|
1361 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1362 | - } elseif ($z_axis === 302) { |
|
1363 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1364 | - } |
|
1365 | - //-- reset the data array |
|
1366 | - for ($i = 0; $i < $zmax; $i++) { |
|
1367 | - for ($j = 0; $j < $xmax; $j++) { |
|
1368 | - $ydata[$i][$j] = 0; |
|
1292 | + if ($y_axis === 201) { |
|
1293 | + $percentage = false; |
|
1294 | + $ytitle = I18N::translate('Individuals'); |
|
1295 | + } elseif ($y_axis === 202) { |
|
1296 | + $percentage = true; |
|
1297 | + $ytitle = I18N::translate('percentage'); |
|
1369 | 1298 | } |
1370 | - } |
|
1371 | - $total = number_of_children($z_axis, $z_boundaries, $stats); |
|
1372 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren(); |
|
1373 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1374 | - break; |
|
1375 | -default: |
|
1376 | - echo '<i class="icon-loading-large"></i>'; |
|
1377 | - break; |
|
1299 | + $male_female = false; |
|
1300 | + if ($z_axis === 300) { |
|
1301 | + $zgiven = false; |
|
1302 | + $legend[0] = 'all'; |
|
1303 | + $zmax = 1; |
|
1304 | + $z_boundaries[0] = 100000; |
|
1305 | + } elseif ($z_axis === 301) { |
|
1306 | + $male_female = true; |
|
1307 | + $zgiven = true; |
|
1308 | + $legend[0] = I18N::translate('Male'); |
|
1309 | + $legend[1] = I18N::translate('Female'); |
|
1310 | + $zmax = 2; |
|
1311 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1312 | + } elseif ($z_axis === 302) { |
|
1313 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1314 | + } |
|
1315 | + //-- reset the data array |
|
1316 | + for ($i = 0; $i < $zmax; $i++) { |
|
1317 | + for ($j = 0; $j < $xmax; $j++) { |
|
1318 | + $ydata[$i][$j] = 0; |
|
1319 | + } |
|
1320 | + } |
|
1321 | + $total = age_at_first_marriage($z_axis, $z_boundaries, $stats); |
|
1322 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1323 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1324 | + break; |
|
1325 | + case '21': |
|
1326 | + $monthdata = array(); |
|
1327 | + for ($i = 0; $i < 12; ++$i) { |
|
1328 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1329 | + } |
|
1330 | + $xgiven = false; |
|
1331 | + $zgiven = false; |
|
1332 | + $title = I18N::translate('Number of children'); |
|
1333 | + $xtitle = I18N::translate('children'); |
|
1334 | + $ytitle = I18N::translate('numbers'); |
|
1335 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers'); |
|
1336 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1337 | + calculate_axis($boundaries_x_axis); |
|
1338 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1339 | + calculate_legend($boundaries_z_axis); |
|
1340 | + } |
|
1341 | + $percentage = false; |
|
1342 | + if ($y_axis === 201) { |
|
1343 | + $percentage = false; |
|
1344 | + $ytitle = I18N::translate('Families'); |
|
1345 | + } elseif ($y_axis === 202) { |
|
1346 | + $percentage = true; |
|
1347 | + $ytitle = I18N::translate('percentage'); |
|
1348 | + } |
|
1349 | + $male_female = false; |
|
1350 | + if ($z_axis === 300) { |
|
1351 | + $zgiven = false; |
|
1352 | + $legend[0] = 'all'; |
|
1353 | + $zmax = 1; |
|
1354 | + $z_boundaries[0] = 100000; |
|
1355 | + } elseif ($z_axis === 301) { |
|
1356 | + $male_female = true; |
|
1357 | + $zgiven = true; |
|
1358 | + $legend[0] = I18N::translate('Male'); |
|
1359 | + $legend[1] = I18N::translate('Female'); |
|
1360 | + $zmax = 2; |
|
1361 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1362 | + } elseif ($z_axis === 302) { |
|
1363 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1364 | + } |
|
1365 | + //-- reset the data array |
|
1366 | + for ($i = 0; $i < $zmax; $i++) { |
|
1367 | + for ($j = 0; $j < $xmax; $j++) { |
|
1368 | + $ydata[$i][$j] = 0; |
|
1369 | + } |
|
1370 | + } |
|
1371 | + $total = number_of_children($z_axis, $z_boundaries, $stats); |
|
1372 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren(); |
|
1373 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1374 | + break; |
|
1375 | + default: |
|
1376 | + echo '<i class="icon-loading-large"></i>'; |
|
1377 | + break; |
|
1378 | 1378 | } |
1379 | 1379 | echo '</div>'; |
@@ -780,69 +780,69 @@ discard block |
||
780 | 780 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_QUICK', $INDI_FACTS_QUICK)); |
781 | 781 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_UNIQUE', $INDI_FACTS_UNIQUE)); |
782 | 782 | switch ($LANGUAGE) { |
783 | - case 'catalan': |
|
784 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca')); |
|
785 | - break; |
|
786 | - case 'english-uk': |
|
787 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB')); |
|
788 | - break; |
|
789 | - case 'polish': |
|
790 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl')); |
|
791 | - break; |
|
792 | - case 'italian': |
|
793 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it')); |
|
794 | - break; |
|
795 | - case 'spanish': |
|
796 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es')); |
|
797 | - break; |
|
798 | - case 'finnish': |
|
799 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi')); |
|
800 | - break; |
|
801 | - case 'french': |
|
802 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr')); |
|
803 | - break; |
|
804 | - case 'german': |
|
805 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de')); |
|
806 | - break; |
|
807 | - case 'danish': |
|
808 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da')); |
|
809 | - break; |
|
810 | - case 'portuguese': |
|
811 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt')); |
|
812 | - break; |
|
813 | - case 'hebrew': |
|
814 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he')); |
|
815 | - break; |
|
816 | - case 'estonian': |
|
817 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et')); |
|
818 | - break; |
|
819 | - case 'turkish': |
|
820 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr')); |
|
821 | - break; |
|
822 | - case 'dutch': |
|
823 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl')); |
|
824 | - break; |
|
825 | - case 'slovak': |
|
826 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk')); |
|
827 | - break; |
|
828 | - case 'norwegian': |
|
829 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn')); |
|
830 | - break; |
|
831 | - case 'slovenian': |
|
832 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl')); |
|
833 | - break; |
|
834 | - case 'hungarian': |
|
835 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu')); |
|
836 | - break; |
|
837 | - case 'swedish': |
|
838 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv')); |
|
839 | - break; |
|
840 | - case 'russian': |
|
841 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru')); |
|
842 | - break; |
|
843 | - default: |
|
844 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US')); |
|
845 | - break; |
|
783 | + case 'catalan': |
|
784 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca')); |
|
785 | + break; |
|
786 | + case 'english-uk': |
|
787 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB')); |
|
788 | + break; |
|
789 | + case 'polish': |
|
790 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl')); |
|
791 | + break; |
|
792 | + case 'italian': |
|
793 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it')); |
|
794 | + break; |
|
795 | + case 'spanish': |
|
796 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es')); |
|
797 | + break; |
|
798 | + case 'finnish': |
|
799 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi')); |
|
800 | + break; |
|
801 | + case 'french': |
|
802 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr')); |
|
803 | + break; |
|
804 | + case 'german': |
|
805 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de')); |
|
806 | + break; |
|
807 | + case 'danish': |
|
808 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da')); |
|
809 | + break; |
|
810 | + case 'portuguese': |
|
811 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt')); |
|
812 | + break; |
|
813 | + case 'hebrew': |
|
814 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he')); |
|
815 | + break; |
|
816 | + case 'estonian': |
|
817 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et')); |
|
818 | + break; |
|
819 | + case 'turkish': |
|
820 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr')); |
|
821 | + break; |
|
822 | + case 'dutch': |
|
823 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl')); |
|
824 | + break; |
|
825 | + case 'slovak': |
|
826 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk')); |
|
827 | + break; |
|
828 | + case 'norwegian': |
|
829 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn')); |
|
830 | + break; |
|
831 | + case 'slovenian': |
|
832 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl')); |
|
833 | + break; |
|
834 | + case 'hungarian': |
|
835 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu')); |
|
836 | + break; |
|
837 | + case 'swedish': |
|
838 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv')); |
|
839 | + break; |
|
840 | + case 'russian': |
|
841 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru')); |
|
842 | + break; |
|
843 | + default: |
|
844 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US')); |
|
845 | + break; |
|
846 | 846 | } |
847 | 847 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_ALIVE_AGE', $MAX_ALIVE_AGE)); |
848 | 848 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_DESCENDANCY_GENERATIONS', $MAX_DESCENDANCY_GENERATIONS)); |
@@ -902,26 +902,26 @@ discard block |
||
902 | 902 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_LIST_STYLE', $SURNAME_LIST_STYLE)); |
903 | 903 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_TRADITION', $SURNAME_TRADITION)); |
904 | 904 | switch ($THEME_DIR) { |
905 | - case '': |
|
906 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', '')); |
|
907 | - break; |
|
908 | - case 'themes/cloudy/': |
|
909 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds')); |
|
910 | - break; |
|
911 | - case 'themes/minimal/': |
|
912 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal')); |
|
913 | - break; |
|
914 | - case 'themes/simplyblue/': |
|
915 | - case 'themes/simplygreen/': |
|
916 | - case 'themes/simplyred/': |
|
917 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors')); |
|
918 | - break; |
|
919 | - case 'themes/xenea/': |
|
920 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea')); |
|
921 | - break; |
|
922 | - default: |
|
923 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees')); |
|
924 | - break; |
|
905 | + case '': |
|
906 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', '')); |
|
907 | + break; |
|
908 | + case 'themes/cloudy/': |
|
909 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds')); |
|
910 | + break; |
|
911 | + case 'themes/minimal/': |
|
912 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal')); |
|
913 | + break; |
|
914 | + case 'themes/simplyblue/': |
|
915 | + case 'themes/simplygreen/': |
|
916 | + case 'themes/simplyred/': |
|
917 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors')); |
|
918 | + break; |
|
919 | + case 'themes/xenea/': |
|
920 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea')); |
|
921 | + break; |
|
922 | + default: |
|
923 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees')); |
|
924 | + break; |
|
925 | 925 | } |
926 | 926 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THUMBNAIL_WIDTH', $THUMBNAIL_WIDTH)); |
927 | 927 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY)); |