public function modAction($modAction) { global $controller; switch ($modAction) { case 'menu-add-favorite': // Process the "add to user favorites" menu item on indi/fam/etc. pages $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF)); if (WT_USER_ID && $record->canShowName()) { self::addFavorite(array('user_id' => WT_USER_ID, 'gedcom_id' => $record->getGedcomId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null)); WT_FlashMessages::addMessage(WT_I18N::translate('“%s” has been added to your favorites.', $record->getFullName())); } break; } }
public function __construct() { // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links = 0; foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isOld() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) { // These can be links or inline. Only delete links. if (!$fact->isOld() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) { $this->record->deleteFact($fact->getFactId(), false); WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } if ($broken_links) { // Reload the updated family $this->record = WT_GedcomRecord::getInstance($this->record->getXref()); } } parent::__construct(); // We want robots to index this page $this->setMetaRobots('index,follow'); // Set a page title if ($this->record) { $this->setCanonicalUrl($this->record->getHtmlUrl()); if ($this->record->canShowName()) { // e.g. "John Doe" or "1881 Census of Wales" $this->setPageTitle($this->record->getFullName()); } else { // e.g. "Individual" or "Source" $record = $this->record; $this->setPageTitle(WT_Gedcom_Tag::getLabel($record::RECORD_TYPE)); } } else { // No such record $this->setPageTitle(WT_I18N::translate('Private')); } }
foreach (WT_Tree::getAll() as $tree) { echo '<tr><td>', $tree->tree_title_html, '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-rootid', $tree->userPreference($user_id, 'rootid')), '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-gedcomid', $tree->userPreference($user_id, 'gedcomid')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-canedit', $ALL_EDIT_OPTIONS, null, $tree->userPreference($user_id, 'canedit')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-RELATIONSHIP_PATH_LENGTH', array(0 => WT_I18N::translate('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10), null, $tree->userPreference($user_id, 'RELATIONSHIP_PATH_LENGTH')), '</td></tr>'; } echo '</table>'; exit; case 'createuser': if (!WT_Filter::checkCsrf()) { $action = 'createform'; } elseif (User::findByIdentifier($username)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')); $action = 'createform'; } elseif (User::findByIdentifier($emailaddress)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.')); $action = 'createform'; } elseif ($pass1 != $pass2) { WT_FlashMessages::addMessage(WT_I18N::translate('Passwords do not match.')); $action = 'createform'; } else { $user = User::create($username, $realname, $emailaddress, $pass1); $user->setSetting('reg_timestamp', date('U'))->setSetting('sessiontime', '0')->setSetting('theme', $user_theme)->setSetting('language', $user_language)->setSetting('contactmethod', $new_contact_method)->setSetting('comment', $new_comment)->setSetting('auto_accept', $new_auto_accept)->setSetting('canadmin', $canadmin)->setSetting('visibleonline', $visibleonline)->setSetting('editaccount', $editaccount)->setSetting('verified', $verified)->setSetting('verified_by_admin', $verified_by_admin); foreach (WT_Tree::getAll() as $tree) { $tree->userPreference($user->getUserId(), 'gedcomid', WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF)); $tree->userPreference($user->getUserId(), 'rootid', WT_Filter::post('rootid' . $tree->tree_id, WT_REGEX_XREF)); $tree->userPreference($user->getUserId(), 'canedit', WT_Filter::post('canedit' . $tree->tree_id, implode('|', array_keys($ALL_EDIT_OPTIONS)))); if (WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF)) { $tree->userPreference($user->getUserId(), 'RELATIONSHIP_PATH_LENGTH', WT_Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->tree_id, 0, 10, 0)); } else { // Do not allow a path length to be set if the individual ID is not $tree->userPreference($user->getUserId(), 'RELATIONSHIP_PATH_LENGTH', null); } }
echo WT_MenuBar::getChartsMenu(); ?> <?php echo WT_MenuBar::getListsMenu(); ?> <?php echo WT_MenuBar::getCalendarMenu(); ?> <?php echo WT_MenuBar::getReportsMenu(); ?> <?php echo WT_MenuBar::getSearchMenu(); ?> <?php echo implode('', WT_MenuBar::getModuleMenus()); ?> </ul> </div> </div> <?php } ?> <?php echo $javascript; ?> <?php echo WT_FlashMessages::getHtmlMessages(); ?> <div id="content">
$media_folder = WT_Filter::post('media_folder', null, ''); // MySQL needs an empty string, not NULL $disk_files = all_disk_files($media_folder, '', 'include', ''); if (in_array($delete_file, $disk_files)) { $tmp = WT_DATA_DIR . $media_folder . $delete_file; if (@unlink($tmp)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp)); } else { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s could not be deleted.', $tmp)); } $tmp = WT_DATA_DIR . $media_folder . 'thumbs/' . $delete_file; if (file_exists($tmp)) { if (@unlink($tmp)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp)); } else { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s could not be deleted.', $tmp)); } } } else { // File no longer exists? Maybe it was already deleted or renamed. } $controller->pageHeader(); exit; } //////////////////////////////////////////////////////////////////////////////// // GET callback for server-side pagination //////////////////////////////////////////////////////////////////////////////// switch ($action) { case 'load_json': Zend_Session::writeClose(); $search = WT_Filter::get('search');
break; case 'register': if (!WT_Site::preference('USE_REGISTRATION_MODULE')) { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } $controller->setPageTitle(WT_I18N::translate('Request new user account')); // The form parameters are mandatory, and the validation errors are shown in the client. if ($WT_SESSION->good_to_send && $user_name && $user_password01 && $user_password01 == $user_password02 && $user_realname && $user_email && $user_comments) { // These validation errors cannot be shown in the client. if (User::findByIdentifier($user_name)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')); } elseif (User::findByIdentifier($user_email)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.')); } elseif (preg_match('/(?!' . preg_quote(WT_SERVER_NAME, '/') . ')(((?:ftp|http|https):\\/\\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) { WT_FlashMessages::addMessage(WT_I18N::translate('You are not allowed to send messages that contain external links.') . ' ' . WT_I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1])); Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"'); } else { // Everything looks good - create the user $controller->pageHeader(); Log::addAuthenticationLog('User registration requested for: ' . $user_name); $user = User::create($user_name, $user_realname, $user_email, $user_password01); $user->setSetting('language', WT_LOCALE)->setSetting('verified', 0)->setSetting('verified_by_admin', !$REQUIRE_ADMIN_AUTH_REGISTRATION)->setSetting('reg_timestamp', date('U'))->setSetting('reg_hashcode', md5(Uuid::uuid4()))->setSetting('contactmethod', 'messaging2')->setSetting('comment', $user_comments)->setSetting('visibleonline', 1)->setSetting('editaccount', 1)->setSetting('auto_accept', 0)->setSetting('canadmin', 0)->setSetting('sessiontime', 0); // Generate an email in the admin’s language $webmaster = User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID')); WT_I18N::init($webmaster->getSetting('language')); $mail1_body = WT_I18N::translate('Hello administrator…') . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . $WT_TREE->tree_title_html) . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('Username') . ' ' . $user->getUserName() . WT_Mail::EOL . WT_I18N::translate('Real name') . ' ' . $user->getRealName() . WT_Mail::EOL . WT_I18N::translate('Email address:') . ' ' . $user->getEmail() . WT_Mail::EOL . WT_I18N::translate('Comments') . ' ' . $user_comments . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('The user has been sent an e-mail with the information necessary to confirm the access request') . WT_Mail::EOL . WT_Mail::EOL; if ($REQUIRE_ADMIN_AUTH_REGISTRATION) { $mail1_body .= WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. You can then complete the process by activating the user name. The new user will not be able to login until you activate the account.'); } else { $mail1_body .= WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. After this, the user will be able to login without any action on your part.');
if ($menu) { echo getMenuAsCustomList($menu); } } echo '</ul>'; echo '<div id="menu-right">', '<ul class="makeMenu">'; if (WT_USER_ID) { echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>'; if (WT_USER_CAN_ACCEPT && exists_pending_change()) { echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>'; } } else { echo '<li>', login_link(), '</li>'; } $menu = WT_MenuBar::getFavoritesMenu(); if ($menu) { echo $menu->getMenuAsList(); } $menu = WT_MenuBar::getLanguageMenu(); if ($menu) { echo $menu->getMenuAsList(); } $menu = WT_MenuBar::getThemeMenu(); if ($menu) { echo $menu->getMenuAsList(); } echo '</ul>', '</div>', '</div>', '</div>'; // <div id="clouds-container"> } echo $javascript, WT_FlashMessages::getHtmlMessages(), '<div id="content">';
} elseif (strpos($fact->getGedcom(), ' @' . $target . '@')) { // Level 2-3 links $source->updateFact($fact->getFactId(), preg_replace(array('/\\n2 OBJE @' . $target . '@(\\n[3-9].*)*/', '/\\n3 OBJE @' . $target . '@(\\n[4-9].*)*/'), '', $fact->getGedcom()), true); } } } } } else { header('HTTP/1.0 406 Not Acceptable'); } break; case 'reject-changes': // Reject all the pending changes for a record $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF)); if ($record && WT_USER_CAN_ACCEPT && $record->canShow() && $record->canEdit()) { WT_FlashMessages::addMessage(WT_I18N::translate('The changes to “%s” have been rejected.', $record->getFullName())); reject_all_changes($record->getXref(), $record->getGedcomId()); } else { header('HTTP/1.0 406 Not Acceptable'); } break; case 'theme': // Change the current theme $theme_dir = WT_Filter::post('theme'); if (WT_Site::getPreference('ALLOW_USER_THEMES') && in_array($theme_dir, get_theme_names())) { $WT_SESSION->theme_dir = $theme_dir; if (Auth::id()) { // Remember our selection Auth::user()->setSetting('theme', $theme_dir); } } else {
$form_username = WT_Filter::post('form_username'); $form_realname = WT_Filter::post('form_realname'); $form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD); $form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD); $form_email = WT_Filter::postEmail('form_email'); $form_rootid = WT_Filter::post('form_rootid', WT_REGEX_XREF); $form_theme = WT_Filter::post('form_theme', implode('|', $ALL_THEME_DIRS)); $form_language = WT_Filter::post('form_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE); $form_contact_method = WT_Filter::post('form_contact_method'); $form_visible_online = WT_Filter::postBool('form_visible_online'); // Respond to form action if ($form_action == 'update' && WT_Filter::checkCsrf()) { if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')); } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.')); } else { // Change username if ($form_username != WT_USER_NAME) { Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username); Auth::user()->setUserName($form_username); } // Change password if ($form_pass1 && $form_pass1 == $form_pass2) { Auth::user()->setPassword($form_pass1); } // Change other settings Auth::user()->setRealName($form_realname)->setEmail($form_email)->setSetting('theme', $form_theme)->setSetting('language', $form_language)->setSetting('contactmethod', $form_contact_method)->setSetting('visibleonline', $form_visible_online); $WT_TREE->userPreference(WT_USER_ID, 'rootid', $form_rootid); // Reload page to pick up changes such as theme and user_id header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME);
private function error_page($message) { global $controller, $WT_SESSION; try { unset($WT_SESSION->facebook_access_token); unset($WT_SESSION->facebook_state); Zend_Session::writeClose(); } catch (Exception $e) { } $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->pageHeader(); try { WT_FlashMessages::addMessage($message); } catch (Zend_Session_Exception $zse) { echo '<div class="warning">' . $message . '</div>'; } exit; }
if (WT_Filter::post('gedcom_title')) { set_gedcom_setting(WT_GED_ID, 'title', WT_Filter::post('gedcom_title')); } // Only accept valid folders for NEW_MEDIA_DIRECTORY $NEW_MEDIA_DIRECTORY = preg_replace('/[\\/\\\\]+/', '/', WT_Filter::post('NEW_MEDIA_DIRECTORY') . '/'); if (substr($NEW_MEDIA_DIRECTORY, 0, 1) == '/') { $NEW_MEDIA_DIRECTORY = substr($NEW_MEDIA_DIRECTORY, 1); } if ($NEW_MEDIA_DIRECTORY) { if (is_dir(WT_DATA_DIR . $NEW_MEDIA_DIRECTORY)) { set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY', $NEW_MEDIA_DIRECTORY); } elseif (@mkdir(WT_DATA_DIR . $NEW_MEDIA_DIRECTORY, 0755, true)) { set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY', $NEW_MEDIA_DIRECTORY); WT_FlashMessages::addMessage(WT_I18N::translate('The folder %s was created.', WT_DATA_DIR . $NEW_MEDIA_DIRECTORY)); } else { WT_FlashMessages::addMessage(WT_I18N::translate('The folder %s does not exist, and it could not be created.', WT_DATA_DIR . $NEW_MEDIA_DIRECTORY)); } } $gedcom = WT_Filter::post('gedcom'); if ($gedcom && $gedcom != WT_GEDCOM) { try { WT_DB::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, WT_GED_ID)); WT_DB::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, WT_GEDCOM)); } catch (Exception $ex) { // Probably a duplicate name. $gedcom = WT_GEDCOM; } } // Reload the page, so that the settings take effect immediately. Zend_Session::writeClose(); header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?ged=' . $gedcom);
if (move_uploaded_file($_FILES['mediafile' . $i]['tmp_name'], $serverFileName)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was uploaded.', '<span class="filename">' . $serverFileName . '</span>')); chmod($serverFileName, WT_PERM_FILE); Log::addMediaLog('Media file ' . $serverFileName . ' uploaded'); } else { WT_FlashMessages::addMessage(WT_I18N::translate('There was an error uploading your file.') . '<br>' . file_upload_error_text($_FILES['mediafile' . $i]['error'])); $filename = ''; break; } // Now copy the (optional thumbnail) if (!empty($_FILES['thumbnail' . $i]['name']) && preg_match('/^image\\/(png|gif|jpeg)/', $_FILES['thumbnail' . $i]['type'], $match)) { $extension = $match[1]; $thumbFile = preg_replace('/\\.[a-z0-9]{3,5}$/', '.' . $extension, $fileName); $serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile; if (move_uploaded_file($_FILES['thumbnail' . $i]['tmp_name'], $serverFileName)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was uploaded.', '<span class="filename">' . $serverFileName . '</span>')); chmod($serverFileName, WT_PERM_FILE); Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded'); } } } } } } $controller->pageHeader(); $mediaFolders = WT_Query_Media::folderListAll(); // Determine file size limit // TODO: do we need to check post_max_size size too? $filesize = ini_get('upload_max_filesize'); if (empty($filesize)) { $filesize = "2M";
} } } $i = 0; foreach ($toarray as $indexval => $to) { $message = array(); $message['to'] = $to; $message['from'] = $from; if (!empty($from_name)) { $message['from_name'] = $from_name; $message['from_email'] = $from_email; } $message['subject'] = $subject; $message['body'] = $body; $message['created'] = WT_TIMESTAMP; $message['method'] = $method; $message['url'] = $url; if ($i > 0) { $message['no_from'] = true; } if (addMessage($message)) { WT_FlashMessages::addMessage(WT_I18N::translate('Message successfully sent to %s', WT_Filter::escapeHtml($to))); } else { WT_FlashMessages::addMessage(WT_I18N::translate('Message was not sent')); Log::addErrorLog('Unable to send message. FROM:' . $from . ' TO:' . $to . ' (failed to send)'); } $i++; } $controller->pageHeader()->addInlineJavascript('window.opener.location.reload(); window.close();'); break; }
public static function checkCsrf() { if (WT_Filter::post('csrf') !== WT_Filter::getCsrfToken()) { // Oops. Something is not quite right Log::addAuthenticationLog('CSRF mismatch - session expired or malicious attack'); WT_FlashMessages::addMessage(WT_I18N::translate('This form has expired. Try again.')); return false; } return true; }
echo $language_menu->getMenuAsList(); } echo '</ul>'; if (WT_USER_CAN_ACCEPT && exists_pending_change()) { echo ' | <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>'; } echo '</div>', '<div id="info">', WT_WEBTREES, ' ', WT_VERSION, '<br>', WT_I18N::translate('Server time'), ' — ', format_timestamp(WT_SERVER_TIMESTAMP), '<br>', WT_I18N::translate('Client time'), ' — ', format_timestamp(WT_CLIENT_TIMESTAMP), '<br>', WT_I18N::translate('UTC'), ' — ', format_timestamp(WT_TIMESTAMP), '</div>', '</div>', '<div id="admin_menu" class="ui-widget-content">', '<ul>', '<li><a ', WT_SCRIPT_NAME == 'admin.php' ? 'class="current" ' : '', 'href="admin.php">', WT_I18N::translate('Administration'), '</a></li>'; if (Auth::isAdmin()) { echo '<li><ul>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_config.php' ? 'class="current" ' : '', 'href="admin_site_config.php">', WT_I18N::translate('Site configuration'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_logs.php' ? 'class="current" ' : '', 'href="admin_site_logs.php">', WT_I18N::translate('Logs'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_readme.php' ? 'class="current" ' : '', 'href="admin_site_readme.php">', WT_I18N::translate('README documentation'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_info.php' ? 'class="current" ' : '', 'href="admin_site_info.php">', WT_I18N::translate('PHP information'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_access.php' ? 'class="current" ' : '', 'href="admin_site_access.php">', WT_I18N::translate('Site access rules'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_clean.php' ? 'class="current" ' : '', 'href="admin_site_clean.php">', WT_I18N::translate('Clean up data folder'), '</a></li>', '</ul></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_trees_manage.php' ? 'class="current" ' : '', 'href="admin_trees_manage.php">', WT_I18N::translate('Family trees'), '</a></li>'; } else { echo '<li>', WT_I18N::translate('Family trees'), '</li>'; } echo '<li><ul>'; //-- gedcom list foreach (WT_Tree::getAll() as $tree) { if (Auth::isManager($tree)) { // Add a title="" element, since long tree titles are cropped echo '<li><span><a ', WT_SCRIPT_NAME == 'admin_trees_config.php' && WT_GED_ID == $tree->tree_id ? 'class="current" ' : '', 'href="admin_trees_config.php?ged=' . $tree->tree_name_url . '" title="', WT_Filter::escapeHtml($tree->tree_title), '" dir="auto">', $tree->tree_title_html, '</a></span></li>'; } } echo '<li><a ', WT_SCRIPT_NAME == 'admin_site_merge.php' ? 'class="current" ' : '', 'href="admin_site_merge.php">', WT_I18N::translate('Merge records'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_other.php' ? 'class="current" ' : '', 'href="admin_site_other.php">', WT_I18N::translate('Add unlinked records'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_trees_places.php' ? 'class="current" ' : '', 'href="admin_trees_places.php">', WT_I18N::translate('Update place names'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_trees_check.php' ? 'class="current" ' : '', 'href="admin_trees_check.php">', WT_I18N::translate('Check for errors'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_site_change.php' ? 'class="current" ' : '', 'href="admin_site_change.php">', WT_I18N::translate('Changes log'), '</a></li>', '<li><a href="index_edit.php?gedcom_id=-1" onclick="return modalDialog(\'index_edit.php?gedcom_id=-1' . '\', \'', WT_I18N::translate('Set the default blocks for new family trees'), '\');">', WT_I18N::translate('Set the default blocks'), '</a></li>', '</ul></li>'; if (Auth::isAdmin()) { echo '<li><a ', WT_SCRIPT_NAME == 'admin_users.php' && WT_Filter::get('action') != "cleanup" && WT_Filter::get('action') != "createform" ? 'class="current" ' : '', 'href="admin_users.php">', WT_I18N::translate('Users'), '</a></li>', '<li><ul>', '<li><a ', WT_SCRIPT_NAME == 'admin_users.php' && WT_Filter::get('action') == 'createform' ? 'class="current" ' : '', 'href="admin_users.php?action=createform">', WT_I18N::translate('Add a new user'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_users_bulk.php' ? 'class="current" ' : '', 'href="admin_users_bulk.php">', WT_I18N::translate('Send broadcast messages'), '</a>', '<li><a ', WT_SCRIPT_NAME == 'admin_users.php' && WT_Filter::get('action') == 'cleanup' ? 'class="current" ' : '', 'href="admin_users.php?action=cleanup">', WT_I18N::translate('Delete inactive users'), '</a></li>', '<li><a href="index_edit.php?user_id=-1" onclick="return modalDialog(\'index_edit.php?user_id=-1' . '\', \'', WT_I18N::translate('Set the default blocks for new users'), '\');">', WT_I18N::translate('Set the default blocks'), '</a></li>', '</ul></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_media.php' ? 'class="current" ' : '', 'href="admin_media.php">', WT_I18N::translate('Media'), '</a></li>', '<li><ul>', '<li><a ', WT_SCRIPT_NAME == 'admin_media_upload.php' ? 'class="current" ' : '', 'href="admin_media_upload.php">', WT_I18N::translate('Upload media files'), '</a></li>', '</ul></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_modules.php' ? 'class="current" ' : '', 'href="admin_modules.php">', WT_I18N::translate('Modules'), '</a></li>', '<li><ul>', '<li><a ', WT_SCRIPT_NAME == 'admin_module_menus.php' ? 'class="current" ' : '', 'href="admin_module_menus.php">', WT_I18N::translate('Menus'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_module_tabs.php' ? 'class="current" ' : '', 'href="admin_module_tabs.php">', WT_I18N::translate('Tabs'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_module_blocks.php' ? 'class="current" ' : '', 'href="admin_module_blocks.php">', WT_I18N::translate('Blocks'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_module_sidebar.php' ? 'class="current" ' : '', 'href="admin_module_sidebar.php">', WT_I18N::translate('Sidebar'), '</a></li>', '<li><a ', WT_SCRIPT_NAME == 'admin_module_reports.php' ? 'class="current" ' : '', 'href="admin_module_reports.php">', WT_I18N::translate('Reports'), '</a></li>', '</ul></li>'; foreach (WT_Module::getActiveModules(true) as $module) { if ($module instanceof WT_Module_Config) { echo '<li><span><a ', WT_SCRIPT_NAME == 'module.php' && WT_Filter::get('mod') == $module->getName() ? 'class="current" ' : '', 'href="', $module->getConfigLink(), '">', $module->getTitle(), '</a></span></li>'; } } } echo '</ul>', '</div>', '<div id="admin_content" class="ui-widget-content">', WT_FlashMessages::getHtmlMessages(); // Feedback from asynchronous actions;
if (!file_exists($newServerFile)) { WT_FlashMessages::addMessage(WT_I18N::translate('Media file %s does not exist.', '<span class="filename">' . $newFilename . '</span>')); $messages = true; } } if ($oldServerThumb != $newServerThumb) { if (!file_exists($newServerThumb) || @md5_file($oldServerFile) == md5_file($newServerThumb)) { if (@rename($oldServerThumb, $newServerThumb)) { WT_FlashMessages::addMessage(WT_I18N::translate('Thumbnail file %1$s successfully renamed to %2$s.', '<span class="filename">' . $oldFilename . '</span>', '<span class="filename">' . $newFilename . '</span>')); } else { WT_FlashMessages::addMessage(WT_I18N::translate('Thumbnail file %1$s could not be renamed to %2$s.', '<span class="filename">' . $oldFilename . '</span>', '<span class="filename">' . $newFilename . '</span>')); } $messages = true; } if (!file_exists($newServerThumb)) { WT_FlashMessages::addMessage(WT_I18N::translate('Thumbnail file %s does not exist.', '<span class="filename">' . $newFilename . '</span>')); $messages = true; } } } // Insert the 1 FILE xxx record into the arrays used by function handle_updates() $glevels = array_merge(array('1'), $glevels); $tag = array_merge(array('FILE'), $tag); $islink = array_merge(array(0), $islink); $text = array_merge(array($newFilename), $text); $record = WT_GedcomRecord::getInstance($pid); $newrec = "0 @{$pid}@ OBJE\n"; $newrec = handle_updates($newrec); $record->updateRecord($newrec, $update_CHAN); if ($pid && $linktoid) { $record = WT_GedcomRecord::getInstance($linktoid);