Ejemplo n.º 1
0
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin());
// Valid values for form variables
$ALL_EDIT_OPTIONS = array('none' => I18N::translate('Visitor'), 'access' => I18N::translate('Member'), 'edit' => I18N::translate('Editor'), 'accept' => I18N::translate('Moderator'), 'admin' => I18N::translate('Manager'));
// Form actions
switch (Filter::post('action')) {
    case 'save':
        if (Filter::checkCsrf()) {
            $user_id = Filter::postInteger('user_id');
            $user = User::find($user_id);
            $username = Filter::post('username');
            $real_name = Filter::post('real_name');
            $email = Filter::postEmail('email');
            $pass1 = Filter::post('pass1', WT_REGEX_PASSWORD);
            $pass2 = Filter::post('pass2', WT_REGEX_PASSWORD);
            $theme = Filter::post('theme', implode('|', array_keys(Theme::installedThemes())), '');
            $language = Filter::post('language');
            $timezone = Filter::post('timezone');
            $contact_method = Filter::post('contact_method');
            $comment = Filter::post('comment');
            $auto_accept = Filter::postBool('auto_accept');
            $canadmin = Filter::postBool('canadmin');
            $visible_online = Filter::postBool('visible_online');
            $verified = Filter::postBool('verified');
            $approved = Filter::postBool('approved');
            if ($user_id === 0) {
                // Create a new user
                if (User::findByIdentifier($username)) {
                    FlashMessages::addMessage(I18N::translate('Duplicate user name.  A user with that user name already exists.  Please choose another user name.'));
                } elseif (User::findByIdentifier($email)) {
                    FlashMessages::addMessage(I18N::translate('Duplicate email address.  A user with that email already exists.'));
Ejemplo n.º 2
0
 /**
  * Themes menu.
  *
  * @return Menu|null
  */
 public function menuThemes()
 {
     if ($this->tree && Site::getPreference('ALLOW_USER_THEMES') && $this->tree->getPreference('ALLOW_THEME_DROPDOWN')) {
         $submenus = array();
         foreach (Theme::installedThemes() as $theme) {
             $class = 'menu-theme-' . $theme->themeId() . ($theme === $this ? ' active' : '');
             $submenus[] = new Menu($theme->themeName(), '#', $class, array('onclick' => 'return false;', 'data-theme' => $theme->themeId()));
         }
         usort($submenus, function (Menu $x, Menu $y) {
             return I18N::strcasecmp($x->getLabel(), $y->getLabel());
         });
         $menu = new Menu(I18N::translate('Theme'), '#', 'menu-theme', array(), $submenus);
         return $menu;
     } else {
         return null;
     }
 }
Ejemplo n.º 3
0
} else {
    // Last theme used?
    $theme_id = Session::get('theme_id');
    // Default for tree
    if (!array_key_exists($theme_id, Theme::themeNames()) && $WT_TREE) {
        $theme_id = $WT_TREE->getPreference('THEME_DIR');
    }
    // Default for site
    if (!array_key_exists($theme_id, Theme::themeNames())) {
        $theme_id = Site::getPreference('THEME_DIR');
    }
    // Default
    if (!array_key_exists($theme_id, Theme::themeNames())) {
        $theme_id = 'webtrees';
    }
    foreach (Theme::installedThemes() as $theme) {
        if ($theme->themeId() === $theme_id) {
            Theme::theme($theme)->init($WT_TREE);
            // Remember this setting
            if (Site::getPreference('ALLOW_USER_THEMES')) {
                Session::put('theme_id', $theme_id);
            }
            break;
        }
    }
}
// Search engines are only allowed to see certain pages.
if (Auth::isSearchEngine() && !in_array(WT_SCRIPT_NAME, array('index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php'))) {
    http_response_code(403);
    $controller = new PageController();
    $controller->setPageTitle(I18N::translate('Search engine'));