private function flags() { require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Simple(); $controller->setPageTitle(WT_I18N::translate('Select flag'))->pageHeader(); $countries = WT_Stats::getAllCountries(); $action = WT_Filter::post('action'); $countrySelected = WT_Filter::get('countrySelected', null, 'Countries'); $stateSelected = WT_Filter::get('stateSelected', null, 'States'); $country = array(); $rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $country[] = substr($file, 0, strlen($file) - 4); } } closedir($rep); sort($country); if ($countrySelected == 'Countries') { $flags = $country; } else { $flags = array(); $rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $flags[] = substr($file, 0, strlen($file) - 4); } } closedir($rep); sort($flags); } $flags_s = array(); if ($stateSelected != 'States' && is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected . '/')) { $rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected . '/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $flags_s[] = substr($file, 0, strlen($file) - 4); } } closedir($rep); sort($flags_s); } if ($action == 'ChangeFlag' && isset($_POST['FLAGS'])) { ?> <script> <?php if ($_POST['selcountry'] == 'Countries') { ?> window.opener.document.editplaces.icon.value = 'places/flags/<?php echo $flags[$_POST['FLAGS']]; ?> .png'; window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?> googlemap/places/flags/<?php echo $country[$_POST['FLAGS']]; ?> .png\"> <a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?> </a> <a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?> </a>"; <?php } elseif ($_POST['selstate'] != "States") { ?> window.opener.document.editplaces.icon.value = 'places/<?php echo $countrySelected, '/flags/', $_POST['selstate'], '/', $flags_s[$_POST['FLAGS']]; ?> .png'; window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?> googlemap/places/<?php echo $countrySelected, "/flags/", $_POST['selstate'], "/", $flags_s[$_POST['FLAGS']]; ?> .png\"> <a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?> </a> <a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?> </a>"; <?php } else { ?> window.opener.document.editplaces.icon.value = "places/<?php echo $countrySelected, "/flags/", $flags[$_POST['FLAGS']]; ?> .png"; window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?> googlemap/places/<?php echo $countrySelected, "/flags/", $flags[$_POST['FLAGS']]; ?> .png\"> <a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?> </a> <a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?> </a>"; <?php } ?> window.opener.updateMap(); window.close(); </script> <?php exit; } else { ?> <script> function selectCountry() { if (document.flags.COUNTRYSELECT.value == 'Countries') { window.location="module.php?mod=googlemap&mod_action=flags"; } else if (document.flags.STATESELECT.value != 'States') { window.location="module.php?mod=googlemap&mod_action=flags&countrySelected=" + document.flags.COUNTRYSELECT.value + "&stateSelected=" + document.flags.STATESELECT.value; } else { window.location="module.php?mod=googlemap&mod_action=flags&countrySelected=" + document.flags.COUNTRYSELECT.value; } } </script> <?php } $countryList = array(); $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/'); for ($i = 0; $i < count($country); $i++) { if (count(preg_grep('/' . $country[$i] . '/', $placesDir)) != 0) { $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $country[$i] . '/'); while ($file = readdir($rep)) { if (stristr($file, 'flags')) { if (isset($countries[$country[$i]])) { $countryList[$country[$i]] = $countries[$country[$i]]; } else { $countryList[$country[$i]] = $country[$i]; } } } closedir($rep); } } asort($countryList); $stateList = array(); if ($countrySelected != 'Countries') { $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/'); for ($i = 0; $i < count($flags); $i++) { if (in_array($flags[$i], $placesDir)) { $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $flags[$i] . '/'); while ($file = readdir($rep)) { $stateList[$flags[$i]] = $flags[$i]; } closedir($rep); } } asort($stateList); } ?> <h4><?php echo WT_I18N::translate('Change flag'); ?> </h4> <form method="post" id="flags" name="flags" action="module.php?mod=googlemap&mod_action=flags&countrySelected=<?php echo $countrySelected; ?> &stateSelected=<?php echo $stateSelected; ?> "> <input type="hidden" name="action" value="ChangeFlag"> <input type="hidden" name="selcountry" value="<?php echo $countrySelected; ?> "> <input type="hidden" name="selstate" value="<?php echo $stateSelected; ?> "> <table class="facts_table"> <tr> <td class="optionbox" colspan="4"> <?php echo help_link('PLE_FLAGS', 'googlemap'); ?> <select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()"> <option value="Countries"><?php echo WT_I18N::translate('Countries'); ?> </option> <?php foreach ($countryList as $country_key => $country_name) { echo '<option value="', $country_key, '"'; if ($countrySelected == $country_key) { echo ' selected="selected" '; } echo '>', $country_name, '</option>'; } ?> </select> </td> </tr> <tr> <?php $j = 1; for ($i = 0; $i < count($flags); $i++) { if ($countrySelected == 'Countries') { $tempstr = '<td><input type="radio" dir="ltr" name="FLAGS" value="' . $i . '"><img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/places/flags/' . $flags[$i] . '.png" alt="' . $flags[$i] . '" title="'; if ($flags[$i] != 'blank') { if (isset($countries[$flags[$i]])) { $tempstr .= $countries[$flags[$i]]; } else { $tempstr .= $flags[$i]; } } else { $tempstr .= $countries['???']; } echo $tempstr, '"> ', $flags[$i], '</input></td>'; } else { echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $flags[$i], '.png"> ', $flags[$i], '</input></td>'; } if ($j == 4) { echo '</tr><tr>'; $j = 0; } $j++; } echo '</tr><tr'; if ($countrySelected == 'Countries' || count($stateList) == 0) { echo ' style=" visibility: hidden"'; } echo '>'; ?> <td class="optionbox" colspan="4"> <?php echo help_link('PLE_FLAGS', 'googlemap'); ?> <select name="STATESELECT" dir="ltr" onchange="selectCountry()"> <option value="States"><?php echo WT_I18N::translate('Subdivision'); ?> </option> <?php foreach ($stateList as $state_key => $state_name) { echo '<option value="', $state_key, '"'; if ($stateSelected == $state_key) { echo ' selected="selected"'; } echo '>', $state_name, '</option>'; } ?> </select> </td> </tr> <tr> <?php $j = 1; for ($i = 0; $i < count($flags_s); $i++) { if ($stateSelected != 'States') { echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL . WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flags_s[$i], '.png"> ', $flags_s[$i], '</input></td>'; } if ($j == 4) { echo '</tr><tr>'; $j = 0; } $j++; } ?> </tr> </table> <p id="save-cancel"> <input type="submit" class="save" value="<?php echo WT_I18N::translate('save'); ?> "> <input type="button" class="cancel" value="<?php echo WT_I18N::translate('close'); ?> " onclick="window.close();"> </p> </form> <?php }
$preselCustom[] = $one; } } } if ($subclick == 'all') { $all = true; } $embed = substr($choose, 0, 1) == "1"; $chooseType = substr($choose, 1); if ($chooseType != "media" && $chooseType != "0file") { $chooseType = "all"; } // End variables for find media switch ($type) { case "indi": $controller->setPageTitle(WT_I18N::translate('Find an individual')); break; case "fam": $controller->setPageTitle(WT_I18N::translate('Find a family')); break; case "media": $controller->setPageTitle(WT_I18N::translate('Find a media object')); break; case "place": $controller->setPageTitle(WT_I18N::translate('Find a place')); break; case "repo": $controller->setPageTitle(WT_I18N::translate('Find a repository')); break; case "note": $controller->setPageTitle(WT_I18N::translate('Find a shared note'));
function run() { $controller = new WT_Controller_Simple(); $controller->setPageTitle($this->title)->pageHeader(); // Setting up the styles echo '<style type="text/css">'; foreach ($this->Styles as $class => $style) { echo '.', $class, ' { '; if ($style["font"] == "dejavusans") { $style["font"] = $this->defaultFont; } echo 'font-family: ', $style['font'], '; '; echo 'font-size: ', $style['size'], 'pt; '; // Case-insensitive if (stripos($style['style'], 'B') !== false) { echo 'font-weight: bold; '; } if (stripos($style['style'], 'I') !== false) { echo 'font-style: italic; '; } if (stripos($style['style'], 'U') !== false) { echo 'text-decoration: underline; '; } if (stripos($style['style'], 'D') !== false) { echo 'text-decoration: line-through; '; } echo '}', PHP_EOL; } unset($class, $style); //-- header divider echo '</style>', PHP_EOL; echo '<div id="headermargin" style="position: relative; top: auto; height: ', $this->headermargin, 'pt; width: ', $this->noMarginWidth, 'pt;"></div>'; echo '<div id="headerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;">'; foreach ($this->headerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element == "footnotetexts") { $this->Footnotes(); } elseif (is_string($element) && $element == "addpage") { $this->AddPage(); } } //-- body echo '</div>'; echo '<script>document.getElementById("headerdiv").style.height="', $this->topmargin - $this->headermargin - 6, 'pt";</script>'; echo '<div id="bodydiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt; height: 100%;">'; $this->Y = 0; $this->maxY = 0; $this->runPageHeader(); foreach ($this->bodyElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element == "footnotetexts") { $this->Footnotes(); } elseif (is_string($element) && $element == "addpage") { $this->AddPage(); } } //-- footer echo '</div>'; echo '<script>document.getElementById("bodydiv").style.height="', $this->maxY, 'pt";</script>'; echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottommargin - $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">'; $this->Y = 0; $this->X = 0; $this->maxY = 0; foreach ($this->footerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element == "footnotetexts") { $this->Footnotes(); } elseif (is_string($element) && $element == "addpage") { $this->AddPage(); } } echo '</div>'; echo '<script>document.getElementById("footerdiv").style.height="', $this->maxY, 'pt";</script>'; echo '<div id="footermargin" style="position: relative; top: auto; height: ', $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; }
private static function media_query_3a() { $iid2 = WT_Filter::get('iid', WT_REGEX_XREF); $controller = new WT_Controller_Simple(); $controller->setPageTitle(WT_I18N::translate('Link to an existing media object'))->pageHeader(); $record = WT_GedcomRecord::getInstance($iid2); if ($record) { $headjs = ''; if ($record instanceof WT_Family) { if ($record->getHusband()) { $headjs = $record->getHusband()->getXref(); } elseif ($record->getWife()) { $headjs = $record->getWife()->getXref(); } } ?> <script> function insertId() { if (window.opener.document.getElementById('addlinkQueue')) { // alert('Please move this alert window and examine the contents of the pop-up window, then click OK') window.opener.insertRowToTable('<?php echo $record->getXref(); ?> ', '<?php echo htmlSpecialChars($record->getFullName()); ?> ', '<?php echo $headjs; ?> '); window.close(); } } </script> <?php } else { ?> <script> function insertId() { window.opener.alert('<?php echo strtoupper($iid2); ?> - <?php echo WT_I18N::translate('Not a valid individual, family, or source ID'); ?> '); window.close(); } </script> <?php } ?> <script>window.onLoad = insertId();</script> <?php }
use WT\Auth; define('WT_SCRIPT_NAME', 'edit_interface.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $action = WT_Filter::post('action', null, WT_Filter::get('action')); $controller = new WT_Controller_Simple(); $controller->restrictAccess(Auth::isEditor())->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->addInlineJavascript(' var locale_date_format="' . preg_replace('/[^DMY]/', '', str_replace(array('J', 'F'), array('D', 'M'), strtoupper($DATE_FORMAT))) . '"; '); switch ($action) { //////////////////////////////////////////////////////////////////////////////// case 'editraw': $xref = WT_Filter::get('xref', WT_REGEX_XREF); $record = WT_GedcomRecord::getInstance($xref); check_record_access($record); $controller->setPageTitle($record->getFullName() . ' - ' . WT_I18N::translate('Edit raw GEDCOM'))->pageHeader()->addInlineJavascript('jQuery("#raw-gedcom-list").sortable({opacity: 0.7, cursor: "move", axis: "y"});'); ?> <div id="edit_interface-page"> <h4> <?php echo $controller->getPageTitle(); ?> <?php echo help_link('edit_edit_raw'); ?> </h4> <pre> <?php echo '0 @' . $record->getXref() . '@ ' . $record::RECORD_TYPE; ?> </pre> <form method="post" action="edit_interface.php">
// (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 $controller = new WT_Controller_Simple(); $filter = WT_Filter::get('filter'); $action = WT_Filter::get('action'); $callback = WT_Filter::get('callback'); $multiple = WT_Filter::getBool('multiple'); $controller->setPageTitle(WT_I18N::translate('Find an individual'))->pageHeader(); ?> <script> function pasterow(id, nam, mnam, label, gend, cond, dom, dob, dod, occu, age, birthpl, fbirthpl, mbirthpl, chilBLD) { window.opener.insertRowToTable(id, nam, mnam, label, gend, cond, dom, dob, dod, occu, age, birthpl, fbirthpl, mbirthpl, chilBLD); <?php if (!$multiple) { echo "window.close();"; } ?> } function pasteid(id, name, thumb) { if (thumb) { window.opener.<?php echo $callback;
use WT\Log; use WT\User; define('WT_SCRIPT_NAME', 'message.php'); require './includes/session.php'; // Some variables are initialised from GET (so we can set initial values in URLs), // but are submitted in POST so we can have long body text. $subject = WT_Filter::post('subject', null, WT_Filter::get('subject')); $body = WT_Filter::post('body'); $from_name = WT_Filter::post('from_name'); $from_email = WT_Filter::post('from_email'); $action = WT_Filter::post('action', 'compose|send', 'compose'); $to = WT_Filter::post('to', null, WT_Filter::get('to')); $method = WT_Filter::post('method', 'messaging|messaging2|messaging3|mailto|none', WT_Filter::get('method', 'messaging|messaging2|messaging3|mailto|none', 'messaging2')); $url = WT_Filter::postUrl('url', WT_Filter::getUrl('url')); $controller = new WT_Controller_Simple(); $controller->setPageTitle(WT_I18N::translate('webtrees message')); $to_user = User::findByIdentifier($to); // Only admins can send broadcast messages if ((!$to_user || $to == 'all' || $to == 'last_6mo' || $to == 'never_logged') && !Auth::isAdmin()) { // TODO, what if we have a user called "all" or "last_6mo" or "never_logged" ??? WT_FlashMessages::addMessage(WT_I18N::translate('Message was not sent')); $controller->pageHeader(); $controller->addInlineJavascript('window.opener.location.reload(); window.close();'); exit; } $errors = ''; // Is this message from a member or a visitor? if (WT_USER_ID) { $from = WT_USER_NAME; } else { // Visitors must provide a valid email address
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', '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) {
} if ($action == 'update' || $action == 'create') { if ($linktoid) { $disp = WT_GedcomRecord::getInstance($linktoid)->canShow(); } } if (!WT_USER_CAN_EDIT || !$disp) { $controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();'); exit; } // TODO - there is a lot of common code in the create and update cases.... // .... and also in the admin_media_upload.php script switch ($action) { case 'create': // Save the information from the “showcreateform” action $controller->setPageTitle(WT_I18N::translate('Create a new media object')); // Validate the media folder $folderName = str_replace('\\', '/', $folder); $folderName = trim($folderName, '/'); if ($folderName == '.') { $folderName = ''; } if ($folderName) { $folderName .= '/'; // Not allowed to use “../” if (strpos('/' . $folderName, '/../') !== false) { WT_FlashMessages::addMessage('Folder names are not allowed to include “../”'); break; } } // Make sure the media folder exists