Exemplo n.º 1
0
 public function pageHeader()
 {
     global $view;
     $view = 'simple';
     parent::pageHeader();
     return $this;
 }
Exemplo n.º 2
0
                $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);
                }
            }
            Log::addAuthenticationLog("User ->{$username}<- created");
            header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME);
            WT_Session::writeClose();
            exit;
        }
}
$controller->pageHeader();
switch ($action) {
    case 'createform':
        $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        init_calendar_popup();
        $controller->addInlineJavascript('
		function checkform(frm) {
			if (frm.username.value=="") {
				alert("' . WT_I18N::translate('You must enter a user name.') . '");
				frm.username.focus();
				return false;
			}
			if (frm.realname.value=="") {
				alert("' . WT_I18N::translate('You must enter a real name.') . '");
				frm.realname.focus();
				return false;
Exemplo n.º 3
0
        } else {
            $ORDER_BY = '1 ASC';
        }
        // This becomes a JSON list, not array, so need to fetch with numeric keys.
        $data = WT_DB::prepare($SELECT1 . $WHERE . $ORDER_BY . $LIMIT)->execute($args)->fetchAll(PDO::FETCH_NUM);
        foreach ($data as &$datum) {
            $datum[2] = WT_Filter::escapeHtml($datum[2]);
        }
        // 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) . '&amp;to=' . rawurlencode($to) . '&amp;type=' . rawurlencode($type) . '&amp;text=' . rawurlencode($text) . '&amp;ip=' . rawurlencode($ip) . '&amp;user='******'&amp;gedc=' . rawurlencode($gedc);
$users_array = array();
Exemplo n.º 4
0
     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.');
         }
         $mail1_body .= WT_Mail::auditFooter();
         $mail1_subject = WT_I18N::translate('New registration at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . $WT_TREE->tree_title);
         WT_I18N::init(WT_LOCALE);
Exemplo n.º 5
0
 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_USER_CAN_EDIT) {
         if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
             $block_id = WT_Filter::postInteger('block_id');
             if ($block_id) {
                 WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
             } else {
                 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                 $block_id = WT_DB::getInstance()->lastInsertId();
             }
             set_block_setting($block_id, 'title', WT_Filter::post('title'));
             set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
             $languages = array();
             foreach (WT_I18N::installed_languages() as $code => $name) {
                 if (WT_Filter::postBool('lang_' . $code)) {
                     $languages[] = $code;
                 }
             }
             set_block_setting($block_id, 'languages', implode(',', $languages));
             $this->config();
         } else {
             $block_id = WT_Filter::getInteger('block_id');
             $controller = new WT_Controller_Page();
             if ($block_id) {
                 $controller->setPageTitle(WT_I18N::translate('Edit story'));
                 $title = get_block_setting($block_id, 'title');
                 $story_body = get_block_setting($block_id, 'story_body');
                 $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                 $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             } else {
                 $controller->setPageTitle(WT_I18N::translate('Add a story'));
                 $title = '';
                 $story_body = '';
                 $gedcom_id = WT_GED_ID;
                 $xref = WT_Filter::get('xref', WT_REGEX_XREF);
             }
             $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
             if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
                 ckeditor_WT_Module::enableEditor($controller);
             }
             echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
             echo WT_Filter::getCsrf();
             echo '<input type="hidden" name="save" value="1">';
             echo '<input type="hidden" name="block_id" value="', $block_id, '">';
             echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
             echo '<table id="story_module">';
             echo '<tr><th>';
             echo WT_I18N::translate('Story title');
             echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
             echo '<tr><th>';
             echo WT_I18N::translate('Story');
             echo '</th></tr><tr><td>';
             echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
             echo '</td></tr>';
             echo '</table><table id="story_module2">';
             echo '<tr>';
             echo '<th>', WT_I18N::translate('Individual'), '</th>';
             echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
             echo '</tr>';
             echo '<tr>';
             echo '<td class="optionbox">';
             echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
             echo print_findindi_link('pid');
             if ($xref) {
                 $person = WT_Individual::getInstance($xref);
                 if ($person) {
                     echo ' ', $person->format_list('span');
                 }
             }
             echo '</td>';
             $languages = get_block_setting($block_id, 'languages');
             echo '<td class="optionbox">';
             echo edit_language_checkboxes('lang_', $languages);
             echo '</td></tr></table>';
             echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
             echo '</p>';
             echo '</form>';
             exit;
         }
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }
Exemplo n.º 6
0
        $data = WT_DB::prepare($sql)->execute($args)->fetchAll(PDO::FETCH_NUM);
        // Reformat the data for display
        foreach ($data as &$datum) {
            $site_access_rule_id = $datum[4];
            $datum[4] = '<i class="icon-yes" onclick="document.location=\'' . WT_SCRIPT_NAME . '?action=allow&amp;site_access_rule_id=' . $site_access_rule_id . '\';"></i>';
            $datum[5] = '<i class="icon-yes" onclick="document.location=\'' . WT_SCRIPT_NAME . '?action=deny&amp;site_access_rule_id=' . $site_access_rule_id . '\';"></i>';
            $datum[6] = '<i class="icon-yes" onclick="document.location=\'' . WT_SCRIPT_NAME . '?action=robot&amp;site_access_rule_id=' . $site_access_rule_id . '\';"></i>';
        }
        // Total filtered/unfiltered rows
        $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchOne();
        $recordsTotal = WT_DB::prepare("SELECT COUNT(*) FROM `##site_access_rule` WHERE rule = 'unknown'")->fetchOne();
        header('Content-type: application/json');
        echo json_encode(array('draw' => WT_Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
        exit;
}
$controller->pageHeader()->addInlineJavascript('
		jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
		jQuery.fn.dataTableExt.oSort["unicode-desc"]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
		jQuery("#site_access_rules").dataTable({
			dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
			ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_rules",
			serverSide: true,
			' . WT_I18N::datatablesI18N() . ',
			jQueryUI: true,
			autoWidth: false,
			processing: true,
			pagingType: "full_numbers",
			stateSave: true,
			stateDuration: 180,
			columns: [
				/* 0 ip_address_start        */ { dataSort: 1, class: "ip_address" },
Exemplo n.º 7
0
 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         $block_id = WT_Filter::postInteger('block_id');
         if ($block_id) {
             WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id));
         } else {
             WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order')));
             $block_id = WT_DB::getInstance()->lastInsertId();
         }
         set_block_setting($block_id, 'header', WT_Filter::post('header'));
         set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
         $languages = array();
         foreach (WT_I18N::installed_languages() as $code => $name) {
             if (WT_Filter::postBool('lang_' . $code)) {
                 $languages[] = $code;
             }
         }
         set_block_setting($block_id, 'languages', implode(',', $languages));
         $this->config();
     } else {
         $block_id = WT_Filter::getInteger('block_id');
         $controller = new WT_Controller_Page();
         if ($block_id) {
             $controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
             $header = get_block_setting($block_id, 'header');
             $faqbody = get_block_setting($block_id, 'faqbody');
             $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
         } else {
             $controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
             $header = '';
             $faqbody = '';
             $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
             $gedcom_id = WT_GED_ID;
         }
         $controller->pageHeader();
         if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
             ckeditor_WT_Module::enableEditor($controller);
         }
         // "Help for this page" link
         echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
         echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
         echo WT_Filter::getCsrf();
         echo '<input type="hidden" name="save" value="1">';
         echo '<input type="hidden" name="block_id" value="', $block_id, '">';
         echo '<table id="faq_module">';
         echo '<tr><th>';
         echo WT_I18N::translate('Question');
         echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>';
         echo '<tr><th>';
         echo WT_I18N::translate('Answer');
         echo '</th></tr><tr><td>';
         echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>';
         echo '</td></tr>';
         echo '</table><table id="faq_module2">';
         echo '<tr>';
         echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
         echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
         echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
         echo '</tr><tr>';
         echo '<td>';
         $languages = get_block_setting($block_id, 'languages');
         echo edit_language_checkboxes('lang_', $languages);
         echo '</td><td>';
         echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
         echo '</td><td>';
         echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"');
         echo '</td></tr>';
         echo '</table>';
         echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
         echo '</form>';
         exit;
     }
 }
Exemplo n.º 8
0
        $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);
        exit;
}
$controller->pageHeader()->addInlineJavascript('jQuery("#tabs").tabs(); jQuery("#tabs").css("display", "inline");')->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
?>
<form enctype="multipart/form-data" method="post" id="configform" name="configform" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
	<?php 
echo WT_Filter::getCsrf();
?>
	<input type="hidden" name="action" value="update">
	<input type="hidden" name="ged" value="<?php 
echo WT_Filter::escapeHtml(WT_GEDCOM);
?>
">

	<div id="tabs">