function getOptions() { parent::getOptions(); $this->search = WT_Filter::get('search'); $this->replace = WT_Filter::get('replace'); $this->method = WT_Filter::get('method', 'exact|words|wildcards|regex', 'exact'); $this->case = WT_Filter::get('case', 'i'); $this->error = ''; switch ($this->method) { case 'exact': $this->regex = preg_quote($this->search, '/'); break; case 'words': $this->regex = '\\b' . preg_quote($this->search, '/') . '\\b'; break; case 'wildcards': $this->regex = '\\b' . str_replace(array('\\*', '\\?'), array('.*', '.'), preg_quote($this->search, '/')) . '\\b'; break; case 'regex': $this->regex = $this->search; // Check for invalid regexes // If the regex is bad, $ct will be left at -1 $ct = -1; $ct = @preg_match('/' . $this->search . '/', ''); if ($ct == -1) { $this->error = '<br><span class="error">' . WT_I18N::translate('The regex appears to contain an error. It can’t be used.') . '</span>'; } break; } }
public function ajaxRequest() { global $SEARCH_SPIDER; // Search engines should not make AJAX requests if ($SEARCH_SPIDER) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } // Initialise tabs $tab = WT_Filter::get('module'); // A request for a non-existant tab? if (array_key_exists($tab, $this->tabs)) { $mod = $this->tabs[$tab]; } else { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); exit; } header("Content-Type: text/html; charset=UTF-8"); // AJAX calls do not have the meta tag headers and need this set header("X-Robots-Tag: noindex,follow"); // AJAX pages should not show up in search results, any links can be followed though Zend_Session::writeClose(); echo $mod->getTabContent(); if (WT_DEBUG_SQL) { echo WT_DB::getQueryLog(); } }
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype; switch (WT_Filter::get('action')) { case 'deletenews': $news_id = WT_Filter::getInteger('news_id'); if ($news_id) { deleteNews($news_id); } break; } $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } $usernews = getUserNews(WT_USER_ID); $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = ''; $title .= $this->getTitle(); $content = ''; if (count($usernews) == 0) { $content .= WT_I18N::translate('You have not created any journal items.'); } foreach ($usernews as $key => $news) { $day = date('j', $news['date']); $mon = date('M', $news['date']); $year = date('Y', $news['date']); $content .= "<div class=\"journal_box\">"; $content .= "<div class=\"news_title\">" . $news['title'] . '</div>'; $content .= "<div class=\"news_date\">" . format_timestamp($news['date']) . '</div>'; if ($news["text"] == strip_tags($news["text"])) { // No HTML? $news["text"] = nl2br($news["text"], false); } $content .= $news["text"] . "<br><br>"; $content .= "<a href=\"#\" onclick=\"window.open('editnews.php?news_id='+" . $key . ", '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Edit') . "</a> | "; $content .= "<a href=\"index.php?action=deletenews&news_id={$key}&ctype={$ctype}\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . "</a><br>"; $content .= "</div><br>"; } if (WT_USER_ID) { $content .= "<br><a href=\"#\" onclick=\"window.open('editnews.php?user_id='+WT_USER_ID, '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Add a new journal entry') . "</a>"; } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } }
public function __construct() { global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight; $bwidth = $Dbwidth; $pbwidth = $bwidth + 12; $pbheight = $bheight + 14; $xref = WT_Filter::get('famid', WT_REGEX_XREF); $this->record = WT_Family::getInstance($xref); parent::__construct(); }
public function modAction($mod_action) { switch ($mod_action) { case 'admin': $this->admin(); break; case 'generate': Zend_Session::writeClose(); $this->generate(WT_Filter::get('file')); break; default: header('HTTP/1.0 404 Not Found'); } }
function __construct($rootid = '', $show_full = 1) { global $bheight, $bwidth, $cbwidth, $cbheight, $bhalfheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS; global $TEXT_DIRECTION, $show_full; parent::__construct(); // Extract parameters from from $this->pid = WT_Filter::get('rootid', WT_REGEX_XREF); $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1, 0); $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3); $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; if (!empty($rootid)) { $this->pid = $rootid; } //-- flip the arrows for RTL languages if ($TEXT_DIRECTION == 'ltr') { $this->left_arrow = 'icon-larrow'; $this->right_arrow = 'icon-rarrow'; } else { $this->left_arrow = 'icon-larrow'; $this->right_arrow = 'icon-larrow'; } // -- size of the detailed boxes based upon optional width parameter $Dbwidth = $this->box_width * $bwidth / 100; $Dbheight = $this->box_width * $bheight / 100; $bwidth = $Dbwidth; $bheight = $Dbheight; // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $this->box_width * $cbwidth / 100; $bheight = $cbheight; } $bhalfheight = (int) ($bheight / 2); // Validate parameters $this->hourPerson = WT_Individual::getInstance($this->pid); if (!$this->hourPerson) { $this->hourPerson = $this->getSignificantIndividual(); $this->pid = $this->hourPerson->getXref(); } $this->name = $this->hourPerson->getFullName(); //Checks how many generations of descendency is for the person for formatting purposes $this->dgenerations = $this->max_descendency_generations($this->pid, 0); if ($this->dgenerations < 1) { $this->dgenerations = 1; } $this->setPageTitle(WT_I18N::translate('Hourglass chart of %s', $this->name)); }
public function getSidebarAjaxContent() { $alpha = WT_Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none $surname = WT_Filter::get('surname'); // All indis with this surname. $search = WT_Filter::get('search'); if ($search) { return $this->search($search); } elseif ($alpha == '@' || $alpha == ',' || $surname) { return $this->getSurnameIndis($alpha, $surname); } elseif ($alpha) { return $this->getAlphaSurnames($alpha, $surname); } else { return ''; } }
public function __construct() { parent::__construct(); $this->surname = WT_Filter::get('surname'); $this->soundex_std = WT_Filter::getBool('soundex_std'); $this->soundex_dm = WT_Filter::getBool('soundex_dm'); if ($this->surname) { $this->setPageTitle(WT_I18N::translate('Branches of the %s family', WT_Filter::escapeHtml($this->surname))); $this->loadIndividuals(); $self = WT_Individual::getInstance(WT_USER_GEDCOM_ID); if ($self) { $this->loadAncestors(WT_Individual::getInstance(WT_USER_GEDCOM_ID), 1); } } else { $this->setPageTitle(WT_I18N::translate('Branches')); } }
public function __construct() { parent::__construct(); $this->rootid = WT_Filter::get('rootid', WT_REGEX_XREF); if ($this->rootid) { $this->root = WT_Individual::getInstance($this->rootid); } else { // Missing rootid parameter? Do something. $this->root = $this->getSignificantIndividual(); $this->rootid = $this->root->getXref(); } if (!$this->root || !$this->root->canShowName()) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $this->error_message = WT_I18N::translate('This individual does not exist or you do not have permission to view it.'); $this->rootid = null; } }
public function modAction($modAction) { Zend_Session::writeClose(); header('Content-Type: text/html; charset=UTF-8'); switch ($modAction) { case 'search': $search = WT_Filter::get('search'); echo $this->search($search); break; case 'descendants': $individual = WT_Individual::getInstance(WT_Filter::get('xref', WT_REGEX_XREF)); if ($individual) { echo $this->loadSpouses($individual, 1); } break; default: header('HTTP/1.0 404 Not Found'); break; } exit; }
$show_all = 'no'; $legend = $UNKNOWN_NN; $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . WT_GEDURL; $show = 'indi'; // SURN list makes no sense here } elseif ($alpha == ',') { $show_all = 'no'; $legend = WT_I18N::translate('None'); $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . WT_GEDURL; $show = 'indi'; // SURN list makes no sense here } elseif ($alpha) { $show_all = 'no'; $legend = WT_Filter::escapeHtml($alpha) . '…'; $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . WT_GEDURL; $show = WT_Filter::get('show', 'surn|indi', 'surn'); } else { $show_all = 'no'; $legend = '…'; $url = WT_SCRIPT_NAME . '?ged=' . WT_GEDURL; $show = 'none'; // Don't show lists until something is chosen } $legend = '<span dir="auto">' . $legend . '</span>'; $controller->setPageTitle(WT_I18N::translate('Families') . ' : ' . $legend)->pageHeader(); echo '<h2 class="center">', WT_I18N::translate('Families'), '</h2>'; // Print a selection list of initial letters $list = array(); foreach (WT_Query_Name::surnameAlpha($show_marnm, true, WT_GED_ID) as $letter => $count) { switch ($letter) { case '@':
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller; self::updateSchema(); // make sure the favorites table has been created $action = WT_Filter::get('action'); switch ($action) { case 'deletefav': $favorite_id = WT_Filter::getInteger('favorite_id'); if ($favorite_id) { self::deleteFavorite($favorite_id); } break; case 'addfav': $gid = WT_Filter::get('gid', WT_REGEX_XREF); $favnote = WT_Filter::get('favnote'); $url = WT_Filter::getUrl('url'); $favtitle = WT_Filter::get('favtitle'); if ($gid) { $record = WT_GedcomRecord::getInstance($gid); if ($record && $record->canShow()) { self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => $favnote, 'title' => $favtitle)); } } elseif ($url) { self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => null, 'type' => 'URL', 'url' => $url, 'note' => $favnote, 'title' => $favtitle ? $favtitle : $url)); } break; } $block = get_block_setting($block_id, 'block', false); if ($cfg) { foreach (array('block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; $show_full = 1; $PEDIGREE_FULL_DETAILS = 1; $userfavs = $this->getFavorites($ctype == 'user' ? WT_USER_ID : WT_GED_ID); if (!is_array($userfavs)) { $userfavs = array(); } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); if (WT_USER_ID) { $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); } $content = ''; $style = 2; // 1 means "regular box", 2 means "wide box" if ($userfavs) { foreach ($userfavs as $key => $favorite) { if (isset($favorite['id'])) { $key = $favorite['id']; } $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&action=deletefav&favorite_id=' . $key . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . WT_I18N::translate('Remove') . '</a> '; if ($favorite['type'] == 'URL') { $content .= '<div id="boxurl' . $key . '.0" class="person_box">'; if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>'; $content .= '<br>' . $favorite['note']; $content .= '</div>'; } else { $record = WT_GedcomRecord::getInstance($favorite['gid']); if ($record && $record->canShow()) { if ($record instanceof WT_Individual) { $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header'; switch ($record->getsex()) { case 'M': break; case 'F': $content .= 'F'; break; case 'U': $content .= 'NN'; break; } $content .= '">'; if ($ctype == "user" || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } ob_start(); print_pedigree_person($record, $style, 1, $key); $content .= ob_get_clean(); $content .= $favorite['note']; $content .= '</div>'; } else { $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">'; if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= $record->format_list('span'); $content .= '<br>' . $favorite['note']; $content .= '</div>'; } } } } } if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $uniqueID = Uuid::uuid4(); // This block can theoretically appear multiple times, so use a unique ID. $content .= '<div class="add_fav_head">'; $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . WT_I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>'; $content .= '</div>'; $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">'; $content .= '<form name="addfavform" method="get" action="index.php">'; $content .= '<input type="hidden" name="action" value="addfav">'; $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">'; $content .= '<input type="hidden" name="ged" value="' . WT_GEDCOM . '">'; $content .= '<div class="add_fav_ref">'; $content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<label for="gid' . $uniqueID . '">' . WT_I18N::translate('Enter an individual, family, or source ID') . '</label>'; $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">'; $content .= ' ' . print_findindi_link('gid' . $uniqueID); $content .= ' ' . print_findfamily_link('gid' . $uniqueID); $content .= ' ' . print_findsource_link('gid' . $uniqueID); $content .= ' ' . print_findrepository_link('gid' . $uniqueID); $content .= ' ' . print_findnote_link('gid' . $uniqueID); $content .= ' ' . print_findmedia_link('gid' . $uniqueID); $content .= '</div>'; $content .= '<div class="add_fav_url">'; $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . WT_Gedcom_Tag::getLabel('URL') . '" disabled="disabled"> '; $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . WT_I18N::translate('Title') . '" disabled="disabled">'; $content .= '<p>' . WT_I18N::translate('Enter an optional note about this favorite') . '</p>'; $content .= '<textarea name="favnote" rows="6" cols="50"></textarea>'; $content .= '</div>'; $content .= '<input type="submit" value="' . WT_I18N::translate('Add') . '">'; $content .= '</form></div>'; } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; }
// // 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 define('WT_SCRIPT_NAME', 'reportengine.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_rtl.php'; $controller = new WT_Controller_Page(); $famid = WT_Filter::get('famid', WT_REGEX_XREF); $pid = WT_Filter::get('pid', WT_REGEX_XREF); $action = WT_Filter::get('action', 'choose|setup|run', 'choose'); $report = WT_Filter::get('report'); $output = WT_Filter::get('output', 'HTML|PDF', 'PDF'); $vars = WT_Filter::get('vars'); $varnames = WT_Filter::get('varnames'); $type = WT_Filter::get('type'); if (!is_array($vars)) { $vars = array(); } if (!is_array($varnames)) { $varnames = array(); } if (!is_array($type)) { $type = array(); } /** * function to get the values for the given tag */ function get_tag_values($tag) { global $tags, $values;
function __construct() { parent::__construct(); $this->setPageTitle(WT_I18N::translate('Timeline')); $this->baseyear = date("Y"); // new pid $newpid = WT_Filter::get('newpid', WT_REGEX_XREF); // pids array $this->pids = WT_Filter::getArray('pids', WT_REGEX_XREF); // make sure that arrays are indexed by numbers $this->pids = array_values($this->pids); if (!empty($newpid) && !in_array($newpid, $this->pids)) { $this->pids[] = $newpid; } if (count($this->pids) == 0) { $this->pids[] = $this->getSignificantIndividual()->getXref(); } $remove = WT_Filter::get('remove', WT_REGEX_XREF); // cleanup user input $newpids = array(); foreach ($this->pids as $value) { if ($value != $remove) { $newpids[] = $value; $person = WT_Individual::getInstance($value); if ($person) { $this->people[] = $person; } } } $this->pids = $newpids; $this->pidlinks = ""; /* @var $indi Person */ foreach ($this->people as $p => $indi) { if (!is_null($indi) && $indi->canShow()) { // setup string of valid pids for links $this->pidlinks .= "pids%5B%5D=" . $indi->getXref() . "&"; $bdate = $indi->getBirthDate(); if ($bdate->isOK()) { $date = $bdate->MinDate(); $date = $date->convert_to_cal('gregorian'); if ($date->y) { $this->birthyears[$indi->getXref()] = $date->y; $this->birthmonths[$indi->getXref()] = max(1, $date->m); $this->birthdays[$indi->getXref()] = max(1, $date->d); } } // find all the fact information $facts = $indi->getFacts(); foreach ($indi->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { $fact->spouse = $family->getSpouse($indi); $facts[] = $fact; } } foreach ($facts as $event) { // get the fact type $fact = $event->getTag(); if (!in_array($fact, $this->nonfacts)) { // check for a date $date = $event->getDate(); $date = $date->MinDate(); $date = $date->convert_to_cal('gregorian'); if ($date->y) { $this->baseyear = min($this->baseyear, $date->y); $this->topyear = max($this->topyear, $date->y); if (!$indi->isDead()) { $this->topyear = max($this->topyear, date('Y')); } $event->temp = $p; // do not add the same fact twice (prevents marriages from being added multiple times) // TODO - this code does not work. If both spouses are shown, their marriage is duplicated... if (!in_array($event, $this->indifacts, true)) { $this->indifacts[] = $event; } } } } } } $scale = WT_Filter::getInteger('scale', 0, 200); if ($scale == 0) { $this->scale = round(($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4); if ($this->scale < 6) { $this->scale = 6; } } else { $this->scale = $scale; } if ($this->scale < 2) { $this->scale = 2; } $this->baseyear -= 5; $this->topyear += 5; }
public function __construct() { $xref = WT_Filter::get('rid', WT_REGEX_XREF); $this->record = WT_Repository::getInstance($xref); parent::__construct(); }
// 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_trees_renumber.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Renumber family tree'))->pageHeader(); // Every XREF used by this tree and also used by some other tree $xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . " UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . " UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . " UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . " UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . " UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAssoc(); echo '<h2>', $controller->getPageTitle(), ' — ', $WT_TREE->tree_title_html, '</h2>'; if (WT_Filter::get('go')) { foreach ($xrefs as $old_xref => $type) { WT_DB::exec("START TRANSACTION"); WT_DB::exec("LOCK TABLE `##individuals` WRITE," . " `##families` WRITE," . " `##sources` WRITE," . " `##media` WRITE," . " `##other` WRITE," . " `##name` WRITE," . " `##placelinks` WRITE," . " `##change` WRITE," . " `##next_id` WRITE," . " `##dates` WRITE," . " `##default_resn` WRITE," . " `##hit_counter` WRITE," . " `##link` WRITE," . " `##user_gedcom_setting` WRITE"); $new_xref = get_new_xref($type); switch ($type) { case 'INDI': WT_DB::prepare("UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?")->execute(array($new_xref, "0 @{$old_xref}@ INDI\n", "0 @{$new_xref}@ INDI\n", $old_xref, WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " HUSB @{$old_xref}@", " HUSB @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " WIFE @{$old_xref}@", " WIFE @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " CHIL @{$old_xref}@", " CHIL @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?")->execute(array($new_xref, $old_xref, WT_GED_ID));
function __construct() { global $WT_SESSION; parent::__construct(); $this->setPageTitle(WT_I18N::translate('Lifespans')); $this->colorindex = 0; $this->Fcolorindex = 0; $this->Mcolorindex = 0; $this->zoomfactor = 10; $this->color = "#0000FF"; $this->currentYear = date("Y"); $this->deathMod = 0; $this->endDate = $this->currentYear; // Request parameters $newpid = WT_Filter::get('newpid', WT_REGEX_XREF); $remove = WT_Filter::get('remove', WT_REGEX_XREF); $pids = WT_Filter::getArray('pids', WT_REGEX_XREF); $clear = WT_Filter::getBool('clear'); $addfam = WT_Filter::getBool('addFamily'); $place = WT_Filter::get('place'); $beginYear = WT_Filter::getInteger('beginYear', 0, date('Y') + 100, 0); $endYear = WT_Filter::getInteger('endYear', 0, date('Y') + 100, 0); if ($clear) { // Empty list $this->pids = array(); } elseif ($pids) { // List of specified records $this->pids = $pids; } elseif ($place) { // All records found in a place $wt_place = new WT_Place($place, WT_GED_ID); $this->pids = WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($wt_place->getPlaceId(), WT_GED_ID))->fetchOneColumn(); $this->place = $place; } else { // Modify an existing list of records if (is_array($WT_SESSION->timeline_pids)) { $this->pids = $WT_SESSION->timeline_pids; } else { $this->pids = array(); } if ($remove) { foreach ($this->pids as $key => $value) { if ($value == $remove) { unset($this->pids[$key]); } } } elseif ($newpid) { $person = WT_Individual::getInstance($newpid); $this->addFamily($person, $addfam); } elseif (!$this->pids) { $this->addFamily($this->getSignificantIndividual(), false); } } $WT_SESSION->timeline_pids = $this->pids; $this->beginYear = $beginYear; $this->endYear = $endYear; if ($beginYear == 0 || $endYear == 0) { //-- cleanup user input $this->pids = array_unique($this->pids); //removes duplicates foreach ($this->pids as $key => $value) { if ($value != $remove) { $this->pids[$key] = $value; $person = WT_Individual::getInstance($value); // list of linked records includes families as well as individuals. if ($person) { $bdate = $person->getEstimatedBirthDate(); if ($bdate->isOK() && $person->canShow()) { $this->people[] = $person; } } } } } else { //--Finds if the begin year and end year textboxes are not empty //-- reset the people array when doing a year range search $this->people = array(); //Takes the begining year and end year passed by the postback and modifies them and uses them to populate //the time line //Variables to restrict the person boxes to the year searched. //--Searches for individuals who had an even between the year begin and end years $indis = self::search_indis_year_range($beginYear, $endYear); //--Populates an array of people that had an event within those years foreach ($indis as $person) { if (empty($searchplace) || in_array($person->getXref(), $this->pids)) { $bdate = $person->getEstimatedBirthDate(); if ($bdate->isOK() && $person->canShow()) { $this->people[] = $person; } } } $WT_SESSION->timeline_pids = null; } // Sort the array in order of birth year uasort($this->people, function (WT_Individual $a, WT_Individual $b) { return WT_Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //If there is people in the array posted back this if occurs if (isset($this->people[0])) { //Find the maximum Death year and mimimum Birth year for each individual returned in the array. $bdate = $this->people[0]->getEstimatedBirthDate(); $ddate = $this->people[0]->getEstimatedDeathDate(); $this->timelineMinYear = $bdate->gregorianYear(); $this->timelineMaxYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y'); foreach ($this->people as $value) { $bdate = $value->getEstimatedBirthDate(); $ddate = $value->getEstimatedDeathDate(); $this->timelineMinYear = min($this->timelineMinYear, $bdate->gregorianYear()); $this->timelineMaxYear = max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y')); } if ($this->timelineMaxYear > $this->currentYear) { $this->timelineMaxYear = $this->currentYear; } } else { // Sets the default timeline length $this->timelineMinYear = date("Y") - 101; $this->timelineMaxYear = date("Y"); } }
// // 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 // GEDFact Media assistant replacement code for inverselink.php: =========================== //-- extra page parameters and checking use WT\Auth; $more_links = WT_Filter::get('more_links'); $exist_links = WT_Filter::get('exist_links'); $gid = WT_Filter::get('gid', WT_REGEX_XREF); $update_CHAN = WT_Filter::get('preserve_last_changed'); $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); $paramok = true; if (!empty($linktoid)) { $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow(); } if ($action == 'choose' && $paramok) { ?> <script> // Javascript variables var id_empty = "<?php echo WT_I18N::translate('When adding a link, the ID field cannot be empty.'); ?> "; function blankwin() {
// (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 define('WT_SCRIPT_NAME', 'placelist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page(); $action = WT_Filter::get('action', 'find|show', 'find'); $display = WT_Filter::get('display', 'hierarchy|list', 'hierarchy'); $parent = WT_Filter::getArray('parent'); $level = count($parent); if ($display == 'hierarchy') { if ($level) { $controller->setPageTitle(WT_I18N::translate('Place hierarchy') . ' - <span dir="auto">' . WT_Filter::escapeHtml(end($parent)) . '</span>'); } else { $controller->setPageTitle(WT_I18N::translate('Place hierarchy')); } } else { $controller->setPageTitle(WT_I18N::translate('Place list')); } $controller->pageHeader(); echo '<div id="place-hierarchy">'; switch ($display) { case 'list':
} 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? if (!$THEME_DIR && in_array($WT_SESSION->theme_dir, get_theme_names())) { $THEME_DIR = $WT_SESSION->theme_dir; } } else { $THEME_DIR = ''; } if (!$THEME_DIR) { // User cannot choose (or has not chosen) a theme. // 1) gedcom setting // 2) site setting // 3) webtrees
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(), '&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; } }
$rows = WT_DB::prepare($SELECT1 . $WHERE . ' ORDER BY log_id')->execute($args)->fetchAll(); foreach ($rows as $row) { echo '"', $row->log_time, '",', '"', $row->log_type, '",', '"', str_replace('"', '""', $row->log_message), '",', '"', $row->ip_address, '",', '"', str_replace('"', '""', $row->user_name), '",', '"', str_replace('"', '""', $row->gedcom_name), '"', "\n"; } exit; case 'load_json': Zend_Session::writeClose(); $start = WT_Filter::getInteger('start'); $length = WT_Filter::getInteger('length'); Auth::user()->setSetting('admin_site_log_page_size', $length); if ($length > 0) { $LIMIT = " LIMIT " . $start . ',' . $length; } else { $LIMIT = ""; } $order = WT_Filter::get('order'); if ($order) { $ORDER_BY = ' ORDER BY '; for ($i = 0; $i < count($order); ++$i) { if ($i > 0) { $ORDER_BY .= ','; } // Datatables numbers columns 0, 1, 2, ... // MySQL numbers columns 1, 2, 3, ... switch ($order[$i]['dir']) { case 'asc': $ORDER_BY .= 1 + $order[$i]['column'] . ' ASC '; break; case 'desc': $ORDER_BY .= 1 + $order[$i]['column'] . ' DESC '; break;
public function downloadForm($clip_ctrl) { global $GEDCOM_MEDIA_PATH; $pid = WT_Filter::get('pid', WT_REGEX_XREF); $out = '<script>'; $out .= 'function cancelDownload() { var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '"; jQuery("#sb_clippings_content").load(link); }'; $out .= '</script>'; $out .= '<form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="pid" value="' . $pid . '"> <input type="hidden" name="action" value="download"> <table> <tr><td colspan="2" class="topbottombar"><h2>' . WT_I18N::translate('Download') . '</h2></td></tr> <tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Zip file(s)') . help_link('zip') . '</td> <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked="checked"></td></tr> <tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Include media (automatically zips files)') . help_link('include_media') . '</td> <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked="checked"></td></tr> '; if (WT_USER_GEDCOM_ADMIN) { $out .= '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' . '<td class="optionbox">' . ' <input type="radio" name="privatize_export" value="none" checked="checked"> ' . WT_I18N::translate('None') . '<br>' . ' <input type="radio" name="privatize_export" value="gedadmin"> ' . WT_I18N::translate('Manager') . '<br>' . ' <input type="radio" name="privatize_export" value="user"> ' . WT_I18N::translate('Member') . '<br>' . ' <input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') . '</td></tr>'; } elseif (WT_USER_CAN_ACCESS) { $out .= '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' . '<td class="list_value">' . ' <input type="radio" name="privatize_export" value="user" checked="checked"> ' . WT_I18N::translate('Member') . '<br>' . ' <input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') . '</td></tr>'; } $out .= ' <tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)') . help_link('utf8_ansi') . '</td> <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> <tr> <td class="descriptionbox width50 wrap">' . WT_I18N::translate('Add the GEDCOM media path to filenames') . help_link('GEDCOM_MEDIA_PATH') . '</td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '"> <span dir="auto">' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '</span></td> </tr> <input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '"> </td></tr> <tr><td class="topbottombar" colspan="2"> <input type="button" value="' . WT_I18N::translate('Cancel') . '" onclick="cancelDownload();"> <input type="submit" value="' . WT_I18N::translate('Download') . '"> </form>'; return $out; }
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']; } } } else { $placelist[$j]['lati'] = NULL; } if (preg_match("/4 LONG (.*)/", $placerec, $match)) { $placelist[$j]['long'] = trim($match[1]); if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') { if ($placelist[$j]['long'] < 0) { $placelist[$j]['long'][0] = 'W'; } else { $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; } } } else { $placelist[$j]['long'] = NULL; } $j = $j + 1; } $i = $i + 1; $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i); } } asort($placelist); $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $highestIndex = $this->getHighestIndex(); $default_zoom_level = array(4, 7, 10, 12); foreach ($placelistUniq as $k => $place) { $parent = preg_split('/ *, */', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) { $default_zoom_level[$i] = $default_zoom_level[$i - 1]; } $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if ($i < count($parent) - 1) { // Create higher-level places, if necessary if (empty($row)) { $highestIndex++; WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; $parent_id = $highestIndex; } else { $parent_id = $row->pl_id; } } else { // Create lowest-level place, if necessary if (empty($row->pl_id)) { $highestIndex++; WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; } else { if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id)); echo WT_Filter::escapeHtml($escparent), '<br>'; } } } } } $parent = 0; } if ($action == 'ImportFile') { $placefiles = array(); $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> <table class="gm_plac_edit"> <tr> <th><?php echo WT_I18N::translate('File containing places (CSV)'); ?> </th> <td><input type="file" name="placesfile" size="50"></td> </tr> <?php if (count($placefiles) > 0) { ?> <tr> <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE', 'googlemap'); ?> </th> <td> <select name="localfile"> <option></option> <?php foreach ($placefiles as $p => $placefile) { ?> <option value="<?php echo WT_Filter::escapeHtml($placefile); ?> "><?php if (substr($placefile, 0, 1) == "/") { echo substr($placefile, 1); } else { echo $placefile; } ?> </option> <?php } ?> </select> </td> </tr> <?php } ?> <tr> <th><?php echo WT_I18N::translate('Delete all existing geographic data before importing the file.'); ?> </th> <td><input type="checkbox" name="cleardatabase"></td> </tr> <tr> <th><?php echo WT_I18N::translate('Do not create new locations, just import coordinates for existing locations.'); ?> </th> <td><input type="checkbox" name="updateonly"></td> </tr> <tr> <th><?php echo WT_I18N::translate('Overwrite existing coordinates.'); ?> </th> <td><input type="checkbox" name="overwritedata"></td> </tr> </table> <input id="savebutton" type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "><br> </form> <?php exit; } if ($action == 'ImportFile2') { $country_names = array(); foreach (WT_Stats::iso3166() as $key => $value) { $country_names[$key] = WT_I18N::translate($key); } if (isset($_POST['cleardatabase'])) { WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1"); } if (!empty($_FILES['placesfile']['tmp_name'])) { $lines = file($_FILES['placesfile']['tmp_name']); } elseif (!empty($_REQUEST['localfile'])) { $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); } // Strip BYTE-ORDER-MARK, if present if (!empty($lines[0]) && substr($lines[0], 0, 3) == WT_UTF8_BOM) { $lines[0] = substr($lines[0], 3); } asort($lines); $highestIndex = $this->getHighestIndex(); $placelist = array(); $j = 0; $maxLevel = 0; foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if ($fieldrec[0] > $maxLevel) { $maxLevel = $fieldrec[0]; } } $fields = count($fieldrec); $set_icon = true; if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; } foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { $placelist[$j] = array(); $placelist[$j]['place'] = ''; for ($ii = $fields - 4; $ii > 1; $ii--) { if ($fieldrec[0] > $ii - 2) { $placelist[$j]['place'] .= $fieldrec[$ii] . ','; } } foreach ($country_names as $countrycode => $countryname) { if ($countrycode == strtoupper($fieldrec[1])) { $fieldrec[1] = $countryname; break; } } $placelist[$j]['place'] .= $fieldrec[1]; $placelist[$j]['long'] = $fieldrec[$fields - 4]; $placelist[$j]['lati'] = $fieldrec[$fields - 3]; $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; if ($set_icon) { $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); } else { $placelist[$j]['icon'] = ''; } $j = $j + 1; } } $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $placelistUniq[$j]['zoom'] = $place['zoom']; $placelistUniq[$j]['icon'] = $place['icon']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; $placelistUniq[$j - 1]['zoom'] = $place['zoom']; $placelistUniq[$j - 1]['icon'] = $place['icon']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $default_zoom_level = array(); $default_zoom_level[0] = 4; $default_zoom_level[1] = 7; $default_zoom_level[2] = 10; $default_zoom_level[3] = 12; foreach ($placelistUniq as $k => $place) { $parent = explode(',', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if (empty($row)) { // this name does not yet exist: create entry if (!isset($_POST['updateonly'])) { $highestIndex = $highestIndex + 1; if ($i + 1 == count($parent)) { $zoomlevel = $place['zoom']; } elseif (isset($default_zoom_level[$i])) { $zoomlevel = $default_zoom_level[$i]; } else { $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); } if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) { WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); } else { //delete leading zero $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); if ($pl_lati >= 0) { $place['lati'] = 'N' . abs($pl_lati); } elseif ($pl_lati < 0) { $place['lati'] = 'S' . abs($pl_lati); } if ($pl_long >= 0) { $place['long'] = 'E' . abs($pl_long); } elseif ($pl_long < 0) { $place['long'] = 'W' . abs($pl_long); } WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); } $parent_id = $highestIndex; } } else { $parent_id = $row->pl_id; if (isset($_POST['overwritedata']) && $i + 1 == count($parent)) { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); } else { if (($row->pl_long == '0' || $row->pl_long == null) && ($row->pl_lati == '0' || $row->pl_lati == null)) { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $parent_id)); } if (empty($row->pl_icon) && !empty($place['icon'])) { WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?")->execute(array($place['icon'], $parent_id)); } } } } } $parent = 0; } if ($action == 'DeleteRecord') { $exists = WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne(); if (!$exists) { WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord)); } else { echo '<table class="facts_table"><tr><td>', WT_I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; } } ?> <script> function updateList(inactive) { window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?> '+inactive; } function edit_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs); return false; } function add_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs); return false; } function delete_place(placeid) { var answer=confirm('<?php echo WT_I18N::translate('Remove this location?'); ?> '); if (answer == true) { window.location = '<?php echo $_SERVER['REQUEST_URI']; ?> &action=DeleteRecord&deleteRecord=' + placeid; } } </script> <?php echo '<div id="gm_breadcrumb">'; $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo WT_Filter::escapeHtml($place); } else { echo WT_I18N::translate('unknown'); } } else { echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; if ($place != 'Unknown') { echo WT_Filter::escapeHtml($place), '</a>'; } else { echo WT_I18N::translate('unknown'), '</a>'; } } echo ' - '; } echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top level'), '</a></div>'; echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">'; echo '<label for="inactive">', WT_I18N::translate('Show inactive places'), '</label>'; echo '<input type="checkbox" name="inactive" id="inactive"'; if ($inactive) { echo ' checked="checked"'; } echo ' onclick="updateList(this.checked)"'; echo '>', help_link('PLE_ACTIVE', 'googlemap'), '</div></form>'; $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="gm_plac_edit"><tr>'; echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>'; echo '<th>', WT_Gedcom_Tag::getLabel('LATI'), '</th>'; echo '<th>', WT_Gedcom_Tag::getLabel('LONG'), '</th>'; echo '<th>', WT_I18N::translate('Zoom level'), '</th>'; echo '<th>', WT_I18N::translate('Icon'), '</th>'; echo '<th>'; echo WT_I18N::translate('Edit'), '</th><th>', WT_I18N::translate('Delete'), '</th></tr>'; if (count($placelist) == 0) { echo '<tr><td colspan="7" class="accepted">', WT_I18N::translate('No places found'), '</td></tr>'; } foreach ($placelist as $place) { echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; if ($place['place'] != 'Unknown') { echo WT_Filter::escapeHtml($place['place']), '</a></td>'; } else { echo WT_I18N::translate('unknown'), '</a></td>'; } echo '<td>', $place['lati'], '</td>'; echo '<td>', $place['long'], '</td>'; echo '<td>', $place['zoom'], '</td>'; echo '<td>'; if ($place['icon'] == NULL || $place['icon'] == '') { if ($place['lati'] == NULL || $place['long'] == NULL || $place['lati'] == '0' && $place['long'] == '0') { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; } } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>'; $noRows = WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne(); if ($noRows == 0) { ?> <td><a href="#" onclick="delete_place(<?php echo $place['place_id']; ?> );return false;" class="icon-delete" title="<?php echo WT_I18N::translate('Remove'); ?> "></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> <?php } ?> </tr> <?php } ?> </table> </div> <table id="gm_manage"> <tr> <td> <?php echo WT_I18N::translate('Add a new geographic location'); ?> </td> <td> <form action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;"> <?php echo select_edit_control('parent_id', $where_am_i, WT_I18N::translate('Top level'), $parent); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Import all places from a family tree'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportGedcom"> <?php echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM); ?> <input type="submit" value="<?php echo WT_I18N::translate('Import'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Upload geographic data'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportFile"> <input type="submit" value="<?php echo WT_I18N::translate('Upload'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Download geographic data'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ExportFile"> <?php echo select_edit_control('parent', $where_am_i, WT_I18N::translate('All'), WT_GED_ID); ?> <input type="submit" value="<?php echo WT_I18N::translate('Download'); ?> "> </form> </td> </tr> </table> <?php }
// Only one of $user_id and $gedcom_id should be set $user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER)); if ($user_id) { $gedcom_id = null; } else { $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER)); } // Only an admin can edit the "default" page // Only managers can edit the "home page" // Only a user or an admin can edit a user’s "my page" if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) { $controller->pageHeader(); $controller->addInlineJavascript('window.location.reload();'); exit; } $action = WT_Filter::get('action'); if (isset($_REQUEST['main'])) { $main = $_REQUEST['main']; } else { $main = array(); } if (isset($_REQUEST['right'])) { $right = $_REQUEST['right']; } else { $right = array(); } // Define all the icons we're going to use $IconUarrow = 'icon-uarrow'; $IconDarrow = 'icon-darrow'; if ($TEXT_DIRECTION == 'ltr') { $IconRarrow = 'icon-rarrow';
exit; } $which = $thumb ? 'thumb' : 'main'; $serverFilename = $media->getServerFilename($which); if (!file_exists($serverFilename)) { send404AndExit(); } $mimetype = $media->mimeType(); $imgsize = $media->getImageAttributes($which); $protocol = $_SERVER["SERVER_PROTOCOL"]; // determine if we are using HTTP/1.0 or HTTP/1.1 $filetime = $media->getFiletime($which); $filetimeHeader = gmdate("D, d M Y H:i:s", $filetime) . ' GMT'; $expireOffset = 3600 * 24; // tell browser to cache this image for 24 hours if (WT_Filter::get('cb')) { $expireOffset = $expireOffset * 7; } // if cb parameter was sent, cache for 7 days $expireHeader = gmdate("D, d M Y H:i:s", WT_TIMESTAMP + $expireOffset) . " GMT"; $type = isImageTypeSupported($imgsize['ext']); $usewatermark = false; // if this image supports watermarks and the watermark module is intalled... if ($type) { // if this is not a thumbnail, or WATERMARK_THUMB is true if ($which == 'main' || $WATERMARK_THUMB) { // if the user’s priv’s justify it... if (WT_USER_ACCESS_LEVEL > $SHOW_NO_WATERMARK) { // add a watermark $usewatermark = true; }
break; case "place": $controller->setPageTitle(WT_I18N::translate('Find a place')); break; case "repo": $controller->setPageTitle(WT_I18N::translate('Find a repository')); 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; }
$username = WT_Filter::post('username'); $password = WT_Filter::post('password'); $timediff = WT_Filter::postInteger('timediff', -43200, 50400, 0); // Same range as date('Z') // These parameters may come from the URL which is emailed to users. if (!$action) { $action = WT_Filter::get('action'); } if (!$user_name) { $user_name = WT_Filter::get('user_name', WT_REGEX_USERNAME); } if (!$user_hashcode) { $user_hashcode = WT_Filter::get('user_hashcode'); } if (!$url) { $url = WT_Filter::get('url'); } // Not actually a URL - just a path $message = ''; switch ($action) { case 'login': try { if (!$_COOKIE) { Log::addAuthenticationLog('Login failed (no session cookies): ' . $username); throw new Exception(WT_I18N::translate('You cannot login because your browser does not accept cookies.')); } $user = User::findByIdentifier($username); if (!$user) { Log::addAuthenticationLog('Login failed (no such user/email): ' . $username); throw new Exception(WT_I18N::translate('The username or password is incorrect.')); }
/* approved */ { class: "center" }, /* delete */ { sortable: false } ], "drawCallback": function() { // Our JSON responses include Javascript as well as HTML. This does not get executed automatically… jQuery("#list script").each(function() { eval(this.text); }); } }); /* When clicking on the +/- icon, we expand/collapse the details block */ jQuery("#list tbody").on("click", "td.icon-close", function () { var nTr=this.parentNode; jQuery(this).removeClass("icon-close"); oTable.fnClose(nTr); jQuery(this).addClass("icon-open"); }); jQuery("#list tbody").on("click", "td.icon-open", function () { var nTr=this.parentNode; jQuery(this).removeClass("icon-open"); var aData=oTable.fnGetData(nTr); jQuery.get("' . WT_SCRIPT_NAME . '?action=load1row&user_id="+aData[1], function(data) { oTable.fnOpen(nTr, data, "details"); }); jQuery(this).addClass("icon-close"); }); oTable.fnFilter("' . WT_Filter::get('filter') . '"); '); break; }
// 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 define('WT_SCRIPT_NAME', 'downloadbackup.php'); require './includes/session.php'; $fname = WT_Filter::get('fname'); if (!WT_USER_GEDCOM_ADMIN || !preg_match('/\\.zip$/', $fname)) { $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Error'))->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>'; exit; } header('Pragma: public'); // required header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', false); // required for certain browsers header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $fname . '"'); header('Content-length: ' . filesize(WT_DATA_DIR . $fname));