public static function getMyPageMenu() { global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT; $showFull = $PEDIGREE_FULL_DETAILS ? 1 : 0; $showLayout = $PEDIGREE_LAYOUT ? 1 : 0; if (!Auth::id()) { return null; } //-- main menu $menu = new WT_Menu(WT_I18N::translate('My page'), 'index.php?ctype=user&ged=' . WT_GEDURL, 'menu-mymenu'); //-- mypage submenu $submenu = new WT_Menu(WT_I18N::translate('My page'), 'index.php?ctype=user&ged=' . WT_GEDURL, 'menu-mypage'); $menu->addSubmenu($submenu); //-- editaccount submenu if (Auth::user()->getSetting('editaccount')) { $submenu = new WT_Menu(WT_I18N::translate('My account'), 'edituser.php', 'menu-myaccount'); $menu->addSubmenu($submenu); } if (WT_USER_GEDCOM_ID) { //-- my_pedigree submenu $submenu = new WT_Menu(WT_I18N::translate('My pedigree'), 'pedigree.php?ged=' . WT_GEDURL . '&rootid=' . WT_USER_GEDCOM_ID . "&show_full={$showFull}&talloffset={$showLayout}", 'menu-mypedigree'); $menu->addSubmenu($submenu); //-- my_indi submenu $submenu = new WT_Menu(WT_I18N::translate('My individual record'), 'individual.php?pid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL, 'menu-myrecord'); $menu->addSubmenu($submenu); } if (WT_USER_GEDCOM_ADMIN) { //-- admin submenu $submenu = new WT_Menu(WT_I18N::translate('Administration'), 'admin.php', 'menu-admin'); $menu->addSubmenu($submenu); } return $menu; }
function exists_pending_change(User $user = null, WT_Tree $tree = null) { global $WT_TREE; if ($user === null) { $user = Auth::user(); } if ($tree === null) { $tree = $WT_TREE; } if ($user === null || $tree === null) { return false; } return $tree->canAcceptChanges($user) && WT_DB::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending' AND gedcom_id=?")->execute(array($tree->tree_id))->fetchOne(); }
public function getBlock($block_id, $template = true, $cfg = null) { $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = '<span dir="auto">' . WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>'; $content = '<table><tr>'; if (Auth::user()->getSetting('editaccount')) { $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . WT_I18N::translate('My account') . '</a></td>'; } if (WT_USER_GEDCOM_ID) { $content .= '<td><a href="pedigree.php?rootid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('My pedigree') . '</a></td>'; $content .= '<td><a href="individual.php?pid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('My individual record') . '</a></td>'; } $content .= '</tr></table>'; if ($template) { require WT_THEME_DIR . 'templates/block_main_temp.php'; } else { return $content; } }
} // If there is no current tree and we need one, then redirect somewhere if (WT_SCRIPT_NAME != 'admin_trees_manage.php' && WT_SCRIPT_NAME != 'admin_pgv_to_wt.php' && WT_SCRIPT_NAME != 'login.php' && WT_SCRIPT_NAME != 'logout.php' && WT_SCRIPT_NAME != 'import.php' && WT_SCRIPT_NAME != 'help_text.php' && WT_SCRIPT_NAME != 'message.php') { if (!$WT_TREE || !WT_IMPORTED) { if (Auth::isAdmin()) { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'admin_trees_manage.php'); } else { header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(WT_SCRIPT_NAME . (isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')), true, 301); } exit; } } if (Auth::id()) { // Update the login time every 5 minutes if (WT_TIMESTAMP - $WT_SESSION->activity_time > 300) { Auth::user()->setSetting('sessiontime', WT_TIMESTAMP); $WT_SESSION->activity_time = WT_TIMESTAMP; } } // Set the theme if (substr(WT_SCRIPT_NAME, 0, 5) == 'admin' || WT_SCRIPT_NAME == 'module.php' && substr(WT_Filter::get('mod_action'), 0, 5) == 'admin') { // Administration scripts begin with “admin” and use a special administration theme define('WT_THEME_DIR', WT_THEMES_DIR . '_administration/'); } else { if (WT_Site::preference('ALLOW_USER_THEMES')) { // Requested change of theme? $THEME_DIR = WT_Filter::get('theme'); if (!in_array($THEME_DIR, get_theme_names())) { $THEME_DIR = ''; } // Last theme used?
} switch (WT_Filter::get('show_marnm', 'no|yes')) { case 'no': $show_marnm = false; if (Auth::id()) { Auth::user()->setSetting(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); } break; case 'yes': $show_marnm = true; if (Auth::id()) { Auth::user()->setSetting(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); } break; default: $show_marnm = Auth::id() && Auth::user()->getSetting(WT_SCRIPT_NAME . '_show_marnm'); } // Make sure selections are consistent. // i.e. can’t specify show_all and surname at the same time. if ($show_all == 'yes') { if ($show_all_firstnames == 'yes') { $alpha = ''; $surname = ''; $legend = WT_I18N::translate('All'); $url = WT_SCRIPT_NAME . '?show_all=yes&ged=' . WT_GEDURL; $show = 'indi'; } else { if ($falpha) { $alpha = ''; $surname = ''; $legend = WT_I18N::translate('All') . ', ' . WT_Filter::escapeHtml($falpha) . '…';
Log::addAuthenticationLog('Login failed (incorrect password): ' . $username); throw new Exception(WT_I18N::translate('The username or password is incorrect.')); } if (!$user->getSetting('verified')) { Log::addAuthenticationLog('Login failed (not verified by user): ' . $username); throw new Exception(WT_I18N::translate('This account has not been verified. Please check your email for a verification message.')); } if (!$user->getSetting('verified_by_admin')) { Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username); throw new Exception(WT_I18N::translate('This account has not been approved. Please wait for an administrator to approve it.')); } Auth::login($user); Log::addAuthenticationLog('Login: '******'/' . Auth::user()->getRealName()); $WT_SESSION->timediff = $timediff; $WT_SESSION->locale = Auth::user()->getSetting('language'); $WT_SESSION->theme_dir = Auth::user()->getSetting('theme'); // If we’ve clicked login from the login page, we don’t want to go back there. if (strpos($url, WT_SCRIPT_NAME) === 0) { $url = ''; } // We're logging in as an administrator if (Auth::isAdmin()) { // Check for updates $latest_version_txt = fetch_latest_version(); if (preg_match('/^[0-9.]+\\|[0-9.]+\\|/', $latest_version_txt)) { list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt); if (version_compare(WT_VERSION, $latest_version) < 0) { // An upgrade is available. Let the admin know, by redirecting to the upgrade wizard $url = 'admin_site_upgrade.php'; } } else {
<?php $menu_items = array(WT_MenuBar::getGedcomMenu(), WT_MenuBar::getMyPageMenu(), WT_MenuBar::getChartsMenu(), WT_MenuBar::getListsMenu(), WT_MenuBar::getCalendarMenu(), WT_MenuBar::getReportsMenu(), WT_MenuBar::getSearchMenu()); foreach (WT_MenuBar::getModuleMenus() as $menu) { $menu_items[] = $menu; } // Print the menu bar echo '<div id="topMenu">', '<ul id="main-menu">'; foreach ($menu_items as $menu) { 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();
function getActionButtons($xref) { if (Auth::user()->getSetting('auto_accept')) { return array(batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'), batch_update::createSubmitButton(WT_I18N::translate('Update all'), $xref, 'update_all')); } else { return array(batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update')); } }
break; case "note": $controller->setPageTitle(WT_I18N::translate('Find a shared note')); break; case "source": $controller->setPageTitle(WT_I18N::translate('Find a source')); break; case "specialchar": $controller->setPageTitle(WT_I18N::translate('Find a special character')); $language_filter = WT_Filter::get('language_filter'); if (Auth::id()) { // Users will probably always want the same language, so remember their setting if (!$language_filter) { $language_filter = Auth::user()->getSetting('default_language_filter'); } else { Auth::user()->setSetting('default_language_filter', $language_filter); } } require WT_ROOT . 'includes/specialchars.php'; $action = "filter"; break; case "facts": $controller->setPageTitle(WT_I18N::translate('Find a fact or event'))->addInlineJavascript('initPickFact();'); break; } $controller->pageHeader(); echo '<script>'; ?> function pasteid(id, name, thumb) { if (thumb) { window.opener.<?php
?> <div id="header"> <div class="header_img"> <img src="<?php echo WT_CSS_URL; ?> images/webtrees.png" width="242" height="50" alt="<?php echo WT_WEBTREES; ?> "> </div> <ul id="extra-menu" class="makeMenu"> <li> <?php if (WT_USER_ID) { echo '<a href="edituser.php">', WT_I18N::translate('Logged in as '), ' ', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link(); } else { echo login_link(); } ?> </li> <?php echo WT_MenuBar::getFavoritesMenu(); ?> <?php echo WT_MenuBar::getThemeMenu(); ?> <?php echo WT_MenuBar::getLanguageMenu(); ?> </ul>
<div class="label">', WT_I18N::translate('Password'), help_link('password'), '</div> <div class="value"><input type="password" name="form_pass1"> ', WT_I18N::translate('Leave password blank if you want to keep the current password.'), '</div> <div class="label">', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '</div> <div class="value"><input type="password" name="form_pass2"></div> <div class="label">', WT_I18N::translate('Language'), '</div> <div class="value">', edit_field_language('form_language', Auth::user()->getSetting('language')), '</div> <div class="label">', WT_I18N::translate('Email address'), help_link('email'), '</div> <div class="value"><input type="email" name="form_email" value="', WT_Filter::escapeHtml(Auth::user()->getEmail()), '" size="50"></div> <div class="label">', WT_I18N::translate('Theme'), help_link('THEME'), '</div> <div class="value"> <select name="form_theme"> <option value="">', WT_Filter::escapeHtml(WT_I18N::translate('<default theme>')), '</option>'; foreach (get_theme_names() as $themename => $themedir) { echo '<option value="', $themedir, '"'; if ($themedir == Auth::user()->getSetting('theme')) { echo ' selected="selected"'; } echo '>', $themename, '</option>'; } echo '</select> </div> <div class="label">', WT_I18N::translate('Preferred contact method'), help_link('edituser_contact_meth'), '</div> <div class="value">', edit_field_contact('form_contact_method', Auth::user()->getSetting('contactmethod')), '</div> <div class="label">', WT_I18N::translate('Visible to other users when online'), help_link('useradmin_visibleonline'), '</div> <div class="value">', checkbox('form_visible_online', Auth::user()->getSetting('visibleonline')), '</div> </div>'; // close edituser-table echo '<div id="edituser_submit"><input type="submit" value="', WT_I18N::translate('save'), '"></div>'; echo '</form> </div>'; // close edituser-page
private function login($user_id) { global $WT_SESSION; $user = User::find($user_id); $user_name = $user->getUserName(); // Below copied from authenticateUser in authentication.php $is_admin = $user->getPreference('canadmin'); $verified = $user->getPreference('verified'); $approved = $user->getPreference('verified_by_admin'); if ($verified && $approved || $is_admin) { Auth::login($user); Log::addAuthenticationLog('Login: '******'/' . Auth::user()->getRealName()); $WT_SESSION->locale = Auth::user()->getPreference('language'); $WT_SESSION->theme_dir = Auth::user()->getPreference('theme'); $WT_SESSION->activity_time = WT_TIMESTAMP; $user->setPreference('sessiontime', WT_TIMESTAMP); Zend_Session::writeClose(); return $user_id; } elseif (!$is_admin && !$verified) { Log::addAuthenticationLog('Login failed ->' . $user_name . '<- not verified'); return -1; } elseif (!$is_admin && !$approved) { Log::addAuthenticationLog('Login failed ->' . $user_name . '<- not approved'); return -2; } throw new Exception('Login failure: Unexpected condition'); }
public function deleteRecord() { // Create a pending change WT_DB::prepare("INSERT INTO `##change` (gedcom_id, xref, old_gedcom, new_gedcom, user_id) VALUES (?, ?, ?, '', ?)")->execute(array($this->gedcom_id, $this->xref, $this->getGedcom(), Auth::id())); // Accept this pending change if (Auth::user()->getSetting('auto_accept')) { accept_all_changes($this->xref, $this->gedcom_id); } // Clear the cache self::$gedcom_record_cache = null; self::$pending_record_cache = null; Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref); }
$recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchOne(); header('Content-type: application/json'); echo json_encode(array('draw' => WT_Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); exit; } $controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#log_list").dataTable( { "dom": \'<"H"pf<"dt-clear">irl>t<"F"pl>\', "processing": true, "serverSide": true, "ajax": "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user='******'&gedc=' . rawurlencode($gedc) . '", ' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ', jQueryUI: true, autoWidth: false, sorting: [[ 0, "desc" ]], pageLength: ' . Auth::user()->getSetting('admin_site_change_page_size', 10) . ', pagingType: "full_numbers", columns: [ /* Timestamp */ { }, /* Status */ { }, /* Record */ { }, /* Old data */ { class: "raw_gedcom", sortable: false }, /* New data */ { class: "raw_gedcom", sortable: false }, /* User */ { }, /* Family tree */ { } ] }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) {
/** * Initialise the translation adapter with a locale setting. * * @param string|null $locale If no locale specified, choose one automatically * * @return string $string */ public static function init($locale = null) { global $WT_SESSION; // The translation libraries only work with a cache. $cache_options = array('automatic_serialization' => true, 'cache_id_prefix' => md5(WT_SERVER_NAME . WT_SCRIPT_PATH)); if (ini_get('apc.enabled')) { self::$cache = Zend_Cache::factory('Core', 'Apc', $cache_options, array()); } elseif (WT_File::mkdir(WT_DATA_DIR . 'cache')) { self::$cache = Zend_Cache::factory('Core', 'File', $cache_options, array('cache_dir' => WT_DATA_DIR . 'cache')); } else { self::$cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_BlackHole', $cache_options, array(), false, true); } Zend_Locale::setCache(self::$cache); Zend_Translate::setCache(self::$cache); $installed_languages = self::installed_languages(); if (is_null($locale) || !array_key_exists($locale, $installed_languages)) { // Automatic locale selection. $locale = WT_Filter::get('lang'); if ($locale && array_key_exists($locale, $installed_languages)) { // Requested in the URL? if (Auth::id()) { Auth::user()->setSetting('language', $locale); } } elseif (array_key_exists($WT_SESSION->locale, $installed_languages)) { // Rembered from a previous visit? $locale = $WT_SESSION->locale; } else { // Browser preference takes priority over gedcom default if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $prefs = explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } else { $prefs = array(); } if (WT_GED_ID) { // Add the tree’s default language as a low-priority $locale = get_gedcom_setting(WT_GED_ID, 'LANGUAGE'); $prefs[] = $locale . ';q=0.2'; } $prefs2 = array(); foreach ($prefs as $pref) { list($l, $q) = explode(';q=', $pref . ';q=1.0'); $l = preg_replace_callback('/_[a-z][a-z]$/', function ($x) { return strtoupper($x[0]); }, str_replace('-', '_', $l)); // en-gb => en_GB if (array_key_exists($l, $prefs2)) { $prefs2[$l] = max((double) $q, $prefs2[$l]); } else { $prefs2[$l] = (double) $q; } } // Ensure there is a fallback. if (!array_key_exists('en_US', $prefs2)) { $prefs2['en_US'] = 0.01; } arsort($prefs2); foreach (array_keys($prefs2) as $pref) { if (array_key_exists($pref, $installed_languages)) { $locale = $pref; break; } } } } // Load the translation file self::$translation_adapter = new Zend_Translate('gettext', WT_ROOT . 'language/' . $locale . '.mo', $locale); // Deprecated - some custom modules use this to add translations Zend_Registry::set('Zend_Translate', self::$translation_adapter); // Load any local user translations if (is_dir(WT_DATA_DIR . 'language')) { if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.mo')) { self::addTranslation(new Zend_Translate('gettext', WT_DATA_DIR . 'language/' . $locale . '.mo', $locale)); } if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.php')) { self::addTranslation(new Zend_Translate('array', WT_DATA_DIR . 'language/' . $locale . '.php', $locale)); } if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.csv')) { self::addTranslation(new Zend_Translate('csv', WT_DATA_DIR . 'language/' . $locale . '.csv', $locale)); } } // Extract language settings from the translation file global $DATE_FORMAT; // I18N: This is the format string for full dates. See http://php.net/date for codes $DATE_FORMAT = self::noop('%j %F %Y'); global $TIME_FORMAT; // I18N: This is the format string for the time-of-day. See http://php.net/date for codes $TIME_FORMAT = self::noop('%H:%i:%s'); // Alphabetic sorting sequence (upper-case letters), used by webtrees to sort strings list(, self::$alphabet_upper) = explode('=', self::noop('ALPHABET_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ')); // Alphabetic sorting sequence (lower-case letters), used by webtrees to sort strings list(, self::$alphabet_lower) = explode('=', self::noop('ALPHABET_lower=abcdefghijklmnopqrstuvwxyz')); global $WEEK_START; // I18N: This is the first day of the week on calendars. 0=Sunday, 1=Monday... list(, $WEEK_START) = explode('=', self::noop('WEEK_START=0')); global $TEXT_DIRECTION; $TEXT_DIRECTION = self::scriptDirection(self::languageScript($locale)); self::$locale = $locale; self::$dir = $TEXT_DIRECTION; // I18N: This punctuation is used to separate lists of items. self::$list_separator = self::translate(', '); // I18N: This is the name of the MySQL collation that applies to your language. A list is available at http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html self::$collation = self::translate('utf8_unicode_ci'); // Non-latin numbers may require non-latin digits try { self::$numbering_system = Zend_Locale_Data::getContent($locale, 'defaultnumberingsystem'); } catch (Zend_Locale_Exception $ex) { // The latest CLDR database omits some languges such as Tatar (tt) self::$numbering_system = 'latin'; } return $locale; }
static function userFullName() { return Auth::check() ? Auth::user()->getRealName() : ''; }
// Request to change color $subColor = $_GET['themecolor']; if (Auth::id()) { Auth::user()->setSetting('themecolor', $subColor); if (Auth::isAdmin()) { WT_Site::preference('DEFAULT_COLOR_PALETTE', $subColor); } } unset($_GET['themecolor']); // Rember that we have selected a value $WT_SESSION->subColor = $subColor; } // If we are logged in, use our preference $subColor = null; if (Auth::id()) { $subColor = Auth::user()->getSetting('themecolor'); } // If not logged in or no preference, use one we selected earlier in the session? if (!$subColor) { $subColor = $WT_SESSION->subColor; } // We haven't selected one this session? Use the site default if (!$subColor) { $subColor = WT_Site::preference('DEFAULT_COLOR_PALETTE'); } // Make sure our selected palette actually exists if (!array_key_exists($subColor, $COLOR_THEME_LIST)) { $subColor = 'ash'; } // Theme name - this needs double quotes, as file is scanned/parsed by script $theme_name = "colors";
} } 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 { // Request for a non-existant theme. header('HTTP/1.0 406 Not Acceptable'); } break; } Zend_Session::writeClose();
} // Total filtered/unfiltered rows $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn(); $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn(); header('Content-type: application/json'); echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); exit; } $controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#log_list").dataTable( { dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', processing: true, serverSide: true, ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '", ' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ', jQueryUI: true, autoWidth: false, sorting: [[ 0, "desc" ]], pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ', pagingType: "full_numbers" }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) { $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName(); } echo '<form name="logs" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_logs">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Type'), '<br>', select_edit_control('type', array('' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search'), null, $type, ''), '</td>', '<td>', WT_I18N::translate('Message'), '<br><input class="log-filter" name="text" value="', WT_Filter::escapeHtml($text), '"> ', '</td>', '<td>', WT_I18N::translate('IP address'), '<br><input class="log-filter" name="ip" value="', WT_Filter::escapeHtml($ip), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.logs.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.logs.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>'; if ($action) { echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Type'), '</th>', '<th>', WT_I18N::translate('Message'), '</th>', '<th>', WT_I18N::translate('IP address'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>'; }
<?php // Log out from the current session // // webtrees: Web based Family History software // Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; use WT\Log; define('WT_SCRIPT_NAME', 'logout.php'); require './includes/session.php'; if (Auth::id()) { Log::addAuthenticationLog('Logout: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName()); Auth::logout(); } header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
} } break; case 'listusers': default: echo '<table id="list">', '<thead>', '<tr>', '<th style="margin:0 -2px 1px 1px; padding:6px 0 5px;"> </th>', '<th> user-id </th>', '<th>', WT_I18N::translate('Username'), '</th>', '<th>', WT_I18N::translate('Real name'), '</th>', '<th>', WT_I18N::translate('Email'), '</th>', '<th> </th>', '<th>', WT_I18N::translate('Language'), '</th>', '<th> date_registered </th>', '<th>', WT_I18N::translate('Date registered'), '</th>', '<th> last_login </th>', '<th>', WT_I18N::translate('Last logged in'), '</th>', '<th>', WT_I18N::translate('Verified'), '</th>', '<th>', WT_I18N::translate('Approved'), '</th>', '<th style="margin:0 -2px 1px 1px; padding:3px 0 4px;"> </th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>'; $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)->addInlineJavascript(' var oTable = jQuery("#list").dataTable({ dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', ' . WT_I18N::datatablesI18N() . ', processing: true, serverSide: true, ajax: "' . WT_SCRIPT_NAME . '?action=loadrows", jQueryUI: true, autoWidth: false, pageLength: ' . Auth::user()->getSetting('admin_users_page_size', 10) . ', pagingType: "full_numbers", sorting: [[2,"asc"]], columns: [ /* details */ { sortable: false, class: "icon-open" }, /* user-id */ { visible: false }, /* user_name */ null, /* real_name */ null, /* email */ null, /* email link */ { sortable: false }, /* language */ null, /* registered (sort) */ { visible: false }, /* registered */ { dataSort: 7 }, /* last_login (sort) */ { visible: false }, /* last_login */ { dataSort: 9 }, /* verified */ { class: "center" },
break; case 'user_setting': ////////////////////////////////////////////////////////////////////////////// // Table name: WT_USER_SETTING // ID format: user_setting-{user_id}-{setting_name} ////////////////////////////////////////////////////////////////////////////// $user = User::find($id1); // Authorisation if (!(Auth::isAdmin() || $user && $user->getSetting('editaccount') && in_array($id2, array('language', 'visible_online', 'contact_method')))) { fail(); } // Validation switch ($id2) { case 'canadmin': // Cannot change our own admin status - either to add it or remove it if (Auth::user() == $user) { fail(); } break; case 'verified_by_admin': // Approving for the first time? Send a confirmation email if ($value && !$user->getSetting('verified_by_admin') && $user->getSetting('sessiontime') == 0) { WT_I18N::init($user->getSetting('language')); WT_Mail::system_message($WT_TREE, $user, WT_I18N::translate('Approval of account at %s', WT_SERVER_NAME . WT_SCRIPT_PATH), WT_I18N::translate('The administrator at the webtrees site %s has approved your application for an account. You may now login by accessing the following link: %s', WT_SERVER_NAME . WT_SCRIPT_PATH, WT_SERVER_NAME . WT_SCRIPT_PATH)); } break; case 'auto_accept': case 'editaccount': case 'verified': case 'visibleonline': case 'max_relation_path':