Пример #1
0
 public function modAction($modAction)
 {
     global $controller;
     switch ($modAction) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
             if (WT_USER_ID && $record->canShowName()) {
                 self::addFavorite(array('user_id' => WT_USER_ID, 'gedcom_id' => $record->getGedcomId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 WT_FlashMessages::addMessage(WT_I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
Пример #2
0
 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         $block_id = WT_Filter::postInteger('block_id');
         if ($block_id) {
             WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id));
         } else {
             WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order')));
             $block_id = WT_DB::getInstance()->lastInsertId();
         }
         set_block_setting($block_id, 'header', WT_Filter::post('header'));
         set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
         $languages = array();
         foreach (WT_I18N::installed_languages() as $code => $name) {
             if (WT_Filter::postBool('lang_' . $code)) {
                 $languages[] = $code;
             }
         }
         set_block_setting($block_id, 'languages', implode(',', $languages));
         $this->config();
     } else {
         $block_id = WT_Filter::getInteger('block_id');
         $controller = new WT_Controller_Page();
         if ($block_id) {
             $controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
             $header = get_block_setting($block_id, 'header');
             $faqbody = get_block_setting($block_id, 'faqbody');
             $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
         } else {
             $controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
             $header = '';
             $faqbody = '';
             $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
             $gedcom_id = WT_GED_ID;
         }
         $controller->pageHeader();
         if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
             ckeditor_WT_Module::enableEditor($controller);
         }
         // "Help for this page" link
         echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
         echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
         echo WT_Filter::getCsrf();
         echo '<input type="hidden" name="save" value="1">';
         echo '<input type="hidden" name="block_id" value="', $block_id, '">';
         echo '<table id="faq_module">';
         echo '<tr><th>';
         echo WT_I18N::translate('Question');
         echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>';
         echo '<tr><th>';
         echo WT_I18N::translate('Answer');
         echo '</th></tr><tr><td>';
         echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>';
         echo '</td></tr>';
         echo '</table><table id="faq_module2">';
         echo '<tr>';
         echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
         echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
         echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
         echo '</tr><tr>';
         echo '<td>';
         $languages = get_block_setting($block_id, 'languages');
         echo edit_language_checkboxes('lang_', $languages);
         echo '</td><td>';
         echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
         echo '</td><td>';
         echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"');
         echo '</td></tr>';
         echo '</table>';
         echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
         echo '</form>';
         exit;
     }
 }
Пример #3
0
// 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', 'index_edit.php');
require './includes/session.php';
$controller = new WT_Controller_Ajax();
// Only one of $user_id and $gedcom_id should be set
$user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER));
if ($user_id) {
    $gedcom_id = null;
} else {
    $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER));
}
// Only an admin can edit the "default" page
// Only managers can edit the "home page"
// Only a user or an admin can edit a user’s "my page"
if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) {
    $controller->pageHeader();
    $controller->addInlineJavascript('window.location.reload();');
    exit;
}
$action = WT_Filter::get('action');
if (isset($_REQUEST['main'])) {
    $main = $_REQUEST['main'];
} else {
    $main = array();
}
Пример #4
0
    public function configureBlock($block_id)
    {
        global $ctype, $controller;
        $PEDIGREE_ROOT_ID = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID');
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'details', WT_Filter::postBool('details'));
            set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
            set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF));
            exit;
        }
        $details = get_block_setting($block_id, 'details', false);
        $type = get_block_setting($block_id, 'type', 'pedigree');
        $pid = get_block_setting($block_id, 'pid', WT_USER_ID ? WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID);
        $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        ?>
		<tr><td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Chart type');
        ?>
</td>
		<td class="optionbox">
			<select name="type">
				<option value="pedigree"<?php 
        if ($type == "pedigree") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Pedigree');
        ?>
</option>
				<option value="descendants"<?php 
        if ($type == "descendants") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Descendants');
        ?>
</option>
				<option value="hourglass"<?php 
        if ($type == "hourglass") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Hourglass chart');
        ?>
</option>
				<option value="treenav"<?php 
        if ($type == "treenav") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Interactive tree');
        ?>
</option>
			</select>
		</td></tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Show details');
        ?>
</td>
		<td class="optionbox">
			<select name="details">
					<option value="no" <?php 
        if (!$details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('no');
        ?>
</option>
					<option value="yes" <?php 
        if ($details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('yes');
        ?>
</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Individual');
        ?>
</td>
			<td class="optionbox">
				<input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php 
        echo $pid;
        ?>
" size="5">
				<?php 
        echo print_findindi_link('pid');
        $root = WT_Individual::getInstance($pid);
        if ($root) {
            echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>';
        }
        ?>
			</td>
		</tr>
		<?php 
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $block = get_block_setting($block_id, 'block', false);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Add a scrollbar when block contents grow');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('block', $block);
        echo '</td></tr>';
    }
Пример #5
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
         set_block_setting($block_id, 'hide_empty', WT_Filter::postBool('hide_empty'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', self::MAX_DAYS, self::MAX_DAYS), '</em>';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'date');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('name' => WT_I18N::translate('sort by name'), 'date_asc' => WT_I18N::translate('sort by date, oldest first'), 'date_desc' => WT_I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
     $hide_empty = get_block_setting($block_id, 'hide_empty', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Should this block be hidden when it is empty?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', WT_I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
Пример #6
0
    public function configureBlock($block_id)
    {
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'filter', WT_Filter::post('filter', 'indi|event|all', 'all'));
            set_block_setting($block_id, 'controls', WT_Filter::postBool('controls'));
            set_block_setting($block_id, 'start', WT_Filter::postBool('start'));
            set_block_setting($block_id, 'filter_avi', WT_Filter::postBool('filter_avi'));
            set_block_setting($block_id, 'filter_bmp', WT_Filter::postBool('filter_bmp'));
            set_block_setting($block_id, 'filter_gif', WT_Filter::postBool('filter_gif'));
            set_block_setting($block_id, 'filter_jpeg', WT_Filter::postBool('filter_jpeg'));
            set_block_setting($block_id, 'filter_mp3', WT_Filter::postBool('filter_mp3'));
            set_block_setting($block_id, 'filter_ole', WT_Filter::postBool('filter_ole'));
            set_block_setting($block_id, 'filter_pcx', WT_Filter::postBool('filter_pcx'));
            set_block_setting($block_id, 'filter_pdf', WT_Filter::postBool('filter_pdf'));
            set_block_setting($block_id, 'filter_png', WT_Filter::postBool('filter_png'));
            set_block_setting($block_id, 'filter_tiff', WT_Filter::postBool('filter_tiff'));
            set_block_setting($block_id, 'filter_wav', WT_Filter::postBool('filter_wav'));
            set_block_setting($block_id, 'filter_audio', WT_Filter::postBool('filter_audio'));
            set_block_setting($block_id, 'filter_book', WT_Filter::postBool('filter_book'));
            set_block_setting($block_id, 'filter_card', WT_Filter::postBool('filter_card'));
            set_block_setting($block_id, 'filter_certificate', WT_Filter::postBool('filter_certificate'));
            set_block_setting($block_id, 'filter_coat', WT_Filter::postBool('filter_coat'));
            set_block_setting($block_id, 'filter_document', WT_Filter::postBool('filter_document'));
            set_block_setting($block_id, 'filter_electronic', WT_Filter::postBool('filter_electronic'));
            set_block_setting($block_id, 'filter_fiche', WT_Filter::postBool('filter_fiche'));
            set_block_setting($block_id, 'filter_film', WT_Filter::postBool('filter_film'));
            set_block_setting($block_id, 'filter_magazine', WT_Filter::postBool('filter_magazine'));
            set_block_setting($block_id, 'filter_manuscript', WT_Filter::postBool('filter_manuscript'));
            set_block_setting($block_id, 'filter_map', WT_Filter::postBool('filter_map'));
            set_block_setting($block_id, 'filter_newspaper', WT_Filter::postBool('filter_newspaper'));
            set_block_setting($block_id, 'filter_other', WT_Filter::postBool('filter_other'));
            set_block_setting($block_id, 'filter_painting', WT_Filter::postBool('filter_painting'));
            set_block_setting($block_id, 'filter_photo', WT_Filter::postBool('filter_photo'));
            set_block_setting($block_id, 'filter_tombstone', WT_Filter::postBool('filter_tombstone'));
            set_block_setting($block_id, 'filter_video', WT_Filter::postBool('filter_video'));
            exit;
        }
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $filter = get_block_setting($block_id, 'filter', 'all');
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Show only individuals, events, or all?');
        echo '</td><td class="optionbox">';
        echo select_edit_control('filter', array('indi' => WT_I18N::translate('Individuals'), 'event' => WT_I18N::translate('Facts and events'), 'all' => WT_I18N::translate('All')), null, $filter, '');
        echo '</td></tr>';
        $filters = array('avi' => get_block_setting($block_id, 'filter_avi', false), 'bmp' => get_block_setting($block_id, 'filter_bmp', true), 'gif' => get_block_setting($block_id, 'filter_gif', true), 'jpeg' => get_block_setting($block_id, 'filter_jpeg', true), 'mp3' => get_block_setting($block_id, 'filter_mp3', false), 'ole' => get_block_setting($block_id, 'filter_ole', true), 'pcx' => get_block_setting($block_id, 'filter_pcx', true), 'pdf' => get_block_setting($block_id, 'filter_pdf', false), 'png' => get_block_setting($block_id, 'filter_png', true), 'tiff' => get_block_setting($block_id, 'filter_tiff', true), 'wav' => get_block_setting($block_id, 'filter_wav', false), 'audio' => get_block_setting($block_id, 'filter_audio', false), 'book' => get_block_setting($block_id, 'filter_book', true), 'card' => get_block_setting($block_id, 'filter_card', true), 'certificate' => get_block_setting($block_id, 'filter_certificate', true), 'coat' => get_block_setting($block_id, 'filter_coat', true), 'document' => get_block_setting($block_id, 'filter_document', true), 'electronic' => get_block_setting($block_id, 'filter_electronic', true), 'fiche' => get_block_setting($block_id, 'filter_fiche', true), 'film' => get_block_setting($block_id, 'filter_film', true), 'magazine' => get_block_setting($block_id, 'filter_magazine', true), 'manuscript' => get_block_setting($block_id, 'filter_manuscript', true), 'map' => get_block_setting($block_id, 'filter_map', true), 'newspaper' => get_block_setting($block_id, 'filter_newspaper', true), 'other' => get_block_setting($block_id, 'filter_other', true), 'painting' => get_block_setting($block_id, 'filter_painting', true), 'photo' => get_block_setting($block_id, 'filter_photo', true), 'tombstone' => get_block_setting($block_id, 'filter_tombstone', true), 'video' => get_block_setting($block_id, 'filter_video', false));
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Filter');
        ?>
	</td>
		<td class="optionbox">
			<center><b><?php 
        echo WT_Gedcom_Tag::getLabel('FORM');
        ?>
</b></center>
			<table class="width100">
				<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_avi"
				<?php 
        if ($filters['avi']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;avi&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_bmp"
				<?php 
        if ($filters['bmp']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;bmp&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_gif"
				<?php 
        if ($filters['gif']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;gif&nbsp;&nbsp;</td>
				</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_jpeg"
				<?php 
        if ($filters['jpeg']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;jpeg&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_mp3"
				<?php 
        if ($filters['mp3']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;mp3&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_ole"
				<?php 
        if ($filters['ole']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;ole&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_pcx"
				<?php 
        if ($filters['pcx']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;pcx&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_pdf"
				<?php 
        if ($filters['pdf']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;pdf&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_png"
				<?php 
        if ($filters['png']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;png&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_tiff"
				<?php 
        if ($filters['tiff']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;tiff&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_wav"
				<?php 
        if ($filters['wav']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;wav&nbsp;&nbsp;</td>
					<td class="width33">&nbsp;</td>
					<td class="width33">&nbsp;</td>
				</tr>
			</table>
			<br>
			<center><b><?php 
        echo WT_Gedcom_Tag::getLabel('TYPE');
        ?>
</b></center>
			<table class="width100">
				<tr>
				<?php 
        //-- Build the list of checkboxes
        $i = 0;
        foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) {
            $i++;
            if ($i > 3) {
                $i = 1;
                echo "</tr><tr>";
            }
            echo "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_" . $typeName . "\"";
            if ($filters[$typeName]) {
                echo " checked=\"checked\"";
            }
            echo ">&nbsp;&nbsp;" . $typeValue . "&nbsp;&nbsp;</td>";
        }
        ?>
				</tr>
			</table>
	</td>
	</tr>

	<?php 
        $controls = get_block_setting($block_id, 'controls', true);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Show slide show controls?');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('controls', $controls);
        echo '</td></tr>';
        $start = get_block_setting($block_id, 'start', false);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Start slide show on page load?');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('start', $start);
        echo '</td></tr>';
    }
Пример #7
0
		<input type="hidden" name="action" value="requestpw">
		<h4>', WT_I18N::translate('Lost password request'), '</h4>
		<div>
			<label for="new_passwd_username">', WT_I18N::translate('Username or email address'), '<input type="text" id="new_passwd_username" name="new_passwd_username" value="">
			</label>
		</div>
		<div><input type="submit" value="', WT_I18N::translate('continue'), '"></div>
		</form>
	</div>';
        echo '</div>';
        echo '</div>';
        break;
    case 'requestpw':
        $controller->setPageTitle(WT_I18N::translate('Lost password request'))->pageHeader();
        echo '<div id="login-page">';
        $user_name = WT_Filter::post('new_passwd_username', WT_REGEX_USERNAME);
        $user = User::findByIdentifier($user_name);
        if ($user) {
            $passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
            $user_new_pw = '';
            $max = strlen($passchars) - 1;
            for ($i = 0; $i < 8; $i++) {
                $index = rand(0, $max);
                $user_new_pw .= $passchars[$index];
            }
            $user->setPassword($user_new_pw);
            Log::addAuthenticationLog('Password request was sent to user: '******'Lost password request'), WT_I18N::translate('Hello %s…', $user->getRealName()) . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('A new password was requested for your user name.') . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('Username') . ": " . $user->getUserName() . WT_Mail::EOL . WT_I18N::translate('Password') . ": " . $user_new_pw . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('After you have logged in, select the “My account” link under the “My page” menu and fill in the password fields to change your password.') . WT_Mail::EOL . WT_Mail::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'login.php?ged=' . WT_GEDURL . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'login.php?ged=' . WT_GEDURL . '</a>');
        }
        // Show a success message, even if the user account does not exist.
        // Otherwise this page can be used to guess/test usernames.
Пример #8
0
    public function configureBlock($block_id)
    {
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom'));
            set_block_setting($block_id, 'title', WT_Filter::post('title'));
            set_block_setting($block_id, 'html', WT_Filter::post('html'));
            set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp'));
            set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp'));
            $languages = array();
            foreach (WT_I18N::installed_languages() as $code => $name) {
                if (WT_Filter::postBool('lang_' . $code)) {
                    $languages[] = $code;
                }
            }
            set_block_setting($block_id, 'languages', implode(',', $languages));
            exit;
        }
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $templates = array(WT_I18N::translate('Keyword examples') => '#getAllTagsTable#', WT_I18N::translate('Narrative description') => WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), WT_I18N::translate('Statistics') => '<div class="gedcom_stats">
				<span style="font-weight: bold"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br>
				' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
				<table id="keywords">
					<tr>
						<td valign="top" class="width20">
							<table cellspacing="1" cellpadding="0">
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Individuals') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Males') . '</td>
									<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Females') . '</td>
									<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . WT_GEDURL . '">#totalSurnames#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Families') . '</td>
									<td class="facts_value" align="right"><a href="famlist.php?ged=' . WT_GEDURL . '">#totalFamilies#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Sources') . '</td>
									<td class="facts_value" align="right"><a href="sourcelist.php?ged=' . WT_GEDURL . '">#totalSources#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Media objects') . '</td>
									<td class="facts_value" align="right"><a href="medialist.php?ged=' . WT_GEDURL . '">#totalMedia#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Repositories') . '</td>
									<td class="facts_value" align="right"><a href="repolist.php?ged=' . WT_GEDURL . '">#totalRepositories#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total events') . '</td>
									<td class="facts_value" align="right">#totalEvents#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total users') . '</td>
									<td class="facts_value" align="right">#totalUsers#</td>
								</tr>
							</table>
						</td>
						<td><br></td>
						<td valign="top">
							<table cellspacing="1" cellpadding="0" border="0">
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td>
									<td class="facts_value" align="right">#firstBirthYear#</td>
									<td class="facts_value">#firstBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td>
									<td class="facts_value" align="right">#lastBirthYear#</td>
									<td class="facts_value">#lastBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td>
									<td class="facts_value" align="right">#firstDeathYear#</td>
									<td class="facts_value">#firstDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td>
									<td class="facts_value" align="right">#lastDeathYear#</td>
									<td class="facts_value">#lastDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td>
									<td class="facts_value" align="right">#longestLifeAge#</td>
									<td class="facts_value">#longestLife#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td>
									<td class="facts_value" align="right">#averageLifespan#</td>
									<td class="facts_value"></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td>
									<td class="facts_value" align="right">#largestFamilySize#</td>
									<td class="facts_value">#largestFamily#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td>
									<td class="facts_value" align="right">#averageChildren#</td>
									<td class="facts_value"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table><br>
				<span style="font-weight: bold">' . WT_I18N::translate('Most common surnames') . '</span><br>
				#commonSurnames#
			</div>');
        $title = get_block_setting($block_id, 'title');
        $html = get_block_setting($block_id, 'html');
        // title
        echo '<tr><td class="descriptionbox wrap">', WT_Gedcom_Tag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>';
        // templates
        echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Templates'), help_link('block_html_template', $this->getName()), '</td><td class="optionbox">';
        // The CK editor needs lots of help to load/save data :-(
        if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
            $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);';
        } else {
            $ckeditor_onchange = '';
        }
        echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">';
        echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>';
        foreach ($templates as $title => $template) {
            echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>';
        }
        echo '</select></td></tr>';
        // gedcom
        $gedcom = get_block_setting($block_id, 'gedcom');
        if (count(WT_Tree::getAll()) > 1) {
            if ($gedcom == '__current__') {
                $sel_current = ' selected="selected"';
            } else {
                $sel_current = '';
            }
            if ($gedcom == '__default__') {
                $sel_default = ' selected="selected"';
            } else {
                $sel_default = '';
            }
            echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>', '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
            foreach (WT_Tree::getAll() as $tree) {
                if ($tree->tree_name == $gedcom) {
                    $sel = ' selected="selected"';
                } else {
                    $sel = '';
                }
                echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
            }
            echo '</select></td></tr>';
        }
        // html
        echo '<tr><td colspan="2" class="descriptionbox">', WT_I18N::translate('Content'), help_link('block_html_content', $this->getName()), '</td></tr><tr>', '<td colspan="2" class="optionbox">';
        echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>';
        echo '</td></tr>';
        $show_timestamp = get_block_setting($block_id, 'show_timestamp', false);
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show the date and time of update');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('show_timestamp', $show_timestamp);
        echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">';
        echo '</td></tr>';
        $languages = get_block_setting($block_id, 'languages');
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show this block for which languages?');
        echo '</td><td class="optionbox">';
        echo edit_language_checkboxes('lang_', $languages);
        echo '</td></tr>';
    }
Пример #9
0
			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveMenus(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
        foreach (WT_Tree::getAll() as $tree) {
            $access_level = WT_Filter::post("menuaccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel());
            WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'menu', ?)")->execute(array($module_name, $tree->tree_id, $access_level));
        }
        $order = WT_Filter::post('menuorder-' . $module_name);
        WT_DB::prepare("UPDATE `##module` SET menu_order=? WHERE module_name=?")->execute(array($order, $module_name));
        $module->order = $order;
        // Make the new order take effect immediately
    }
    uasort($modules, function ($x, $y) {
        return $x->order - $y->order;
    });
}
?>
<div id="menus" align="center">
	<form method="post" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
		<input type="hidden" name="action" value="update_mods">
Пример #10
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
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Merge records'))->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->pageHeader();
require_once WT_ROOT . 'includes/functions/functions_edit.php';
$ged = $GEDCOM;
$gid1 = WT_Filter::post('gid1', WT_REGEX_XREF);
$gid2 = WT_Filter::post('gid2', WT_REGEX_XREF);
$action = WT_Filter::post('action', 'choose|select|merge', 'choose');
$ged1 = WT_Filter::post('ged1', null, $ged);
$ged2 = WT_Filter::post('ged2', null, $ged);
$keep1 = WT_Filter::postArray('keep1');
$keep2 = WT_Filter::postArray('keep2');
if ($action != 'choose') {
    if ($gid1 == $gid2 && $ged1 == $ged2) {
        $action = 'choose';
        echo '<span class="error">', WT_I18N::translate('You entered the same IDs.  You cannot merge the same records.'), '</span>';
    } else {
        $rec1 = WT_GedcomRecord::getInstance($gid1, WT_Tree::getIdFromName($ged1));
        $rec2 = WT_GedcomRecord::getInstance($gid2, WT_Tree::getIdFromName($ged2));
        if (!$rec1) {
            echo '<span class="error">', WT_I18N::translate('Unable to find record with ID'), ':</span> ', $gid1, ', ', $ged;
            $action = 'choose';
        } elseif (!$rec2) {
            echo '<span class="error">', WT_I18N::translate('Unable to find record with ID'), ':</span> ', $gid2, ', ', $ged2;
            $action = 'choose';
Пример #11
0
    exit;
}
if (version_compare(PHP_VERSION, WT_REQUIRED_PHP_VERSION) < 0) {
    // We cannot translate these messages without a modern PHP
    echo '<h1>Sorry, the setup wizard cannot start.</h1>', '<p>This server is running PHP version ', PHP_VERSION, '</p>', '<p>PHP ', WT_REQUIRED_PHP_VERSION, ' (or any later version) is required</p>';
    exit;
}
require 'includes/functions/functions.php';
require 'includes/functions/functions_edit.php';
$WT_REQUEST = new Zend_Controller_Request_Http();
$WT_SESSION = new stdClass();
$WT_SESSION->locale = null;
// Needed for WT_I18N
$WT_SESSION->wt_user = null;
// Needed for WT_Auth
define('WT_LOCALE', WT_I18N::init(WT_Filter::post('lang', '[@a-zA-Z_]+')));
header('Content-Type: text/html; charset=UTF-8');
?>
<!DOCTYPE html>
<html <?php 
echo WT_I18N::html_markup();
?>
>
<head>
	<meta charset="UTF-8">
	<title>
		webtrees setup wizard
	</title>
	<style type="text/css">
		body {color: black; background-color: white; font: 14px tahoma, arial, helvetica, sans-serif; padding:10px; }
		a {color: black; font-weight: normal; text-decoration: none;}
Пример #12
0
// Valid values for form variables
$ALL_THEMES_DIRS = array();
foreach (get_theme_names() as $themename => $themedir) {
    $ALL_THEME_DIRS[] = $themedir;
}
// Extract form variables
$form_action = WT_Filter::post('form_action');
$form_username = WT_Filter::post('form_username');
$form_realname = WT_Filter::post('form_realname');
$form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD);
$form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD);
$form_email = WT_Filter::postEmail('form_email');
$form_rootid = WT_Filter::post('form_rootid', WT_REGEX_XREF);
$form_theme = WT_Filter::post('form_theme', implode('|', $ALL_THEME_DIRS));
$form_language = WT_Filter::post('form_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE);
$form_contact_method = WT_Filter::post('form_contact_method');
$form_visible_online = WT_Filter::postBool('form_visible_online');
// Respond to form action
if ($form_action == 'update' && WT_Filter::checkCsrf()) {
    if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name.  A user with that user name already exists.  Please choose another user name.'));
    } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address.  A user with that email already exists.'));
    } else {
        // Change username
        if ($form_username != WT_USER_NAME) {
            Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username);
            Auth::user()->setUserName($form_username);
        }
        // Change password
        if ($form_pass1 && $form_pass1 == $form_pass2) {
Пример #13
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="' . $days . '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $calendar = get_block_setting($block_id, 'calendar');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Calendar');
     echo '</td><td class="optionbox">';
     echo select_edit_control('calendar', array('jewish' => WT_Date_Jewish::calendarName(), 'gregorian' => WT_Date_Gregorian::calendarName()), null, $calendar, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
Пример #14
0
 private function connect()
 {
     global $WT_SESSION;
     $url = WT_Filter::post('url', NULL, WT_Filter::get('url', NULL, ''));
     // If we’ve clicked login from the login page, we don’t want to go back there.
     if (strpos($url, 'login.php') === 0 || strpos($url, 'mod=facebook') !== false && strpos($url, 'mod_action=connect') !== false) {
         $url = '';
     }
     // Redirect to the homepage/$url if the user is already logged-in.
     if ($WT_SESSION->wt_user) {
         header('Location: ' . WT_SCRIPT_PATH . $url);
         exit;
     }
     $app_id = $this->getSetting('app_id');
     $app_secret = $this->getSetting('app_secret');
     $connect_url = $this->getConnectURL($url);
     if (!$app_id || !$app_secret) {
         $this->error_page(WT_I18N::translate('Facebook logins have not been setup by the administrator.'));
         return;
     }
     $code = @$_REQUEST["code"];
     if (!empty($_REQUEST['error'])) {
         Log::addErrorLog('Facebook Error: ' . WT_Filter::get('error') . '. Reason: ' . WT_Filter::get('error_reason'));
         if ($_REQUEST['error_reason'] == 'user_denied') {
             $this->error_page(WT_I18N::translate('You must allow access to your Facebook account in order to login with Facebook.'));
         } else {
             $this->error_page(WT_I18N::translate('An error occurred trying to log you in with Facebook.'));
         }
     } else {
         if (empty($code) && empty($WT_SESSION->facebook_access_token)) {
             if (!WT_Filter::checkCsrf()) {
                 echo WT_I18N::translate('This form has expired.  Try again.');
                 return;
             }
             $WT_SESSION->timediff = WT_Filter::postInteger('timediff', -43200, 50400, 0);
             // Same range as date('Z')
             // FB Login flow has not begun so redirect to login dialog.
             $WT_SESSION->facebook_state = md5(uniqid(rand(), TRUE));
             // CSRF protection
             $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($connect_url) . "&state=" . $WT_SESSION->facebook_state . "&scope=" . self::scope;
             Zend_Session::writeClose();
             echo "<script> window.location.href='" . $dialog_url . "'</script>";
         } else {
             if (!empty($WT_SESSION->facebook_access_token)) {
                 // User has already authorized the app and we have a token so get their info.
                 $graph_url = "https://graph.facebook.com/" . self::api_dir . "me?access_token=" . $WT_SESSION->facebook_access_token;
                 $response = $this->fetch_url($graph_url);
                 if ($response === FALSE) {
                     Log::addErrorLog("Facebook: Access token is no longer valid");
                     // Clear the state and try again with a new token.
                     try {
                         unset($WT_SESSION->facebook_access_token);
                         unset($WT_SESSION->facebook_state);
                         Zend_Session::writeClose();
                     } catch (Exception $e) {
                     }
                     header("Location: " . $this->getConnectURL($url));
                     exit;
                 }
                 $user = json_decode($response);
                 $this->login_or_register($user, $url);
             } else {
                 if (!empty($WT_SESSION->facebook_state) && $WT_SESSION->facebook_state === $_REQUEST['state']) {
                     // User has already been redirected to login dialog.
                     // Exchange the code for an access token.
                     $token_url = "https://graph.facebook.com/" . self::api_dir . "oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($connect_url) . "&client_secret=" . $app_secret . "&code=" . $code;
                     $response = $this->fetch_url($token_url);
                     if ($response === FALSE) {
                         Log::addErrorLog("Facebook: Couldn't exchange the code for an access token");
                         $this->error_page(WT_I18N::translate("Your Facebook code is invalid. This can happen if you hit back in your browser after login or if Facebook logins have been setup incorrectly by the administrator."));
                     }
                     $params = null;
                     parse_str($response, $params);
                     if (empty($params['access_token'])) {
                         Log::addErrorLog("Facebook: The access token was empty");
                         $this->error_page(WT_I18N::translate("Your Facebook code is invalid. This can happen if you hit back in your browser after login or if Facebook logins have been setup incorrectly by the administrator."));
                     }
                     $WT_SESSION->facebook_access_token = $params['access_token'];
                     $graph_url = "https://graph.facebook.com/" . self::api_dir . "me?access_token=" . $WT_SESSION->facebook_access_token;
                     $meResponse = $this->fetch_url($graph_url);
                     if ($meResponse === FALSE) {
                         $this->error_page(WT_I18N::translate("Could not fetch your information from Facebook. Please try again."));
                     }
                     $user = json_decode($meResponse);
                     $this->login_or_register($user, $url);
                 } else {
                     $this->error_page(WT_I18N::translate("The state does not match. You may been tricked to load this page."));
                 }
             }
         }
     }
 }
Пример #15
0
			<input type="submit" class="save" onclick="document.reorder_form.action.value='reorder_fams'; document.reorder_form.submit();" value="<?php 
        echo WT_I18N::translate('sort by date of marriage');
        ?>
">
			<input type="button" class="cancel" value="<?php 
        echo WT_I18N::translate('close');
        ?>
" onclick="window.close();">
		</p>
	</form>
	</div>
	<?php 
        break;
    case 'reorder_fams_update':
        $xref = WT_Filter::post('xref', WT_REGEX_XREF);
        $order = WT_Filter::post('order');
        $keep_chan = WT_Filter::postBool('keep_chan');
        if (!WT_Filter::checkCsrf()) {
            Zend_Session::writeClose();
            header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=reorder_fams&xref=' . $xref);
            exit;
        }
        $person = WT_Individual::getInstance($xref);
        check_record_access($person);
        $controller->setPageTitle(WT_I18N::translate('Re-order families'))->pageHeader();
        if (is_array($order)) {
            $gedcom = array('0 @' . $person->getXref() . '@ INDI');
            $facts = $person->getFacts();
            // Move families to the end of the record
            foreach ($order as $family => $num) {
                foreach ($facts as $n => $fact) {
Пример #16
0
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
use WT\User;
define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
require './includes/session.php';
//require WT_ROOT.'includes/functions/functions_edit.php';
// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
if (WT_GED_ID || count(User::all()) > 1) {
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
    exit;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
$error = '';
$warning = '';
$PGV_PATH = WT_Filter::post('PGV_PATH');
if ($PGV_PATH) {
    if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) {
        $error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView');
    } else {
        // Load the configuration settings
        $config_php = file_get_contents($PGV_PATH . '/config.php');
        // The easiest way to do this is to exec() the file - but not lines containing require or PHP tags
        $config_php = preg_replace(array('/^\\s*(include|require).*/m', '/.*<\\?php.*/', '/.*\\?>.*/'), '', $config_php);
        eval($config_php);
        // $INDEX_DIRECTORY can be either absolute or relative to the PhpGedView root.
        if (preg_match('/^(\\/|\\|[A-Z]:)/', $INDEX_DIRECTORY)) {
            $INDEX_DIRECTORY = realpath($INDEX_DIRECTORY);
        } else {
            $INDEX_DIRECTORY = realpath($PGV_PATH . '/' . $INDEX_DIRECTORY);
        }
Пример #17
0
        }
        $myfunc();
        if ($indfam == 'IND') {
            $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalIndividuals();
        } else {
            if ($x_as == 21) {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalChildren();
            } else {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalFamilies();
            }
        }
        myplot($hstr, $zmax, $xdata, $xtitle, $ydata, $ytitle, $legend);
    }
}
//-- ========= start of main program =========
$action = WT_Filter::post('action');
if ($action == 'update') {
    $x_as = $_POST['x-as'];
    $y_as = $_POST['y-as'];
    if (isset($_POST['z-as'])) {
        $z_as = $_POST['z-as'];
    } else {
        $z_as = 300;
    }
    $xgl = $_POST['xas-grenzen-leeftijden'];
    $xglm = $_POST['xas-grenzen-leeftijden_m'];
    $xgm = $_POST['xas-grenzen-maanden'];
    $xga = $_POST['xas-grenzen-aantallen'];
    if (isset($_POST['zas-grenzen-periode'])) {
        $zgp = $_POST['zas-grenzen-periode'];
    } else {
Пример #18
0
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            foreach ($_FILES as $FILE) {
                if ($FILE['error'] == 0 && is_readable($FILE['tmp_name'])) {
                    import_gedcom_file($gedcom_id, $FILE['tmp_name'], $FILE['name']);
                }
            }
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
    case 'replace_import':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            $ged_name = basename(WT_Filter::post('ged_name'));
            import_gedcom_file($gedcom_id, WT_DATA_DIR . $ged_name, $ged_name);
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
}
$controller->pageHeader();
// Process GET actions
switch (WT_Filter::get('action')) {
    case 'uploadform':
    case 'importform':
        $gedcom_id = WT_Filter::getInteger('gedcom_id');
        $gedcom_name = get_gedcom_from_id($gedcom_id);
        // Check it exists
        if (!$gedcom_name) {
            break;
Пример #19
0
    private function placesEdit()
    {
        require WT_ROOT . 'includes/functions/functions_edit.php';
        $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
        $action = WT_Filter::post('action', null, WT_Filter::get('action'));
        $placeid = WT_Filter::post('placeid', null, WT_Filter::get('placeid'));
        $place_name = WT_Filter::post('place_name', null, WT_Filter::get('place_name'));
        $controller = new WT_Controller_Simple();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Geographic data'))->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");')->pageHeader();
        $where_am_i = $this->placeIdToHierarchy($placeid);
        $level = count($where_am_i);
        if ($action == 'addrecord' && Auth::isAdmin()) {
            $statement = WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
            if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
                $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
            } else {
                $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
            }
            // autoclose window when update successful unless debug on
            if (!WT_DEBUG) {
                $controller->addInlineJavaScript('closePopupAndReloadParent();');
            }
            echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", WT_I18N::translate('close'), "</button></div>";
            exit;
        }
        if ($action == 'updaterecord' && Auth::isAdmin()) {
            $statement = WT_DB::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
            if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
                $statement->execute(array($_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
            } else {
                $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
            }
            // autoclose window when update successful unless debug on
            if (!WT_DEBUG) {
                $controller->addInlineJavaScript('closePopupAndReloadParent();');
            }
            echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", WT_I18N::translate('close'), "</button></div>";
            exit;
        }
        // Update placelocation STREETVIEW fields
        // TODO: This ought to be a POST request, rather than a GET request
        if ($action == 'update_sv_params' && Auth::isAdmin()) {
            WT_DB::prepare("UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?")->execute(array(WT_Filter::get('svlati'), WT_Filter::get('svlong'), WT_Filter::get('svbear'), WT_Filter::get('svelev'), WT_Filter::get('svzoom'), $placeid));
            $controller->addInlineJavaScript('window.close();');
            exit;
        }
        if ($action == "update") {
            // --- find the place in the file
            $row = WT_DB::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($placeid))->fetchOneRow();
            $place_name = $row->pl_place;
            $place_icon = $row->pl_icon;
            $selected_country = explode("/", $place_icon);
            if (isset($selected_country[1]) && $selected_country[1] != "flags") {
                $selected_country = $selected_country[1];
            } else {
                $selected_country = "Countries";
            }
            $parent_id = $row->pl_parent_id;
            $level = $row->pl_level;
            $zoomfactor = $row->pl_zoom;
            $parent_lati = "0.0";
            $parent_long = "0.0";
            if ($row->pl_lati !== null && $row->pl_long !== null) {
                $place_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                $place_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
            } else {
                $place_lati = null;
                $place_long = null;
                $zoomfactor = 1;
            }
            do {
                $row = WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
                if (!$row) {
                    break;
                }
                if ($row->pl_lati !== null && $row->pl_long !== null) {
                    $parent_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                    $parent_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
                    if ($zoomfactor == 1) {
                        $zoomfactor = $row->pl_zoom;
                    }
                }
                $parent_id = $row->pl_parent_id;
            } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
            echo '<b>', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
        }
        if ($action == 'add') {
            // --- find the parent place in the file
            if ($placeid != 0) {
                if (!isset($place_name)) {
                    $place_name = '';
                }
                $place_lati = null;
                $place_long = null;
                $zoomfactor = 1;
                $parent_lati = '0.0';
                $parent_long = '0.0';
                $place_icon = '';
                $parent_id = $placeid;
                do {
                    $row = WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
                    if ($row->pl_lati !== null && $row->pl_long !== null) {
                        $parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                        $parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
                        $zoomfactor = $row->pl_zoom;
                        if ($zoomfactor > $GM_MAX_ZOOM) {
                            $zoomfactor = $GM_MAX_ZOOM;
                        }
                        $level = $row->pl_level + 1;
                    }
                    $parent_id = $row->pl_parent_id;
                } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
            } else {
                if (!isset($place_name)) {
                    $place_name = '';
                }
                $place_lati = null;
                $place_long = null;
                $parent_lati = "0.0";
                $parent_long = "0.0";
                $place_icon = '';
                $parent_id = 0;
                $level = 0;
                $zoomfactor = $this->getSetting('GM_MIN_ZOOM');
            }
            $selected_country = 'Countries';
            if (!isset($place_name) || $place_name == "") {
                echo '<b>', WT_I18N::translate('unknown');
            } else {
                echo '<b>', $place_name;
            }
            if (count($where_am_i) > 0) {
                echo ', ', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
            }
            echo '</b><br>';
        }
        ?>

			<script src="<?php 
        echo $this->googleMapsScript();
        ?>
"></script>
			<script>
			var map;
			var marker;
			var zoom;
			var pl_name = '<?php 
        echo WT_Filter::escapeJs($place_name);
        ?>
';
			if (pl_name) {
				var pl_lati = '<?php 
        echo $place_lati;
        ?>
';
				var pl_long = '<?php 
        echo $place_long;
        ?>
';
			} else {
				var pl_lati = '<?php 
        echo $parent_lati;
        ?>
';
				var pl_long = '<?php 
        echo $parent_long;
        ?>
';
			}
			var pl_zoom = <?php 
        echo $zoomfactor;
        ?>
;
			var latlng = new google.maps.LatLng(pl_lati, pl_long);
			var polygon1;
			var geocoder;
			var mapType;

			var infowindow = new google.maps.InfoWindow({
				//
			});

			function geocodePosition(pos) {
				geocoder.geocode({
					latLng: pos
				}, function(responses) {
					if (responses && responses.length > 0) {
						updateMarkerAddress(responses[0].formatted_address);
					} else {
						updateMarkerAddress('Cannot determine address at this location.');
					}
				});
			}

			function updateMap(event) {
				var point;
				var zoom;
				var latitude;
				var longitude;
				var i;

				zoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);

				prec = 20;
				for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}
				if ((document.editplaces.NEW_PLACE_LATI.value == '') ||
					(document.editplaces.NEW_PLACE_LONG.value == '')) {
					latitude = parseFloat(document.editplaces.parent_lati.value).toFixed(prec);
					longitude = parseFloat(document.editplaces.parent_long.value).toFixed(prec);
					point = new google.maps.LatLng(latitude, longitude);
				} else {
					latitude = parseFloat(document.editplaces.NEW_PLACE_LATI.value).toFixed(prec);
					longitude = parseFloat(document.editplaces.NEW_PLACE_LONG.value).toFixed(prec);
					document.editplaces.NEW_PLACE_LATI.value = latitude;
					document.editplaces.NEW_PLACE_LONG.value = longitude;

					if (event == 'flag_drag') {
						if (longitude < 0.0 ) {
							longitude = longitude * -1;
							document.editplaces.NEW_PLACE_LONG.value = longitude;
							document.editplaces.LONG_CONTROL.value = 'PL_W';
						} else {
							document.editplaces.NEW_PLACE_LONG.value = longitude;
							document.editplaces.LONG_CONTROL.value = 'PL_E';
						}
						if (latitude < 0.0 ) {
							latitude = latitude * -1;
							document.editplaces.NEW_PLACE_LATI.value = latitude;
							document.editplaces.LATI_CONTROL.value = 'PL_S';
						} else {
							document.editplaces.NEW_PLACE_LATI.value = latitude;
							document.editplaces.LATI_CONTROL.value = 'PL_N';
						}

						if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
							latitude = latitude * -1;
						}
						if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
							longitude = longitude * -1;
						}
						point = new google.maps.LatLng(latitude, longitude);
					} else {
						if (latitude < 0.0) {
							latitude = latitude * -1;
							document.editplaces.NEW_PLACE_LATI.value = latitude;
						}
						if (longitude < 0.0) {
							longitude = longitude * -1;
							document.editplaces.NEW_PLACE_LONG.value = longitude;
						}
						if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
							latitude = latitude * -1;
						}
						if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
							longitude = longitude * -1;
						}
						point = new google.maps.LatLng(latitude, longitude);
					}
				}

				map.setCenter(point);
				map.setZoom(zoom);
				marker.setPosition(point);

			}

			// === Create Borders for the UK Countries =========================================================
			function overlays() {

				// Define place LatLng arrays
				var polygon1;
				var num_arrays = "";
				if (pl_name == 'Scotland') {
					var returnGeom1 = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611';
					num_arrays = 1;
				} else if (pl_name == 'England') {
					// England
					var returnGeom1 = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; //|-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					// Wales Test
			//		var returnGeom2 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					num_arrays = 2;
				} else if (pl_name == 'Wales') {
					var returnGeom1 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					num_arrays = 1;
				} else if (pl_name == 'Ireland') {
					var returnGeom1 = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388';
					num_arrays = 1;
				} else if (pl_name == 'NC') {
					var returnGeom1 = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938';
					num_arrays = 1;
				} else {
					// show nothing
				}

			/*
				// Set borders and fill parameters ------- Not finished yet. ---------------
				if (map.mapTypeId == 'roadmap') {
					var colorStroke 	= "#444444";
					var weightStroke	= 1.2;
					var opacityFill		= 0.1;
				} else if (map.mapTypeId == 'satellite') {
					var colorStroke 	= "#000000";
					var weightStroke	= 0.1;
					var opacityFill		= 0;
				} else if (map.mapTypeId == 'hybrid') {
					var colorStroke 	= "#ffffff";
					var weightStroke	= 1.2;
					var opacityFill		= 0;
				} else if (map.mapTypeId == 'terrain') {
					var colorStroke 	= "#ffffff";
					var weightStroke	= 1.2;
					var opacityFill		= 0;
				}
				// -------------------------------------------------------------------------
			*/

			    // If showing one country only (num_arrays == 1) ---------------------------
				// Calculate polygon
				if (num_arrays == 1 ) {
					var geomAry1 = new Array();
					geomAry1 = returnGeom1.split('|');
					var XY1 = new Array();
					var points1 = [];
					for (var i = 0; i < geomAry1.length; i++) {
						XY1 = geomAry1[i].split(',');
						points1.push( new google.maps.LatLng(parseFloat(XY1[1]),parseFloat(XY1[0]))) ;
					}
			    	// Construct the polygon
			    	polygon1 = new google.maps.Polygon({
			    	  paths: points1,
			    	  strokeColor: "#888888",
			    	  strokeOpacity: 0.8,
			    	  strokeWeight: 1,
			    	  fillColor: "#ff0000",
			    	  fillOpacity: 0.15
			    	});
			    	polygon1.setMap(map);
			    }

			    // If showing two countries at the same time (num_arrays == 2) --------------
				if (num_arrays == 2) {
					// Calculate polygon1
					var geomAry1 = new Array();
					geomAry1 = returnGeom1.split('|');
					var XY1 = new Array();
					var points1 = [];
					for (var i = 0; i < geomAry1.length; i++) {
						XY1 = geomAry1[i].split(',');
						points1.push( new google.maps.LatLng(parseFloat(XY1[1]),parseFloat(XY1[0]))) ;
					}

			    	// Construct polygon1
			    	polygon1 = new google.maps.Polygon({
			    	  paths: points1,
			    	  strokeColor: "#888888",
			    	  strokeOpacity: 0.8,
			    	  strokeWeight: 1,
			    	  fillColor: "#ff0000",
			    	  fillOpacity: 0.15
			    	});
			    	polygon1.setMap(map);

			    	// Calculate polygon2
					var geomAry2 = new Array();
					geomAry2 = returnGeom2.split('|');
					var XY2 = new Array();
					var points2 = [];
					for (var i = 0; i < geomAry2.length; i++) {
						XY2 = geomAry2[i].split(',');
						points2.push( new google.maps.LatLng(parseFloat(XY2[1]),parseFloat(XY2[0]))) ;
					}

			    	// Construct polygon2
			    	polygon2 = new google.maps.Polygon({
			    	  paths: points2,
			    	  strokeColor: "#888888",
			    	  strokeOpacity: 0.8,
			    	  strokeWeight: 1,
			    	  fillColor: "#ff0000",
			    	  fillOpacity: 0.15
			    	});
			    	polygon2.setMap(map);
				}
			}

			// The HomeControl returns user to original position and style =================
			function HomeControl(controlDiv, map) {
				// Set CSS styles for the DIV containing the control
				// Setting padding to 5 px will offset the control from the edge of the map
				controlDiv.style.paddingTop = '5px';
				controlDiv.style.paddingRight = '0px';

				// Set CSS for the control border
				var controlUI = document.createElement('DIV');
				controlUI.style.backgroundColor = 'white';
				controlUI.style.color = 'black';
				controlUI.style.borderColor = 'black';
				controlUI.style.borderColor = 'black';
				controlUI.style.borderStyle = 'solid';
				controlUI.style.borderWidth = '2px';
				controlUI.style.cursor = 'pointer';
				controlUI.style.textAlign = 'center';
				controlUI.title = '';
				controlDiv.appendChild(controlUI);

				// Set CSS for the control interior
				var controlText = document.createElement('DIV');
				controlText.style.fontFamily = 'Arial,sans-serif';
				controlText.style.fontSize = '12px';
				controlText.style.paddingLeft = '15px';
				controlText.style.paddingRight = '15px';
				controlText.innerHTML = '<b><?php 
        echo WT_I18N::translate('Redraw map');
        ?>
<\/b>';
				controlUI.appendChild(controlText);

				// Setup the click event listeners: simply set the map to original LatLng
				google.maps.event.addDomListener(controlUI, 'click', function() {
					map.setCenter(latlng);
					map.setZoom(pl_zoom);
					map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
				});
			}

			function loadMap(zoom, mapType) {
				if (mapType) {
					mapTyp = mapType;
				} else {
					mapTyp = google.maps.MapTypeId.ROADMAP;
				}
				geocoder = new google.maps.Geocoder();
				if (!zoom) {
					zoom = pl_zoom;
				}
				// Define map
				var myOptions = {
					zoom: zoom,
					center: latlng,
					mapTypeId: mapTyp,											// ROADMAP, SATELLITE, HYBRID, TERRAIN
					// mapTypeId: google.maps.MapTypeId.ROADMAP,				// ROADMAP, SATELLITE, HYBRID, TERRAIN
					mapTypeControlOptions: {
						style: google.maps.MapTypeControlStyle.DROPDOWN_MENU	// DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
					},
					navigationControlOptions: {
					position: google.maps.ControlPosition.TOP_RIGHT,			// BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc
					style: google.maps.NavigationControlStyle.SMALL				// ANDROID, DEFAULT, SMALL, ZOOM_PAN
					},
					streetViewControl: false,									// Show Pegman or not
					scrollwheel: true
				};

				map = new google.maps.Map(document.getElementById('map_pane'), myOptions);

				overlays();

				// Close any infowindow when map is clicked
				google.maps.event.addListener(map, 'click', function() {
					infowindow.close();
				});

				// Create the DIV to hold the control and call HomeControl() passing in this DIV. --
				var homeControlDiv = document.createElement('DIV');
				var homeControl = new HomeControl(homeControlDiv, map);
				homeControlDiv.index = 1;
				map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
				// ---------------------------------------------------------------------------------

				// Check for zoom changes
				google.maps.event.addListener(map, 'zoom_changed', function() {
					document.editplaces.NEW_ZOOM_FACTOR.value = map.zoom;
				});

				// Create the Main Location Marker
				<?php 
        if ($level < 3 && $place_icon != '') {
            echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon, '",';
            echo 'new google.maps.Size(25, 15),';
            // Image size
            echo 'new google.maps.Point(0, 0),';
            // Image origin
            echo 'new google.maps.Point(0, 44)';
            // Image anchor
            echo ');';
            echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",';
            echo 'new google.maps.Size(35, 45),';
            // Shadow size
            echo 'new google.maps.Point(0,0),';
            // Shadow origin
            echo 'new google.maps.Point(1, 45)';
            // Shadow anchor is base of flagpole
            echo ');';
            echo 'marker = new google.maps.Marker({';
            echo 'icon: image,';
            echo 'shadow: iconShadow,';
            echo 'position: latlng,';
            echo 'map: map,';
            echo 'title: pl_name,';
            echo 'draggable: true,';
            echo 'zIndex:1';
            echo '});';
        } else {
            echo 'marker = new google.maps.Marker({';
            echo 'position: latlng,';
            echo 'map: map,';
            echo 'title: pl_name,';
            echo 'draggable: true,';
            echo 'zIndex: 1';
            echo '});';
        }
        ?>

				prec = 20;
				for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}

				// Set marker by clicking on map ---
				clickset = google.maps.event.addListener(map, 'click', function(event) {
					clearMarks();
					latlng = event.latLng;
					<?php 
        echo 'marker = new google.maps.Marker({';
        echo 'position: latlng,';
        echo 'map: map,';
        echo 'title: pl_name,';
        echo 'draggable: true,';
        echo 'zIndex: 1';
        echo '});';
        ?>
					pos3 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos3.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos3.lng()).toFixed(prec);
					updateMap('flag_drag');
					currzoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);
					mapType = map.getMapTypeId();
					loadMap(currzoom, mapType);
				});

				// Set marker by drag-n-drop on map ---
				dragset = google.maps.event.addListener(marker, 'drag', function() {
					pos1 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos1.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos1.lng()).toFixed(prec);
				});
				dropset = google.maps.event.addListener(marker, 'dragend', function() {
					pos2 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos2.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos2.lng()).toFixed(prec);
					updateMap('flag_drag');
				});
			}

			function clearMarks() {
				marker.setMap(null);
			}

			function setLoc(lat, lng) {
				prec = 20;
				for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}
				if (lat < 0.0) {
					document.editplaces.NEW_PLACE_LATI.value = (lat.toFixed(prec) * -1);
					document.editplaces.LATI_CONTROL.value = 'PL_S';
				} else {
					document.editplaces.NEW_PLACE_LATI.value = lat.toFixed(prec);
					document.editplaces.LATI_CONTROL.value = 'PL_N';
				}
				if (lng < 0.0) {
					document.editplaces.NEW_PLACE_LONG.value = (lng.toFixed(prec) * -1);
					document.editplaces.LONG_CONTROL.value = 'PL_W';
				} else {
					document.editplaces.NEW_PLACE_LONG.value = lng.toFixed(prec);
					document.editplaces.LONG_CONTROL.value = 'PL_E';
				}
				newval = new google.maps.LatLng (lat.toFixed(prec), lng.toFixed(prec));
				updateMap();
			}

			function createMarker(i, point, name) {
				var contentString = '<div id="iwcontent_edit">'+name+'<\/div>';
				<?php 
        echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png",';
        echo 'new google.maps.Size(20, 34),';
        // Image size
        echo 'new google.maps.Point(0, 0),';
        // Image origin
        echo 'new google.maps.Point(10, 34)';
        // Image anchor
        echo ');';
        echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png",';
        echo 'new google.maps.Size(37, 34),';
        // Shadow size
        echo 'new google.maps.Point(0, 0),';
        // Shadow origin
        echo 'new google.maps.Point(10, 34)';
        // Shadow anchor is base of image
        echo ');';
        ?>
				var marker = new google.maps.Marker({
					icon: image,
					shadow: iconShadow,
					map: map,
					position: point,
					zIndex: 0
				});

				google.maps.event.addListener(marker, 'click', function() {
					infowindow.close();
					infowindow.setContent(contentString);
					infowindow.open(map, marker);
				});

				google.maps.event.addListener(map, 'click', function() {
					infowindow.close();
				});

				return marker;
			}

			function change_icon() {
				window.open('module.php?mod=googlemap&mod_action=flags&countrySelected=<?php 
        echo $selected_country;
        ?>
', '_blank', indx_window_specs);
				return false;
			}

			function remove_icon() {
				document.editplaces.icon.value = '';
				document.getElementById('flagsDiv').innerHTML = '<a href="#" onclick="change_icon();return false;"><?php 
        echo WT_I18N::translate('Change flag');
        ?>
</a>';
			}

			function addAddressToMap(response) {
				var bounds = new google.maps.LatLngBounds();
				if (!response ) {
					alert('<?php 
        echo WT_I18N::translate('No places found');
        ?>
');
				} else {
					if (response.length > 0) {
						for (i=0; i<response.length; i++) {
							// 5 decimal places is approx 1 metre accuracy.
							var name  = '<div id="gname" class="iwstyle">'+response[i].address_components[0].short_name+'<br>('+response[i].geometry.location.lng().toFixed(5)+','+response[i].geometry.location.lat().toFixed(5)+'';
								name +=	'<br><a href="#" onclick="setLoc(' + response[i].geometry.location.lat() + ', ' + response[i].geometry.location.lng() + ');"><div id="namelink"><?php 
        echo WT_I18N::translate('Use this value');
        ?>
</div></a>';
								name += '</div>';
							var point = response[i].geometry.location;
							var marker = createMarker(i, point, name);
							bounds.extend(response[i].geometry.location);
						}

						<?php 
        if ($level > 0) {
            ?>
							map.fitBounds(bounds);
						<?php 
        }
        ?>
						zoomlevel = map.getZoom();

						if (zoomlevel < <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
) {
							zoomlevel = <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
;
						}
						if (zoomlevel > <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
) {
							zoomlevel = <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
;
						}
						if (document.editplaces.NEW_ZOOM_FACTOR.value < zoomlevel) {
							zoomlevel = document.editplaces.NEW_ZOOM_FACTOR.value;
							if (zoomlevel < <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
) {
								zoomlevel = <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
;
							}
							if (zoomlevel > <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
) {
								zoomlevel = <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
;
							}
						}
						map.setCenter(bounds.getCenter());
						map.setZoom(zoomlevel);
					}
				}
			}

			function showLocation_level(address) {
				address += '<?php 
        if ($level > 0) {
            echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true)));
        }
        ?>
';
				geocoder.geocode({'address': address}, addAddressToMap);
			}

			function showLocation_all(address) {
				geocoder.geocode({'address': address}, addAddressToMap);
			}

			function paste_char(value) {
				document.editplaces.NEW_PLACE_NAME.value += value;
			}
			window.onload = function() { loadMap(); };
		</script>
		<table><tr><td align="center">
		</td></tr></table>
		</body>
		<form method="post" id="editplaces" name="editplaces" action="module.php?mod=googlemap&amp;mod_action=places_edit">
			<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
record">
			<input type="hidden" name="placeid" value="<?php 
        echo $placeid;
        ?>
">
			<input type="hidden" name="level" value="<?php 
        echo $level;
        ?>
">
			<input type="hidden" name="icon" value="<?php 
        echo $place_icon;
        ?>
">
			<input type="hidden" name="parent_id" value="<?php 
        echo $parent_id;
        ?>
">
			<input type="hidden" name="place_long" value="<?php 
        echo $place_long;
        ?>
">
			<input type="hidden" name="place_lati" value="<?php 
        echo $place_lati;
        ?>
">
			<input type="hidden" name="parent_long" value="<?php 
        echo $parent_long;
        ?>
">
			<input type="hidden" name="parent_lati" value="<?php 
        echo $parent_lati;
        ?>
">

			<table class="facts_table">
			<tr>
				<td class="optionbox" colspan="3">
				<center><div id="map_pane" style="width: 100%; height: 300px;"></div></center>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_Gedcom_Tag::getLabel('PLAC');
        ?>
</td>
				 <td class="optionbox"><input type="text" id="new_pl_name" name="NEW_PLACE_NAME" value="<?php 
        echo WT_Filter::escapeHtml($place_name);
        ?>
" size="25" class="address_input">
					<div id="INDI_PLAC_pop" style="display: inline;">
					<?php 
        echo print_specialchar_link('new_pl_name');
        ?>
</div></td><td class="optionbox">
					<label for="new_pl_name"><a href="#" onclick="showLocation_all(document.getElementById('new_pl_name').value); return false">&nbsp;<?php 
        echo WT_I18N::translate('Search globally');
        ?>
</a></label>
					&nbsp;&nbsp;|&nbsp;&nbsp;
					<label for="new_pl_name"><a href="#" onclick="showLocation_level(document.getElementById('new_pl_name').value); return false">&nbsp;<?php 
        echo WT_I18N::translate('Search locally');
        ?>
</a></label>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_I18N::translate('Precision'), help_link('PLE_PRECISION', 'googlemap');
        ?>
</td>
				<?php 
        $exp = explode(".", $place_lati);
        if (isset($exp[1])) {
            $precision1 = strlen($exp[1]);
        } else {
            $precision1 = -1;
        }
        $exp = explode(".", $place_long);
        if (isset($exp[1])) {
            $precision2 = strlen($exp[1]);
        } else {
            $precision2 = -1;
        }
        $precision1 > $precision2 ? $precision = $precision1 : ($precision = $precision2);
        if ($precision == -1) {
            $level > 3 ? $precision = 3 : ($precision = $level);
        } elseif ($precision > 5) {
            $precision = 5;
        }
        ?>
				<td class="optionbox" colspan="2">
					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_0')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_0');
        ?>
">
					<label for="new_prec_0"><?php 
        echo WT_I18N::translate('Country');
        ?>
</label>
					<input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_1')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_1');
        ?>
">
					<label for="new_prec_1"><?php 
        echo WT_I18N::translate('State');
        ?>
</label>
					<input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_2')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_2');
        ?>
">
					<label for="new_prec_2"><?php 
        echo WT_I18N::translate('City');
        ?>
</label>
					<input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_3')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_3');
        ?>
">
					<label for="new_prec_3"><?php 
        echo WT_I18N::translate('Neighborhood');
        ?>
</label>
					<input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_4')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_4');
        ?>
">
					<label for="new_prec_4"><?php 
        echo WT_I18N::translate('House');
        ?>
</label>
					<input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision >= $this->getSetting('GM_PRECISION_5')) {
            echo "checked=\"checked\"";
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_5');
        ?>
">
					<label for="new_prec_5"><?php 
        echo WT_I18N::translate('Max');
        ?>
</label>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_Gedcom_Tag::getLabel('LATI');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" placeholder="<?php 
        echo WT_I18N::translate('degrees');
        ?>
" value="<?php 
        if ($place_lati != null) {
            echo abs($place_lati);
        }
        ?>
" size="20" onchange="updateMap();">
					<select name="LATI_CONTROL" onchange="updateMap();">
						<option value="PL_N" <?php 
        if ($place_lati > 0) {
            echo " selected=\"selected\"";
        }
        echo ">", WT_I18N::translate('north');
        ?>
</option>
						<option value="PL_S" <?php 
        if ($place_lati < 0) {
            echo " selected=\"selected\"";
        }
        echo ">", WT_I18N::translate('south');
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_Gedcom_Tag::getLabel('LONG');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" placeholder="<?php 
        echo WT_I18N::translate('degrees');
        ?>
" value="<?php 
        if ($place_long != null) {
            echo abs($place_long);
        }
        ?>
" size="20" onchange="updateMap();">
					<select name="LONG_CONTROL" onchange="updateMap();">
						<option value="PL_E" <?php 
        if ($place_long > 0) {
            echo " selected=\"selected\"";
        }
        echo ">", WT_I18N::translate('east');
        ?>
</option>
						<option value="PL_W" <?php 
        if ($place_long < 0) {
            echo " selected=\"selected\"";
        }
        echo ">", WT_I18N::translate('west');
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_I18N::translate('Zoom level'), help_link('PLE_ZOOM', 'googlemap');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php 
        echo $zoomfactor;
        ?>
" size="20" onchange="updateMap();"></td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo WT_I18N::translate('Flag'), help_link('PLE_ICON', 'googlemap');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<div id="flagsDiv">
		<?php 
        if ($place_icon == NULL || $place_icon == "") {
            ?>
						<a href="#" onclick="change_icon();return false;"><?php 
            echo WT_I18N::translate('Change flag');
            ?>
</a>
		<?php 
        } else {
            ?>
						<img alt="<?php 
            echo WT_I18N::translate('Flag');
            ?>
" src="<?php 
            echo WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon;
            ?>
">&nbsp;&nbsp;
						<a href="#" onclick="change_icon();return false;"><?php 
            echo WT_I18N::translate('Change flag');
            ?>
</a>&nbsp;&nbsp;
						<a href="#" onclick="remove_icon();return false;"><?php 
            echo WT_I18N::translate('Remove flag');
            ?>
</a>
		<?php 
        }
        ?>
					</div></td>
			</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 
    }
Пример #20
0
            }
        } else {
            header('HTTP/1.0 406 Not Acceptable');
        }
        break;
    case 'reject-changes':
        // Reject all the pending changes for a record
        $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
        if ($record && WT_USER_CAN_ACCEPT && $record->canShow() && $record->canEdit()) {
            WT_FlashMessages::addMessage(WT_I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
            reject_all_changes($record->getXref(), $record->getGedcomId());
        } else {
            header('HTTP/1.0 406 Not Acceptable');
        }
        break;
    case 'theme':
        // Change the current theme
        $theme_dir = WT_Filter::post('theme');
        if (WT_Site::getPreference('ALLOW_USER_THEMES') && in_array($theme_dir, get_theme_names())) {
            $WT_SESSION->theme_dir = $theme_dir;
            if (Auth::id()) {
                // Remember our selection
                Auth::user()->setSetting('theme', $theme_dir);
            }
        } else {
            // Request for a non-existant theme.
            header('HTTP/1.0 406 Not Acceptable');
        }
        break;
}
Zend_Session::writeClose();
Пример #21
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
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_module_blocks.php');
require 'includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader();
$modules = WT_Module::getActiveBlocks(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
        foreach (WT_Tree::getAll() as $tree) {
            $value = WT_Filter::post("blockaccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel());
            WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'block', ?)")->execute(array($module_name, $tree->tree_id, $value));
        }
    }
}
?>
<div id="blocks" align="center">
	<form method="post" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
		<input type="hidden" name="action" value="update_mods">
		<?php 
echo WT_Filter::getCsrf();
?>
		<table id="blocks_table" class="modules_table">
Пример #22
0
function addNewFact($fact)
{
    global $ADVANCED_PLAC_FACTS;
    $FACT = WT_Filter::post($fact);
    $DATE = WT_Filter::post("{$fact}_DATE");
    $PLAC = WT_Filter::post("{$fact}_PLAC");
    if ($DATE || $PLAC || $FACT && $FACT != 'Y') {
        if ($FACT && $FACT != 'Y') {
            $gedrec = "\n1 {$fact} {$FACT}";
        } else {
            $gedrec = "\n1 {$fact}";
        }
        if ($DATE) {
            $gedrec .= "\n2 DATE {$DATE}";
        }
        if ($PLAC) {
            $gedrec .= "\n2 PLAC {$PLAC}";
            if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $ADVANCED_PLAC_FACTS, $match)) {
                foreach ($match[1] as $tag) {
                    $TAG = WT_Filter::post("{$fact}_{$tag}");
                    if ($TAG) {
                        $gedrec .= "\n3 {$tag} {$TAG}";
                    }
                }
            }
            $LATI = WT_Filter::post("{$fact}_LATI");
            $LONG = WT_Filter::post("{$fact}_LONG");
            if ($LATI || $LONG) {
                $gedrec .= "\n3 MAP\n4 LATI {$LATI}\n4 LONG {$LONG}";
            }
        }
        if (WT_Filter::postBool("SOUR_{$fact}")) {
            return updateSOUR($gedrec, 2);
        } else {
            return $gedrec;
        }
    } elseif ($FACT == 'Y') {
        if (WT_Filter::postBool("SOUR_{$fact}")) {
            return updateSOUR("\n1 {$fact} Y", 2);
        } else {
            return "\n1 {$fact} Y";
        }
    } else {
        return '';
    }
}
Пример #23
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
         set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
         set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
     echo '</td></tr>';
     $filter = get_block_setting($block_id, 'filter', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only events of living individuals?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('filter', $filter);
     echo '</td></tr>';
     $onlyBDM = get_block_setting($block_id, 'onlyBDM', false);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only births, deaths, and marriages?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('alpha' => WT_I18N::translate('sort by name'), 'anniv' => WT_I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
Пример #24
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', 'admin_trees_merge.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Merge family trees'))->pageHeader();
echo '<h2>', $controller->getPageTitle(), '</h2>';
$ged2_id = WT_Filter::post('ged2_id');
if ($ged2_id && $ged2_id != WT_GED_ID) {
    // Every XREF used by both trees
    $xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id = ?" . "  UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id))->fetchAssoc();
    if ($xrefs) {
        echo '<p class="error">', WT_I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which uses the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p class="error">', WT_I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>';
    } else {
        WT_DB::exec("START TRANSACTION");
        WT_DB::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        try {
            WT_DB::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($ged2_id, WT_GED_ID));
Пример #25
0
// MySQL needs an empty string, not NULL
// User paths may contain special characters.  Restrict to actual paths.
if (!array_key_exists($media_path, $media_paths)) {
    $media_path = reset($media_paths);
}
// subfolders within $media_path
$subfolders = WT_Filter::get('subfolders', 'include|exclude', 'include');
$action = WT_Filter::get('action');
////////////////////////////////////////////////////////////////////////////////
// POST callback for file deletion
////////////////////////////////////////////////////////////////////////////////
$delete_file = WT_Filter::post('delete');
if ($delete_file) {
    $controller = new WT_Controller_Ajax();
    // Only delete valid (i.e. unused) media files
    $media_folder = WT_Filter::post('media_folder', null, '');
    // MySQL needs an empty string, not NULL
    $disk_files = all_disk_files($media_folder, '', 'include', '');
    if (in_array($delete_file, $disk_files)) {
        $tmp = WT_DATA_DIR . $media_folder . $delete_file;
        if (@unlink($tmp)) {
            WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp));
        } else {
            WT_FlashMessages::addMessage(WT_I18N::translate('The file %s could not be deleted.', $tmp));
        }
        $tmp = WT_DATA_DIR . $media_folder . 'thumbs/' . $delete_file;
        if (file_exists($tmp)) {
            if (@unlink($tmp)) {
                WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp));
            } else {
                WT_FlashMessages::addMessage(WT_I18N::translate('The file %s could not be deleted.', $tmp));
Пример #26
0
    // Cannot determine the latest version
    list($latest_version, $earliest_version, $download_url) = explode('|', '||');
}
$latest_version_html = '<span dir="ltr">' . $latest_version . '</span>';
$download_url_html = '<b dir="auto"><a href="' . WT_Filter::escapeHtml($download_url) . '">' . WT_Filter::escapeHtml($download_url) . '</a></b>';
// Show a friendly message while the site is being upgraded
$lock_file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'offline.txt';
$lock_file_html = '<span dir="ltr">' . WT_Filter::escapeHtml($lock_file) . '</span>';
$lock_file_text = WT_I18N::translate('This site is being upgraded.  Try again in a few minutes.') . PHP_EOL . format_timestamp(WT_TIMESTAMP) . WT_I18N::translate('UTC');
// Success/failure indicators
$icon_success = '<i class="icon-yes"></i>';
$icon_failure = '<i class="icon-failure"></i>';
// Need confirmation for various actions
$continue = WT_Filter::post('continue', '1') && WT_Filter::checkCsrf();
$modules_action = WT_Filter::post('modules', 'ignore|disable');
$themes_action = WT_Filter::post('themes', 'ignore|disable');
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Upgrade wizard'))->pageHeader();
// Flush output as it happens - only effective on some webserver configurations.
ob_implicit_flush(true);
if (ob_get_level()) {
    ob_end_flush();
}
echo '<h2>', $controller->getPageTitle(), '</h2>';
if ($latest_version == '') {
    echo '<p>', WT_I18N::translate('No upgrade information is available.'), '</p>';
    exit;
}
if (version_compare(WT_VERSION, $latest_version) >= 0) {
    echo '<p>', WT_I18N::translate('This is the latest version of webtrees.  No upgrade is available.'), '</p>';
    exit;
Пример #27
0
			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
        foreach (WT_Tree::getAll() as $tree) {
            $access_level = WT_Filter::post("sidebaraccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel());
            WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module_name, $tree->tree_id, $access_level));
        }
        $order = WT_Filter::post('sidebarorder-' . $module_name);
        WT_DB::prepare("UPDATE `##module` SET sidebar_order=? WHERE module_name=?")->execute(array($order, $module_name));
        $module->order = $order;
        // Make the new order take effect immediately
    }
    uasort($modules, function ($x, $y) {
        return $x->order - $y->order;
    });
}
?>
<div id="sidebars" align="center">
	<form method="post" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
		<input type="hidden" name="action" value="update_mods">
Пример #28
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|array|table|tagcloud', 'table'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $num = get_block_setting($block_id, 'num', 10);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of items to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="num" size="2" value="', $num, '">';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('bullet list'), 'array' => WT_I18N::translate('compact list'), 'table' => WT_I18N::translate('table'), 'tagcloud' => WT_I18N::translate('tag cloud')), null, $infoStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', false);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
Пример #29
0
	<p>
	<?php 
        if ($ucnt > 0) {
            ?>
<input type="submit" value="<?php 
            echo WT_I18N::translate('continue');
            ?>
">&nbsp;&nbsp;<?php 
        }
        ?>
	</p>
	</form><?php 
        break;
    case 'cleanup2':
        foreach (User::all() as $user) {
            if (WT_Filter::post('del_' . $user->getUserId()) == '1') {
                Log::addAuthenticationLog('Deleted user: '******'Deleted user: '******'<br>';
                $user->delete();
            }
        }
        break;
    case 'listusers':
    default:
        echo '<table id="list">', '<thead>', '<tr>', '<th style="margin:0 -2px 1px 1px; padding:6px 0 5px;"> </th>', '<th> user-id </th>', '<th>', WT_I18N::translate('Username'), '</th>', '<th>', WT_I18N::translate('Real name'), '</th>', '<th>', WT_I18N::translate('Email'), '</th>', '<th> </th>', '<th>', WT_I18N::translate('Language'), '</th>', '<th> date_registered </th>', '<th>', WT_I18N::translate('Date registered'), '</th>', '<th> last_login </th>', '<th>', WT_I18N::translate('Last logged in'), '</th>', '<th>', WT_I18N::translate('Verified'), '</th>', '<th>', WT_I18N::translate('Approved'), '</th>', '<th style="margin:0 -2px 1px 1px; padding:3px 0 4px;"> </th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
        $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)->addInlineJavascript('
			var oTable = jQuery("#list").dataTable({
				dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
				' . WT_I18N::datatablesI18N() . ',
				processing: true,
				serverSide: true,
Пример #30
0
 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_USER_CAN_EDIT) {
         if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
             $block_id = WT_Filter::postInteger('block_id');
             if ($block_id) {
                 WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
             } else {
                 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                 $block_id = WT_DB::getInstance()->lastInsertId();
             }
             set_block_setting($block_id, 'title', WT_Filter::post('title'));
             set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
             $languages = array();
             foreach (WT_I18N::installed_languages() as $code => $name) {
                 if (WT_Filter::postBool('lang_' . $code)) {
                     $languages[] = $code;
                 }
             }
             set_block_setting($block_id, 'languages', implode(',', $languages));
             $this->config();
         } else {
             $block_id = WT_Filter::getInteger('block_id');
             $controller = new WT_Controller_Page();
             if ($block_id) {
                 $controller->setPageTitle(WT_I18N::translate('Edit story'));
                 $title = get_block_setting($block_id, 'title');
                 $story_body = get_block_setting($block_id, 'story_body');
                 $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                 $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             } else {
                 $controller->setPageTitle(WT_I18N::translate('Add a story'));
                 $title = '';
                 $story_body = '';
                 $gedcom_id = WT_GED_ID;
                 $xref = WT_Filter::get('xref', WT_REGEX_XREF);
             }
             $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
             if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
                 ckeditor_WT_Module::enableEditor($controller);
             }
             echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
             echo WT_Filter::getCsrf();
             echo '<input type="hidden" name="save" value="1">';
             echo '<input type="hidden" name="block_id" value="', $block_id, '">';
             echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
             echo '<table id="story_module">';
             echo '<tr><th>';
             echo WT_I18N::translate('Story title');
             echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
             echo '<tr><th>';
             echo WT_I18N::translate('Story');
             echo '</th></tr><tr><td>';
             echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
             echo '</td></tr>';
             echo '</table><table id="story_module2">';
             echo '<tr>';
             echo '<th>', WT_I18N::translate('Individual'), '</th>';
             echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
             echo '</tr>';
             echo '<tr>';
             echo '<td class="optionbox">';
             echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
             echo print_findindi_link('pid');
             if ($xref) {
                 $person = WT_Individual::getInstance($xref);
                 if ($person) {
                     echo ' ', $person->format_list('span');
                 }
             }
             echo '</td>';
             $languages = get_block_setting($block_id, 'languages');
             echo '<td class="optionbox">';
             echo edit_language_checkboxes('lang_', $languages);
             echo '</td></tr></table>';
             echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
             echo '</p>';
             echo '</form>';
             exit;
         }
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }