作者:brambrav
项目:webtree
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;
}
作者:sadr11
项目:webtree
/**
* Store a new message (of the appropriate type) in the message log.
*
* @param string $message
* @param string $log_type
* @param WT_Tree|null $tree
*/
private static function addLog($message, $log_type, WT_Tree $tree = null)
{
global $WT_REQUEST, $WT_TREE;
if (!$tree) {
$tree = $WT_TREE;
}
WT_DB::prepare("INSERT INTO `##log` (log_type, log_message, ip_address, user_id, gedcom_id) VALUES (?, ?, ?, ?, ?)")->execute(array($log_type, $message, $WT_REQUEST->getClientIp(), Auth::id(), $tree ? $tree->tree_id : null));
}
作者:brambrav
项目:webtree
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-obje');
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Edit media object'), '#', 'menu-obje-edit');
$submenu->addOnclick("window.open('addmedia.php?action=editmedia&pid={$this->record->getXref()}', '_blank', edit_window_specs)");
$menu->addSubmenu($submenu);
// main link displayed on page
if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Manage links'), '#', 'menu-obje-link');
$submenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','manage');");
} else {
$submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', 'menu-obje-link');
$ssubmenu = new WT_Menu(WT_I18N::translate('To individual'), '#', 'menu-obje-link-indi');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','person');");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new WT_Menu(WT_I18N::translate('To family'), '#', 'menu-obje-link-fam');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','family');");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new WT_Menu(WT_I18N::translate('To source'), '#', 'menu-obje-link-sour');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','source');");
$submenu->addSubMenu($ssubmenu);
}
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-obje-del');
$submenu->addOnclick("return delete_media('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-obje-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
作者:jacolin
项目:webtree
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();
}
作者:brambrav
项目:webtree
public function modAction($mod_action)
{
switch ($mod_action) {
case 'admin_batch_update':
$controller = new WT_Controller_Page();
$controller->setPageTitle(WT_I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader();
// TODO: these files should be methods in this class
require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php';
$mod = new batch_update();
echo $mod->main();
break;
default:
header('HTTP/1.0 404 Not Found');
}
}
作者:jacolin
项目:webtree
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo');
if (WT_USER_CAN_EDIT) {
$fact = $this->record->getFirstFact('NAME');
$submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit');
if ($fact) {
// Edit existing name
$submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');');
} else {
// Add new name
$submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');');
}
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del');
$submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
作者:brambrav
项目:webtree
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;
}
}
作者:sadr11
项目:webtree
/**
* PDF Setup - WT_Report_PDF
*/
function setup()
{
parent::setup();
// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
$this->pdf = new PDF($this->orientation, parent::unit, array($this->pagew, $this->pageh), self::unicode, "UTF-8", self::diskcache);
// Setup the PDF margins
$this->pdf->setMargins($this->leftmargin, $this->topmargin, $this->rightmargin);
$this->pdf->SetHeaderMargin($this->headermargin);
$this->pdf->SetFooterMargin($this->footermargin);
//Set auto page breaks
$this->pdf->SetAutoPageBreak(true, $this->bottommargin);
// Set font subsetting
$this->pdf->setFontSubsetting(self::subsetting);
// Setup PDF compression
$this->pdf->SetCompression(self::compression);
// Setup RTL support
$this->pdf->setRTL($this->rtl);
// Set the document information
// Only admin should see the version number
$appversion = WT_WEBTREES;
if (Auth::isAdmin()) {
$appversion .= " " . WT_VERSION;
}
$this->pdf->SetCreator($appversion . " (" . parent::wt_url . ")");
// Not implemented yet - WT_Report_Base::setup()
$this->pdf->SetAuthor($this->rauthor);
$this->pdf->SetTitle($this->title);
$this->pdf->SetSubject($this->rsubject);
$this->pdf->SetKeywords($this->rkeywords);
$this->pdf->setReport($this);
if ($this->showGenText) {
// The default style name for Generated by.... is 'genby'
$element = new CellPDF(0, 10, 0, "C", "", "genby", 1, ".", ".", 0, 0, "", "", true);
$element->addText($this->generatedby);
$element->setUrl(parent::wt_url);
$this->pdf->addFooter($element);
}
}
作者:brambrav
项目:webtree
// (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;
define('WT_SCRIPT_NAME', 'admin_module_sidebar.php');
require 'includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript('
jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"});
//-- update the order numbers after drag-n-drop sorting is complete
jQuery("#sidebars_table").bind("sortupdate", function(event, ui) {
jQuery("#"+jQuery(this).attr("id")+" input").each(
function (index, value) {
value.value = index+1;
}
);
});
');
$modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module_name => $module) {
作者:brambrav
项目:webtree
// 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;
define('WT_SCRIPT_NAME', 'admin_users_bulk.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Send broadcast messages'))->pageHeader();
?>
<div id="users_bulk">
<p>
<a href="#" onclick="message('all', 'messaging2', ''); return false;">
<?php
echo WT_I18N::translate('Send message to all users');
?>
</a>
</p>
<p>
<a href="#" onclick="message('never_logged', 'messaging2', ''); return false;">
<?php
echo WT_I18N::translate('Send message to users who have never logged in');
?>
</a>
作者:brambrav
项目:webtree
}
// 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?
作者:jacolin
项目:webtree
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-indi');
$menu->addLabel($menu->label, 'down');
// What behaviour shall we give the main menu? If we leave it blank, the framework
// will copy the first submenu - which may be edit-raw or delete.
// As a temporary solution, make it edit the name
$menu->addOnclick("return false;");
if (WT_USER_CAN_EDIT) {
foreach ($this->record->getFacts() as $fact) {
if ($fact->getTag() == 'NAME' && $fact->canEdit()) {
$menu->addOnclick("return edit_name('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');");
}
break;
}
$submenu = new WT_Menu(WT_I18N::translate('Add a new name'), '#', 'menu-indi-addname');
$submenu->addOnclick("return add_name('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
$has_sex_record = false;
$submenu = new WT_Menu(WT_I18N::translate('Edit gender'), '#', 'menu-indi-editsex');
foreach ($this->record->getFacts() as $fact) {
if ($fact->getTag() == 'SEX' && $fact->canEdit()) {
$submenu->addOnclick("return edit_record('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');");
$has_sex_record = true;
break;
}
}
if (!$has_sex_record) {
$submenu->addOnclick("return add_new_record('" . $this->record->getXref() . "', 'SEX');");
}
$menu->addSubmenu($submenu);
if (count($this->record->getSpouseFamilies()) > 1) {
$submenu = new WT_Menu(WT_I18N::translate('Re-order families'), '#', 'menu-indi-orderfam');
$submenu->addOnclick("return reorder_families('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-indi-del');
$submenu->addOnclick("return delete_individual('" . WT_I18N::translate('Are you sure you want to delete “%s”?', WT_Filter::escapeJs(strip_tags($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-indi-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-indi-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
return $menu;
}
作者:brambrav
项目:webtree
//
// 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\User;
define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
require './includes/session.php';
//require WT_ROOT.'includes/functions/functions_edit.php';
// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
if (WT_GED_ID || count(User::all()) > 1) {
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
exit;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
$error = '';
$warning = '';
$PGV_PATH = WT_Filter::post('PGV_PATH');
if ($PGV_PATH) {
if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) {
$error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView');
} else {
// Load the configuration settings
$config_php = file_get_contents($PGV_PATH . '/config.php');
// The easiest way to do this is to exec() the file - but not lines containing require or PHP tags
$config_php = preg_replace(array('/^\\s*(include|require).*/m', '/.*<\\?php.*/', '/.*\\?>.*/'), '', $config_php);
eval($config_php);
// $INDEX_DIRECTORY can be either absolute or relative to the PhpGedView root.
if (preg_match('/^(\\/|\\|[A-Z]:)/', $INDEX_DIRECTORY)) {
$INDEX_DIRECTORY = realpath($INDEX_DIRECTORY);
作者:brambrav
项目:webtree
// 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";
作者:jacolin
项目:webtree
private function adminPlaces()
{
require WT_ROOT . 'includes/functions/functions_edit.php';
$action = WT_Filter::get('action');
$parent = WT_Filter::get('parent');
$inactive = WT_Filter::getBool('inactive');
$deleteRecord = WT_Filter::get('deleteRecord');
if (!isset($parent)) {
$parent = 0;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin());
if ($action == 'ExportFile' && Auth::isAdmin()) {
Zend_Session::writeClose();
$tmp = $this->placeIdToHierarchy($parent);
$maxLevel = $this->getHighestLevel();
if ($maxLevel > 8) {
$maxLevel = 8;
}
$tmp[0] = 'places';
$outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
if ($maxLevel > 0) {
echo '"', WT_I18N::translate('State'), '";';
}
if ($maxLevel > 1) {
echo '"', WT_I18N::translate('County'), '";';
}
if ($maxLevel > 2) {
echo '"', WT_I18N::translate('City'), '";';
}
if ($maxLevel > 3) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 4) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 5) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 6) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 7) {
echo '"', WT_I18N::translate('Place'), '";';
}
echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
$this->outputLevel($parent);
exit;
}
$controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
?>
<table id="gm_config">
<tr>
<th>
<a href="module.php?mod=googlemap&mod_action=admin_config">
<?php
echo WT_I18N::translate('Google Maps™ preferences');
?>
</a>
</th>
<th>
<a class="current" href="module.php?mod=googlemap&mod_action=admin_places">
<?php
echo WT_I18N::translate('Geographic data');
?>
</a>
</th>
<th>
<a href="module.php?mod=googlemap&mod_action=admin_placecheck">
<?php
echo WT_I18N::translate('Place check');
?>
</a>
</th>
</tr>
</table>
<?php
if ($action == 'ImportGedcom') {
$placelist = array();
$j = 0;
$gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn();
foreach ($gedcom_records as $gedrec) {
$i = 1;
$placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
while (!empty($placerec)) {
if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
$placelist[$j] = array();
$placelist[$j]['place'] = trim($match[1]);
if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
$placelist[$j]['lati'] = trim($match[1]);
if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
if ($placelist[$j]['lati'] < 0) {
$placelist[$j]['lati'][0] = 'S';
} else {
$placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
}
//.........这里部分代码省略.........
作者:brambrav
项目:webtree
<?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();
作者:sadr11
项目:webtree
// UI for online updating of the config file.
//
// 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 Michelf\MarkdownExtra;
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_site_readme.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('README documentation'))->pageHeader();
?>
<div class="markdown" dir="ltr" lang="en">
<?php
echo MarkdownExtra::defaultTransform(file_get_contents('README.md'));
?>
</div>
作者:brambrav
项目:webtree
<?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);
作者:brambrav
项目:webtree
// 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;
define('WT_SCRIPT_NAME', 'admin_site_clean.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Clean up data folder'))->pageHeader();
require WT_ROOT . 'includes/functions/functions_edit.php';
function full_rmdir($dir)
{
if (!is_writable($dir)) {
if (!@chmod($dir, WT_PERM_EXE)) {
return false;
}
}
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry = $dir . '/' . $entry;
if (is_dir($entry)) {
作者:brambrav
项目:webtree
}
// 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=' . rawurlencode($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=' . rawurlencode($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>';
}