summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addmedia.php7
-rw-r--r--admin.php13
-rw-r--r--admin_media.php17
-rw-r--r--admin_media_upload.php6
-rw-r--r--admin_module_blocks.php18
-rw-r--r--admin_module_menus.php19
-rw-r--r--admin_module_reports.php18
-rw-r--r--admin_module_sidebar.php18
-rw-r--r--admin_module_tabs.php18
-rw-r--r--admin_modules.php18
-rw-r--r--admin_pgv_to_wt.php12
-rw-r--r--admin_site_clean.php14
-rw-r--r--admin_site_config.php59
-rw-r--r--admin_site_info.php65
-rw-r--r--admin_site_ipaddress.php116
-rw-r--r--admin_site_logs.php61
-rw-r--r--admin_site_merge.php8
-rw-r--r--admin_site_other.php57
-rw-r--r--admin_site_readme.php57
-rw-r--r--admin_trees_config.php9
-rw-r--r--admin_trees_manage.php14
-rw-r--r--admin_users.php16
-rw-r--r--admin_users_bulk.php70
-rw-r--r--branches.php7
-rw-r--r--calendar.php8
-rw-r--r--compact.php6
-rw-r--r--downloadbackup.php51
-rw-r--r--downloadgedcom.php75
-rw-r--r--edit_changes.php6
-rw-r--r--edit_interface.php12
-rw-r--r--editnews.php7
-rw-r--r--edituser.php12
-rw-r--r--export_gedcom.php55
-rw-r--r--familybook.php6
-rw-r--r--famlist.php8
-rw-r--r--fanchart.php10
-rw-r--r--find.php23
-rw-r--r--gedcheck.php17
-rw-r--r--gedrecord.php9
-rw-r--r--help_text.php8
-rw-r--r--imageview.php8
-rw-r--r--includes/functions/functions_edit.php1
-rw-r--r--includes/functions/functions_print.php165
-rw-r--r--includes/session.php5
-rw-r--r--index.php17
-rw-r--r--index_edit.php10
-rw-r--r--indilist.php8
-rw-r--r--inverselink.php9
-rw-r--r--library/WT/Controller/Base.php76
-rw-r--r--library/WT/Controller/Simple.php36
-rw-r--r--login.php18
-rw-r--r--login_register.php23
-rw-r--r--medialist.php12
-rw-r--r--message.php10
-rw-r--r--module.php51
-rw-r--r--modules_v3/GEDFact_assistant/MEDIA_ctrl.php2
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_3_find.php23
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php10
-rw-r--r--modules_v3/GEDFact_assistant/module.php27
-rw-r--r--modules_v3/batch_update/admin_batch_update.php5
-rw-r--r--modules_v3/batch_update/module.php4
-rw-r--r--modules_v3/clippings/index.php3
-rw-r--r--modules_v3/faq/module.php18
-rw-r--r--modules_v3/googlemap/admin_editconfig.php23
-rw-r--r--modules_v3/googlemap/admin_placecheck.php18
-rw-r--r--modules_v3/googlemap/admin_places.php6
-rw-r--r--modules_v3/googlemap/flags.php9
-rw-r--r--modules_v3/googlemap/pedigree_map.php10
-rw-r--r--modules_v3/googlemap/places_edit.php10
-rw-r--r--modules_v3/lightbox/admin_config.php14
-rw-r--r--modules_v3/sitemap/admin_index.php17
-rw-r--r--modules_v3/stories/module.php71
-rw-r--r--modules_v3/tree/module.php7
-rw-r--r--notelist.php6
-rw-r--r--placelist.php8
-rw-r--r--relationship.php10
-rw-r--r--repolist.php6
-rw-r--r--reportengine.php14
-rw-r--r--sourcelist.php6
-rw-r--r--statistics.php7
-rw-r--r--statisticsplot.php62
81 files changed, 839 insertions, 1036 deletions
diff --git a/addmedia.php b/addmedia.php
index 4d0b2340f7..19b510a5ee 100644
--- a/addmedia.php
+++ b/addmedia.php
@@ -28,6 +28,10 @@ require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
require WT_ROOT.'includes/functions/functions_edit.php';
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Add a new media object'));
+$controller->pageHeader();
+
// TODO use GET/POST, rather than $_REQUEST
// TODO decide what validation is required on these input parameters
$pid =safe_REQUEST($_REQUEST, 'pid', WT_REGEX_XREF);
@@ -49,7 +53,6 @@ $update_CHAN=!safe_POST_bool('preserve_last_changed');
$success=false; // If successful, we close this window automatically
-print_simple_header(WT_I18N::translate('Add a new media object'));
$disp = true;
if (empty($pid) && !empty($mid)) $pid = $mid;
if (!empty($pid)) {
@@ -80,7 +83,6 @@ if (!WT_USER_CAN_EDIT || !$disp || !$ALLOW_EDIT_GEDCOM) {
}
}
echo '<br /><br /><div class="center"><a href="javascript: ', WT_I18N::translate('Close Window'), '" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close();">', WT_I18N::translate('Close Window'), '</a></div>';
- print_simple_footer();
exit;
}
@@ -630,4 +632,3 @@ if ($success && !WT_DEBUG) {
echo '<div class="center"><a href="#" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close();">'.WT_I18N::translate('Close Window').'</a></div>';
echo '<br />';
}
-print_simple_footer();
diff --git a/admin.php b/admin.php
index 897a2a9d8c..b42051c045 100644
--- a/admin.php
+++ b/admin.php
@@ -25,14 +25,10 @@ define('WT_SCRIPT_NAME', 'admin.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
-// Only managers can access this page
-if (!WT_USER_GEDCOM_ADMIN) {
- // TODO: Check if we are a manager in *any* gedcom, not just the current one
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
-
-print_header(WT_I18N::translate('Administration'));
+$controller=new WT_Controller_Base();
+$controller->requireManagerLogin();
+$controller->setPageTitle(WT_I18N::translate('Administration'));
+$controller->pageHeader();
// Check for updates
$latest_version_txt=fetch_latest_version();
@@ -288,7 +284,6 @@ echo
WT_JS_END,
'</div>'; //id = content_container
-print_footer();
// This is a list of old files and directories, from earlier versions of webtrees, that can be deleted
// It was generated with the help of a command like this
diff --git a/admin_media.php b/admin_media.php
index 7edef62428..c543e808d4 100644
--- a/admin_media.php
+++ b/admin_media.php
@@ -42,25 +42,23 @@
define('WT_SCRIPT_NAME', 'admin_media.php');
require './includes/session.php';
+
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Manage multimedia'));
+
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_edit.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
require_once WT_ROOT.'includes/functions/functions_mediadb.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
-
// editing must be enabled
if (!$ALLOW_EDIT_GEDCOM) {
- print_header(WT_I18N::translate('Manage multimedia'));
+ $controller->pageHeader();
echo "<span class=\"error\"><b>";
echo WT_I18N::translate('Media management features are not available when online editing is disabled.');
echo "</b></span><br />";
- print_footer();
exit;
}
@@ -271,7 +269,7 @@ if (WT_USER_IS_ADMIN) {
}
// echo the header of the page
-print_header(WT_I18N::translate('Manage multimedia'));
+$controller->pageHeader();
?>
<script type="text/javascript">
<!--
@@ -1303,4 +1301,3 @@ echo WT_JS_START; ?>
} else {
echo WT_I18N::translate('The media folder is corrupted.');
}
-print_footer();
diff --git a/admin_media_upload.php b/admin_media_upload.php
index a085123ae4..a5c37f476e 100644
--- a/admin_media_upload.php
+++ b/admin_media_upload.php
@@ -48,7 +48,10 @@ if (!WT_USER_CAN_EDIT) {
exit;
}
-print_header(WT_I18N::translate('Upload media files'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Upload media files'));
+$controller->pageHeader();
+
?>
<script type="text/javascript">
<!--
@@ -80,4 +83,3 @@ if (!dir_is_writable($MEDIA_DIRECTORY)) {
} else {
show_mediaUpload_form(WT_SCRIPT_NAME, false); // We have the green light to upload media, print the form
}
-print_footer();
diff --git a/admin_module_blocks.php b/admin_module_blocks.php
index 2fad5e2f4b..6a5a6782c4 100644
--- a/admin_module_blocks.php
+++ b/admin_module_blocks.php
@@ -18,18 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_module_blocks.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -65,7 +63,7 @@ if ($action=='update_mods') {
}
}
-print_header(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
?>
<div align="center">
@@ -120,5 +118,3 @@ print_header(WT_I18N::translate('Module administration'));
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_module_menus.php b/admin_module_menus.php
index 6d5e1432f5..b0fa9050df 100644
--- a/admin_module_menus.php
+++ b/admin_module_menus.php
@@ -18,18 +18,17 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_module_menus.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -69,8 +68,6 @@ if ($action=='update_mods') {
}
}
-print_header(WT_I18N::translate('Module administration'));
-
echo WT_JS_START; ?>
jQuery(document).ready(function() {
@@ -143,5 +140,3 @@ echo WT_JS_START; ?>
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_module_reports.php b/admin_module_reports.php
index cc13e8ed16..53ae3dca60 100644
--- a/admin_module_reports.php
+++ b/admin_module_reports.php
@@ -18,18 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_module_reports.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -65,7 +63,7 @@ if ($action=='update_mods') {
}
}
-print_header(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
?>
<div align="center">
@@ -120,5 +118,3 @@ print_header(WT_I18N::translate('Module administration'));
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_module_sidebar.php b/admin_module_sidebar.php
index 5581bdcdde..a7849a1d7f 100644
--- a/admin_module_sidebar.php
+++ b/admin_module_sidebar.php
@@ -18,18 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_module_sidebar.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -69,7 +67,7 @@ if ($action=='update_mods') {
}
}
-print_header(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
echo WT_JS_START; ?>
@@ -142,5 +140,3 @@ echo WT_JS_START; ?>
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_module_tabs.php b/admin_module_tabs.php
index 32dfbda090..64563bcac6 100644
--- a/admin_module_tabs.php
+++ b/admin_module_tabs.php
@@ -18,18 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_module_tabs.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -69,7 +67,7 @@ if ($action=='update_mods') {
}
}
-print_header(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
echo WT_JS_START; ?>
@@ -143,5 +141,3 @@ echo WT_JS_START; ?>
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_modules.php b/admin_modules.php
index b33b8490f1..23dc1b3348 100644
--- a/admin_modules.php
+++ b/admin_modules.php
@@ -18,18 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
define('WT_SCRIPT_NAME', 'admin_modules.php');
-
require 'includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Module administration'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
// New modules may have been added...
$installed_modules=WT_Module::getInstalledModules();
@@ -80,7 +78,7 @@ case 'delete_module':
break;
}
-print_header(WT_I18N::translate('Module administration'));
+$controller->pageHeader();
?>
<script type="text/javascript">
//<![CDATA[
@@ -185,5 +183,3 @@ print_header(WT_I18N::translate('Module administration'));
</form>
</div>
</div>
-<?php
-print_footer();
diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php
index a1b1e5ac63..aaaca89c10 100644
--- a/admin_pgv_to_wt.php
+++ b/admin_pgv_to_wt.php
@@ -22,7 +22,6 @@
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 || get_user_count()>1) {
@@ -30,13 +29,12 @@ if (WT_GED_ID || get_user_count()>1) {
exit;
}
-// Must be logged in as an admin
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
+$controller->pageHeader();
-print_header(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
+require WT_ROOT.'includes/functions/functions_edit.php';
echo
'<style type="text/css">
diff --git a/admin_site_clean.php b/admin_site_clean.php
index 666737f077..2d76361ba2 100644
--- a/admin_site_clean.php
+++ b/admin_site_clean.php
@@ -23,12 +23,13 @@
define('WT_SCRIPT_NAME', 'admin_site_clean.php');
require './includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Cleanup data directory'));
+$controller->pageHeader();
+
+require WT_ROOT.'includes/functions/functions_edit.php';
function full_rmdir($dir) {
if (!is_writable($dir)) {
@@ -75,7 +76,6 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) {
}
}
-print_header(WT_I18N::translate('Cleanup data directory'));
echo
'<h3>', WT_I18N::translate('Cleanup data directory'), '</h3>',
'<p>',
@@ -125,5 +125,3 @@ echo
'<button type="submit">', WT_I18N::translate('Delete'), '</button>',
'</div>',
'</form>';
-
-print_footer();
diff --git a/admin_site_config.php b/admin_site_config.php
index d0ddb8fbde..f92fc60434 100644
--- a/admin_site_config.php
+++ b/admin_site_config.php
@@ -1,41 +1,34 @@
<?php
-/**
- * A form to edit site configuration.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Admin
- * @version $Id$
- */
+// A form to edit site configuration.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'admin_site_config.php');
-
require './includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Site configuration'));
+$controller->pageHeader();
-print_header(WT_I18N::translate('Site configuration'));
+require WT_ROOT.'includes/functions/functions_edit.php';
echo WT_JS_START;
?>
@@ -108,5 +101,3 @@ echo
'</td>',
'</tr>',
'</table>';
-
-print_footer();
diff --git a/admin_site_info.php b/admin_site_info.php
index 8d275a0e6e..549281b353 100644
--- a/admin_site_info.php
+++ b/admin_site_info.php
@@ -1,41 +1,37 @@
<?php
-/**
- * Displays information on the PHP installation
- *
- * Provides links for administrators to get to other administrative areas of the site
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- */
+// Displays information on the PHP installation
+//
+// Provides links for administrators to get to other administrative areas of the site
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'admin_site_info.php');
-
require './includes/session.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('PHP information'));
+$controller->pageHeader();
if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
@@ -43,7 +39,6 @@ if (!isset($action)) $action = "";
if ($action == "phpinfo") {
$helpindex = "phpinfo_help";
- print_header(WT_I18N::translate('PHP information'));
// "Help for this page" link
echo '<div id="page_help">', help_link('phpinfo'), '</div>';
@@ -81,5 +76,3 @@ if ($action == "phpinfo") {
echo $php_info;
echo '</div>';
}
-
-print_footer();
diff --git a/admin_site_ipaddress.php b/admin_site_ipaddress.php
index 1f998220e3..46c0540a02 100644
--- a/admin_site_ipaddress.php
+++ b/admin_site_ipaddress.php
@@ -26,20 +26,17 @@
// $Id$
define('WT_SCRIPT_NAME', 'admin_site_ipaddress.php');
-
require './includes/session.php';
+
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Manage sites'));
+$controller->pageHeader();
+
require_once WT_ROOT.'includes/functions/functions.php';
require_once WT_ROOT.'includes/functions/functions_edit.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
-
-print_header(WT_I18N::translate('Manage sites'));
-
$action = safe_GET('action');
if (empty($action)) $action = safe_POST('action');
$address = safe_GET('address');
@@ -107,61 +104,60 @@ echo
'<tr><td>',
'<form name="searchengineform" action="', WT_SCRIPT_NAME, '" method="post">',
'<table>',
- '<tr><th>', WT_I18N::translate('Manually mark Search Engines by IP'). help_link('help_manual_search_engines'), '</th></tr>',
- '<tr>',
- '<td>',
- '<table>';
+ '<tr><th>', WT_I18N::translate('Manually mark Search Engines by IP'). help_link('help_manual_search_engines'), '</th></tr>',
+ '<tr>',
+ '<td>',
+ '<table>';
- $sql="SELECT ip_address, comment FROM `##ip_address` WHERE category='search-engine' ORDER BY INET_ATON(ip_address)";
- $index=0;
- $search_engines=WT_DB::prepare($sql)->fetchAssoc();
- foreach ($search_engines as $ip_address=>$ip_comment) {
- echo '<tr><td><span dir="ltr"><input type="text" name="address', ++$index, '" size="16" value="', $ip_address, '" readonly /></span></td>';
- echo '<td><input type="text" name="comment', ++$index, '" size="60" value="', $ip_comment, '" readonly /></td><td class="button">';
- echo '<button name="deleteSearch" value="', $ip_address, '" type="submit">', WT_I18N::translate('Remove'), '</button>';
- echo '</td></tr>';
- }
- echo '<tr><td valign="top"><span dir="ltr"><input type="text" id="txtAddIp" name="address" size="16" value="', empty($errorSearch) ? '':$address, '" /></span></td>';
- echo '<td><input type="text" id="txtAddComment" name="comment" size="60" value="" />';
- echo '<br />', WT_I18N::translate('You may enter a comment here.'), '</td><td class="button" valign="top"><input name="action" type="hidden" value="addSearch"/>';
- echo '<input type="submit" value="', WT_I18N::translate('Add'), '" />';
- echo '</td></tr>';
+$sql="SELECT ip_address, comment FROM `##ip_address` WHERE category='search-engine' ORDER BY INET_ATON(ip_address)";
+$index=0;
+$search_engines=WT_DB::prepare($sql)->fetchAssoc();
+foreach ($search_engines as $ip_address=>$ip_comment) {
+ echo '<tr><td><span dir="ltr"><input type="text" name="address', ++$index, '" size="16" value="', $ip_address, '" readonly /></span></td>';
+ echo '<td><input type="text" name="comment', ++$index, '" size="60" value="', $ip_comment, '" readonly /></td><td class="button">';
+ echo '<button name="deleteSearch" value="', $ip_address, '" type="submit">', WT_I18N::translate('Remove'), '</button>';
+ echo '</td></tr>';
+}
+echo '<tr><td valign="top"><span dir="ltr"><input type="text" id="txtAddIp" name="address" size="16" value="', empty($errorSearch) ? '':$address, '" /></span></td>';
+echo '<td><input type="text" id="txtAddComment" name="comment" size="60" value="" />';
+echo '<br />', WT_I18N::translate('You may enter a comment here.'), '</td><td class="button" valign="top"><input name="action" type="hidden" value="addSearch"/>';
+echo '<input type="submit" value="', WT_I18N::translate('Add'), '" />';
+echo '</td></tr>';
- if (!empty($errorSearch)) {
- echo '<tr><td colspan="2"><span class="warning">';
- echo $errorSearch;
- echo '</span></td></tr>';
- $errorSearch = '';
- }
- echo '</table></td></tr></table></form></td></tr></table>';
+if (!empty($errorSearch)) {
+ echo '<tr><td colspan="2"><span class="warning">';
+ echo $errorSearch;
+ echo '</span></td></tr>';
+ $errorSearch = '';
+}
+echo '</table></td></tr></table></form></td></tr></table>';
// Banned IP address table
echo '<table class="sites">',
- '<tr><td><form name="banIPform" action="', WT_SCRIPT_NAME, '" method="post">',
- '<table>',
- '<tr><th>', WT_I18N::translate('Ban Sites by IP').help_link('help_banning'), '</th></tr>',
- '<tr><td>',
- '<table>';
- $sql="SELECT ip_address, comment FROM `##ip_address` WHERE category='banned' ORDER BY INET_ATON(ip_address)";
- $banned=WT_DB::prepare($sql)->fetchAssoc();
- foreach ($banned as $ip_address=>$ip_comment) {
- echo '<tr><td><span dir="ltr"><input type="text" name="address', ++$index, '" size="16" value="', $ip_address, '" readonly /></span></td>',
- '<td><input type="text" name="comment', ++$index, '" size="60" value="', $ip_comment, '" readonly /></td><td class="button">',
- '<button name="deleteBanned" value="', $ip_address, '" type="submit">', WT_I18N::translate('Remove'), '</button>',
- '</td></tr>';
- }
- echo '<tr><td valign="top"><span dir="ltr"><input type="text" id="txtAddIp" name="address" size="16" value="', empty($errorBanned) ? '':$address, '" /></span></td>',
- '<td><input type="text" id="txtAddComment" name="comment" size="60" value="" />',
- '<br />', WT_I18N::translate('You may enter a comment here.'), '</td><td class="button" valign="top"><input name="action" type="hidden" value="addBanned"/>',
- '<input type="submit" value="', WT_I18N::translate('Add'), '" />',
- '</td></tr>';
+ '<tr><td><form name="banIPform" action="', WT_SCRIPT_NAME, '" method="post">',
+ '<table>',
+ '<tr><th>', WT_I18N::translate('Ban Sites by IP').help_link('help_banning'), '</th></tr>',
+ '<tr><td>',
+ '<table>';
+$sql="SELECT ip_address, comment FROM `##ip_address` WHERE category='banned' ORDER BY INET_ATON(ip_address)";
+$banned=WT_DB::prepare($sql)->fetchAssoc();
+foreach ($banned as $ip_address=>$ip_comment) {
+ echo '<tr><td><span dir="ltr"><input type="text" name="address', ++$index, '" size="16" value="', $ip_address, '" readonly /></span></td>',
+ '<td><input type="text" name="comment', ++$index, '" size="60" value="', $ip_comment, '" readonly /></td><td class="button">',
+ '<button name="deleteBanned" value="', $ip_address, '" type="submit">', WT_I18N::translate('Remove'), '</button>',
+ '</td></tr>';
+}
+echo '<tr><td valign="top"><span dir="ltr"><input type="text" id="txtAddIp" name="address" size="16" value="', empty($errorBanned) ? '':$address, '" /></span></td>',
+ '<td><input type="text" id="txtAddComment" name="comment" size="60" value="" />',
+ '<br />', WT_I18N::translate('You may enter a comment here.'), '</td><td class="button" valign="top"><input name="action" type="hidden" value="addBanned"/>',
+ '<input type="submit" value="', WT_I18N::translate('Add'), '" />',
+ '</td></tr>';
- if (!empty($errorBanned)) {
- echo '<tr><td colspan="2"><span class="warning">';
- echo $errorBanned;
- echo '</span></td></tr>';
- $errorBanned = '';
- }
- echo '</table></td></tr></table></form></td></tr></table>';
-print_footer();
+if (!empty($errorBanned)) {
+ echo '<tr><td colspan="2"><span class="warning">';
+ echo $errorBanned;
+ echo '</span></td></tr>';
+ $errorBanned = '';
+}
+echo '</table></td></tr></table></form></td></tr></table>';
diff --git a/admin_site_logs.php b/admin_site_logs.php
index 3162b057d2..071d6dcf61 100644
--- a/admin_site_logs.php
+++ b/admin_site_logs.php
@@ -1,40 +1,33 @@
<?php
-/**
- * Log viewer.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2011 webtrees development team.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Admin
- * @version $Id$
- */
+// Log viewer.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'admin_site_logs.php');
-
require './includes/session.php';
-require WT_ROOT.'includes/functions/functions_edit.php';
-// Only managers can access this page
-if (!WT_USER_GEDCOM_ADMIN) {
- // TODO: Check if we are a manager in *any* gedcom, not just the current one
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireManagerLogin();
+$controller->setPageTitle(WT_I18N::translate('Logs'));
+
+require WT_ROOT.'includes/functions/functions_edit.php';
$earliest=WT_DB::prepare("SELECT DATE(MIN(log_time)) FROM `##log`")->execute(array())->fetchOne();
$latest =WT_DB::prepare("SELECT DATE(MAX(log_time)) FROM `##log`")->execute(array())->fetchOne();
@@ -181,7 +174,7 @@ case 'load_json':
exit;
}
-print_header(WT_I18N::translate('Logs'));
+$controller->pageHeader();
echo WT_JS_START;
?>
@@ -285,5 +278,3 @@ if ($action) {
'</tbody>',
'</table>';
}
-
-print_footer();
diff --git a/admin_site_merge.php b/admin_site_merge.php
index c68f92829e..27c21113b4 100644
--- a/admin_site_merge.php
+++ b/admin_site_merge.php
@@ -27,6 +27,10 @@
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
+
+$controller=new WT_Controller_Base;
+$controller->setPageTitle(WT_I18N::translate('Merge records'));
+
require_once WT_ROOT.'includes/functions/functions_edit.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -40,7 +44,7 @@ $keep2=safe_POST('keep2', WT_REGEX_UNSAFE);
if (empty($keep1)) $keep1=array();
if (empty($keep2)) $keep2=array();
-print_header(WT_I18N::translate('Merge records'));
+$controller->pageHeader();
if (get_gedcom_count()==1) { //Removed becasue it doesn't work here for multiple GEDCOMs. Can be reinstated when fixed (https://bugs.launchpad.net/webtrees/+bug/613235)
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -49,7 +53,6 @@ if (get_gedcom_count()==1) { //Removed becasue it doesn't work here for multiple
//-- make sure they have accept access privileges
if (!WT_USER_CAN_ACCEPT) {
echo '<span class="error">', WT_I18N::translate('<b>Access Denied</b><br />You do not have access to this resource.'), '</span>';
- print_footer();
exit;
}
@@ -326,4 +329,3 @@ if ($action=='choose') {
<input type="submit" value="', WT_I18N::translate('Merge records'), '" tabindex="3" />
</form></div>';
}
-print_footer();
diff --git a/admin_site_other.php b/admin_site_other.php
index ee3f48e5e6..cf69fa4102 100644
--- a/admin_site_other.php
+++ b/admin_site_other.php
@@ -1,37 +1,34 @@
<?php
-/**
-* Miscellaneous administrative functions
-*
-*
-* webtrees: Web based Family History software
- * Copyright (C) 2011 webtrees development team.
- *
- * Partly Derived from PhpGedView
-* Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* @package webtrees
-* @subpackage admin
-* @version $Id$
-*/
+// Miscellaneous administrative functions
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Partly Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'admin_site_other.php');
require './includes/session.php';
-print_header(WT_I18N::translate('Add unlinked records'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Add unlinked records'));
+$controller->pageHeader();
// The addnewXXX() functions work only for the default tree.
// Choose one...
@@ -74,5 +71,3 @@ echo
'</td></tr>',
'</table>',
'</div>';
-
-print_footer();
diff --git a/admin_site_readme.php b/admin_site_readme.php
index ba432893bc..42babd2ed1 100644
--- a/admin_site_readme.php
+++ b/admin_site_readme.php
@@ -1,36 +1,32 @@
<?php
-/**
- * UI for online updating of the config file.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- */
+// UI for online updating of the config file.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'admin_site_readme.php');
-
require './includes/session.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('README documentation'));
+$controller->pageHeader();
function get_tag($txt,$tag){
$offset = 0;
@@ -51,9 +47,7 @@ function get_tag($txt,$tag){
return $arr;
}
-print_header(WT_I18N::translate("README documentation"));
-
-echo '<div id="readme" dir="ltr" lang="en">'; // This page is always LTR/English
+echo '<div id="readme" dir="ltr" lang="en">'; // This information is always LTR/English
$url = 'readme.html';
$txt = file_get_contents($url);
@@ -64,4 +58,3 @@ foreach ($arr as $value) {
}
echo '</div>';
-print_footer();
diff --git a/admin_trees_config.php b/admin_trees_config.php
index e2ebf7dfd5..4065bc232d 100644
--- a/admin_trees_config.php
+++ b/admin_trees_config.php
@@ -33,6 +33,9 @@ if (!WT_USER_GEDCOM_ADMIN) {
exit;
}
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Family tree configuration'));
+
/**
* find the name of the first GEDCOM file in a zipfile
* @param string $zipfile the path and filename
@@ -361,7 +364,9 @@ default:
break;
}
-print_header(WT_I18N::translate('Family tree configuration'));
+
+$controller->pageHeader();
+
if (get_gedcom_count()==1) { //Removed because it doesn't work here for multiple GEDCOMs. Can be reinstated when fixed (https://bugs.launchpad.net/webtrees/+bug/613235)
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
}
@@ -1607,5 +1612,3 @@ echo WT_JS_START;?>
</tr>
</table>
</form>
-<?php
-print_footer();
diff --git a/admin_trees_manage.php b/admin_trees_manage.php
index 98ace1ce70..3a3e6dc694 100644
--- a/admin_trees_manage.php
+++ b/admin_trees_manage.php
@@ -21,14 +21,11 @@
// $Id$
define('WT_SCRIPT_NAME', 'admin_trees_manage.php');
-
require './includes/session.php';
-// The gedcom admin page is for managers only!
-if (!WT_USER_GEDCOM_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireManagerLogin();
+$controller->setPageTitle(WT_I18N::translate('Family trees'));
// Don't allow the user to cancel the request. We do not want to be left
// with an incomplete transaction.
@@ -131,7 +128,7 @@ case 'replace_import':
$gedcoms=get_all_gedcoms();
-print_header(WT_I18N::translate('Family trees'));
+$controller->pageHeader();
// "Help for this page" link
echo '<div id="page_help">', help_link('gedcom_administration'), '</div>';
@@ -181,7 +178,6 @@ case 'importform':
} else {
echo '<p>', WT_I18N::translate('No GEDCOM files found. You need to copy files to the <b>%s</b> directory on your server.', WT_DATA_DIR);
echo '</form>';
- print_footer();
exit;
}
}
@@ -189,7 +185,6 @@ case 'importform':
echo WT_I18N::translate('If you have created media objects in webtrees, and have edited your gedcom off-line using a program that deletes media objects, then check this box to merge the current media objects with the new GEDCOM.');
echo '<br /><br /><input type="submit" value="', WT_I18N::translate('Save'), '" /></form>';
echo '</form>';
- print_footer();
exit;
}
@@ -289,4 +284,3 @@ if (WT_USER_IS_ADMIN) {
'</div>';
}
}
-print_footer();
diff --git a/admin_users.php b/admin_users.php
index fb56bac014..4e43fb2e38 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -25,13 +25,12 @@
define('WT_SCRIPT_NAME', 'admin_users.php');
require './includes/session.php';
-require_once WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('User administration'));
+
+require_once WT_ROOT.'includes/functions/functions_edit.php';
// Valid values for form variables
$ALL_ACTIONS=array('cleanup', 'cleanup2', 'createform', 'createuser', 'deleteuser', 'edituser', 'edituser2', 'listusers', 'loadrows', 'load1row');
@@ -267,7 +266,8 @@ case 'load1row':
exit;
}
-print_header(WT_I18N::translate('User administration'));
+$controller->pageHeader();
+
// Save new user info to the database
if ($action=='createuser' || $action=='edituser2') {
if (($action=='createuser' || $action=='edituser2' && $username!=$oldusername) && get_user_id($username)) {
@@ -781,5 +781,3 @@ default:
echo WT_JS_END;
break;
}
-
-print_footer();
diff --git a/admin_users_bulk.php b/admin_users_bulk.php
index 68bad34cd1..dccbe6098b 100644
--- a/admin_users_bulk.php
+++ b/admin_users_bulk.php
@@ -1,53 +1,43 @@
<?php
-/**
- * Administrative User Interface.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * Modifications Copyright (c) 2010 Greg Roach
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Admin
- * @version $Id: admin_users_bulk.php 10239 2011-01-01 22:32:55Z greg $
-*/
+// Administrative User Interface.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// Modifications Copyright (c) 2010 Greg Roach
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id: admin_users_bulk.php 10239 2011-01-01 22:32:55Z greg $
define('WT_SCRIPT_NAME', 'admin_users_bulk.php');
require './includes/session.php';
-require_once WT_ROOT.'includes/functions/functions_edit.php';
-// Only admin users can access this page
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
- exit;
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Send broadcast messages'));
+$controller->pageHeader();
-print_header(WT_I18N::translate('Send broadcast messages'));
+require_once WT_ROOT.'includes/functions/functions_edit.php';
?>
-
<div id="users_bulk" class="<?php echo $TEXT_DIRECTION; ?>">
<p><a href="javascript: <?php echo WT_I18N::translate('Send message to all users'); ?>" onclick="message('all', 'messaging2', '', ''); return false;"><?php echo WT_I18N::translate('Send message to all users'); ?></a></p>
<p><a href="javascript: <?php echo WT_I18N::translate('Send message to users who have never logged in'); ?>" onclick="message('never_logged', 'messaging2', '', ''); return false;"><?php echo WT_I18N::translate('Send message to users who have never logged in'); ?></a></p>
<p><a href="javascript: <?php echo WT_I18N::translate('Send message to users who have not logged in for 6 months'); ?>" onclick="message('last_6mo', 'messaging2', '', ''); return false;"><?php echo WT_I18N::translate('Send message to users who have not logged in for 6 months'); ?></a></p>
</div>
-
-<?php
-print_footer();
diff --git a/branches.php b/branches.php
index 48744d1b45..50a74904f2 100644
--- a/branches.php
+++ b/branches.php
@@ -51,8 +51,10 @@ if ($surn=='*') {
$surn = array_rand(WT_Query_Name::surnames('', '', false, true, WT_GED_ID));
}
-//-- form
-print_header(WT_I18N::translate('Branches').' - '.$surn);
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Branches').' - '.$surn);
+$controller->pageHeader();
+
if ($ENABLE_AUTOCOMPLETE) {
require WT_ROOT.'/js/autocomplete.js.htm';
}
@@ -100,7 +102,6 @@ if ($surn) {
echo '</ol>';
echo '</fieldset>';
}
-print_footer();
function print_fams($person, $famid=null) {
global $UNKNOWN_NN, $surn, $surn_script, $TEXT_DIRECTION, $user_ancestors;
diff --git a/calendar.php b/calendar.php
index 28487b8d48..ddab8c8306 100644
--- a/calendar.php
+++ b/calendar.php
@@ -29,6 +29,10 @@ define('WT_SCRIPT_NAME', 'calendar.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Anniversary calendar'));
+$controller->pageHeader();
+
if (isset($_REQUEST['cal'])) $cal = $_REQUEST['cal'];
if (isset($_REQUEST['day'])) $day = $_REQUEST['day'];
if (isset($_REQUEST['month'])) $month = $_REQUEST['month'];
@@ -103,9 +107,6 @@ $today_month=$today->Format('%O');
// Invalid dates? Go to monthly view, where they'll be found.
if ($cal_date->d>$days_in_month && $action=='today')
$action='calendar';
-
-// Print the header stuff
-print_header(WT_I18N::translate('Anniversary calendar'));
echo "<div>";
// Calendar form
@@ -526,7 +527,6 @@ case 'calendar':
break;
}
echo '</div><br />';
-print_footer();
/////////////////////////////////////////////////////////////////////////////////
// Filter a list of facts
diff --git a/compact.php b/compact.php
index 48a6293357..5cfc6af2a3 100644
--- a/compact.php
+++ b/compact.php
@@ -39,7 +39,9 @@ $name =$person->getFullName();
$addname=$person->getAddName();
$title = /* I18N: %s is a person's name */ WT_I18N::translate('Compact tree of %s', $person->getFullName());
-print_header($title);
+$controller=new WT_Controller_Base();
+$controller->setPageTitle($title);
+$controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -275,8 +277,6 @@ echo "</tr>";
echo "</table>";
echo "<br />";
-print_footer();
-
function print_td_person($n) {
global $treeid, $WT_IMAGES;
global $SHOW_HIGHLIGHT_IMAGES;
diff --git a/downloadbackup.php b/downloadbackup.php
index 70e6aa1815..f6c981d287 100644
--- a/downloadbackup.php
+++ b/downloadbackup.php
@@ -1,31 +1,27 @@
<?php
-/**
- * Allow an admin user to download the backup file.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2005 John Finlay and Others
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Admin
- * @version $Id$
- */
+// Allow an admin user to download the backup file.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2005 John Finlay and Others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'downloadbackup.php');
require './includes/session.php';
@@ -50,4 +46,3 @@ header('Content-Disposition: attachment; filename="'.$fname.'"');
header('Content-length: '.filesize($INDEX_DIRECTORY.$fname));
header('Content-Transfer-Encoding: binary');
readfile($INDEX_DIRECTORY.basename($fname));
-exit();
diff --git a/downloadgedcom.php b/downloadgedcom.php
index e64fecaad4..0fb2935481 100644
--- a/downloadgedcom.php
+++ b/downloadgedcom.php
@@ -1,57 +1,47 @@
<?php
-
-/**
- * Allow an admin user to download the entire gedcom file.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Admin
- * @version $Id$
- */
+// Allow an admin user to download the entire gedcom file.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'downloadgedcom.php');
require './includes/session.php';
+
+$controller=new WT_Controller_Base();
+$controller->requireManagerLogin();
+$controller->setPageTitle(WT_I18N::translate('Download GEDCOM'));
+
require_once WT_ROOT.'includes/functions/functions_export.php';
// Validate user parameters
-if (!isset($_SESSION['exportConvPath'])) $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY;
-if (!isset($_SESSION['exportConvSlashes'])) $_SESSION['exportConvSlashes'] = 'forward';
-
$ged = safe_GET('ged', preg_quote_array(get_all_gedcoms()));
$action = safe_GET('action', 'download');
$convert = safe_GET('convert', 'yes', 'no');
$zip = safe_GET('zip', 'yes', 'no');
-$conv_path = safe_GET('conv_path', WT_REGEX_NOSCRIPT, $_SESSION['exportConvPath']);
-$conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']);
+$conv_path = safe_GET('conv_path', WT_REGEX_NOSCRIPT);
+$conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'));
$privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin'));
$conv_path = stripLRMRLM($conv_path);
-$_SESSION['exportConvPath'] = $conv_path; // remember this for the next Download
-$_SESSION['exportConvSlashes'] = $conv_slashes;
-
-if (!WT_USER_GEDCOM_ADMIN || !$ged) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'admin_trees_manage.php');
- exit;
-}
if ($action == 'download') {
$conv_path = rtrim(str_replace('\\', '/', trim($conv_path)), '/').'/'; // make sure we have a trailing slash here
@@ -111,7 +101,7 @@ if ($action == "download") {
exit;
}
-print_header(WT_I18N::translate('Download GEDCOM'));
+$controller->pageHeader();
?>
<div class="center"><h2><?php echo WT_I18N::translate('Download GEDCOM'); ?></h2></div>
@@ -149,6 +139,3 @@ print_header(WT_I18N::translate('Download GEDCOM'));
<input type="button" value="<?php echo WT_I18N::translate('Back'); ?>" onclick="window.location='admin_trees_manage.php';"/></td></tr>
</table>
</form>
-<?php
-
-print_footer();
diff --git a/edit_changes.php b/edit_changes.php
index 198ee97cdc..af4aa6f770 100644
--- a/edit_changes.php
+++ b/edit_changes.php
@@ -32,12 +32,15 @@ if (!WT_USER_CAN_ACCEPT) {
exit;
}
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Pending changes'));
+$controller->pageHeader();
+
$action =safe_GET('action');
$change_id=safe_GET('change_id');
$index =safe_GET('index');
$ged =safe_GET('ged');
-print_simple_header(WT_I18N::translate('Pending changes'));
echo WT_JS_START;
?>
function show_gedcom_record(xref) {
@@ -242,4 +245,3 @@ if ($changed_gedcoms) {
}
echo '</div>';
-print_simple_footer();
diff --git a/edit_interface.php b/edit_interface.php
index dc9ea711ac..cb94a925f3 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -25,6 +25,12 @@
define('WT_SCRIPT_NAME', 'edit_interface.php');
require './includes/session.php';
+
+$controller=new WT_Controller_Simple();
+$controller->requireUserLogin();
+$controller->setPageTitle(WT_I18N::translate('Edit'));
+$controller->pageHeader();
+
require WT_ROOT.'includes/functions/functions_edit.php';
// TODO work out whether to use GET/POST for these
@@ -55,8 +61,6 @@ $update_CHAN=!safe_POST_bool('preserve_last_changed');
$uploaded_files = array();
-print_simple_header(WT_I18N::translate('Edit'));
-
if ($ENABLE_AUTOCOMPLETE) {
require WT_ROOT.'js/autocomplete.js.htm';
}
@@ -169,7 +173,6 @@ if (!empty($pid)) {
}
} elseif (($action!="addchild")&&($action!="addchildaction")&&($action!="addnewsource")&&($action!="mod_edit_fact")&&($action!="addnewnote")&&($action!="addmedia_links")&&($action!="addnoteaction")&&($action!="addnoteaction_assisted")) {
// No $pid? Internal error of some sort
- print_simple_footer();
$edit = true;
} else {
$edit = true;
@@ -179,7 +182,6 @@ if (!WT_USER_CAN_EDIT || !$edit || !$ALLOW_EDIT_GEDCOM) {
echo
'<p class="error">', WT_I18N::translate('Privacy settings prevent you from editing this record.'), '</p>',
'<p><a href="javascript: ', WT_I18N::translate('Close Window'), '" onclick="window.close();">', WT_I18N::translate('Close Window'), '</a></p>';
- print_simple_footer();
exit;
}
@@ -2398,8 +2400,6 @@ if ($action == 'addmedia_links' || $action == 'addnewnote_assisted' ) {
echo "<br /><div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('{$link}');\">", WT_I18N::translate('Close Window'), '</a></div>';
} elseif (isset($closeparent) && $closeparent=="yes" ) {
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('{$link}');\">", WT_I18N::translate('Close Window'), '</a></div><br />';
- print_simple_footer();
} else {
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('{$link}');\">", WT_I18N::translate('Close Window'), '</a></div><br />';
- print_simple_footer();
}
diff --git a/editnews.php b/editnews.php
index 1640e9fcd5..a94fbc058a 100644
--- a/editnews.php
+++ b/editnews.php
@@ -26,11 +26,12 @@
define('WT_SCRIPT_NAME', 'editnews.php');
require './includes/session.php';
-print_simple_header(WT_I18N::translate('Add/edit journal/news entry'));
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Add/edit journal/news entry'));
+$controller->pageHeader();
if (!WT_USER_ID) {
echo WT_I18N::translate('<b>Access Denied</b><br />You do not have access to this resource.');
- print_simple_footer();
exit;
}
@@ -117,5 +118,3 @@ if ($action=="compose") {
if (deleteNews($news_id)) echo WT_I18N::translate('The news/journal entry has been deleted.');
}
echo "<center><br /><br /><a href=\"javascript:;\" onclick=\"if (window.opener.refreshpage) window.opener.refreshpage(); window.close();\">".WT_I18N::translate('Close Window')."</a><br /></center>";
-
-print_simple_footer();
diff --git a/edituser.php b/edituser.php
index e06101deba..3cf4fcbc32 100644
--- a/edituser.php
+++ b/edituser.php
@@ -34,6 +34,10 @@ if (!get_user_setting(WT_USER_ID, 'editaccount')) {
exit;
}
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('User administration'));
+
+
// Valid values for form variables
$ALL_THEMES_DIRS=array();
foreach (get_theme_names() as $themename=>$themedir) {
@@ -56,10 +60,10 @@ $form_visible_online=safe_POST_bool('form_visible_online');
// Respond to form action
if ($form_action=='update') {
if ($form_username!=WT_USER_NAME && get_user_id($form_username)) {
- print_header(WT_I18N::translate('User administration'));
+ $controller->pageHeader();
echo '<span class="error">', WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'), '</span><br />';
} elseif ($form_email!=getUserEmail(WT_USER_ID) && get_user_by_email($form_email)) {
- print_header(WT_I18N::translate('User administration'));
+ $controller->pageHeader();
echo '<span class="error">', WT_I18N::translate('Duplicate email address. A user with that email already exists.'), '</span><br />';
} else {
// Change password
@@ -89,7 +93,7 @@ if ($form_action=='update') {
exit;
}
} else {
- print_header(WT_I18N::translate('User administration'));
+ $controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
}
@@ -216,5 +220,3 @@ echo '</td></tr>';
echo '<tr><td class="topbottombar" colspan="2"><input type="submit" value="', WT_I18N::translate('Save'), '" /></td></tr>';
echo '</table></form>';
-
-print_footer();
diff --git a/export_gedcom.php b/export_gedcom.php
index dd09419f4b..5155e482f4 100644
--- a/export_gedcom.php
+++ b/export_gedcom.php
@@ -1,31 +1,27 @@
<?php
-/**
- * Exports data from the database to a gedcom file
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2011 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2008 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Charts
- * @version $Id$
- */
+// Exports data from the database to a gedcom file
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2008 to 2009 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'export_gedcom.php');
require './includes/session.php';
@@ -48,7 +44,9 @@ if (empty($gedcoms)) {
// Which gedcom have we requested to export
$export = safe_GET('export', preg_quote_array($gedcoms));
-print_simple_header(WT_I18N::translate('Export'));
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Export'));
+$controller->pageHeader();
if ($export) {
$ged_id = get_id_from_gedcom($export);
@@ -91,4 +89,3 @@ if ($export) {
}
echo '<p class="center"><a href="javascript: ', WT_I18N::translate('Close Window'), '" onclick="window.close();">', WT_I18N::translate('Close Window'), '</a></p>';
-print_simple_footer();
diff --git a/familybook.php b/familybook.php
index 6e4eaf0f83..b163033b9b 100644
--- a/familybook.php
+++ b/familybook.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'familybook.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_charts.php';
+$controller=new WT_Controller_Base();
+
// Extract form variables
$pid =safe_GET_xref('pid');
$show_full =safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
@@ -208,7 +210,8 @@ function print_family_book($person, $descent) {
}
}
-print_header(/* I18N: %s is a person's name */ WT_I18N::translate('Family book of %s', $person->getFullName()));
+$controller->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Family book of %s', $person->getFullName()));
+$controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -316,4 +319,3 @@ echo
print_family_book($person, $descent);
echo '</div>';
-print_footer();
diff --git a/famlist.php b/famlist.php
index 227bf418e3..af432527db 100644
--- a/famlist.php
+++ b/famlist.php
@@ -30,6 +30,8 @@ define('WT_SCRIPT_NAME', 'famlist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+$controller=new WT_Controller_Base();
+
// We show three different lists: initials, surnames and individuals
// Note that the data may contain special chars, such as surname="<unknown>",
$alpha =safe_GET('alpha', WT_REGEX_UNSAFE); // All surnames beginning with this letter where "@"=unknown and ","=none
@@ -113,7 +115,9 @@ if ($show_all=='yes') {
$url='famlist.php?alpha='.rawurlencode($alpha);
}
-print_header(WT_I18N::translate('Families').' : '.$legend);
+$controller->setPageTitle(WT_I18N::translate('Families').' : '.$legend);
+$controller->pageHeader();
+
echo '<h2 class="center">', WT_I18N::translate('Families'), '</h2>';
// Print a selection list of initial letters
@@ -263,5 +267,3 @@ if ($showList) {
}
}
}
-
-print_footer();
diff --git a/fanchart.php b/fanchart.php
index 5e4c047b67..6a1d11803d 100644
--- a/fanchart.php
+++ b/fanchart.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'fanchart.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_charts.php';
+$controller=new WT_Controller_Base();
+
/**
* split and center text by lines
*
@@ -383,8 +385,8 @@ $name =$person->getFullName();
$addname=$person->getAddName();
$title = /* I18N: http://en.wikipedia.org/wiki/Family_tree#Fan_chart - %s is a person's name */ WT_I18N::translate('Fan chart of %s', $person->getFullName());
-// -- print html header information
-print_header($title);
+$controller->setPageTitle($title);
+$controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -392,7 +394,7 @@ if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
else $cellwidth=(strlen($title)*7);*/
$cellwidth = max(strlen($title)*4, "420");
echo "<table class=\"list_table $TEXT_DIRECTION\"><tr><td width=\"".$cellwidth."px\" valign=\"top\">";
-echo '<h2>', $title, '</h2>';
+echo '<h2>', $controller->getPageTitle(), '</h2>';
// -- print the form to change the number of displayed generations
echo WT_JS_START;
@@ -454,5 +456,3 @@ echo "</td></tr></table>";
$treeid = ancestry_array($rootid);
print_fan_chart($treeid, 640*$fan_width/100, $fan_style*90);
-
-print_footer();
diff --git a/find.php b/find.php
index 859532f349..67101bfbd8 100644
--- a/find.php
+++ b/find.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'find.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+$controller=new WT_Controller_Simple();
+
$type =safe_GET('type', WT_REGEX_ALPHA, 'indi');
$filter =safe_GET('filter');
$action =safe_GET('action');
@@ -110,43 +112,44 @@ require WT_ROOT.'includes/specialchars.php';
switch ($type) {
case "indi":
- print_simple_header(WT_I18N::translate('Find individual ID'));
+ $controller->setPageTitle(WT_I18N::translate('Find individual ID'));
break;
case "fam":
- print_simple_header(WT_I18N::translate('Find Family List'));
+ $controller->setPageTitle(WT_I18N::translate('Find Family List'));
break;
case "media":
- print_simple_header(WT_I18N::translate('Find media'));
+ $controller->setPageTitle(WT_I18N::translate('Find media'));
$action="filter";
break;
case "place":
- print_simple_header(WT_I18N::translate('Find Place'));
+ $controller->setPageTitle(WT_I18N::translate('Find Place'));
$action="filter";
break;
case "repo":
- print_simple_header(WT_I18N::translate('Repositories'));
+ $controller->setPageTitle(WT_I18N::translate('Repositories'));
$action="filter";
break;
case "note":
- print_simple_header(WT_I18N::translate('Find Shared Note'));
+ $controller->setPageTitle(WT_I18N::translate('Find Shared Note'));
$action="filter";
break;
case "source":
- print_simple_header(WT_I18N::translate('Find Source'));
+ $controller->setPageTitle(WT_I18N::translate('Find Source'));
$action="filter";
break;
case "specialchar":
- print_simple_header(WT_I18N::translate('Find Special Characters'));
+ $controller->setPageTitle(WT_I18N::translate('Find Special Characters'));
$action="filter";
break;
case "facts":
- print_simple_header(WT_I18N::translate('Find fact tags'));
+ $controller->setPageTitle(WT_I18N::translate('Find fact tags'));
echo
WT_JS_START,
'jQuery(document).ready(function(){ initPickFact(); });',
WT_JS_END;
break;
}
+$controller->pageHeader();
echo WT_JS_START;
?>
@@ -974,5 +977,3 @@ echo "</div>"; // Close div that centers table
// Set focus to the input field
if ($type!='facts') echo WT_JS_START, 'document.filter', $type, '.filter.focus();', WT_JS_END;
-
-print_simple_footer();
diff --git a/gedcheck.php b/gedcheck.php
index 37e63dc8af..92a6c8e0bd 100644
--- a/gedcheck.php
+++ b/gedcheck.php
@@ -1,10 +1,9 @@
<?php
-//
// Check a GEDCOM file for compliance with the 5.5.1 specification
// and other common errors.
//
// webtrees: Web based Family History software
-// Copyright (C) 2010 webtrees development team.
+// Copyright (C) 2011 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2006-2009 Greg Roach, all rights reserved
@@ -23,11 +22,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @author Greg Roach
-// @package webtrees
-// @subpackage Admin
-// @version $Id$
-//
+//$Id$
define('WT_SCRIPT_NAME', 'gedcheck.php');
require './includes/session.php';
@@ -37,7 +32,10 @@ if (!WT_USER_GEDCOM_ADMIN) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
exit;
}
-print_header(WT_I18N::translate('GEDCOM checker').' - '.$GEDCOM);
+
+$controller=new WT_Controller_Base();
+$controller->setPageTitle('GEDCOM checker').' - '.$GEDCOM);
+$controller->pageHeader();
////////////////////////////////////////////////////////////////////////////////
// Scan the data directory for gedcom files
@@ -123,7 +121,6 @@ echo '</table></form><hr />';
// Instead, show some useful help info.
if (!isset($_POST['action'])) {
echo '<p>', WT_I18N::translate('This module checks the format of a GEDCOM file against the <a href="http://phpgedview.sourceforge.net/ged551-5.pdf">5.5.1 GEDCOM Specification</a>. It also checks for a number of common errors in your data. Note that there are lots of versions, extensions and variations on the specification so you should not be concerned with any issues other than those flagged as "Critical". The explanation for all the line-by-line errors can be found in the specification, so please check there before asking for help.'), '</p><hr />';
- print_footer();
exit();
}
@@ -942,5 +939,3 @@ if (isset($last_err_num)) {
echo WT_I18N::translate('No errors found at this level.');
}
echo '</div>'; // language/direction/alignment
-
-print_footer();
diff --git a/gedrecord.php b/gedrecord.php
index 49877e8b19..e2d1a93295 100644
--- a/gedrecord.php
+++ b/gedrecord.php
@@ -24,6 +24,8 @@
define('WT_SCRIPT_NAME', 'gedrecord.php');
require './includes/session.php';
+$controller=new WT_Controller_Base();
+
$obj=WT_GedcomRecord::getInstance(safe_GET_xref('pid'));
if (
@@ -37,10 +39,12 @@ if (
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.$obj->getRawUrl());
exit;
} elseif (!$obj || !$obj->canDisplayDetails()) {
- print_header(WT_I18N::translate('Private'));
+ $controller->setPageTitle(WT_I18N::translate('Private'));
+ $controller->pageHeader();
print_privacy_error();
} else {
- print_header($obj->getFullName());
+ $controller->setPageTitle($obj->getFullName());
+ $controller->pageHeader();
echo
'<pre style="white-space:pre-wrap; word-wrap:break-word;">',
preg_replace(
@@ -49,4 +53,3 @@ if (
),
'</pre>';
}
-print_footer();
diff --git a/help_text.php b/help_text.php
index 031b5c09b9..e0cb15ebca 100644
--- a/help_text.php
+++ b/help_text.php
@@ -29,9 +29,10 @@
// $Id$
define('WT_SCRIPT_NAME', 'help_text.php');
-
require './includes/session.php';
+$controller=new WT_Controller_Simple();
+
$help=safe_GET('help');
switch ($help) {
//////////////////////////////////////////////////////////////////////////////
@@ -2922,7 +2923,9 @@ default:
break;
}
-print_simple_header($title);
+$controller->setPageTitle($title);
+$controller->pageHeader();
+
echo '<div class="helpheader">', $title, '</div>';
echo '<div class="helpcontent">', $text,'</div>';
echo '<div class="helpfooter">';
@@ -2931,4 +2934,3 @@ if ($help!='help_contents_help') {
}
echo '<a href="javascript:;" onclick="window.close();">', WT_I18N::translate('Close Window'), '</a>';
echo '</div>';
-print_simple_footer();
diff --git a/imageview.php b/imageview.php
index 11b42f60f4..072d48648a 100644
--- a/imageview.php
+++ b/imageview.php
@@ -28,17 +28,16 @@ require './includes/session.php';
$controller=new WT_Controller_Media();
-print_simple_header(WT_I18N::translate('Image viewer'));
+$view='simple'; // TODO, this is a "full screen" controller, but this is a "simple" page.
+$controller->pageHeader();
if (!$controller->mediaobject) {
- echo '<b>', WT_I18N::translate('Unable to find record with ID'), '</b><br /><br />';
- print_footer();
+ echo '<b>', WT_I18N::translate('Unable to find record with ID'), '</b>';
exit;
}
if (!$controller->mediaobject->canDisplayDetails()) {
print_privacy_error();
- print_footer();
exit;
}
?>
@@ -204,4 +203,3 @@ echo "</form>";
echo "<div style=\"position: relative; \">";
echo "</div>";
echo "<div class=\"center\"><br /><a href=\"javascript:;\" onclick=\"window.close();\">".WT_I18N::translate('Close Window')."</a></div>";
-print_simple_footer();
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index 5cac794af8..d6f506045d 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -318,7 +318,6 @@ function checkChangeTime($pid, $gedrec, $last_time) {
echo "<span class=\"error\">", WT_I18N::translate('The record with id %s was changed by another user since you last accessed it.', $pid), "<br /><br />";
if (!empty($changeUser)) echo /* I18N: %s placeholders are a user-ID and a timestamp */ WT_I18N::translate('This record was last changed by <i>%s</i> at %s', $changeUser, date("d M Y H:i:s", $changeTime)), "<br /><br />";
echo WT_I18N::translate('Please reload the previous page to make sure you are working with the most recent record.'), "</span>";
- print_simple_footer();
exit;
}
}
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index d485d535d0..d9e5ab4a06 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -240,166 +240,6 @@ function print_pedigree_person($person, $style=1, $count=0, $personcount="1") {
require WT_THEME_DIR.'templates/personbox_template.php';
}
-/**
-* print out standard HTML header
-*
-* This function will print out the HTML, HEAD, and BODY tags and will load in the CSS javascript and
-* other auxiliary files needed to run webtrees. It will also include the theme specific header file.
-* This function should be called by every page, except popups, before anything is output.
-*
-* Popup pages, because of their different format, should invoke function print_simple_header() instead.
-*/
-function print_header($title, $view='full') {
- // Import global variables into the local scope, for the theme's header.php
- global $bwidth, $BROWSERTYPE, $SEARCH_SPIDER, $cart;
- global $GEDCOM, $GEDCOM_TITLE, $action, $query;
- global $stylesheet, $print_stylesheet, $headerfile, $print_headerfile;
- global $WT_IMAGES, $TEXT_DIRECTION, $REQUIRE_AUTHENTICATION;
- global $controller;
-
- // Initialise variables for the theme's header.php
- if ($controller instanceof WT_Controller_GedcomRecord) {
- $LINK_CANONICAL=$controller->getCanonicalUrl();
- $META_ROBOTS=$controller->getMetaRobots();
- if ($controller->record && !$controller->record->canDisplayName()) {
- header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
- }
- } elseif (WT_SCRIPT_NAME=='index.php') {
- $LINK_CANONICAL='index.php?ctype=gedcom&amp;ged='.WT_GEDURL;
- $META_ROBOTS='index,follow';
- } elseif (in_array(WT_SCRIPT_NAME, array('famlist.php', 'indilist.php', 'notelist.php', 'repolist.php', 'sourcelist.php'))) {
- $LINK_CANONICAL='';
- $META_ROBOTS='index,follow';
- } else {
- $LINK_CANONICAL='';
- $META_ROBOTS='noindex,nofollow';
- }
- $GEDCOM_TITLE = get_gedcom_setting(WT_GED_ID, 'title');
- if ($view=='full') {
- $META_DESCRIPTION=get_gedcom_setting(WT_GED_ID, 'META_DESCRIPTION', $GEDCOM_TITLE);
- $META_GENERATOR=WT_WEBTREES.' - '.WT_WEBTREES_URL;
- } else {
- $META_DESCRIPTION='';
- $META_GENERATOR='';
- }
-
- header('Content-Type: text/html; charset=UTF-8');
-
- // The title often includes the names of records, which may have markup
- // that cannot be used in the page title.
- $title=htmlspecialchars_decode(strip_tags($title));
-
- $META_TITLE=get_gedcom_setting(WT_GED_ID, 'META_TITLE');
- if ($META_TITLE) {
- $title.=' - '.$META_TITLE;
- }
- $javascript=
- '<script type="text/javascript" src="'.WT_JQUERY_URL.'"></script>'.
- '<script type="text/javascript" src="'.WT_JQUERYUI_URL.'"></script>'.
- '<script type="text/javascript" src="'.WT_STATIC_URL.'js/jquery/jquery.jeditable.min.js"></script>'.
- '<script type="text/javascript" src="'.WT_STATIC_URL.'js/jquery/jquery.dataTables.min.js"></script>'.
- '<script type="text/javascript" src="'.WT_STATIC_URL.'js/jquery/jquery.cookie.js"></script>'.
- WT_JS_START.'
- // Give JavaScript access to some PHP constants
- var WT_STATIC_URL = "'.WT_STATIC_URL.'";
- var WT_THEME_DIR = "'.WT_THEME_DIR.'";
- var WT_MODULES_DIR = "'.WT_MODULES_DIR.'";
- var textDirection = "'.$TEXT_DIRECTION.'";
- var browserType = "'.$BROWSERTYPE.'";
- var WT_SCRIPT_NAME = "'.WT_SCRIPT_NAME.'";
- var WT_LOCALE = "'.WT_LOCALE.'";
- /* keep the session id when opening new windows */
- var sessionid = "'.Zend_Session::getId().'";
- var sessionname = "'.WT_SESSION_NAME.'";
- var accesstime = '.WT_DB::prepare("SELECT UNIX_TIMESTAMP(NOW())")->fetchOne().';
- var plusminus = new Array();
- plusminus[0] = new Image();
- plusminus[0].src = "'.$WT_IMAGES["plus"].'";
- plusminus[0].title = "'.WT_I18N::translate('Show Details').'";
- plusminus[1] = new Image();
- plusminus[1].src = "'.$WT_IMAGES["minus"].'";
- plusminus[1].title = "'.WT_I18N::translate('Hide Details').'";
- var zoominout = new Array();
- zoominout[0] = new Image();
- zoominout[0].src = "'.$WT_IMAGES["zoomin"].'";
- zoominout[1] = new Image();
- zoominout[1].src = "'.$WT_IMAGES["zoomout"].'";
- var arrows = new Array();
- arrows[0] = new Image();
- arrows[0].src = "'.$WT_IMAGES["larrow2"].'";
- arrows[1] = new Image();
- arrows[1].src = "'.$WT_IMAGES["rarrow2"].'";
- arrows[2] = new Image();
- arrows[2].src = "'.$WT_IMAGES["uarrow2"].'";
- arrows[3] = new Image();
- arrows[3].src = "'.$WT_IMAGES["darrow2"].'";
-
- function delete_record(pid, linenum, mediaid) {
- if (!mediaid) mediaid="";
- if (confirm(\''.WT_I18N::translate('Are you sure you want to delete this fact?').'\')) {
- window.open(\'edit_interface.php?action=delete&pid=\'+pid+\'&linenum=\'+linenum+\'&mediaid=\'+mediaid+"&"+sessionname+"="+sessionid, \'_blank\', \'top=50, left=50, width=600, height=500, resizable=1, scrollbars=1\');
- }
- return false;
- }
-
- function message(username, method, url, subject) {
- if ((!url)||(url=="")) url=\''.addslashes(urlencode(get_query_url())).'\';
- if ((!subject)||(subject=="")) subject="";
- window.open(\'message.php?to=\'+username+\'&method=\'+method+\'&url=\'+url+\'&subject=\'+subject+"&"+sessionname+"="+sessionid, \'_blank\', \'top=50, left=50, width=600, height=500, resizable=1, scrollbars=1\');
- return false;
- }
-
- var whichhelp = \'help_'.WT_SCRIPT_NAME.'&action='.$action.'\';
- '.
- WT_JS_END.
- '<script src="'.WT_STATIC_URL.'js/webtrees.js" type="text/javascript"></script>';
- require WT_ROOT.$headerfile;
-
- // Allow the browser to format the header/menus while we generate the page
- flush();
-}
-
-/**
-* print simple HTML header
-*
-* This function will print out the HTML, HEAD, and BODY tags and will load in the CSS javascript and
-* other auxiliary files needed to run PGV. It does not include any theme specific header files.
-* This function should be called by every page before anything is output on popup pages.
-*
-* @param string $title the title to put in the <TITLE></TITLE> header tags
-
-*/
-function print_simple_header($title) {
- print_header($title, 'simple');
-}
-
-// -- print the html to close the page
-function print_footer($view='full') {
- global $footerfile, $printlink, $WT_IMAGES, $TEXT_DIRECTION, $footer_count;
-
- // If the main script hasn't closed its session, do it now.
- // If we rely on PHP to close the session, it may not do it
- // until after it has closed the DB connection - which it needs!
- Zend_Session::writeClose();
-
- if ($view=='full') {
- if (!isset($footer_count)) $footer_count = 1;
- else $footer_count++;
- echo "<!-- begin footer -->";
- require WT_ROOT.$footerfile;
- } else {
- if (WT_DEBUG || get_gedcom_setting(WT_GED_ID, 'SHOW_STATS')) {
- echo execution_stats();
- }
- }
-
- if (WT_DEBUG_SQL) {
- echo WT_DB::getQueryLog();
- }
- echo WT_JS::render();
- echo '</body></html>';
-}
-
// print HTML header meta links
// previously identical code in each theme's header.php file
// now added as a function here.
@@ -419,11 +259,6 @@ function header_links($META_DESCRIPTION, $META_ROBOTS, $META_GENERATOR, $LINK_CA
return $header_links;
}
-// Page footer for popup/edit windows
-function print_simple_footer() {
- print_footer('simple');
-}
-
/**
* Prints Exection Statistics
*
diff --git a/includes/session.php b/includes/session.php
index d6639e6fd9..255e196009 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -549,8 +549,9 @@ if ($SEARCH_SPIDER && !in_array(WT_SCRIPT_NAME , array(
'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php',
))) {
header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
- print_header(WT_I18N::translate('Search engine'));
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle(WT_I18N::translate('Search engine'));
+ $controller->pageHeader();
echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>';
- print_footer();
exit;
}
diff --git a/index.php b/index.php
index 591dcc21d7..7c76990fbf 100644
--- a/index.php
+++ b/index.php
@@ -25,10 +25,9 @@
// $Id$
define('WT_SCRIPT_NAME', 'index.php');
-if (defined ('WT_ROOT')) {
- require WT_ROOT.'includes/session.php';
-} else
- require './includes/session.php';
+require './includes/session.php';
+
+$controller=new WT_Controller_Base();
// The only option for action is "ajax"
$action=safe_REQUEST($_REQUEST, 'action', 'ajax');
@@ -80,13 +79,11 @@ if ($action=='ajax') {
}
if ($ctype=='user') {
- print_header(WT_I18N::translate('My page'));
+ $controller->setPageTitle(WT_I18N::translate('My page'));
} else {
- print_header(get_gedcom_setting(WT_GED_ID, 'title'));
+ $controller->setPageTitle(get_gedcom_setting(WT_GED_ID, 'title'));
}
-
-// We have finished writing session data, so release the lock
-Zend_Session::writeClose();
+$controller->pageHeader();
if (WT_USE_LIGHTBOX) {
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_call_js.php';
@@ -167,5 +164,3 @@ if (WT_USER_IS_ADMIN && $ctype=='gedcom' && !in_array('gedcom_block', $blocks['m
echo "<a href=\"javascript:;\" onclick=\"window.open('index_edit.php?name=".WT_GEDURL."&amp;ctype=gedcom', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1');\">".WT_I18N::translate('Change the blocks on this page').'</a>';
echo '</div>';
}
-
-print_footer();
diff --git a/index_edit.php b/index_edit.php
index 7396d1a011..4ee7a26d5a 100644
--- a/index_edit.php
+++ b/index_edit.php
@@ -26,6 +26,8 @@
define('WT_SCRIPT_NAME', 'index_edit.php');
require './includes/session.php';
+$controller=new WT_Controller_Simple();
+
$ctype=safe_REQUEST($_REQUEST, 'ctype', array('user', 'gedcom'));
if (!$ctype) {
@@ -43,10 +45,9 @@ if (isset($_REQUEST['name'])) $name = $_REQUEST['name'];
//-- make sure that they have user status before they can use this page
//-- otherwise have them login again
if (!WT_USER_ID) {
- print_simple_header('');
+ $controller->pageHeader();
echo WT_I18N::translate('<b>Access Denied</b><br />You do not have access to this resource.');
echo '<div class="center"><a href="javascript:;" onclick="self.close();">', WT_I18N::translate('Close Window').'</a></div>';
- print_simple_footer();
exit;
}
if (!WT_USER_IS_ADMIN) $setdefault=false;
@@ -99,10 +100,11 @@ if ($ctype=='user') {
}
if ($ctype=='user') {
- print_simple_header(WT_I18N::translate('My page'));
+ $controller->setPageTitle(WT_I18N::translate('My page'));
} else {
- print_simple_header(get_gedcom_setting(WT_GED_ID, 'title'));
+ $controller->setPageTitle(WT_I18N::translate(get_gedcom_setting(WT_GED_ID, 'title'));
}
+$controller->pageHeader();
if ($action=='update') {
foreach (array('main', 'side') as $location) {
diff --git a/indilist.php b/indilist.php
index 5c1e7b8990..786347fa45 100644
--- a/indilist.php
+++ b/indilist.php
@@ -30,6 +30,8 @@ define('WT_SCRIPT_NAME', 'indilist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+$controller=new WT_Controller_Base();
+
// We show three different lists: initials, surnames and individuals
// Note that the data may contain special chars, such as surname="<unknown>",
$alpha =safe_GET('alpha', WT_REGEX_UNSAFE); // All surnames beginning with this letter where "@"=unknown and ","=none
@@ -113,7 +115,9 @@ if ($show_all=='yes') {
$url='indilist.php?alpha='.rawurlencode($alpha);
}
-print_header(WT_I18N::translate('Individuals').' : '.$legend);
+$controller->setPageTitle(WT_I18N::translate('Individuals').' : '.$legend);
+$controller->pageHeader();
+
echo '<h2 class="center">', WT_I18N::translate('Individuals'), '</h2>';
// Print a selection list of initial letters
@@ -263,5 +267,3 @@ if ($showList) {
}
}
}
-
-print_footer();
diff --git a/inverselink.php b/inverselink.php
index 75f3ac0cb7..4e19983c49 100644
--- a/inverselink.php
+++ b/inverselink.php
@@ -29,6 +29,10 @@ define('WT_SCRIPT_NAME', 'inverselink.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Link media')." ".$toitems);
+$controller->pageHeader();
+
//-- page parameters and checking
$linktoid = safe_GET_xref('linktoid');
$mediaid = safe_GET_xref('mediaid');
@@ -63,8 +67,6 @@ if (WT_USER_IS_ADMIN && $linkto=='manage' && array_key_exists('GEDFact_assistant
}
}
- print_simple_header(WT_I18N::translate('Link media')." ".$toitems);
-
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
//-- check for admin
@@ -196,14 +198,11 @@ if (WT_USER_IS_ADMIN && $linkto=='manage' && array_key_exists('GEDFact_assistant
echo '</table>';
echo '</form>';
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- print_simple_footer();
} elseif ($action == "update" && $paramok) {
linkMedia($mediaid, $linktoid);
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- print_simple_footer();
} else {
echo '<center>nothing to do<center>';
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- print_simple_footer();
}
}
diff --git a/library/WT/Controller/Base.php b/library/WT/Controller/Base.php
index 17e1bac21c..620180b15c 100644
--- a/library/WT/Controller/Base.php
+++ b/library/WT/Controller/Base.php
@@ -36,6 +36,19 @@ class WT_Controller_Base {
private $page_header =false; // Have we printed a page header?
private $page_title =WT_WEBTREES; // <head><title> $page_title </title></head>
+ // The controller accumulates JavaScript (inline and external), and renders it in the footer
+ const JS_START="\n<script type=\"text/javascript\">\n//<![CDATA[\n";
+ const JS_END ="\n//]]>\n</script>\n";
+ const JS_PRIORITY_HIGH = 0;
+ const JS_PRIORITY_NORMAL = 1;
+ const JS_PRIORITY_LOW = 2;
+ private $inline_javascript=array(
+ self::JS_PRIORITY_HIGH =>array(),
+ self::JS_PRIORITY_NORMAL=>array(),
+ self::JS_PRIORITY_LOW =>array(),
+ );
+ private $external_javascript=array();
+
// Startup activity
public function __construct() {
}
@@ -67,6 +80,66 @@ class WT_Controller_Base {
$this->meta_robots=$meta_robots;
}
+ // Restrict access
+ public function requireAdminLogin() {
+ if (!WT_USER_IS_ADMIN) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
+ exit;
+ }
+ }
+
+ // Restrict access
+ public function requireManagerLogin() {
+ if (!WT_USER_GEDCOM_ADMIN) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
+ exit;
+ }
+ }
+
+ // Restrict access
+ public function requireMemberLogin() {
+ if (!WT_USER_ID) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url='.WT_SCRIPT_NAME);
+ exit;
+ }
+ }
+
+ // Make a list of external JavaScript, so we can render them in the footer
+ public function addExternalJavaScript($script_name) {
+ $this->external_javascript[$script_name]=true;
+ }
+
+ // Make a list of inline JavaScript, so we can render them in the footer
+ public function addInlineJavaScript($script, $priority=self::JS_PRIORITY_NORMAL) {
+ if (WT_DEBUG) {
+ /* Show where the JS was added */
+ $backtrace=debug_backtrace();
+ $script='/* '.$backtrace[0]['file'].':'.$backtrace[0]['line'].' */'.PHP_EOL.$script;
+ }
+ $tmp=&$this->$inline_javascript[$priority];
+ $tmp[]=$script;
+ }
+
+ // We've collected up JavaScript fragments while rendering the page.
+ // Now display them.
+ private function getJavaScript() {
+ // Load external libraries first
+ $html=PHP_EOL;
+ foreach (array_keys($this->external_javascript) as $script_name) {
+ $html.='<script type="text/javascript" src="'.htmlspecialchars($script_name).'?v='.rawurlencode(WT_VERSION_TEXT).'"></script>'.PHP_EOL;
+ }
+ // Process the scripts, in priority order
+ $html.=self::JS_START;
+ foreach ($this->inline_javascript as $scripts) {
+ foreach ($scripts as $script) {
+ $html.=$script.PHP_EOL;
+ }
+ }
+ $html.=self::JS_END;
+
+ return $html;
+ }
+
// Print the page header, using the theme
public function pageHeader() {
// Import global variables into the local scope, for the theme's header.php
@@ -167,13 +240,14 @@ class WT_Controller_Base {
protected function pageFooter() {
global $footerfile, $WT_IMAGES, $TEXT_DIRECTION;
+ echo $this->getJavaScript();
+
$view='full';
require WT_ROOT.$footerfile;
if (WT_DEBUG_SQL) {
echo WT_DB::getQueryLog();
}
- echo WT_JS::render();
echo '</body></html>';
}
diff --git a/library/WT/Controller/Simple.php b/library/WT/Controller/Simple.php
index 35e4802297..1a20067d47 100644
--- a/library/WT/Controller/Simple.php
+++ b/library/WT/Controller/Simple.php
@@ -26,4 +26,40 @@ if (!defined('WT_WEBTREES')) {
}
class WT_Controller_Simple extends WT_Controller_Base {
+
+ // Popup windows don't always need a title
+ public function __construct() {
+ $this->setTitle(WT_WEBTREES);
+ }
+
+ // Simple (i.e. popup) windows are deprecated.
+ public function pageHeader() {
+ global $view;
+ $view='simple';
+ parent::pageHeader();
+ }
+
+ // Restrict access
+ public function requireAdminLogin() {
+ if (!WT_USER_IS_ADMIN) {
+ $this->addInlineJavaScript('opener.window.location.reload(); window.close();');
+ exit;
+ }
+ }
+
+ // Restrict access
+ public function requireManagerLogin() {
+ if (!WT_USER_GEDCOM_ADMIN) {
+ $this->addInlineJavaScript('opener.window.location.reload(); window.close();');
+ exit;
+ }
+ }
+
+ // Restrict access
+ public function requireMemberLogin() {
+ if (!WT_USER_ID) {
+ $this->addInlineJavaScript('opener.window.location.reload(); window.close();');
+ exit;
+ }
+ }
}
diff --git a/login.php b/login.php
index 1728ef2fdf..cb96c69d07 100644
--- a/login.php
+++ b/login.php
@@ -28,7 +28,6 @@ require './includes/session.php';
// Extract query parameters
$url =safe_POST('url', WT_REGEX_URL);
-$type =safe_POST('type', array('full', 'simple'));
$action =safe_POST('action');
$username =safe_POST('username', WT_REGEX_USERNAME);
$password =safe_POST('password', WT_REGEX_UNSAFE); // Can use any password that was previously stored
@@ -39,7 +38,6 @@ $help_message=safe_GET('help_message');
// Some variables can come from the URL as well as the form
if (!$url) $url =safe_GET('url', WT_REGEX_URL);
-if (!$type) $type =safe_GET('type', array('full', 'simple'), 'full');
if (!$action) $action=safe_GET('action');
if (empty($url)) {
@@ -141,11 +139,10 @@ if ($action=='login') {
}
}
-if ($type=="full") {
- print_header(WT_I18N::translate('webtrees user login'));
-} else {
- print_simple_header(WT_I18N::translate('webtrees user login'));
-}
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('webtrees user login'));
+$controller->pageHeader();
+
echo '<div class="center">';
echo '<table class="center width60"><tr><td>';
@@ -181,7 +178,6 @@ echo '</td></tr></table><br /><br />';
<input type="hidden" name="url" value="<?php echo htmlspecialchars($url); ?>" />
<input type="hidden" name="ged" value="<?php if (isset($ged)) echo htmlspecialchars($ged); else echo htmlentities($GEDCOM); ?>" />
<input type="hidden" name="pid" value="<?php if (isset($pid)) echo htmlspecialchars($pid); ?>" />
- <input type="hidden" name="type" value="<?php echo htmlspecialchars($type); ?>" />
<input type="hidden" name="usertime" value="" />
<?php
if (!empty($message)) echo "<span class='error'><br /><b>$message</b><br /><br /></span>";
@@ -222,9 +218,3 @@ echo "</div><br /><br />";
<script type="text/javascript">
document.loginform.username.focus();
</script>
-<?php
-if ($type=="full") {
- print_footer();
-} else {
- print_simple_footer();
-}
diff --git a/login_register.php b/login_register.php
index dbf199818c..f8e57515fe 100644
--- a/login_register.php
+++ b/login_register.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'login_register.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
+$controller=new WT_Controller_Base();
+
$REQUIRE_ADMIN_AUTH_REGISTRATION=get_site_setting('REQUIRE_ADMIN_AUTH_REGISTRATION');
$action =safe_POST('action');
@@ -49,7 +51,8 @@ $message='';
switch ($action) {
case 'pwlost' :
- print_header(WT_I18N::translate('Lost password request'));
+ $controller->setPageTitle(WT_I18N::translate('Lost password request'));
+ $controller->pageHeader();
?>
<script type="text/javascript">
<!--
@@ -84,7 +87,8 @@ switch ($action) {
break;
case 'requestpw' :
- print_header(WT_I18N::translate('Lost password request'));
+ $controller->setPageTitle(WT_I18N::translate('Lost password request'));
+ $controller->pageHeader();
echo '<div class="center">';
$user_id=get_user_id($user_name);
if (!$user_id) {
@@ -188,7 +192,8 @@ switch ($action) {
if ($user_name_false == false && $user_password01_false == false && $user_password02_false == false && $user_realname_false == false && $user_email_false == false && $user_language_false == false && $user_comments_false == false && $password_mismatch == false) $action = 'registernew';
else {
- print_header(WT_I18N::translate('Request new user account'));
+ $controller->setPageTitle(WT_I18N::translate('Request new user account'));
+ $controller->pageHeader();
// Empty user array in case any details might be left
// and faulty users are requested and created
$user = array();
@@ -315,7 +320,8 @@ switch ($action) {
$_SESSION['good_to_send'] = false;
if (isset($user_name)) {
- print_header(WT_I18N::translate('New Account confirmation'));
+ $controller->setPageTitle(WT_I18N::translate('New Account confirmation'));
+ $controller->pageHeader();
echo '<div class="center">';
$user_created_ok = false;
@@ -435,7 +441,9 @@ switch ($action) {
$user_id=get_user_id($user_name);
WT_I18N::init(get_user_setting($user_id, 'language'));
- print_header(WT_I18N::translate('User verification'));
+ $controller->setPageTitle(WT_I18N::translate('User verification'));
+ $controller->pageHeader();
+
echo '<div class="center">';
?>
<form name="verifyform" method="post" action="" onsubmit="t = new Date(); document.verifyform.time.value=t.toUTCString();">
@@ -467,7 +475,8 @@ switch ($action) {
$user_id=get_user_id($user_name);
WT_I18N::init(get_user_setting($user_id, 'language'));
- print_header(WT_I18N::translate('User verification')); // <-- better verification of authentication code
+ $controller->setPageTitle(WT_I18N::translate('User verification'));
+ $controller->pageHeader();
echo '<div class="center">';
echo '<table class="center facts_table wrap '.$TEXT_DIRECTION.'">';
echo '<tr><td class="topbottombar">'.WT_I18N::translate('User verification').'</td></tr>';
@@ -547,5 +556,3 @@ switch ($action) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.$url);
break;
}
-
-print_footer();
diff --git a/medialist.php b/medialist.php
index a22c2bc563..a80736f99b 100644
--- a/medialist.php
+++ b/medialist.php
@@ -27,6 +27,9 @@ define('WT_SCRIPT_NAME', 'medialist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Media objects'));
+
$action = safe_GET('action');
$search = safe_GET('search');
$sortby = safe_GET('sortby', 'file', 'title');
@@ -165,12 +168,9 @@ if ($build == 'yes') {
$WT_SESSION->Medialist_user=WT_USER_ID;
}
-// We have finished writing session data, so release the lock
-Zend_Session::writeClose();
-// ************************ END = 'Build the medialist array' ************************
+$controller->pageHeader();
-print_header(WT_I18N::translate('Media objects'));
-echo '<div class="center"><h2>', WT_I18N::translate('Media objects'), '</h2></div>';
+echo '<div class="center"><h2>', $controller->getPageTitle(), '</h2></div>';
if (WT_USE_LIGHTBOX) {
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_call_js.php';
}
@@ -563,5 +563,3 @@ Plus other Media Options - MediaViewer page'), '" />';
}
echo '</div>';
}
-// ************************ END = 'Print the medialist array' ************************
-print_footer();
diff --git a/message.php b/message.php
index f85bedab11..c8418e1b53 100644
--- a/message.php
+++ b/message.php
@@ -26,7 +26,9 @@
define('WT_SCRIPT_NAME', 'message.php');
require './includes/session.php';
-print_simple_header(WT_I18N::translate('webtrees Message'));
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('webtrees Message'));
+$controller->pageHeader();
$subject =isset($_REQUEST['subject' ]) ? $_REQUEST['subject' ] : '';
$url =isset($_REQUEST['url' ]) ? $_REQUEST['url' ] : '';
@@ -42,12 +44,10 @@ $method =isset($_REQUEST['method' ]) ? $_REQUEST['method' ] : '';
if (empty($to)) {
echo '<p class="ui-state-error">'.WT_I18N::translate('No recipient user was provided. Cannot continue.').'</p>';
- print_simple_footer();
exit;
}
if ($to=='all' && !WT_USER_IS_ADMIN) {
echo '<p class="ui-state-error">'.WT_I18N::translate('No recipient user was provided. Cannot continue.').'</p>';
- print_simple_footer();
exit;
}
// Do not allow anonymous visitors to include links to external sites
@@ -78,8 +78,6 @@ if (($action=='send')&&(isset($_SESSION['good_to_send']))&&($_SESSION['good_to_s
if ($ip === false) {
echo '<p class="ui-state-error">'.WT_I18N::translate('Please enter a valid email address.').'</p>';
$action='compose';
- //print_simple_footer();
- //exit;
}
}
}
@@ -233,5 +231,3 @@ else if ($action=='delete') {
if (deleteMessage($id)) echo WT_I18N::translate('Message Deleted');
}
echo '<center><br /><br /><a href="javascript:;" onclick="if (window.opener.refreshpage) window.opener.refreshpage(); window.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
-
-print_simple_footer();
diff --git a/module.php b/module.php
index d973abf9f2..e86f50e051 100644
--- a/module.php
+++ b/module.php
@@ -1,32 +1,27 @@
<?php
-/**
- * Module system for adding features to phpGedView.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Display
- * @version $Id$
- * @author Patrick Kellum
- */
+// Module system for adding features to phpGedView.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'module.php');
require './includes/session.php';
diff --git a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
index 02ef06d7da..b941f931a8 100644
--- a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
+++ b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
@@ -35,8 +35,6 @@ global $GEDCOM, $ABBREVIATE_CHART_LABELS;
global $show_full;
global $famid, $censyear, $censdate;
-// print_simple_header("Census");
-
$summary=$controller->record->format_first_major_fact(WT_EVENTS_BIRT, 2);
if (!($controller->record->isDead())) {
// If alive display age
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
index 8024bb860a..df30536b62 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
@@ -23,6 +23,8 @@
//
// $Id$
+$controller=new WT_Controller_Simple();
+
global $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $TEXT_DIRECTION, $ABBREVIATE_CHART_LABELS;
$type =safe_GET('type', WT_REGEX_ALPHA, 'indi');
@@ -108,43 +110,44 @@ require WT_ROOT.'includes/specialchars.php';
switch ($type) {
case "indi":
- print_simple_header(WT_I18N::translate('Find individual ID'));
+ $controller->setPageTitle(WT_I18N::translate('Find individual ID'));
break;
case "fam":
- print_simple_header(WT_I18N::translate('Find Family List'));
+ $controller->setPageTitle(WT_I18N::translate('Find Family List'));
break;
case "media":
- print_simple_header(WT_I18N::translate('Find media'));
+ $controller->setPageTitle(WT_I18N::translate('Find media'));
$action="filter";
break;
case "place":
- print_simple_header(WT_I18N::translate('Find Place'));
+ $controller->setPageTitle(WT_I18N::translate('Find Place'));
$action="filter";
break;
case "repo":
- print_simple_header(WT_I18N::translate('Repositories'));
+ $controller->setPageTitle(WT_I18N::translate('Repositories'));
$action="filter";
break;
case "note":
- print_simple_header(WT_I18N::translate('Find Shared Note'));
+ $controller->setPageTitle(WT_I18N::translate('Find Shared Note'));
$action="filter";
break;
case "source":
- print_simple_header(WT_I18N::translate('Find Source'));
+ $controller->setPageTitle(WT_I18N::translate('Find Source'));
$action="filter";
break;
case "specialchar":
- print_simple_header(WT_I18N::translate('Find Special Characters'));
+ $controller->setPageTitle(WT_I18N::translate('Find Special Characters'));
$action="filter";
break;
case "facts":
- print_simple_header(WT_I18N::translate('Find fact tags'));
+ $controller->setPageTitle(WT_I18N::translate('Find fact tags'));
echo
WT_JS_START,
'jQuery(document).ready(function(){ initPickFact(); });',
WT_JS_END;
break;
}
+$controller->pageHeader();
echo WT_JS_START;
?>
@@ -1081,5 +1084,3 @@ echo "</div>"; // Close div that centers table
// Set focus to the input field
if ($type!='facts') echo WT_JS_START, 'document.filter', $type, '.filter.focus();', WT_JS_END;
-
-print_simple_footer();
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
index 80587a04eb..54957d3f51 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
@@ -50,12 +50,6 @@ if (empty($linktoid) || empty($linkto)) {
break;
}
}
-if (WT_USER_IS_ADMIN) {
- print_simple_header(WT_I18N::translate('Link media')." ".$toitems);
-} else {
- print_simple_header(WT_I18N::translate('Administration'));
- echo WT_I18N::translate('Unable to authenticate user.');
-}
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -699,7 +693,6 @@ function shiftlinks() {
echo '</table>';
echo '</form>';
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close(); winNav.close(); ">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- // print_simple_footer();
} elseif ($action == "update" && $paramok) {
@@ -744,10 +737,7 @@ function shiftlinks() {
}
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close(); winNav.close(); ">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- print_simple_footer();
-
} else {
// echo '<center>You must be logged in as an Administrator<center>';
echo '<br/><br/><center><a href="javascript:;" onclick="if (window.opener.showchanges) window.opener.showchanges(); window.close(); winNav.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
- //print_simple_footer();
}
diff --git a/modules_v3/GEDFact_assistant/module.php b/modules_v3/GEDFact_assistant/module.php
index 589ce4f115..6572b66095 100644
--- a/modules_v3/GEDFact_assistant/module.php
+++ b/modules_v3/GEDFact_assistant/module.php
@@ -60,6 +60,8 @@ class GEDFact_assistant_WT_Module extends WT_Module {
private static function media_3_find() {
global $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $TEXT_DIRECTION, $ABBREVIATE_CHART_LABELS;
+
+ $controller=new WT_Controller_Simple();
$type =safe_GET('type', WT_REGEX_ALPHA, 'indi');
$filter =safe_GET('filter');
@@ -124,36 +126,37 @@ class GEDFact_assistant_WT_Module extends WT_Module {
switch ($type) {
case "indi":
- print_simple_header(WT_I18N::translate('Find individual ID'));
+ $controller->setPageTitle(WT_I18N::translate('Find individual ID'));
break;
case "fam":
- print_simple_header(WT_I18N::translate('Find Family List'));
+ $controller->setPageTitle(WT_I18N::translate('Find Family List'));
break;
case "media":
- print_simple_header(WT_I18N::translate('Find media'));
+ $controller->setPageTitle(WT_I18N::translate('Find media'));
$action="filter";
break;
case "place":
- print_simple_header(WT_I18N::translate('Find Place'));
+ $controller->setPageTitle(WT_I18N::translate('Find Place'));
$action="filter";
break;
case "repo":
- print_simple_header(WT_I18N::translate('Repositories'));
+ $controller->setPageTitle(WT_I18N::translate('Repositories'));
$action="filter";
break;
case "note":
- print_simple_header(WT_I18N::translate('Find Shared Note'));
+ $controller->setPageTitle(WT_I18N::translate('Find Shared Note'));
$action="filter";
break;
case "source":
- print_simple_header(WT_I18N::translate('Find Source'));
+ $controller->setPageTitle(WT_I18N::translate('Find Source'));
$action="filter";
break;
case "specialchar":
- print_simple_header(WT_I18N::translate('Find Special Characters'));
+ $controller->setPageTitle(WT_I18N::translate('Find Special Characters'));
$action="filter";
break;
}
+ $controller->pageHeader();
echo WT_JS_START;
?>
@@ -826,14 +829,14 @@ class GEDFact_assistant_WT_Module extends WT_Module {
// Set focus to the input field
echo WT_JS_START, 'document.filter', $type, '.filter.focus();', WT_JS_END;
-
- print_simple_footer();
}
private static function media_query_3a() {
$iid2 = safe_GET('iid');
-
- print_simple_header(WT_I18N::translate('Link media'));
+
+ $controller=new WT_Controller_Simple();
+ $controller->setPageTitle(WT_I18N::translate('Link media'));
+ $controller->pageHeader();
$record=WT_GedcomRecord::getInstance($iid2);
if ($record) {
diff --git a/modules_v3/batch_update/admin_batch_update.php b/modules_v3/batch_update/admin_batch_update.php
index 785b91c167..f8d6d6e3db 100644
--- a/modules_v3/batch_update/admin_batch_update.php
+++ b/modules_v3/batch_update/admin_batch_update.php
@@ -52,7 +52,6 @@ class batch_update {
function main() {
// HTML common to all pages
$html=
- print_header(WT_I18N::translate('Batch update')).
self::getJavascript().
'<form id="batch_update_form" action="module.php" method="get">'.
'<input type="hidden" name="mod" value="batch_update">'.
@@ -116,9 +115,7 @@ class batch_update {
}
}
$html.='</table></form>';
- ob_start();
- print_footer();
- return $html.ob_get_clean();
+ return $html;
}
// Constructor - initialise variables and validate user-input
diff --git a/modules_v3/batch_update/module.php b/modules_v3/batch_update/module.php
index 3561a811b5..b34f092661 100644
--- a/modules_v3/batch_update/module.php
+++ b/modules_v3/batch_update/module.php
@@ -40,6 +40,10 @@ class batch_update_WT_Module extends WT_Module implements WT_Module_Config{
public function modAction($mod_action) {
switch($mod_action) {
case 'admin_batch_update':
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle(WT_I18N::translate('Batch update')).
+ $controller->pageHeader();
+
// TODO: these files should be methods in this class
require WT_ROOT.WT_MODULES_DIR.$this->getName().'/'.$mod_action.'.php';
$mod=new batch_update;
diff --git a/modules_v3/clippings/index.php b/modules_v3/clippings/index.php
index 2f70d4f933..2a9c8d2179 100644
--- a/modules_v3/clippings/index.php
+++ b/modules_v3/clippings/index.php
@@ -35,7 +35,7 @@ global $ENABLE_AUTOCOMPLETE, $cart, $MAX_PEDIGREE_GENERATIONS, $TEXT_DIRECTION,
require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php';
$controller=new WT_Controller_Clippings();
-print_header(WT_I18N::translate('Clippings cart'));
+$controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -310,4 +310,3 @@ if ($ct==0) {
<?php
}
if (isset($_SESSION["cart"])) $_SESSION["cart"]=$cart;
-print_footer();
diff --git a/modules_v3/faq/module.php b/modules_v3/faq/module.php
index 1c1b1f981a..50ba7f6622 100644
--- a/modules_v3/faq/module.php
+++ b/modules_v3/faq/module.php
@@ -134,8 +134,9 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
$this->config();
} else {
$block_id=safe_GET('block_id');
+ $controller=new WT_Controller_Base();
if ($block_id) {
- print_header(WT_I18N::translate('Edit FAQ item'));
+ $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(
@@ -145,7 +146,7 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
"SELECT gedcom_id FROM `##block` WHERE block_id=?"
)->execute(array($block_id))->fetchOne();
} else {
- print_header(WT_I18N::translate('Add FAQ item'));
+ $controller->setPageTitle(WT_I18N::translate('Add FAQ item'));
$header='';
$faqbody='';
$block_order=WT_DB::prepare(
@@ -153,6 +154,7 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
)->execute(array($this->getName()))->fetchOne();
$gedcom_id=WT_GED_ID;
}
+ $controller->pageHeader();
// "Help for this page" link
echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
@@ -203,8 +205,6 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
echo '<p><input type="submit" value="', WT_I18N::translate('Save'), '" tabindex="5"/>';
echo '&nbsp;<input type="button" value="', WT_I18N::translate('Cancel'), '" onclick="window.location=\''.$this->getConfigLink().'\';" tabindex="6" /></p>';
echo '</form>';
-
- print_footer();
exit;
}
}
@@ -276,7 +276,9 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
}
private function show() {
- print_header($this->getTitle());
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle($this->getTitle());
+ $controller->pageHeader();
$faqs=WT_DB::prepare(
"SELECT block_id, bs1.setting_value AS header, bs2.setting_value AS body".
@@ -334,13 +336,14 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
echo '<hr />';
}
}
- print_footer();
}
private function config() {
global $WT_IMAGES;
- print_header($this->getTitle());
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle($this->getTitle());
+ $controller->pageHeader();
$faqs=WT_DB::prepare(
"SELECT block_id, block_order, gedcom_id, bs1.setting_value AS header, bs2.setting_value AS faqbody".
@@ -410,6 +413,5 @@ class faq_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_Conf
}
echo '</table>';
}
- print_footer();
}
}
diff --git a/modules_v3/googlemap/admin_editconfig.php b/modules_v3/googlemap/admin_editconfig.php
index e273d1df43..defe075fdc 100644
--- a/modules_v3/googlemap/admin_editconfig.php
+++ b/modules_v3/googlemap/admin_editconfig.php
@@ -21,7 +21,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// @version $Id$
+// $Id$
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
@@ -87,20 +87,16 @@ function print_level_config_table($level) {
<?php
}
-print_header(WT_I18N::translate('Google Maps configuration'));
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Google Maps configuration'));
+$controller->pageHeader();
-
-if (!WT_USER_IS_ADMIN) {
- echo '<div>', WT_I18N::translate('Page only for Administrators'), '</div>';
- print_footer();
- exit;
-} else {
- echo '<table id="gm_config"><tr>',
- '<th><a ', (safe_GET('mod_action')=="admin_editconfig" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
- '<th><a ', (safe_GET('mod_action')=="admin_places" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>', '</th>',
- '<th><a ', (safe_GET('mod_action')=="admin_placecheck" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_I18N::translate('Place Check'), '</a>', help_link('GOOGLEMAP_PLACECHECK','googlemap'), '</th>',
+echo '<table id="gm_config"><tr>',
+ '<th><a ', (safe_GET('mod_action')=="admin_editconfig" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_places" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_placecheck" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_I18N::translate('Place Check'), '</a>', help_link('GOOGLEMAP_PLACECHECK','googlemap'), '</th>',
'</tr></table>';
-}
if ($action=="update" && !isset($security_user)) {
set_module_setting('googlemap', 'GM_MAP_TYPE', $_POST['NEW_GM_MAP_TYPE']);
@@ -400,7 +396,6 @@ echo '<div id="tabs">',
<?php
if (empty($SEARCH_SPIDER)) {
- print_footer();
} else {
echo WT_I18N::translate('Search Engine Spider Detected'), ": ", $SEARCH_SPIDER;
echo "</div></body></html>";
diff --git a/modules_v3/googlemap/admin_placecheck.php b/modules_v3/googlemap/admin_placecheck.php
index c41e7d32c3..9bce83368a 100644
--- a/modules_v3/googlemap/admin_placecheck.php
+++ b/modules_v3/googlemap/admin_placecheck.php
@@ -29,11 +29,6 @@ if (!defined('WT_WEBTREES')) {
exit;
}
-if (!WT_USER_IS_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'admin.php');
- exit;
-}
-
$action =safe_POST ('action' );
$gedcom_id=safe_POST ('gedcom_id', array_keys(get_all_gedcoms()), WT_GED_ID );
$openinnew=safe_POST_bool('openinnew' );
@@ -73,12 +68,10 @@ if ($show_changes && !empty($_SESSION['placecheck_state'])) {
$_SESSION['placecheck_state'] = $state;
}
-// Must be an admin user to use this module
-if (!WT_USER_GEDCOM_ADMIN) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url=placelist.php');
- exit;
-}
-print_header(WT_I18N::translate('Place Check').' - '.WT_GEDCOM);
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Place Check'));
+$controller->pageHeader();
$target=$openinnew ? 'target="_blank"' : '';
@@ -374,6 +367,3 @@ default:
echo "<div class=\"gm_check_top accepted\">", WT_I18N::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), "</div>";
break;
}
-
-//echo footers
-print_footer();
diff --git a/modules_v3/googlemap/admin_places.php b/modules_v3/googlemap/admin_places.php
index b1ffb4662e..0240055632 100644
--- a/modules_v3/googlemap/admin_places.php
+++ b/modules_v3/googlemap/admin_places.php
@@ -170,7 +170,9 @@ if ($action=='ExportFile' && WT_USER_IS_ADMIN) {
exit;
}
-print_header(WT_I18N::translate('Edit geographic place locations'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Edit geographic place locations'));
+$controller->pageHeader();
echo '<table id="gm_config"><tr>',
'<th><a ', (safe_GET('mod_action')=='admin_editconfig' ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
@@ -344,7 +346,6 @@ if ($action=='ImportFile') {
<input id="savebutton" type="submit" value="<?php echo WT_I18N::translate('Continue Adding'); ?>" /><br />
</form>
<?php
- print_footer();
exit;
}
@@ -653,7 +654,6 @@ foreach ($placelist as $place) {
echo help_link('PL_EXPORT_ALL_FILE','googlemap');
echo '</td></tr></table>';
if (empty($SEARCH_SPIDER)) {
- print_footer();
} else {
echo WT_I18N::translate('Search Engine Spider Detected'), ': ', $SEARCH_SPIDER;
echo '</div></body></html>';
diff --git a/modules_v3/googlemap/flags.php b/modules_v3/googlemap/flags.php
index 3c2ad64a60..9d03d1262f 100644
--- a/modules_v3/googlemap/flags.php
+++ b/modules_v3/googlemap/flags.php
@@ -31,6 +31,10 @@ if (!defined('WT_WEBTREES')) {
require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
require WT_ROOT.'includes/functions/functions_edit.php';
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Select flag'));
+$controller->pageHeader();
+
$countries=WT_Stats::get_all_countries();
$action=safe_REQUEST($_REQUEST, 'action');
@@ -39,8 +43,6 @@ if (!isset($countrySelected)) $countrySelected='Countries';
if (isset($_REQUEST['stateSelected'])) $stateSelected = $_REQUEST['stateSelected'];
if (!isset($stateSelected)) $stateSelected='States';
-print_simple_header(WT_I18N::translate('Select flag'));
-
$country = array();
$rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/flags/');
while ($file = readdir($rep)) {
@@ -102,7 +104,6 @@ if ($action == 'ChangeFlag') {
echo "\n<script type=\"text/javascript\">\n<!--\nedit_close();\n//-->\n</script>";
}
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close();\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
- print_simple_footer();
exit;
}
else {
@@ -244,5 +245,3 @@ else {
</form>
<?php
echo '<div class="center"><a href="javascript:;" onclick="edit_close();">', WT_I18N::translate('Close Window'), '</a></div><br />';
-
-print_simple_footer();
diff --git a/modules_v3/googlemap/pedigree_map.php b/modules_v3/googlemap/pedigree_map.php
index 2a36491e43..50f164f32c 100644
--- a/modules_v3/googlemap/pedigree_map.php
+++ b/modules_v3/googlemap/pedigree_map.php
@@ -35,7 +35,8 @@ if (!defined('WT_WEBTREES')) {
require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
-global $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES;
+global $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES, $TEXT_DIRECTION;
+
// Default is show for both of these.
$hideflags = safe_GET('hideflags');
@@ -60,15 +61,14 @@ $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
// End of internal configuration variables
-global $TEXT_DIRECTION;
-
-print_header(/* I18N: %s is a person's name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()));
+$controller->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()));
+$controller->pageHeader();
echo '<link type="text/css" href ="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/googlemap_style.css" rel="stylesheet" />';
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
echo '<div><table><tr><td valign="middle">';
-echo '<h2>', WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()), '</h2>';
+echo '<h2>', $controller->getPageTitle(), '</h2>';
// -- print the form to change the number of displayed generations
?>
diff --git a/modules_v3/googlemap/places_edit.php b/modules_v3/googlemap/places_edit.php
index 9bf2b72936..1f0d509648 100644
--- a/modules_v3/googlemap/places_edit.php
+++ b/modules_v3/googlemap/places_edit.php
@@ -35,14 +35,15 @@ $action=safe_REQUEST($_REQUEST, 'action');
if (isset($_REQUEST['placeid'])) $placeid = $_REQUEST['placeid'];
if (isset($_REQUEST['place_name'])) $place_name = $_REQUEST['place_name'];
-print_simple_header(WT_I18N::translate('Edit geographic place locations'));
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Edit geographic place locations'));
+$controller->pageHeader();
if (!WT_USER_IS_ADMIN) {
echo "<table class=\"facts_table\">\n";
echo "<tr><td colspan=\"2\" class=\"facts_value\">", WT_I18N::translate('Page only for Administrators');
echo "</td></tr></table>\n";
echo "<br /><br /><br />\n";
- print_simple_footer();
exit;
}
echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/googlemap_style.css" rel="stylesheet" />';
@@ -102,7 +103,6 @@ if ($action=='addrecord' && WT_USER_IS_ADMIN) {
echo "\n<script type=\"text/javascript\">\n<!--\nedit_close('');\n//-->\n</script>";
}
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('');return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
- print_simple_footer();
exit;
}
@@ -121,7 +121,6 @@ if ($action=='updaterecord' && WT_USER_IS_ADMIN) {
echo "\n<script type=\"text/javascript\">\n<!--\nedit_close('');\n//-->\n</script>";
}
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('');return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
- print_simple_footer();
exit;
}
@@ -142,7 +141,6 @@ if ($action=='update_sv_params' && WT_USER_IS_ADMIN) {
echo "\n<script type=\"text/javascript\">\n<!--\nedit_close();\n//-->\n</script>";
}
echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close();return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
- print_simple_footer();
exit;
}
@@ -363,5 +361,3 @@ $api="v3";
</form>
<?php
echo "<center><a href=\"javascript:;\" onclick=\"edit_close('')\">", WT_I18N::translate('Close Window'), "</a><br /></center>\n";
-
-print_simple_footer();
diff --git a/modules_v3/lightbox/admin_config.php b/modules_v3/lightbox/admin_config.php
index ddd3dcdddc..539f1e780c 100644
--- a/modules_v3/lightbox/admin_config.php
+++ b/modules_v3/lightbox/admin_config.php
@@ -28,15 +28,12 @@ if (!defined('WT_WEBTREES')) {
exit;
}
-$action = safe_POST('action');
-
-print_header(WT_I18N::translate('Lightbox-Album Configuration'));
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Lightbox-Album Configuration'));
+$controller->pageHeader();
-if (!WT_USER_IS_ADMIN) {
- echo'<div class="warning">', WT_I18N::translate('Page only for Administrators'), '</div>';
- print_footer();
- exit;
-}
+$action = safe_POST('action');
if ($action=='update' && !isset($security_user)) {
set_module_setting('lightbox', 'LB_MUSIC_FILE', $_POST['NEW_LB_MUSIC_FILE']);
@@ -117,4 +114,3 @@ $LB_URL_HEIGHT=get_module_setting('lightbox', 'LB_URL_HEIGHT', '600'); // URL W
&nbsp;&nbsp;
<input type="reset" value="<?php echo WT_I18N::translate('Reset'); ?>" />
</form>
-<?php print_footer();
diff --git a/modules_v3/sitemap/admin_index.php b/modules_v3/sitemap/admin_index.php
index 036404eab3..054c15403d 100644
--- a/modules_v3/sitemap/admin_index.php
+++ b/modules_v3/sitemap/admin_index.php
@@ -30,17 +30,9 @@ if (!defined('WT_WEBTREES')) {
exit;
}
-//-- make sure that they have admin status before they can use this page
-//-- otherwise have them login again
-if (!WT_USER_IS_ADMIN) {
- if (WT_USER_ID) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
- exit;
- } else {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url=module.php?mod=sitemap');
- exit;
- }
-}
+$controller=new WT_Controller_Base();
+$controller->requireAdminLogin();
+$controller->setPageTitle(WT_I18N::translate('Generate Sitemap files'));
global $GEDCOM, $SHOW_MARRIED_NAMES;
@@ -181,7 +173,7 @@ if ($action=="sendIndex") {
exit;
}
-print_header(WT_I18N::translate('Generate Sitemap files'));
+$controller->pageHeader();
if ($action=="generate") {
echo "<h3>";
@@ -400,4 +392,3 @@ if ($action=="") {
<?php
}
-print_footer();
diff --git a/modules_v3/stories/module.php b/modules_v3/stories/module.php
index b7b12e7546..e9ed947623 100644
--- a/modules_v3/stories/module.php
+++ b/modules_v3/stories/module.php
@@ -207,8 +207,10 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
$this->config();
} else {
$block_id=safe_GET('block_id');
+
+ $controller=new WT_Controller_Base();
if ($block_id) {
- print_header(WT_I18N::translate('Edit story'));
+ $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(
@@ -218,12 +220,13 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
"SELECT xref FROM `##block` WHERE block_id=?"
)->execute(array($block_id))->fetchOne();
} else {
- print_header(WT_I18N::translate('Add story'));
+ $controller->setPageTitle(WT_I18N::translate('Add story'));
$title='';
$story_body='';
$gedcom_id=WT_GED_ID;
$xref=safe_GET('xref', WT_REGEX_XREF);
}
+ $controller->pageHeader();
?>
<script type="text/javascript">
var pastefield;
@@ -288,7 +291,6 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
echo '</p>';
echo '</form>';
- print_footer();
exit;
}
} else {
@@ -322,7 +324,10 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
global $WT_IMAGES, $TEXT_DIRECTION;
if (WT_USER_GEDCOM_ADMIN) {
- print_header($this->getTitle());
+
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle($this->getTitle());
+ $controller->pageHeader();
$stories=WT_DB::prepare(
"SELECT block_id, xref".
@@ -360,7 +365,6 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
</tr>';
}
echo '</table>';
- print_footer();
} else {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
@@ -370,39 +374,40 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
private function show_list() {
global $WT_IMAGES, $TEXT_DIRECTION;
- print_header($this->getTitle());
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle($this->getTitle());
+ $controller->pageHeader();
- $stories=WT_DB::prepare(
- "SELECT block_id, xref".
- " FROM `##block` b".
- " WHERE module_name=?".
- " AND gedcom_id=?".
- " ORDER BY xref"
- )->execute(array($this->getName(), WT_GED_ID))->fetchAll();
+ $stories=WT_DB::prepare(
+ "SELECT block_id, xref".
+ " FROM `##block` b".
+ " WHERE module_name=?".
+ " AND gedcom_id=?".
+ " ORDER BY xref"
+ )->execute(array($this->getName(), WT_GED_ID))->fetchAll();
- echo '<table class="list_table width90">';
- if (count($stories)>0) {
+ echo '<table class="list_table width90">';
+ if (count($stories)>0) {
+ echo '<tr>
+ <th class="list_label">', WT_I18N::translate('Story title'), '</th>
+ <th class="list_label">', WT_I18N::translate('Individual'), '</th>
+ </tr>';
+ }
+ foreach ($stories as $story) {
+ $indi=WT_Person::getInstance($story->xref);
+ if ($indi) {
+ $name="<a href=\"".$indi->getHtmlUrl()."#stories\">".$indi->getFullName()."</a>";
+ } else {
+ $name=$story->xref;
+ }
+ if ($indi->canDisplayDetails()) {
echo '<tr>
- <th class="list_label">', WT_I18N::translate('Story title'), '</th>
- <th class="list_label">', WT_I18N::translate('Individual'), '</th>
+ <td class="list_value">', get_block_setting($story->block_id, 'title'), '</td>
+ <td class="list_value wrap">', $name, '</td>
</tr>';
}
- foreach ($stories as $story) {
- $indi=WT_Person::getInstance($story->xref);
- if ($indi) {
- $name="<a href=\"".$indi->getHtmlUrl()."#stories\">".$indi->getFullName()."</a>";
- } else {
- $name=$story->xref;
- }
- if ($indi->canDisplayDetails()) {
- echo '<tr>
- <td class="list_value">', get_block_setting($story->block_id, 'title'), '</td>
- <td class="list_value wrap">', $name, '</td>
- </tr>';
- }
- }
- echo '</table>';
- print_footer();
+ }
+ echo '</table>';
}
// Implement WT_Module_Menu
diff --git a/modules_v3/tree/module.php b/modules_v3/tree/module.php
index a1db93c254..546d36a5ca 100644
--- a/modules_v3/tree/module.php
+++ b/modules_v3/tree/module.php
@@ -113,7 +113,11 @@ class tree_WT_Module extends WT_Module implements WT_Module_Tab {
$tv = new TreeView('tv');
ob_start();
$person=WT_Person::getInstance($rootid);
- print_header(WT_I18N::translate('Interactive tree of %s', $person->getFullName()));
+
+ $controller=new WT_Controller_Base();
+ $controller->setPageTitle(WT_I18N::translate('Interactive tree of %s', $person->getFullName()));
+ $controller->pageHeader();
+
if (WT_USE_LIGHTBOX) {
require WT_MODULES_DIR.'lightbox/functions/lb_call_js.php';
}
@@ -128,7 +132,6 @@ class tree_WT_Module extends WT_Module implements WT_Module_Tab {
$header = str_replace('</head>', $this->js.$this->css.'</head>', $header);
echo $header;
echo $tv->drawViewport($rootid, 4, $this->style);
- print_footer();
break;
case 'getDetails':
diff --git a/notelist.php b/notelist.php
index c4046817df..559418f893 100644
--- a/notelist.php
+++ b/notelist.php
@@ -27,8 +27,10 @@ define('WT_SCRIPT_NAME', 'notelist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-print_header(WT_I18N::translate('Shared notes'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Shared notes'));
+$controller->pageHeader();
+
echo '<div class="center"><h2>', WT_I18N::translate('Shared notes'), '</h2>';
print_note_table(get_note_list(WT_GED_ID));
echo '</div>';
-print_footer();
diff --git a/placelist.php b/placelist.php
index 744984b2eb..33e3eb4cfc 100644
--- a/placelist.php
+++ b/placelist.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'placelist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+$controller=new WT_Controller_Base();
+
$use_googlemap = array_key_exists('googlemap', WT_Module::getActiveModules()) && get_module_setting('googlemap', 'GM_PLACE_HIERARCHY');
if ($use_googlemap) {
@@ -50,10 +52,11 @@ if (empty($action)) $action = 'find';
if (empty($display)) $display = 'hierarchy';
if ($display=='hierarchy') {
- print_header(WT_I18N::translate('Place hierarchy'));
+ $controller->setPageTitle(WT_I18N::translate('Place hierarchy'));
} else {
- print_header(WT_I18N::translate('Place List'));
+ $controller->setPageTitle(WT_I18N::translate('Place List'));
}
+$controller->pageHeader();
echo '<div class="center"><h2>';
if ($display=='hierarchy' && $level == 0) {
@@ -393,4 +396,3 @@ echo '</a></div>';
if ($use_googlemap && $display=='hierarchy') {
map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names);
}
-print_footer();
diff --git a/relationship.php b/relationship.php
index ea94784b7e..69cb0d139b 100644
--- a/relationship.php
+++ b/relationship.php
@@ -27,6 +27,8 @@ define('WT_SCRIPT_NAME', 'relationship.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_charts.php';
+$controller=new WT_Controller_Base();
+
$show_full=$PEDIGREE_FULL_DETAILS;
if (isset($_REQUEST['show_full'])) $show_full = $_REQUEST['show_full'];
if (!isset($_REQUEST['path_to_find'])) {
@@ -95,7 +97,8 @@ if (!empty($_SESSION["pid2"]) && $_SESSION["pid2"]!=$pid2) {
$path_to_find=0;
}
// -- print html header information
-print_header($title_string);
+$controller->setPageTitle($title_string);
+$controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
@@ -282,8 +285,7 @@ function paste_id(value) {
</div>
<?php
if ($check_node===false) {
- print_footer();
- return;
+ exit;
}
if ($show_full==0) {
echo '<br /><span class="details2">', WT_I18N::translate('Click on any of the boxes to get more information about that person.'), '</span><br />';
@@ -508,5 +510,3 @@ $maxyoffset += 100;
relationship_chart_div.style.width = "100%";
}
</script>
-<?php
-print_footer();
diff --git a/repolist.php b/repolist.php
index b5d37eb260..733d40f66f 100644
--- a/repolist.php
+++ b/repolist.php
@@ -27,8 +27,10 @@ define('WT_SCRIPT_NAME', 'repolist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-print_header(WT_I18N::translate('Repositories'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Repositories'));
+$controller->pageHeader();
+
echo '<div class="center"><h2>', WT_I18N::translate('Repositories'), '</h2>';
print_repo_table(get_repo_list(WT_GED_ID));
echo '</div>';
-print_footer();
diff --git a/reportengine.php b/reportengine.php
index a176c9527e..35bb1ad2aa 100644
--- a/reportengine.php
+++ b/reportengine.php
@@ -28,6 +28,8 @@
define('WT_SCRIPT_NAME', 'reportengine.php');
require './includes/session.php';
+$controller=new WT_Controller_Base();
+
$famid=safe_GET('famid');
$pid =safe_GET('pid');
@@ -130,7 +132,8 @@ if (!empty($report)) {
//-- choose a report to run
if ($action=='choose') {
- print_header(WT_I18N::translate('Choose a report to run'));
+ $controller->setPageTitle(WT_I18N::translate('Choose a report to run'));
+ $controller->pageHeader();
echo '<br /><br /><form name="choosereport" method="get" action="reportengine.php">';
echo '<input type="hidden" name="action" value="setup" />';
@@ -145,8 +148,6 @@ if ($action=='choose') {
echo '</select></td></tr>';
echo '<tr><td class="topbottombar" colspan="2"><input type="submit" value="', WT_I18N::translate('Click here to continue'), '" /></td></tr>';
echo '</table></form><br /><br />';
-
- print_footer();
}
//-- setup report to run
@@ -174,7 +175,8 @@ elseif ($action=='setup') {
}
xml_parser_free($xml_parser);
- print_header($report_array['title']);
+ $controller->setPageTitle($report_array['title']);
+ $controller->pageHeader();
if ($ENABLE_AUTOCOMPLETE) {
require_once WT_ROOT.'js/autocomplete.js.htm';
@@ -317,13 +319,9 @@ elseif ($action=='setup') {
echo '<tr><td class="topbottombar" colspan="2">';
echo '<input type="submit" value="', WT_I18N::translate('Download report'), '" ;"/>';
echo '</td></tr></table></form>';
- print_footer();
}
//-- run the report
elseif ($action=='run') {
- // We have finished writing session data, so release the lock
- Zend_Session::writeClose();
-
if (strstr($report, 'report_singlepage.xml')!==false) {
$DEBUG=false;
$pedigree=new ReportPedigree();
diff --git a/sourcelist.php b/sourcelist.php
index b312908c8c..083ce3d390 100644
--- a/sourcelist.php
+++ b/sourcelist.php
@@ -27,8 +27,10 @@ define('WT_SCRIPT_NAME', 'sourcelist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-print_header(WT_I18N::translate('Sources'));
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Sources'));
+$controller->pageHeader();
+
echo '<div class="center"><h2>', WT_I18N::translate('Sources'), '</h2>';
print_sour_table(get_source_list(WT_GED_ID));
echo '</div>';
-print_footer();
diff --git a/statistics.php b/statistics.php
index 8fc5bf82bf..ddcd131a2c 100644
--- a/statistics.php
+++ b/statistics.php
@@ -29,6 +29,9 @@
define('WT_SCRIPT_NAME', 'statistics.php');
require './includes/session.php';
+$controller=new WT_Controller_Base();
+$controller->setPageTitle(WT_I18N::translate('Statistics'));
+
// check for on demand content loading
if (isset($_REQUEST['tab'])) {
$tab = $_REQUEST['tab'];
@@ -719,7 +722,8 @@ if (isset($content) && $content==1) {
</div>
<?php }
} else {
- print_header(WT_I18N::translate('Statistics'));
+ $controller->pageHeader();
+
$ble = false;
?>
<h2 class="center"><?php echo WT_I18N::translate('Statistics'); ?></h2>
@@ -778,5 +782,4 @@ if (isset($content) && $content==1) {
<?php
$ble = true;
echo '<br/><br/>';
- print_footer();
}
diff --git a/statisticsplot.php b/statisticsplot.php
index 9b8088ac0f..7465a10449 100644
--- a/statisticsplot.php
+++ b/statisticsplot.php
@@ -1,38 +1,38 @@
<?php
-/**
- * Creates some statistics out of the GEDCOM information.
- * We will start with the following possibilities
- * number of persons -> periodes of 50 years from 1700-2000
- * age -> periodes of 10 years (different for 0-1,1-5,5-10,10-20 etc)
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2011 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * @package webtrees
- * @subpackage Lists
- */
+// Creates some statistics out of the GEDCOM information.
+// We will start with the following possibilities
+// number of persons -> periodes of 50 years from 1700-2000
+// age -> periodes of 10 years (different for 0-1,1-5,5-10,10-20 etc)
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
define('WT_SCRIPT_NAME', 'statisticsplot.php');
require './includes/session.php';
+$controller=new WT_Controller_Simple();
+$controller->setPageTitle(WT_I18N::translate('Statistics plot'));
+$controller->pageHeader();
+
$stats = new WT_Stats($GEDCOM);
// Month of birth
@@ -915,7 +915,6 @@ if ($action=='update') {
unset($savedInput);
}
-print_simple_header(WT_I18N::translate('Statistics plot'));
echo '<h2 class="center">', WT_I18N::translate('Statistics plot'), '</h2>';
echo '<br />';
@@ -995,4 +994,3 @@ default:
echo '<br /><div class ="center noprint">';
echo '<input type="button" value="', WT_I18N::translate('Close Window'), '" onclick="window.close()" /><br /><br />';
echo '</div>';
-print_simple_footer();