Example #1
1
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('TITL');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
    public function pageBody()
    {
        $tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
        define('_JPGRAPH_PATH', $tmp_dir);
        define('_MPDF_TEMP_PATH', $tmp_dir);
        define('_MPDF_TTFONTDATAPATH', $tmp_dir);
        require_once WT_MODULES_DIR . $this->getName() . '/mpdf/mpdf.php';
        $stylesheet = file_get_contents($this->directory . '/css/style.css');
        $stylesheet_rtl = file_get_contents($this->directory . '/css/style-rtl.css');
        $html = Filter::post('pdfContent');
        $header = '<header>=== ' . $this->tree()->getTitleHtml() . ' ===</header>';
        $footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>';
        $mpdf = new mPDF();
        $mpdf->simpleTables = true;
        $mpdf->shrink_tables_to_fit = 1;
        $mpdf->autoScriptToLang = true;
        $mpdf->baseScript = 1;
        $mpdf->autoVietnamese = true;
        $mpdf->autoArabic = true;
        $mpdf->autoLangToFont = true;
        if (I18N::direction() === 'rtl') {
            $mpdf->SetDirectionality('rtl');
            $mpdf->WriteHTML($stylesheet_rtl, 1);
        } else {
            $mpdf->WriteHTML($stylesheet, 1);
        }
        $mpdf->setAutoTopMargin = 'stretch';
        $mpdf->setAutoBottomMargin = 'stretch';
        $mpdf->autoMarginPadding = 5;
        $admin = User::find($this->tree()->getPreference('WEBMASTER_USER_ID'))->getRealName();
        $mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl');
        $mpdf->SetTitle(Filter::get('title'));
        $mpdf->setAuthor($admin);
        $mpdf->SetHTMLHeader($header);
        $mpdf->setHTMLFooter($footer);
        $html_chunks = explode("\n", $html);
        $chunks = count($html_chunks);
        $i = 1;
        foreach ($html_chunks as $html_chunk) {
            // write html body parts only (option 2);
            if ($i === 1) {
                // first chunk (initialize all buffers - init=true)
                $mpdf->WriteHTML($html_chunk, 2, true, false);
            } elseif ($i === $chunks) {
                // last chunck (close all buffers - close=true)
                $mpdf->WriteHTML($html_chunk, 2, false, true);
            } else {
                // all other parts (keep the buffer open)
                $mpdf->WriteHTML($html_chunk, 2, false, false);
            }
            $i++;
        }
        $index = '
				<pagebreak type="next-odd" />
				<h2>' . I18N::translate('Index') . '</h2>
				<columns column-count="2" column-gap="5" />
				<indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />';
        $mpdf->writeHTML($index);
        $mpdf->Output($tmp_dir . Filter::get('title') . '.pdf', 'F');
    }
Example #3
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_note("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-note-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
 /**
  * Create the chart controller
  *
  * @param int $show_full needed for use by charts module
  */
 public function __construct($show_full = 1)
 {
     global $WT_TREE;
     parent::__construct();
     $rootid = Filter::get('rootid', WT_REGEX_XREF);
     $this->root = Individual::getInstance($rootid, $WT_TREE);
     if (!$this->root) {
         // Missing root individual? Show the chart for someone.
         $this->root = $this->getSignificantIndividual();
     }
     if (!$this->root || !$this->root->canShowName()) {
         http_response_code(404);
         $this->error_message = I18N::translate('This individual does not exist or you do not have permission to view it.');
     }
     // Extract parameter from form
     if ($show_full) {
         $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'));
     } else {
         $this->show_full = 0;
     }
     $this->box = new \stdClass();
     if ($this->showFull()) {
         $this->box->width = Theme::theme()->parameter('chart-box-x');
         $this->box->height = Theme::theme()->parameter('chart-box-y');
     } else {
         $this->box->width = Theme::theme()->parameter('compact-chart-box-x');
         $this->box->height = Theme::theme()->parameter('compact-chart-box-y');
     }
 }
Example #5
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-obje');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
         // main link displayed on page
         if (Module::getModuleByName('GEDFact_assistant')) {
             $menu->addSubmenu(new Menu(I18N::translate('Manage the links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
         } else {
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-obje-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
Example #6
0
 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     $xref = Filter::get('famid', WT_REGEX_XREF);
     $this->record = Family::getInstance($xref, $WT_TREE);
     parent::__construct();
 }
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('NAME');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "NAME");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-repo-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-repo-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-repo-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     return $menu;
 }
Example #8
0
 public function __construct()
 {
     parent::__construct('modulename');
     $this->directory = WT_MODULES_DIR . $this->getName();
     $this->action = Filter::get('mod_action');
     // register the namespaces
     $loader = new ClassLoader();
     $loader->addPsr4('vendor\\WebtreesModules\\modulename\\', $this->directory);
     $loader->register();
 }
Example #9
0
 /**
  * Send an external email message
  * Caution! gmail may rewrite the "From" header unless you have added the address to your account.
  *
  * @param Tree   $tree
  * @param string $to_email
  * @param string $to_name
  * @param string $replyto_email
  * @param string $replyto_name
  * @param string $subject
  * @param string $message
  *
  * @return bool
  */
 public static function send(Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message)
 {
     try {
         $mail = new Zend_Mail('UTF-8');
         $mail->setSubject($subject)->setBodyHtml($message)->setBodyText(Filter::unescapeHtml($message))->setFrom(Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))->addTo($to_email, $to_name)->setReplyTo($replyto_email, $replyto_name)->send(self::transport());
     } catch (\Exception $ex) {
         Log::addErrorLog('Mail: ' . $ex->getMessage());
         return false;
     }
     return true;
 }
Example #10
0
 /**
  * Send an external email message
  * Caution! gmail may rewrite the "From" header unless you have added the address to your account.
  *
  * @param Tree   $tree
  * @param string $to_email
  * @param string $to_name
  * @param string $replyto_email
  * @param string $replyto_name
  * @param string $subject
  * @param string $message
  *
  * @return bool
  */
 public static function send(Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message)
 {
     try {
         $mail = Swift_Message::newInstance()->setSubject($subject)->setFrom(Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))->setTo($to_email, $to_name)->setReplyTo($replyto_email, $replyto_name)->setBody($message, 'text/html')->addPart(Filter::unescapeHtml($message), 'text/plain');
         Swift_Mailer::newInstance(self::transport())->send($mail);
     } catch (Exception $ex) {
         Log::addErrorLog('Mail: ' . $ex->getMessage());
         return false;
     }
     return true;
 }
Example #11
0
 /**
  * Startup activity
  */
 public function __construct()
 {
     parent::__construct();
     // Extract the request parameters
     $this->show_thumbs = Filter::getBool('show_thumbs');
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(I18N::translate('Compact tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(I18N::translate('Compact tree'));
     }
     $this->treeid = $this->sosaAncestors(5);
 }
 /**
  * Create the descendancy controller
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     // Extract parameters from form
     $this->chart_style = Filter::getInteger('chart_style', 0, 3, 0);
     $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS'));
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(I18N::translate('Descendants of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(I18N::translate('Descendants'));
     }
 }
Example #13
0
 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     $WEBTREES_EMAIL = 'webtrees-noreply@' . preg_replace('/^www\\./i', '', Filter::server('SERVER_NAME'));
     // Default settings for new trees.  No defaults for:
     // imported, title, CONTACT_USER_ID, WEBMASTER_USER_ID
     // The following settings have defaults, but may need overwriting:
     // LANGUAGE, SURNAME_TRADITION
     Database::prepare("INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value) VALUES" . "(-1, 'ADVANCED_NAME_FACTS', 'NICK,_AKA')," . "(-1, 'ADVANCED_PLAC_FACTS', '')," . "(-1, 'ALLOW_THEME_DROPDOWN', '1')," . "(-1, 'CALENDAR_FORMAT', 'gregorian')," . "(-1, 'CHART_BOX_TAGS', '')," . "(-1, 'COMMON_NAMES_ADD', '')," . "(-1, 'COMMON_NAMES_REMOVE', '')," . "(-1, 'COMMON_NAMES_THRESHOLD', '40')," . "(-1, 'DEFAULT_PEDIGREE_GENERATIONS', '4')," . "(-1, 'EXPAND_RELATIVES_EVENTS', '0')," . "(-1, 'EXPAND_SOURCES', '0')," . "(-1, 'FAM_FACTS_ADD', 'CENS,MARR,RESI,SLGS,MARR_CIVIL,MARR_RELIGIOUS,MARR_PARTNERS,RESN')," . "(-1, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR')," . "(-1, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS')," . "(-1, 'FAM_ID_PREFIX', 'F')," . "(-1, 'FORMAT_TEXT', 'markdown')," . "(-1, 'FULL_SOURCES', '0')," . "(-1, 'GEDCOM_ID_PREFIX', 'I')," . "(-1, 'GEDCOM_MEDIA_PATH', '')," . "(-1, 'GENERATE_UIDS', '0')," . "(-1, 'HIDE_GEDCOM_ERRORS', '1')," . "(-1, 'HIDE_LIVE_PEOPLE', '1')," . "(-1, 'INDI_FACTS_ADD', 'AFN,BIRT,DEAT,BURI,CREM,ADOP,BAPM,BARM,BASM,BLES,CHRA,CONF,FCOM,ORDN,NATU,EMIG,IMMI,CENS,PROB,WILL,GRAD,RETI,DSCR,EDUC,IDNO,NATI,NCHI,NMR,OCCU,PROP,RELI,RESI,SSN,TITL,BAPL,CONL,ENDL,SLGC,_MILI,ASSO,RESN')," . "(-1, 'INDI_FACTS_QUICK', 'BIRT,BURI,BAPM,CENS,DEAT,OCCU,RESI')," . "(-1, 'INDI_FACTS_UNIQUE', '')," . "(-1, 'KEEP_ALIVE_YEARS_BIRTH', '')," . "(-1, 'KEEP_ALIVE_YEARS_DEATH', '')," . "(-1, 'LANGUAGE', 'en-US')," . "(-1, 'MAX_ALIVE_AGE', '120')," . "(-1, 'MAX_DESCENDANCY_GENERATIONS', '15')," . "(-1, 'MAX_PEDIGREE_GENERATIONS', '10')," . "(-1, 'MEDIA_DIRECTORY', 'media/')," . "(-1, 'MEDIA_ID_PREFIX', 'M')," . "(-1, 'MEDIA_UPLOAD', :MEDIA_UPLOAD)," . "(-1, 'META_DESCRIPTION', '')," . "(-1, 'META_TITLE', :META_TITLE)," . "(-1, 'NOTE_FACTS_ADD', 'SOUR,RESN')," . "(-1, 'NOTE_FACTS_QUICK', '')," . "(-1, 'NOTE_FACTS_UNIQUE', '')," . "(-1, 'NOTE_ID_PREFIX', 'N')," . "(-1, 'NO_UPDATE_CHAN', '0')," . "(-1, 'PEDIGREE_FULL_DETAILS', '1')," . "(-1, 'PEDIGREE_LAYOUT', '1')," . "(-1, 'PEDIGREE_ROOT_ID', '')," . "(-1, 'PEDIGREE_SHOW_GENDER', '0')," . "(-1, 'PREFER_LEVEL2_SOURCES', '1')," . "(-1, 'QUICK_REQUIRED_FACTS', 'BIRT,DEAT')," . "(-1, 'QUICK_REQUIRED_FAMFACTS', 'MARR')," . "(-1, 'REPO_FACTS_ADD', 'PHON,EMAIL,FAX,WWW,RESN')," . "(-1, 'REPO_FACTS_QUICK', '')," . "(-1, 'REPO_FACTS_UNIQUE', 'NAME,ADDR')," . "(-1, 'REPO_ID_PREFIX', 'R')," . "(-1, 'REQUIRE_AUTHENTICATION', '0')," . "(-1, 'SAVE_WATERMARK_IMAGE', '0')," . "(-1, 'SAVE_WATERMARK_THUMB', '0')," . "(-1, 'SHOW_AGE_DIFF', '0')," . "(-1, 'SHOW_COUNTER', '1')," . "(-1, 'SHOW_DEAD_PEOPLE', :SHOW_DEAD_PEOPLE)," . "(-1, 'SHOW_EST_LIST_DATES', '0')," . "(-1, 'SHOW_FACT_ICONS', '1')," . "(-1, 'SHOW_GEDCOM_RECORD', '0')," . "(-1, 'SHOW_HIGHLIGHT_IMAGES', '1')," . "(-1, 'SHOW_LDS_AT_GLANCE', '0')," . "(-1, 'SHOW_LEVEL2_NOTES', '1')," . "(-1, 'SHOW_LIVING_NAMES', :SHOW_LIVING_NAMES)," . "(-1, 'SHOW_MEDIA_DOWNLOAD', '0')," . "(-1, 'SHOW_NO_WATERMARK', :SHOW_NO_WATERMARK)," . "(-1, 'SHOW_PARENTS_AGE', '1')," . "(-1, 'SHOW_PEDIGREE_PLACES', '9')," . "(-1, 'SHOW_PEDIGREE_PLACES_SUFFIX', '0')," . "(-1, 'SHOW_PRIVATE_RELATIONSHIPS', '1')," . "(-1, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU')," . "(-1, 'SOURCE_ID_PREFIX', 'S')," . "(-1, 'SOUR_FACTS_ADD', 'NOTE,REPO,SHARED_NOTE,RESN')," . "(-1, 'SOUR_FACTS_QUICK', 'TEXT,NOTE,REPO')," . "(-1, 'SOUR_FACTS_UNIQUE', 'AUTH,ABBR,TITL,PUBL,TEXT')," . "(-1, 'SUBLIST_TRIGGER_I', '200')," . "(-1, 'SURNAME_LIST_STYLE', 'style2')," . "(-1, 'SURNAME_TRADITION', 'paternal')," . "(-1, 'THUMBNAIL_WIDTH', '100')," . "(-1, 'USE_RIN', '0')," . "(-1, 'USE_SILHOUETTE', '1')," . "(-1, 'WATERMARK_THUMB', '0')," . "(-1, 'WEBTREES_EMAIL', :WEBTREES_EMAIL)," . "(-1, 'WORD_WRAPPED_NOTES', '0')")->execute(array('MEDIA_UPLOAD' => Auth::PRIV_USER, 'META_TITLE' => WT_WEBTREES, 'SHOW_DEAD_PEOPLE' => Auth::PRIV_PRIVATE, 'SHOW_LIVING_NAMES' => Auth::PRIV_USER, 'SHOW_NO_WATERMARK' => Auth::PRIV_USER, 'WEBTREES_EMAIL' => $WEBTREES_EMAIL));
     // Previous versions of webtrees allowed this setting to be empty.
     Database::prepare("DELETE FROM `##gedcom_setting` WHERE setting_name  ='WEBTREES_EMAIL' AND setting_value = ''")->execute();
     Database::prepare("INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" . " SELECT gedcom_id, 'WEBTREES_EMAIL', :WEBTREES_EMAIL" . " FROM `##gedcom` WHERE gedcom_id > 0")->execute(array('WEBTREES_EMAIL' => $WEBTREES_EMAIL));
     // Default restrictions
     Database::prepare("INSERT IGNORE INTO `##default_resn` (gedcom_id, tag_type, resn) VALUES " . "(-1, 'SSN', 'confidential')," . "(-1, 'SOUR', 'privacy')," . "(-1, 'REPO', 'privacy')," . "(-1, 'SUBM', 'confidential')," . "(-1, 'SUBN', 'confidential')")->execute();
 }
Example #14
0
 /**
  * This is a general purpose hook, allowing modules to respond to routes
  * of the form module.php?mod=FOO&mod_action=BAR
  *
  * @param string $mod_action
  */
 public function modAction($mod_action)
 {
     global $WT_TREE;
     switch ($mod_action) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
             if (Auth::check() && $record->canShowName()) {
                 self::addFavorite(array('user_id' => Auth::id(), 'gedcom_id' => $record->getTree()->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 FlashMessages::addMessage(I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
Example #15
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     // Extract form parameters
     $this->show_cousins = Filter::getInteger('show_cousins', 0, 1);
     $this->chart_style = Filter::getInteger('chart_style', 0, 3);
     $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS'));
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(I18N::translate('Ancestors of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(I18N::translate('Ancestors'));
     }
 }
 /**
  * Create the controller
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $default_generations = $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS');
     // Extract the request parameters
     $this->fan_style = Filter::getInteger('fan_style', 2, 4, 3);
     $this->fan_width = Filter::getInteger('fan_width', 50, 500, 100);
     $this->generations = Filter::getInteger('generations', 2, 9, $default_generations);
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(I18N::translate('Fan chart of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(I18N::translate('Fan chart'));
     }
 }
 /**
  * AdminConfig@index
  */
 public function index()
 {
     global $WT_TREE;
     $action = Filter::post('action');
     if ($action == 'update' && Filter::checkCsrf()) {
         $this->update();
     }
     Theme::theme(new AdministrationTheme())->init($WT_TREE);
     $ctrl = new PageController();
     $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle());
     $view_bag = new ViewBag();
     $view_bag->set('title', $ctrl->getPageTitle());
     $view_bag->set('module', $this->module);
     ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
 }
    private function pageBody(PageController $controller)
    {
        ?>
		<!-- ADMIN PAGE CONTENT -->
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
		<form class="form-inline" method="post">
			<?php 
        echo Filter::getCsrf();
        ?>
			<input type="hidden" name="save" value="1">
			<!-- SHOW PDF -->
			<div class="form-group">
				<label class="control-label">
					<?php 
        echo I18N::translate('Access level');
        ?>
				</label>
				<?php 
        echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_PDF_ACCESS_LEVEL', $this->getSetting('FTV_PDF_ACCESS_LEVEL'), 'class="form-control"');
        ?>
			</div>
			<!-- BUTTONS -->
			<button class="btn btn-primary" type="submit">
				<i class="fa fa-check"></i>
				<?php 
        echo I18N::translate('save');
        ?>
			</button>
		</form>
		<?php 
    }
Example #20
0
 /**
  * Create a branches list controller
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $this->surname = Filter::get('surname');
     $this->soundex_std = Filter::getBool('soundex_std');
     $this->soundex_dm = Filter::getBool('soundex_dm');
     if ($this->surname) {
         $this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname)));
         $this->loadIndividuals();
         $self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
         if ($self) {
             $this->loadAncestors($self, 1);
         }
     } else {
         $this->setPageTitle(I18N::translate('Branches'));
     }
 }
 /** {@inheritdoc} */
 public function getSidebarAjaxContent()
 {
     global $WT_TREE;
     $alpha = Filter::get('alpha');
     // All surnames beginning with this letter where "@"=unknown and ","=none
     $surname = Filter::get('surname');
     // All indis with this surname.
     $search = Filter::get('search');
     if ($search) {
         return $this->search($WT_TREE, $search);
     } elseif ($alpha == '@' || $alpha == ',' || $surname) {
         return $this->getSurnameIndis($WT_TREE, $alpha, $surname);
     } elseif ($alpha) {
         return $this->getAlphaSurnames($WT_TREE, $alpha);
     } else {
         return '';
     }
 }
 /**
  * Create a family-book controller
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     // Extract the request parameters
     $this->show_spouse = Filter::getInteger('show_spouse', 0, 1);
     $this->descent = Filter::getInteger('descent', 0, 9, 5);
     $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), 2);
     $this->bhalfheight = $this->getBoxDimensions()->height / 2;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(I18N::translate('Family book of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(I18N::translate('Family book'));
     }
     //Checks how many generations of descendency is for the person for formatting purposes
     $this->dgenerations = $this->maxDescendencyGenerations($this->root->getXref(), 0);
     if ($this->dgenerations < 1) {
         $this->dgenerations = 1;
     }
 }
Example #23
0
 /**
  * This is a general purpose hook, allowing modules to respond to routes
  * of the form module.php?mod=FOO&mod_action=BAR
  *
  * @param string $mod_action
  */
 public function modAction($mod_action)
 {
     global $WT_TREE;
     header('Content-Type: text/html; charset=UTF-8');
     switch ($mod_action) {
         case 'search':
             $search = Filter::get('search');
             echo $this->search($search, $WT_TREE);
             break;
         case 'descendants':
             $individual = Individual::getInstance(Filter::get('xref', WT_REGEX_XREF), $WT_TREE);
             if ($individual) {
                 echo $this->loadSpouses($individual, 1);
             }
             break;
         default:
             http_response_code(404);
             break;
     }
 }
Example #24
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-obje');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
         // main link displayed on page
         if (Module::getModuleByName('GEDFact_assistant')) {
             $menu->addSubmenu(new Menu(I18N::translate('Manage links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
         } else {
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_media("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-obje-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
Example #25
0
 /**
  * Piwik@index
  */
 public function index()
 {
     $ctrl = new AjaxController();
     $data = new ViewBag();
     $data->set('has_stats', false);
     $block_id = Filter::get('block_id');
     if ($block_id) {
         $cached_item = Cache::get('piwikCountYear', $this->module);
         $visitCountYear = $cached_item->get();
         if (!$cached_item->isHit()) {
             $visitCountYear = $this->getNumberOfVisitsPiwik($block_id);
             Cache::save($cached_item, $visitCountYear);
         }
         if ($visitCountYear) {
             $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day'));
             $visitCountYear = max(0, $visitCountYear);
             $data->set('has_stats', true);
             $data->set('visits_today', $visitCountToday);
             $data->set('visits_year', $visitCountYear + $visitCountToday);
         }
     }
     ViewFactory::make('PiwikStats', $this, $ctrl, $data)->render();
 }
Example #26
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('TITL');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-sour-addfav', array('onlick' => 'jQuery.post("module.php?mod=user_favorites&amp;mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
 /**
  * Create the hourglass controller.
  *
  * @param string $rootid
  * @param int    $show_full
  * @param bool   $loadJS
  */
 public function __construct($rootid = '', $show_full = 1, $loadJS = true)
 {
     global $WT_TREE;
     parent::__construct($show_full);
     // Extract parameters from
     $this->show_spouse = Filter::getInteger('show_spouse', 0, 1, 0);
     $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), 3);
     $this->canLoadJS = $loadJS;
     //-- flip the arrows for RTL languages
     if (I18N::direction() === 'ltr') {
         $this->left_arrow = 'icon-larrow';
         $this->right_arrow = 'icon-rarrow';
     } else {
         $this->left_arrow = 'icon-rarrow';
         $this->right_arrow = 'icon-larrow';
     }
     $this->bhalfheight = (int) ($this->getBoxDimensions()->height / 2);
     //Checks how many generations of descendency is for the person for formatting purposes
     $this->dgenerations = $this->maxDescendencyGenerations($this->root, 0);
     if ($this->dgenerations < 1) {
         $this->dgenerations = 1;
     }
     $this->setPageTitle(I18N::translate('Hourglass chart of %s', $this->root->getFullName()));
 }
Example #28
0
    if (strlen($_POST['wtpass']) > 0 && strlen($_POST['wtpass']) < 6) {
        echo '<p class="bad">', I18N::translate('The password needs to be at least six characters long.'), '</p>';
    } elseif ($_POST['wtpass'] != $_POST['wtpass2']) {
        echo '<p class="bad">', I18N::translate('The passwords do not match.'), '</p>';
    } elseif ((empty($_POST['wtname']) || empty($_POST['wtuser']) || empty($_POST['wtpass']) || empty($_POST['wtemail'])) && $_POST['wtname'] . $_POST['wtuser'] . $_POST['wtpass'] . $_POST['wtemail'] != '') {
        echo '<p class="bad">', I18N::translate('You must enter all the administrator account fields.'), '</p>';
    }
    echo '<h2>', I18N::translate('System settings'), '</h2>', '<h3>', I18N::translate('Administrator account'), '</h3>', '<p>', I18N::translate('You need to set up an administrator account.  This account can control all aspects of this webtrees installation.  Please choose a strong password.'), '</p>', '<fieldset><legend>', I18N::translate('Administrator account'), '</legend>', '<table border="0"><tr><td>', I18N::translate('Your name'), '</td><td>', '<input type="text" name="wtname" value="', Filter::escapeHtml($_POST['wtname']), '" autofocus></td><td>', I18N::translate('This is your real name, as you would like it displayed on screen.'), '</td></tr><tr><td>', I18N::translate('Login ID'), '</td><td>', '<input type="text" name="wtuser" value="', Filter::escapeHtml($_POST['wtuser']), '"></td><td>', I18N::translate('You will use this to login to webtrees.'), '</td></tr><tr><td>', I18N::translate('Password'), '</td><td>', '<input type="password" name="wtpass" value="', Filter::escapeHtml($_POST['wtpass']), '"></td><td>', I18N::translate('This must be at least six characters long.  It is case-sensitive.'), '</td></tr><tr><td>', '&nbsp;', '</td><td>', '<input type="password" name="wtpass2" value="', Filter::escapeHtml($_POST['wtpass2']), '"></td><td>', I18N::translate('Type your password again, to make sure you have typed it correctly.'), '</td></tr><tr><td>', I18N::translate('Email address'), '</td><td>', '<input type="email" name="wtemail" value="', Filter::escapeHtml($_POST['wtemail']), '"></td><td>', I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.'), '</td></tr><tr><td>', '</td></tr></table>', '</fieldset>', '<br><hr><input type="submit" id="btncontinue" value="', I18N::translate('continue'), '">', '</form>', '</body></html>';
    return;
} else {
    // Copy these values through to the next step
    echo '<input type="hidden" name="wtname"  value="', Filter::escapeHtml($_POST['wtname']), '">';
    echo '<input type="hidden" name="wtuser"  value="', Filter::escapeHtml($_POST['wtuser']), '">';
    echo '<input type="hidden" name="wtpass"  value="', Filter::escapeHtml($_POST['wtpass']), '">';
    echo '<input type="hidden" name="wtpass2" value="', Filter::escapeHtml($_POST['wtpass2']), '">';
    echo '<input type="hidden" name="wtemail" value="', Filter::escapeHtml($_POST['wtemail']), '">';
}
////////////////////////////////////////////////////////////////////////////////
// Step six  We have a database connection and a writable folder.  Do it!
////////////////////////////////////////////////////////////////////////////////
try {
    // Create/update the database tables.
    Database::updateSchema('\\Fisharebest\\Webtrees\\Schema', 'WT_SCHEMA_VERSION', 30);
    // Create the admin user
    $admin = User::create($_POST['wtuser'], $_POST['wtname'], $_POST['wtemail'], $_POST['wtpass']);
    $admin->setPreference('canadmin', '1');
    $admin->setPreference('language', WT_LOCALE);
    $admin->setPreference('verified', '1');
    $admin->setPreference('verified_by_admin', '1');
    $admin->setPreference('auto_accept', '0');
    $admin->setPreference('visibleonline', '1');
			<!-- GEDCOM_MEDIA_PATH -->
			<?php 
if ($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) {
    ?>
			<label>
				<input type="checkbox" name="conv_path" value="<?php 
    echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH'));
    ?>
">
				<?php 
    echo I18N::translate('Add the GEDCOM media path to filenames');
    ?>
			</label>
			<p>
				<?php 
    echo I18N::translate('Media filenames will be prefixed by %s.', '<code dir="ltr">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</code>');
    ?>
			</p>
			<?php 
}
?>
		</div>
	</fieldset>

	<!-- PRIVACY OPTIONS -->
	<fieldset class="form-group">
		<legend class="control-label col-sm-3">
			<?php 
echo I18N::translate('Apply privacy settings');
?>
		</legend>
Example #30
0
 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     // $action comes from GET (search) or POST (replace)
     if (Filter::post('action')) {
         $this->action = Filter::post('action', 'replace', 'general');
         $this->query = Filter::post('query');
         $this->replace = Filter::post('replace');
         $this->replaceNames = Filter::post('replaceNames', 'checked', '');
         $this->replacePlaces = Filter::post('replacePlaces', 'checked', '');
         $this->replacePlacesWord = Filter::post('replacePlacesWord', 'checked', '');
         $this->replaceAll = Filter::post('replaceAll', 'checked', '');
     } else {
         $this->action = Filter::get('action', 'advanced|general|soundex|replace|header', 'general');
         $this->query = Filter::get('query');
         $this->replace = Filter::get('replace');
         $this->replaceNames = Filter::get('replaceNames', 'checked', '');
         $this->replacePlaces = Filter::get('replacePlaces', 'checked', '');
         $this->replacePlacesWord = Filter::get('replacePlacesWord', 'checked', '');
         $this->replaceAll = Filter::get('replaceAll', 'checked', '');
     }
     // Only editors can use search/replace
     if ($this->action === 'replace' && !Auth::isEditor($WT_TREE)) {
         $this->action = 'general';
     }
     $this->srindi = Filter::get('srindi', 'checked', '');
     $this->srfams = Filter::get('srfams', 'checked', '');
     $this->srsour = Filter::get('srsour', 'checked', '');
     $this->srnote = Filter::get('srnote', 'checked', '');
     $this->soundex = Filter::get('soundex', 'DaitchM|Russell', 'DaitchM');
     $this->showasso = Filter::get('showasso');
     $this->firstname = Filter::get('firstname');
     $this->lastname = Filter::get('lastname');
     $this->place = Filter::get('place');
     $this->year = Filter::get('year');
     // If no record types specified, search individuals
     if (!$this->srfams && !$this->srsour && !$this->srnote) {
         $this->srindi = 'checked';
     }
     // If no replace types specifiied, replace full records
     if (!$this->replaceNames && !$this->replacePlaces && !$this->replacePlacesWord) {
         $this->replaceAll = 'checked';
     }
     // Trees to search
     if (Site::getPreference('ALLOW_CHANGE_GEDCOM')) {
         foreach (Tree::getAll() as $search_tree) {
             if (Filter::get('tree_' . $search_tree->getTreeId())) {
                 $this->search_trees[] = $search_tree;
             }
         }
         if (!$this->search_trees) {
             $this->search_trees[] = $WT_TREE;
         }
     } else {
         $this->search_trees[] = $WT_TREE;
     }
     // If we want to show associated persons, build the list
     switch ($this->action) {
         case 'header':
             // We can type in an XREF into the header search, and jump straight to it.
             // Otherwise, the header search is the same as the general search
             if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
                 $record = GedcomRecord::getInstance($this->query, $WT_TREE);
                 if ($record && $record->canShowName()) {
                     header('Location: ' . WT_BASE_URL . $record->getRawUrl());
                     exit;
                 }
             }
             $this->action = 'general';
             $this->srindi = 'checked';
             $this->srfams = 'checked';
             $this->srsour = 'checked';
             $this->srnote = 'checked';
             $this->setPageTitle(I18N::translate('General search'));
             $this->generalSearch();
             break;
         case 'general':
             $this->setPageTitle(I18N::translate('General search'));
             $this->generalSearch();
             break;
         case 'soundex':
             // Create a dummy search query to use as a title to the results list
             $this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
             $this->setPageTitle(I18N::translate('Phonetic search'));
             $this->soundexSearch();
             break;
         case 'replace':
             $this->setPageTitle(I18N::translate('Search and replace'));
             $this->search_trees = array($WT_TREE);
             $this->srindi = 'checked';
             $this->srfams = 'checked';
             $this->srsour = 'checked';
             $this->srnote = 'checked';
             if (Filter::post('query')) {
                 $this->searchAndReplace($WT_TREE);
                 header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
                 exit;
             }
     }
 }