Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     $PEDIGREE_FULL_DETAILS = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_FULL_DETAILS');
     $MAX_DESCENDANCY_GENERATIONS = get_gedcom_setting(WT_GED_ID, 'MAX_DESCENDANCY_GENERATIONS');
     // Extract the request parameters
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1);
     $this->descent = WT_Filter::getInteger('descent', 0, 9, 5);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // Box sizes are set globally in the theme.  Modify them here.
     global $bwidth, $bheight, $cbwidth, $cbheight, $Dbwidth, $bhalfheight, $Dbheight;
     $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 = $bheight / 2;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Family book of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Family book'));
     }
     //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;
     }
 }
Exemple #2
0
 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&amp;news_id={$key}&amp;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;
     }
 }
Exemple #3
0
 public function __construct()
 {
     parent::__construct();
     $default_generations = get_gedcom_setting(WT_GED_ID, 'DEFAULT_PEDIGREE_GENERATIONS');
     // Extract the request parameters
     $this->fan_style = WT_Filter::getInteger('fan_style', 2, 4, 3);
     $this->fan_width = WT_Filter::getInteger('fan_width', 50, 300, 100);
     $this->generations = WT_Filter::getInteger('generations', 2, 9, $default_generations);
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Fan chart of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Fan chart'));
     }
 }
Exemple #4
0
 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));
 }
Exemple #5
0
 function __construct()
 {
     global $bwidth, $bheight, $cbwidth, $cbheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS;
     global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight;
     global $show_full;
     parent::__construct();
     // Extract form parameters
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_cousins = WT_Filter::getInteger('show_cousins', 0, 1);
     $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3);
     $box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     $PEDIGREE_GENERATIONS = WT_Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     $OLD_PGENS = $PEDIGREE_GENERATIONS;
     // -- size of the detailed boxes based upon optional width parameter
     $Dbwidth = $box_width * $bwidth / 100;
     $Dbheight = $box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $cbwidth;
         $bheight = $cbheight;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Ancestors of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Ancestors'));
     }
     if (strlen($this->name) < 30) {
         $this->cellwidth = "420";
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
 }
Exemple #6
0
 function __construct()
 {
     global $bwidth, $bheight, $cbwidth, $cbheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full;
     parent::__construct();
     // Extract parameters from form
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3, 0);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     $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 (!isset($this->personcount)) {
         $this->personcount = 1;
     }
     // -- 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 = $cbwidth;
         $bheight = $cbheight;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     // Validate form variables
     if (strlen($this->name) < 30) {
         $this->cellwidth = 420;
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Descendants of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Descendants'));
     }
 }
Exemple #7
0
 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 . '&amp;action=deletefav&amp;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;
 }
Exemple #8
0
 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() . "&amp;";
             $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;
 }
Exemple #9
0
//
// 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', 'import.php');
require './includes/session.php';
require_once WT_ROOT . 'includes/functions/functions_import.php';
if (!WT_USER_GEDCOM_ADMIN) {
    header('HTTP/1.1 403 Access Denied');
    exit;
}
$controller = new WT_Controller_Ajax();
$controller->pageHeader();
// Don't use ged=XX as we want to be able to run without changing the current gedcom.
// This will let us load several gedcoms together, or to edit one while loading another.
$gedcom_id = WT_Filter::getInteger('gedcom_id');
// Don't allow the user to cancel the request.  We do not want to be left
// with an incomplete transaction.
ignore_user_abort(true);
// Run in a transaction
WT_DB::exec("START TRANSACTION");
// Only allow one process to import each gedcom at a time
WT_DB::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id));
// What is the current import status?
$row = WT_DB::prepare("SELECT" . " SUM(IF(imported, LENGTH(chunk_data), 0)) AS import_offset," . " SUM(LENGTH(chunk_data))                  AS import_total" . " FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id))->fetchOneRow();
if ($row->import_offset == $row->import_total) {
    set_gedcom_setting($gedcom_id, 'imported', true);
    // Finished?  Show the maintenance links, similar to admin_trees_manage.php
    WT_DB::exec("COMMIT");
    $controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").toggle();' . 'jQuery("#actions' . $gedcom_id . '").toggle();');
    exit;
Exemple #10
0
 private function delete()
 {
     if (WT_USER_CAN_EDIT) {
         $block_id = WT_Filter::getInteger('block_id');
         WT_DB::prepare("DELETE FROM `##block_setting` WHERE block_id=?")->execute(array($block_id));
         WT_DB::prepare("DELETE FROM `##block` WHERE block_id=?")->execute(array($block_id));
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }
Exemple #11
0
 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");
     }
 }
Exemple #12
0
// 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', 'statistics.php');
require './includes/session.php';
// check for on demand content loading
$tab = WT_Filter::getInteger('tab', 0, 3);
$ajax = WT_Filter::getBool('ajax');
if (!$ajax) {
    $controller = new WT_Controller_Page();
    $controller->setPageTitle(WT_I18N::translate('Statistics'))->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('
			jQuery("#statistics_chart").css("visibility", "visible");
			jQuery("#statistics_chart").tabs({
				load: function() {
					jQuery("#loading-indicator").removeClass("loading-image");
				},
				beforeLoad: function(event, ui) {
					jQuery("#loading-indicator").addClass("loading-image");
					// Only load each tab once
					if (ui.tab.data("loaded")) {
						event.preventDefault();
						return;
Exemple #13
0
//
// 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', 'editnews.php');
require './includes/session.php';
$controller = new WT_Controller_Simple();
$controller->setPageTitle(WT_I18N::translate('Add/edit a journal/news entry'))->restrictAccess(Auth::isMember())->pageHeader();
$action = WT_Filter::get('action', 'compose|save|delete', 'compose');
$news_id = WT_Filter::getInteger('news_id');
$user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER));
$gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER));
$date = WT_Filter::postInteger('date', 0, PHP_INT_MAX, WT_TIMESTAMP);
$title = WT_Filter::post('title');
$text = WT_Filter::post('text');
switch ($action) {
    case 'compose':
        if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
            ckeditor_WT_Module::enableEditor($controller);
        }
        echo '<h3>' . WT_I18N::translate('Add/edit a journal/news entry') . '</h3>';
        echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
        if ($news_id) {
            $news = getNewsItem($news_id);
        } else {
                        break;
                }
            }
        } else {
            $ORDER_BY = '1 ASC';
        }
        // This becomes a JSON list, not array, so need to fetch with numeric keys.
        $data = WT_DB::prepare($SELECT1 . $WHERE . $ORDER_BY . $LIMIT)->execute($args)->fetchAll(PDO::FETCH_NUM);
        foreach ($data as &$datum) {
            $datum[2] = WT_Filter::escapeHtml($datum[2]);
        }
        // Total filtered/unfiltered rows
        $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn();
        $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn();
        header('Content-type: application/json');
        echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
        exit;
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
		jQuery("#log_list").dataTable( {
			dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
			processing: true,
			serverSide: true,
			ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '",
			' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
			jQueryUI: true,
			autoWidth: false,
			sorting: [[ 0, "desc" ]],
			pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ',
			pagingType: "full_numbers"
		});
Exemple #15
0
$controller = new WT_Controller_Page();
$controller->setPageTitle(WT_I18N::translate('Media objects'))->pageHeader();
$search = WT_Filter::get('search');
$sortby = WT_Filter::get('sortby', 'file|title', 'title');
if (!WT_USER_CAN_EDIT && !WT_USER_CAN_ACCEPT) {
    $sortby = 'title';
}
$start = WT_Filter::getInteger('start');
$max = WT_Filter::get('max', '10|20|30|40|50|75|100|125|150|200', '20');
$folder = WT_Filter::get('folder', null, '');
// MySQL needs an empty string, not NULL
$reset = WT_Filter::get('reset');
$apply_filter = WT_Filter::get('apply_filter');
$filter = WT_Filter::get('filter', null, '');
// MySQL needs an empty string, not NULL
$columns = WT_Filter::getInteger('columns', 1, 2, 2);
$subdirs = WT_Filter::get('subdirs', 'on');
$currentdironly = $subdirs == 'on' ? false : true;
// reset all variables
if ($reset == 'Reset') {
    $sortby = 'title';
    $max = '20';
    $folder = '';
    $columns = '2';
    $currentdironly = true;
    $filter = '';
}
// A list of all subfolders used by this tree
$folders = WT_Query_Media::folderList();
// A list of all media objects matching the search criteria
$medialist = WT_Query_Media::mediaList($folder, $currentdironly ? 'exclude' : 'include', $sortby, $filter);
Exemple #16
0
 private function moveup()
 {
     $block_id = WT_Filter::getInteger('block_id');
     $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
     $swap_block = WT_DB::prepare("SELECT block_order, block_id" . " FROM `##block`" . " WHERE block_order=(" . "  SELECT MAX(block_order) FROM `##block` WHERE block_order < ? AND module_name=?" . " ) AND module_name=?" . " LIMIT 1")->execute(array($block_order, $this->getName(), $this->getName()))->fetchOneRow();
     if ($swap_block) {
         WT_DB::prepare("UPDATE `##block` SET block_order=? WHERE block_id=?")->execute(array($swap_block->block_order, $block_id));
         WT_DB::prepare("UPDATE `##block` SET block_order=? WHERE block_id=?")->execute(array($block_order, $swap_block->block_id));
     }
 }
Exemple #17
0
 static function callBlock($params = null)
 {
     global $ctype;
     if ($params === null) {
         return '';
     }
     if (isset($params[0]) && $params[0] != '') {
         $block = $params[0];
     } else {
         return '';
     }
     $all_blocks = array();
     foreach (WT_Module::getActiveBlocks() as $name => $active_block) {
         if ($ctype == 'user' && $active_block->isUserBlock() || $ctype == 'gedcom' && $active_block->isGedcomBlock()) {
             $all_blocks[$name] = $active_block;
         }
     }
     if (!array_key_exists($block, $all_blocks) || $block == 'html') {
         return '';
     }
     $class_name = $block . '_WT_Module';
     // Build the config array
     array_shift($params);
     $cfg = array();
     foreach ($params as $config) {
         $bits = explode('=', $config);
         if (count($bits) < 2) {
             continue;
         }
         $v = array_shift($bits);
         $cfg[$v] = join('=', $bits);
     }
     $block = new $class_name();
     $block_id = WT_Filter::getInteger('block_id');
     $content = $block->getBlock($block_id, false, $cfg);
     return $content;
 }
Exemple #18
0
 public function __construct()
 {
     global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS;
     global $DEFAULT_PEDIGREE_GENERATIONS;
     global $bwidth, $bheight, $cbwidth, $cbheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing;
     global $linewidth, $shadowcolor, $shadowblur, $shadowoffsetX, $shadowoffsetY;
     global $show_full, $talloffset;
     parent::__construct();
     $this->linewidth = $linewidth;
     $this->shadowcolor = $shadowcolor;
     $this->shadowblur = $shadowblur;
     $this->shadowoffsetX = $shadowoffsetX;
     $this->shadowoffsetY = $shadowoffsetY;
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->talloffset = WT_Filter::getInteger('talloffset', 0, 3, $PEDIGREE_LAYOUT);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     $this->PEDIGREE_GENERATIONS = WT_Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     if ($this->talloffset == 1) {
         $this->talloffset = 1;
     }
     // Make SURE this is an integer
     if ($this->talloffset > 1 && $this->PEDIGREE_GENERATIONS > 8) {
         $this->PEDIGREE_GENERATIONS = 8;
     }
     // TODO: some library functions expect this as a global.
     // Passing a function parameter would be much better.
     global $PEDIGREE_GENERATIONS;
     $PEDIGREE_GENERATIONS = $this->PEDIGREE_GENERATIONS;
     // This is passed as a global.  A parameter would be better...
     $this->show_full = $this->show_full ? 1 : 0;
     // Make SURE this is an integer
     if ($this->talloffset > 3) {
         $this->talloffset = 3;
     } elseif ($this->talloffset < 0) {
         $this->talloffset = 0;
     }
     $show_full = $this->show_full;
     $talloffset = $this->talloffset;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Pedigree tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Pedigree'));
     }
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $cbwidth;
         $bheight = $cbheight;
     }
     //-- adjustments for portrait mode
     if ($this->talloffset == 0) {
         $bxspacing += 12;
         $baseyoffset -= 20 * ($this->PEDIGREE_GENERATIONS - 1);
     }
     $this->pbwidth = $bwidth + 6;
     $this->pbheight = $bheight + 5;
     $this->treeid = ancestry_array($this->rootid);
     $this->treesize = pow(2, (int) $this->PEDIGREE_GENERATIONS) - 1;
     //-- ancestry_array puts everyone at $i+1
     for ($i = 0; $i < $this->treesize; $i++) {
         $this->treeid[$i] = $this->treeid[$i + 1];
     }
     if (!$this->show_full) {
         if ($this->talloffset == 0) {
             $baseyoffset = 160 + $bheight * 2;
         } elseif ($this->talloffset == 1) {
             $baseyoffset = 180 + $bheight * 2;
         } elseif ($this->talloffset > 1) {
             if ($this->PEDIGREE_GENERATIONS == 3) {
                 $baseyoffset = 30;
             } else {
                 $baseyoffset = -85;
             }
         }
     } else {
         if ($this->talloffset == 0) {
             $baseyoffset = 100 + $bheight / 2;
         } elseif ($this->talloffset == 1) {
             $baseyoffset = 160 + $bheight / 2;
         } elseif ($this->talloffset > 1) {
             if ($this->PEDIGREE_GENERATIONS == 3) {
                 $baseyoffset = 30;
             } else {
                 $baseyoffset = -85;
             }
         }
     }
     // -- this next section will create and position the DIV layers for the pedigree tree
     $this->curgen = 1;
     // -- variable to track which generation the algorithm is currently working on
     $this->yoffset = 0;
     // -- used to offset the position of each box as it is generated
     $this->xoffset = 0;
     $this->prevyoffset = 0;
     // -- used to track the y position of the previous box
     $this->offsetarray = array();
     $this->minyoffset = 0;
     if ($this->treesize < 3) {
         $this->treesize = 3;
     }
     // -- loop through all of IDs in the array starting at the last and working to the first
     //-- calculation the box positions
     for ($i = $this->treesize - 1; $i >= 0; $i--) {
         // -- check to see if we have moved to the next generation
         if ($i < (int) ($this->treesize / pow(2, $this->curgen))) {
             $this->curgen++;
         }
         //-- box position in current generation
         $boxpos = $i - pow(2, $this->PEDIGREE_GENERATIONS - $this->curgen);
         //-- offset multiple for current generation
         if ($this->talloffset < 2) {
             $genoffset = pow(2, $this->curgen - $this->talloffset);
             $boxspacing = $this->pbheight + $byspacing;
         } else {
             $genoffset = pow(2, $this->curgen - 1);
             $boxspacing = $this->pbwidth + $byspacing;
         }
         // -- calculate the yoffset Position in the generation Spacing between boxes put child between parents
         $this->yoffset = $baseyoffset + $boxpos * ($boxspacing * $genoffset) + $boxspacing / 2 * $genoffset + $boxspacing * $genoffset;
         // -- calculate the xoffset
         if ($this->talloffset == 0) {
             if ($this->PEDIGREE_GENERATIONS < 6) {
                 $addxoffset = $basexoffset + (10 + 60 * (5 - $this->PEDIGREE_GENERATIONS));
                 $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset;
             } else {
                 $addxoffset = $basexoffset + 10;
                 $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset;
             }
             //-- compact the tree
             if ($this->curgen < $this->PEDIGREE_GENERATIONS) {
                 $parent = (int) (($i - 1) / 2);
                 if ($i % 2 == 0) {
                     $this->yoffset = $this->yoffset - $boxspacing / 2 * ($this->curgen - 1);
                 } else {
                     $this->yoffset = $this->yoffset + $boxspacing / 2 * ($this->curgen - 1);
                 }
                 $pgen = $this->curgen;
                 while ($parent > 0) {
                     if ($parent % 2 == 0) {
                         $this->yoffset = $this->yoffset - $boxspacing / 2 * $pgen;
                     } else {
                         $this->yoffset = $this->yoffset + $boxspacing / 2 * $pgen;
                     }
                     $pgen++;
                     if ($pgen > 3) {
                         $temp = 0;
                         for ($j = 1; $j < $pgen - 2; $j++) {
                             $temp += pow(2, $j) - 1;
                         }
                         if ($parent % 2 == 0) {
                             $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp;
                         } else {
                             $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp;
                         }
                     }
                     $parent = (int) (($parent - 1) / 2);
                 }
                 if ($this->curgen > 3) {
                     $temp = 0;
                     for ($j = 1; $j < $this->curgen - 2; $j++) {
                         $temp += pow(2, $j) - 1;
                     }
                     if ($i % 2 == 0) {
                         $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp;
                     } else {
                         $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp;
                     }
                 }
             }
             $this->yoffset -= $boxspacing / 2 * pow(2, $this->PEDIGREE_GENERATIONS - 2) - $boxspacing / 2;
         } else {
             if ($this->talloffset == 1) {
                 $this->xoffset = 22 + $basexoffset + ($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing);
                 if ($this->curgen == $this->PEDIGREE_GENERATIONS) {
                     $this->xoffset;
                 }
                 if ($this->PEDIGREE_GENERATIONS < 4) {
                     $this->xoffset += 60;
                 }
             } else {
                 if ($this->talloffset == 2) {
                     if ($this->show_full) {
                         $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 2) + $this->curgen * 10 + 136.5;
                     } else {
                         $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 4) + $this->curgen * 10 + 215.75;
                     }
                 } else {
                     if ($this->show_full) {
                         $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + 260;
                     } else {
                         $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 4) + 270;
                     }
                 }
             }
         }
         if ($this->curgen == 1 && $this->talloffset == 1) {
             $this->xoffset += 10;
         }
         $this->offsetarray[$i]["x"] = $this->xoffset;
         $this->offsetarray[$i]["y"] = $this->yoffset;
     }
     //-- calculate the smallest yoffset and adjust the tree to that offset
     $minyoffset = 0;
     for ($i = 0; $i < count($this->treeid); $i++) {
         if (!empty($offsetarray[$i])) {
             if ($minyoffset == 0 || $minyoffset > $this->offsetarray[$i]["y"]) {
                 $minyoffset = $this->offsetarray[$i]["y"];
             }
         }
     }
     $ydiff = $baseyoffset + 35 - $minyoffset;
     $this->adjust_subtree(0, $ydiff);
 }
Exemple #19
0
// 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', 'edit_changes.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_import.php';
$controller = new WT_Controller_Simple();
$controller->restrictAccess(Auth::isModerator())->setPageTitle(WT_I18N::translate('Pending changes'))->pageHeader()->addInlineJavascript("\n\t\tfunction show_diff(diffurl) {\n\t\t\twindow.opener.location = diffurl;\n\t\t\treturn false;\n\t\t}\n\t");
$action = WT_Filter::get('action');
$change_id = WT_Filter::getInteger('change_id');
$index = WT_Filter::get('index');
$ged = WT_Filter::getInteger('ged');
echo '<div id="pending"><h2>', WT_I18N::translate('Pending changes'), '</h2>';
switch ($action) {
    case 'undo':
        $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
        $xref = WT_DB::prepare("SELECT xref      FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
        // Undo a change, and subsequent changes to the same record
        WT_DB::prepare("UPDATE `##change`" . " SET   status     = 'rejected'" . " WHERE status     = 'pending'" . " AND   gedcom_id  = ?" . " AND   xref       = ?" . " AND   change_id >= ?")->execute(array($gedcom_id, $xref, $change_id));
        break;
    case 'accept':
        $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
        $xref = WT_DB::prepare("SELECT xref      FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
        // Accept a change, and all previous changes to the same record
        $changes = WT_DB::prepare("SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . " FROM  `##change` c" . " JOIN  `##gedcom` g USING (gedcom_id)" . " WHERE c.status   = 'pending'" . " AND   gedcom_id  = ?" . " AND   xref       = ?" . " AND   change_id <= ?" . " ORDER BY change_id")->execute(array($gedcom_id, $xref, $change_id))->fetchAll();
        foreach ($changes as $change) {
            if (empty($change->new_gedcom)) {
Exemple #20
0
 public function __construct()
 {
     global $SCRIPT_NAME, $MEDIA_DIRECTORY, $WT_SESSION;
     // Our cart is an array of items in the session
     if (!is_array($WT_SESSION->cart)) {
         $WT_SESSION->cart = array();
     }
     if (!array_key_exists(WT_GED_ID, $WT_SESSION->cart)) {
         $WT_SESSION->cart[WT_GED_ID] = array();
     }
     $this->action = WT_Filter::get('action');
     $this->id = WT_Filter::get('id');
     $convert = WT_Filter::get('convert', 'yes|no', 'no');
     $this->Zip = WT_Filter::get('Zip');
     $this->IncludeMedia = WT_Filter::get('IncludeMedia');
     $this->conv_path = WT_Filter::get('conv_path');
     $this->privatize_export = WT_Filter::get('privatize_export', 'none|visitor|user|gedadmin', 'visitor');
     $this->level1 = WT_Filter::getInteger('level1');
     $this->level2 = WT_Filter::getInteger('level2');
     $this->level3 = WT_Filter::getInteger('level3');
     $others = WT_Filter::get('others');
     $this->type = WT_Filter::get('type');
     if (($this->privatize_export == 'none' || $this->privatize_export == 'none') && !WT_USER_GEDCOM_ADMIN) {
         $this->privatize_export = 'visitor';
     }
     if ($this->privatize_export == 'user' && !WT_USER_CAN_ACCESS) {
         $this->privatize_export = 'visitor';
     }
     if ($this->action == 'add') {
         if (empty($this->type) && !empty($this->id)) {
             $this->type = "";
             $obj = WT_GedcomRecord::getInstance($this->id);
             if (is_null($obj)) {
                 $this->id = "";
                 $this->action = "";
             } else {
                 $this->type = strtolower($obj::RECORD_TYPE);
             }
         } else {
             if (empty($this->id)) {
                 $this->action = "";
             }
         }
         if (!empty($this->id) && $this->type != 'fam' && $this->type != 'indi' && $this->type != 'sour') {
             $this->action = 'add1';
         }
     }
     if ($this->action == 'add1') {
         $obj = WT_GedcomRecord::getInstance($this->id);
         $this->addClipping($obj);
         if ($this->type == 'sour') {
             if ($others == 'linked') {
                 foreach ($obj->linkedIndividuals('SOUR') as $indi) {
                     $this->addClipping($indi);
                 }
                 foreach ($obj->linkedFamilies('SOUR') as $fam) {
                     $this->addClipping($fam);
                 }
             }
         }
         if ($this->type == 'fam') {
             if ($others == 'parents') {
                 $this->addClipping($obj->getHusband());
                 $this->addClipping($obj->getWife());
             } elseif ($others == "members") {
                 $this->addFamilyMembers(WT_Family::getInstance($this->id));
             } elseif ($others == "descendants") {
                 $this->addFamilyDescendancy(WT_Family::getInstance($this->id));
             }
         } elseif ($this->type == 'indi') {
             if ($others == 'parents') {
                 foreach (WT_Individual::getInstance($this->id)->getChildFamilies() as $family) {
                     $this->addFamilyMembers($family);
                 }
             } elseif ($others == 'ancestors') {
                 $this->addAncestorsToCart(WT_Individual::getInstance($this->id), $this->level1);
             } elseif ($others == 'ancestorsfamilies') {
                 $this->addAncestorsToCartFamilies(WT_Individual::getInstance($this->id), $this->level2);
             } elseif ($others == 'members') {
                 foreach (WT_Individual::getInstance($this->id)->getSpouseFamilies() as $family) {
                     $this->addFamilyMembers($family);
                 }
             } elseif ($others == 'descendants') {
                 foreach (WT_Individual::getInstance($this->id)->getSpouseFamilies() as $family) {
                     $this->addClipping($family);
                     $this->addFamilyDescendancy($family, $this->level3);
                 }
             }
             uksort($WT_SESSION->cart[WT_GED_ID], array('WT_Controller_Clippings', 'compareClippings'));
         }
     } elseif ($this->action == 'remove') {
         unset($WT_SESSION->cart[WT_GED_ID][$this->id]);
     } elseif ($this->action == 'empty') {
         $WT_SESSION->cart[WT_GED_ID] = array();
     } elseif ($this->action == 'download') {
         $media = array();
         $mediacount = 0;
         $filetext = gedcom_header(WT_GEDCOM);
         // Include SUBM/SUBN records, if they exist
         $subn = WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBN', WT_GED_ID))->fetchOne();
         if ($subn) {
             $filetext .= $subn . "\n";
         }
         $subm = WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBM', WT_GED_ID))->fetchOne();
         if ($subm) {
             $filetext .= $subm . "\n";
         }
         if ($convert == "yes") {
             $filetext = str_replace("UTF-8", "ANSI", $filetext);
             $filetext = utf8_decode($filetext);
         }
         switch ($this->privatize_export) {
             case 'gedadmin':
                 $access_level = WT_PRIV_NONE;
                 break;
             case 'user':
                 $access_level = WT_PRIV_USER;
                 break;
             case 'visitor':
                 $access_level = WT_PRIV_PUBLIC;
                 break;
             case 'none':
                 $access_level = WT_PRIV_HIDE;
                 break;
         }
         foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
             $object = WT_GedcomRecord::getInstance($xref);
             if ($object) {
                 // The object may have been deleted since we added it to the cart....
                 $record = $object->privatizeGedcom($access_level);
                 // Remove links to objects that aren't in the cart
                 preg_match_all('/\\n1 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\\n[2-9].*)*/', $record, $matches, PREG_SET_ORDER);
                 foreach ($matches as $match) {
                     if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
                         $record = str_replace($match[0], '', $record);
                     }
                 }
                 preg_match_all('/\\n2 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\\n[3-9].*)*/', $record, $matches, PREG_SET_ORDER);
                 foreach ($matches as $match) {
                     if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
                         $record = str_replace($match[0], '', $record);
                     }
                 }
                 preg_match_all('/\\n3 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\\n[4-9].*)*/', $record, $matches, PREG_SET_ORDER);
                 foreach ($matches as $match) {
                     if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
                         $record = str_replace($match[0], '', $record);
                     }
                 }
                 $record = convert_media_path($record, $this->conv_path);
                 $savedRecord = $record;
                 // Save this for the "does this file exist" check
                 if ($convert == 'yes') {
                     $record = utf8_decode($record);
                 }
                 switch ($object::RECORD_TYPE) {
                     case 'INDI':
                         $filetext .= $record . "\n";
                         $filetext .= "1 SOUR @WEBTREES@\n";
                         $filetext .= "2 PAGE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
                         break;
                     case 'FAM':
                         $filetext .= $record . "\n";
                         $filetext .= "1 SOUR @WEBTREES@\n";
                         $filetext .= "2 PAGE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
                         break;
                     case 'SOUR':
                         $filetext .= $record . "\n";
                         $filetext .= "1 NOTE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
                         break;
                     default:
                         $ft = preg_match_all("/\n\\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER);
                         for ($k = 0; $k < $ft; $k++) {
                             // Skip external files and non-existant files
                             if (file_exists(WT_DATA_DIR . $MEDIA_DIRECTORY . $match[$k][1])) {
                                 $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => WT_DATA_DIR . $MEDIA_DIRECTORY . $match[$k][1], PCLZIP_ATT_FILE_NEW_FULL_NAME => $match[$k][1]);
                                 $mediacount++;
                             }
                         }
                         $filetext .= trim($record) . "\n";
                         break;
                 }
             }
         }
         if ($this->IncludeMedia == "yes") {
             $this->media_list = $media;
         }
         $filetext .= "0 @WEBTREES@ SOUR\n1 TITL " . WT_SERVER_NAME . WT_SCRIPT_PATH . "\n";
         if ($user_id = get_gedcom_setting(WT_GED_ID, 'CONTACT_EMAIL')) {
             $user = User::find($user_id);
             $filetext .= "1 AUTH " . $user->getRealName() . "\n";
         }
         $filetext .= "0 TRLR\n";
         //-- make sure the preferred line endings are used
         $filetext = preg_replace("/[\r\n]+/", WT_EOL, $filetext);
         $this->download_data = $filetext;
         $this->downloadClipping();
     }
 }
Exemple #21
0
// Get the blocks list
if (WT_USER_ID && $ctype == 'user') {
    $blocks = get_user_blocks(WT_USER_ID);
} else {
    $blocks = get_gedcom_blocks(WT_GED_ID);
}
$all_blocks = WT_Module::getActiveBlocks();
// The latest version is shown on the administration page.  This updates it every day.
// TODO: send an email notification to the admin when new versions are available.
fetch_latest_version();
// We generate individual blocks using AJAX
if ($action == 'ajax') {
    $controller = new WT_Controller_Ajax();
    $controller->pageHeader();
    // Check we’re displaying an allowable block.
    $block_id = WT_Filter::getInteger('block_id');
    if (array_key_exists($block_id, $blocks['main'])) {
        $module_name = $blocks['main'][$block_id];
    } elseif (array_key_exists($block_id, $blocks['side'])) {
        $module_name = $blocks['side'][$block_id];
    } else {
        exit;
    }
    if (array_key_exists($module_name, $all_blocks)) {
        $class_name = $module_name . '_WT_Module';
        $module = new $class_name();
        $module->getBlock($block_id);
    }
    if (WT_DEBUG) {
        echo execution_stats();
    }
Exemple #22
0
			</tr>
				<td colspan="4">
					<input type="submit" value="', WT_I18N::translate('Create user'), '">
				</td>
			</tr>
		</table>
	</form>';
        break;
    case 'cleanup':
        ?>
	<form name="cleanupform" method="post" action="admin_users.php?action=cleanup2">
	<table id="clean">
	<?php 
        // Check for idle users
        //if (!isset($month)) $month = 1;
        $month = WT_Filter::getInteger('month', 1, 12, 6);
        echo "<tr><th>", WT_I18N::translate('Number of months since the last login for a user’s account to be considered inactive: '), "</th>";
        echo "<td><select onchange=\"document.location=options[selectedIndex].value;\">";
        for ($i = 1; $i <= 12; $i++) {
            echo "<option value=\"admin_users.php?action=cleanup&amp;month={$i}\"";
            if ($i == $month) {
                echo " selected=\"selected\"";
            }
            echo ">", $i, "</option>";
        }
        echo "</select></td></tr>";
        ?>
	<tr><th colspan="2"><?php 
        echo WT_I18N::translate('Options:');
        ?>
</th></tr>
Exemple #23
0
// 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', 'relationship.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$pid1 = WT_Filter::get('pid1', WT_REGEX_XREF);
$pid2 = WT_Filter::get('pid2', WT_REGEX_XREF);
$show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
$path_to_find = WT_Filter::getInteger('path_to_find');
$followspouse = WT_Filter::getBool('followspouse');
$asc = WT_Filter::getBool('asc');
$asc = $asc ? -1 : 1;
$Dbwidth = $bwidth;
if (!$show_full) {
    $bwidth = $cbwidth;
    $bheight = $cbheight;
    $Dbwidth = $cbwidth;
}
$Dbheight = $bheight;
$Dbxspacing = 0;
$Dbyspacing = 0;
$Dbasexoffset = 0;
$Dbaseyoffset = 0;
$person1 = WT_Individual::getInstance($pid1);