summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/classes/class_module.php2
-rw-r--r--js/jw_player/flvVideo.php180
-rw-r--r--js/jw_player/wmvVideo.php140
-rw-r--r--modules/address_label_report/module.php2
-rw-r--r--modules/address_report/module.php2
-rw-r--r--modules/ahnentafel_report/module.php2
-rw-r--r--modules/bdm_report/module.php2
-rw-r--r--modules/birth_report/module.php2
-rw-r--r--modules/cemetery_report/module.php2
-rw-r--r--modules/change_report/module.php2
-rw-r--r--modules/ckeditor/ckeditor.php58
-rw-r--r--modules/ckeditor/ckeditor_php4.php1186
-rw-r--r--modules/ckeditor/ckeditor_php5.php1166
-rw-r--r--modules/clippings/clippings_ctrl.php1304
-rw-r--r--modules/clippings/index.php638
-rw-r--r--modules/death_report/module.php2
-rw-r--r--modules/descendancy/module.php2
-rw-r--r--modules/descendancy_report/module.php2
-rw-r--r--modules/families/module.php2
-rw-r--r--modules/family_group_report/module.php2
-rw-r--r--modules/family_nav/module.php1566
-rw-r--r--modules/individual_ext_report/module.php2
-rw-r--r--modules/individual_report/module.php2
-rw-r--r--modules/individuals/module.php2
-rw-r--r--modules/marriage_report/module.php2
-rw-r--r--modules/missing_facts_report/module.php2
-rw-r--r--modules/personal_facts/module.php2
-rw-r--r--modules/relative_ext_report/module.php2
-rw-r--r--modules/relative_report/module.php2
-rw-r--r--modules/source_report/module.php2
-rw-r--r--modules/sources_tab/module.php2
-rw-r--r--themes/clouds/templates/block_main_temp.php2
-rw-r--r--themes/clouds/templates/block_small_temp.php112
-rw-r--r--themes/clouds/templates/personbox_template.php2
-rw-r--r--themes/colors/templates/block_small_temp.php112
-rw-r--r--themes/webtrees/templates/block_main_temp.php108
-rw-r--r--themes/webtrees/templates/block_small_temp.php112
-rw-r--r--themes/webtrees/templates/personbox_template.php126
38 files changed, 3429 insertions, 3429 deletions
diff --git a/includes/classes/class_module.php b/includes/classes/class_module.php
index a05d9c22ba..e7437d54bf 100644
--- a/includes/classes/class_module.php
+++ b/includes/classes/class_module.php
@@ -21,7 +21,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/js/jw_player/flvVideo.php b/js/jw_player/flvVideo.php
index d0a439223c..81edc75bed 100644
--- a/js/jw_player/flvVideo.php
+++ b/js/jw_player/flvVideo.php
@@ -1,90 +1,90 @@
-<?php
-/**
- * JW Player module for phpGedView
- *
- * Display flv video media Items using JW Player in webtrees
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2007 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 Module
- * @version $Id: flvVideo.php 8435 2010-05-24 22:52:51Z greg $
- * @author Brian Holland
- */
- ?>
-<html xmlns="http://www.w3.org/1999/xhtml" <?php // echo i18n::html_markup(); ?>>
-<head>
- <META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <title>JW Player for Flash</title>
- <script type="text/javascript" src="swfobject.js"></script>
-</head>
-<body bgcolor="#000000">
-<center>
-
-<?php
-global $pid, $GEDCOM ;
-global $flvVideo;
-$flvVideo=$_GET['flvVideo'];
-$preview="";
-// echo "<font color=white>".$flvVideo."</font>";
-?>
-
- <!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
- <!--
- <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
- <param name="movie" value="player.swf" />
- <param name="allowfullscreen" value="true" />
- <param name="allowscriptaccess" value="always" />
- <param name="flashvars" value="file=video.flv&image=preview.jpg" />
- <embed
- type="application/x-shockwave-flash"
- id="player2"
- name="player2"
- src="player.swf"
- width="400"
- height="315"
- allowscriptaccess="always"
- allowfullscreen="true"
- flashvars="file=http://www.youtube.com/watch?v=TF6cnLnEARo"
- />
- </object>
- -->
- <!-- END OF THE PLAYER EMBEDDING -->
-
-
- <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
- <script type="text/javascript">
- var video = "<?php print $flvVideo; ?>";
- var preview = "<?php print $preview; ?>";
- var s1 = new SWFObject("player.swf","ply","480","365","9","#000000");
- s1.addParam("allowfullscreen","true");
- s1.addParam("allowscriptaccess","always");
- s1.addParam("stretching","fill");
- s1.addParam("flashvars","file=" +video+ "&image=" +preview+ "&autostart=true" );
- s1.write("container");
- </script>
-
-
-
-</center>
-</body>
-</html>
+<?php
+/**
+ * JW Player module for phpGedView
+ *
+ * Display flv video media Items using JW Player in webtrees
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2007 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 Module
+ * @version $Id$
+ * @author Brian Holland
+ */
+ ?>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php // echo i18n::html_markup(); ?>>
+<head>
+ <META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <title>JW Player for Flash</title>
+ <script type="text/javascript" src="swfobject.js"></script>
+</head>
+<body bgcolor="#000000">
+<center>
+
+<?php
+global $pid, $GEDCOM ;
+global $flvVideo;
+$flvVideo=$_GET['flvVideo'];
+$preview="";
+// echo "<font color=white>".$flvVideo."</font>";
+?>
+
+ <!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
+ <!--
+ <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
+ <param name="movie" value="player.swf" />
+ <param name="allowfullscreen" value="true" />
+ <param name="allowscriptaccess" value="always" />
+ <param name="flashvars" value="file=video.flv&image=preview.jpg" />
+ <embed
+ type="application/x-shockwave-flash"
+ id="player2"
+ name="player2"
+ src="player.swf"
+ width="400"
+ height="315"
+ allowscriptaccess="always"
+ allowfullscreen="true"
+ flashvars="file=http://www.youtube.com/watch?v=TF6cnLnEARo"
+ />
+ </object>
+ -->
+ <!-- END OF THE PLAYER EMBEDDING -->
+
+
+ <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
+ <script type="text/javascript">
+ var video = "<?php print $flvVideo; ?>";
+ var preview = "<?php print $preview; ?>";
+ var s1 = new SWFObject("player.swf","ply","480","365","9","#000000");
+ s1.addParam("allowfullscreen","true");
+ s1.addParam("allowscriptaccess","always");
+ s1.addParam("stretching","fill");
+ s1.addParam("flashvars","file=" +video+ "&image=" +preview+ "&autostart=true" );
+ s1.write("container");
+ </script>
+
+
+
+</center>
+</body>
+</html>
diff --git a/js/jw_player/wmvVideo.php b/js/jw_player/wmvVideo.php
index 2ba3400609..6218966e5d 100644
--- a/js/jw_player/wmvVideo.php
+++ b/js/jw_player/wmvVideo.php
@@ -1,70 +1,70 @@
-<?php
-/**
- * JW Player module for phpGedView
- *
- * Display wmv video media Items using JW Player in PGV
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2007 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 Module
- * @version $Id: wmvVideo.php 8435 2010-05-24 22:52:51Z greg $
- * @author Brian Holland
- */
- ?>
-<html xmlns="http://www.w3.org/1999/xhtml" <?php // echo i18n::html_markup(); ?>>
-<head>
- <META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <title>JW Player for Windows Media Videos</title>
- <script type="text/javascript" src="silverlight.js"></script>
- <script type="text/javascript" src="wmvplayer.js"></script>
-</head>
-<body bgcolor="#000000">
-<center>
-
-<?php
-global $pid, $GEDCOM ;
-global $wmvVideo;
-$wmvVideo=$_GET['wmvVideo'];
-?>
-
-<div id="myplayer">The player will be placed here</div>
-
-<script type="text/javascript">
- var elm = document.getElementById("myplayer");
- var src = 'wmvplayer.xaml';
- var cfg = {
- file:'<?php echo $wmvVideo; ?>',
- <?php if (preg_match("/\.mp3$/i", $wmvVideo)) { ?>
- logo:'audio.png',
- <?php } ?>
- autostart:'true',
- overstretch:'true',
- width:'480',
- height:'365'
- };
- var ply = new jeroenwijering.Player(elm,src,cfg);
-</script>
-
-</center>
-</body>
-</html>
+<?php
+/**
+ * JW Player module for phpGedView
+ *
+ * Display wmv video media Items using JW Player in PGV
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2007 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 Module
+ * @version $Id$
+ * @author Brian Holland
+ */
+ ?>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php // echo i18n::html_markup(); ?>>
+<head>
+ <META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <title>JW Player for Windows Media Videos</title>
+ <script type="text/javascript" src="silverlight.js"></script>
+ <script type="text/javascript" src="wmvplayer.js"></script>
+</head>
+<body bgcolor="#000000">
+<center>
+
+<?php
+global $pid, $GEDCOM ;
+global $wmvVideo;
+$wmvVideo=$_GET['wmvVideo'];
+?>
+
+<div id="myplayer">The player will be placed here</div>
+
+<script type="text/javascript">
+ var elm = document.getElementById("myplayer");
+ var src = 'wmvplayer.xaml';
+ var cfg = {
+ file:'<?php echo $wmvVideo; ?>',
+ <?php if (preg_match("/\.mp3$/i", $wmvVideo)) { ?>
+ logo:'audio.png',
+ <?php } ?>
+ autostart:'true',
+ overstretch:'true',
+ width:'480',
+ height:'365'
+ };
+ var ply = new jeroenwijering.Player(elm,src,cfg);
+</script>
+
+</center>
+</body>
+</html>
diff --git a/modules/address_label_report/module.php b/modules/address_label_report/module.php
index e070897360..ef800ea159 100644
--- a/modules/address_label_report/module.php
+++ b/modules/address_label_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/address_report/module.php b/modules/address_report/module.php
index 0792e0f793..4c3dfa3a37 100644
--- a/modules/address_report/module.php
+++ b/modules/address_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/ahnentafel_report/module.php b/modules/ahnentafel_report/module.php
index 6359d2d042..52b65a1bef 100644
--- a/modules/ahnentafel_report/module.php
+++ b/modules/ahnentafel_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/bdm_report/module.php b/modules/bdm_report/module.php
index 623e5662af..e7bfd2cc89 100644
--- a/modules/bdm_report/module.php
+++ b/modules/bdm_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/birth_report/module.php b/modules/birth_report/module.php
index dfa529e7d7..3ce15e6f3d 100644
--- a/modules/birth_report/module.php
+++ b/modules/birth_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/cemetery_report/module.php b/modules/cemetery_report/module.php
index 4c42fc71de..04bd68c5d2 100644
--- a/modules/cemetery_report/module.php
+++ b/modules/cemetery_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/change_report/module.php b/modules/change_report/module.php
index 8cd01f85aa..c7f69bc5ee 100644
--- a/modules/change_report/module.php
+++ b/modules/change_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/ckeditor/ckeditor.php b/modules/ckeditor/ckeditor.php
index edbc70376a..f9bf5506f7 100644
--- a/modules/ckeditor/ckeditor.php
+++ b/modules/ckeditor/ckeditor.php
@@ -1,29 +1,29 @@
-<?php
-/*
- * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-/*! \mainpage CKEditor - PHP server side intergation
- * \section intro_sec CKEditor
- * Visit <a href="http://ckeditor.com">CKEditor web site</a> to find more information about the editor.
- * \section install_sec Installation
- * \subsection step1 Include ckeditor.php in your PHP web site.
- * @code
- * <?php
- * include("ckeditor/ckeditor.php");
- * ?>
- * @endcode
- * \subsection step2 Create CKEditor class instance and use one of available methods to insert CKEditor.
- * @code
- * <?php
- * $CKEditor = new CKEditor();
- * echo $CKEditor->textarea("field1", "<p>Initial value.</p>");
- * ?>
- * @endcode
- */
-
-if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
- include_once( 'ckeditor_php4.php' ) ;
-else
- include_once( 'ckeditor_php5.php' ) ;
+<?php
+/*
+ * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.html or http://ckeditor.com/license
+ */
+
+/*! \mainpage CKEditor - PHP server side intergation
+ * \section intro_sec CKEditor
+ * Visit <a href="http://ckeditor.com">CKEditor web site</a> to find more information about the editor.
+ * \section install_sec Installation
+ * \subsection step1 Include ckeditor.php in your PHP web site.
+ * @code
+ * <?php
+ * include("ckeditor/ckeditor.php");
+ * ?>
+ * @endcode
+ * \subsection step2 Create CKEditor class instance and use one of available methods to insert CKEditor.
+ * @code
+ * <?php
+ * $CKEditor = new CKEditor();
+ * echo $CKEditor->textarea("field1", "<p>Initial value.</p>");
+ * ?>
+ * @endcode
+ */
+
+if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
+ include_once( 'ckeditor_php4.php' ) ;
+else
+ include_once( 'ckeditor_php5.php' ) ;
diff --git a/modules/ckeditor/ckeditor_php4.php b/modules/ckeditor/ckeditor_php4.php
index ff279357dc..7131dd4cb6 100644
--- a/modules/ckeditor/ckeditor_php4.php
+++ b/modules/ckeditor/ckeditor_php4.php
@@ -1,593 +1,593 @@
-<?php
-/*
-* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-* For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * \brief CKEditor class that can be used to create editor
- * instances in PHP pages on server side.
- * @see http://ckeditor.com
- *
- * Sample usage:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->editor("editor1", "<p>Initial value.</p>");
- * @endcode
- */
-class CKEditor
-{
- /**
- * The version of %CKEditor.
- * \private
- */
- var $version = '3.2.2';
- /**
- * A constant string unique for each release of %CKEditor.
- * \private
- */
- var $_timestamp = 'A4SD49X';
-
- /**
- * URL to the %CKEditor installation directory (absolute or relative to document root).
- * If not set, CKEditor will try to guess it's path.
- *
- * Example usage:
- * @code
- * $CKEditor->basePath = '/ckeditor/';
- * @endcode
- */
- var $basePath;
- /**
- * An array that holds the global %CKEditor configuration.
- * For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
- *
- * Example usage:
- * @code
- * $CKEditor->config['height'] = 400;
- * // Use @@ at the beggining of a string to ouput it without surrounding quotes.
- * $CKEditor->config['width'] = '@@screen.width * 0.8';
- * @endcode
- */
- var $config = array();
- /**
- * A boolean variable indicating whether CKEditor has been initialized.
- * Set it to true only if you have already included
- * &lt;script&gt; tag loading ckeditor.js in your website.
- */
- var $initialized = false;
- /**
- * Boolean variable indicating whether created code should be printed out or returned by a function.
- *
- * Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->returnOutput = true;
- * $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
- * echo "<p>Editor 1:</p>";
- * echo $code;
- * @endcode
- */
- var $returnOutput = false;
- /**
- * An array with textarea attributes.
- *
- * When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created,
- * it will be displayed to anyone with JavaScript disabled or with incompatible browser.
- */
- var $textareaAttributes = array( "rows" => 8, "cols" => 60 );
- /**
- * A string indicating the creation date of %CKEditor.
- * Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
- */
- var $timestamp = "A4SD49X";
- /**
- * An array that holds event listeners.
- * \private
- */
- var $_events = array();
- /**
- * An array that holds global event listeners.
- * \private
- */
- var $_globalEvents = array();
-
- /**
- * Main Constructor.
- *
- * @param $basePath (string) URL to the %CKEditor installation directory (optional).
- */
- function CKEditor($basePath = null) {
- if (!empty($basePath)) {
- $this->basePath = $basePath;
- }
- }
-
- /**
- * Creates a %CKEditor instance.
- * In incompatible browsers %CKEditor will downgrade to plain HTML &lt;textarea&gt; element.
- *
- * @param $name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
- * @param $value (string) Initial value (optional).
- * @param $config (array) The specific configurations to apply to this editor instance (optional).
- * @param $events (array) Event listeners for this editor instance (optional).
- *
- * Example usage:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->editor("field1", "<p>Initial value.</p>");
- * @endcode
- *
- * Advanced example:
- * @code
- * $CKEditor = new CKEditor();
- * $config = array();
- * $config['toolbar'] = array(
- * array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
- * array( 'Image', 'Link', 'Unlink', 'Anchor' )
- * );
- * $events['instanceReady'] = 'function (ev) {
- * alert("Loaded: " + ev.editor.name);
- * }';
- * $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);
- * @endcode
- */
- function editor($name, $value = "", $config = array(), $events = array())
- {
- $attr = "";
- foreach ($this->textareaAttributes as $key => $val) {
- $attr.= " " . $key . '="' . str_replace('"', '&quot;', $val) . '"';
- }
- $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings($config, $events);
-
- $js = $this->returnGlobalEvents();
- if (!empty($_config))
- $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
- else
- $js .= "CKEDITOR.replace('".$name."');";
-
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Replaces a &lt;textarea&gt; with a %CKEditor instance.
- *
- * @param $id (string) The id or name of textarea element.
- * @param $config (array) The specific configurations to apply to this editor instance (optional).
- * @param $events (array) Event listeners for this editor instance (optional).
- *
- * Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replace("article");
- * @endcode
- */
- function replace($id, $config = array(), $events = array())
- {
- $out = "";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings($config, $events);
-
- $js = $this->returnGlobalEvents();
- if (!empty($_config)) {
- $js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
- }
- else {
- $js .= "CKEDITOR.replace('".$id."');";
- }
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Replace all &lt;textarea&gt; elements available in the document with editor instances.
- *
- * @param $className (string) If set, replace all textareas with class className in the page.
- *
- * Example 1: replace all &lt;textarea&gt; elements in the page.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replaceAll();
- * @endcode
- *
- * Example 2: replace all &lt;textarea class="myClassName"&gt; elements in the page.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replaceAll( 'myClassName' );
- * @endcode
- */
- function replaceAll($className = null)
- {
- $out = "";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings();
-
- $js = $this->returnGlobalEvents();
- if (empty($_config)) {
- if (empty($className)) {
- $js .= "CKEDITOR.replaceAll();";
- }
- else {
- $js .= "CKEDITOR.replaceAll('".$className."');";
- }
- }
- else {
- $classDetection = "";
- $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
- if (!empty($className)) {
- $js .= " var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
- $js .= " if (!classRegex.test(textarea.className))\n";
- $js .= " return false;\n";
- }
- $js .= " CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
- $js .= "} );";
-
- }
-
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Adds event listener.
- * Events are fired by %CKEditor in various situations.
- *
- * @param $event (string) Event name.
- * @param $javascriptCode (string) Javascript anonymous function or function name.
- *
- * Example usage:
- * @code
- * $CKEditor->addEventHandler('instanceReady', 'function (ev) {
- * alert("Loaded: " + ev.editor.name);
- * }');
- * @endcode
- */
- function addEventHandler($event, $javascriptCode)
- {
- if (!isset($this->_events[$event])) {
- $this->_events[$event] = array();
- }
- // Avoid duplicates.
- if (!in_array($javascriptCode, $this->_events[$event])) {
- $this->_events[$event][] = $javascriptCode;
- }
- }
-
- /**
- * Clear registered event handlers.
- * Note: this function will have no effect on already created editor instances.
- *
- * @param $event (string) Event name, if not set all event handlers will be removed (optional).
- */
- function clearEventHandlers($event = null)
- {
- if (!empty($event)) {
- $this->_events[$event] = array();
- }
- else {
- $this->_events = array();
- }
- }
-
- /**
- * Adds global event listener.
- *
- * @param $event (string) Event name.
- * @param $javascriptCode (string) Javascript anonymous function or function name.
- *
- * Example usage:
- * @code
- * $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
- * alert("Loading dialog: " + ev.data.name);
- * }');
- * @endcode
- */
- function addGlobalEventHandler($event, $javascriptCode)
- {
- if (!isset($this->_globalEvents[$event])) {
- $this->_globalEvents[$event] = array();
- }
- // Avoid duplicates.
- if (!in_array($javascriptCode, $this->_globalEvents[$event])) {
- $this->_globalEvents[$event][] = $javascriptCode;
- }
- }
-
- /**
- * Clear registered global event handlers.
- * Note: this function will have no effect if the event handler has been already printed/returned.
- *
- * @param $event (string) Event name, if not set all event handlers will be removed (optional).
- */
- function clearGlobalEventHandlers($event = null)
- {
- if (!empty($event)) {
- $this->_globalEvents[$event] = array();
- }
- else {
- $this->_globalEvents = array();
- }
- }
-
- /**
- * Prints javascript code.
- * \private
- *
- * @param string $js
- */
- function script($js)
- {
- $out = "<script type=\"text/javascript\">";
- $out .= "//<![CDATA[\n";
- $out .= $js;
- $out .= "\n//]]>";
- $out .= "</script>\n";
-
- return $out;
- }
-
- /**
- * Returns the configuration array (global and instance specific settings are merged into one array).
- * \private
- *
- * @param $config (array) The specific configurations to apply to editor instance.
- * @param $events (array) Event listeners for editor instance.
- */
- function configSettings($config = array(), $events = array())
- {
- $_config = $this->config;
- $_events = $this->_events;
-
- if (is_array($config) && !empty($config)) {
- $_config = array_merge($_config, $config);
- }
-
- if (is_array($events) && !empty($events)) {
- foreach ($events as $eventName => $code) {
- if (!isset($_events[$eventName])) {
- $_events[$eventName] = array();
- }
- if (!in_array($code, $_events[$eventName])) {
- $_events[$eventName][] = $code;
- }
- }
- }
-
- if (!empty($_events)) {
- foreach($_events as $eventName => $handlers) {
- if (empty($handlers)) {
- continue;
- }
- else if (count($handlers) == 1) {
- $_config['on'][$eventName] = '@@'.$handlers[0];
- }
- else {
- $_config['on'][$eventName] = '@@function (ev){';
- foreach ($handlers as $handler => $code) {
- $_config['on'][$eventName] .= '('.$code.')(ev);';
- }
- $_config['on'][$eventName] .= '}';
- }
- }
- }
-
- return $_config;
- }
-
- /**
- * Return global event handlers.
- * \private
- */
- function returnGlobalEvents()
- {
- static $returnedEvents;
- $out = "";
-
- if (!isset($returnedEvents)) {
- $returnedEvents = array();
- }
-
- if (!empty($this->_globalEvents)) {
- foreach ($this->_globalEvents as $eventName => $handlers) {
- foreach ($handlers as $handler => $code) {
- if (!isset($returnedEvents[$eventName])) {
- $returnedEvents[$eventName] = array();
- }
- // Return only new events
- if (!in_array($code, $returnedEvents[$eventName])) {
- $out .= ($code ? "\n" : "") . "CKEDITOR.on('". $eventName ."', $code);";
- $returnedEvents[$eventName][] = $code;
- }
- }
- }
- }
-
- return $out;
- }
-
- /**
- * Initializes CKEditor (executed only once).
- * \private
- */
- function init()
- {
- static $initComplete;
- $out = "";
-
- if (!empty($initComplete)) {
- return "";
- }
-
- if ($this->initialized) {
- $initComplete = true;
- return "";
- }
-
- $args = "";
- $ckeditorPath = $this->ckeditorPath();
-
- if (!empty($this->timestamp) && $this->timestamp != "%"."TIMESTAMP%") {
- $args = '?t=' . $this->timestamp;
- }
-
- // Skip relative paths...
- if (strpos($ckeditorPath, '..') !== 0) {
- $out .= $this->script("window.CKEDITOR_BASEPATH='". $ckeditorPath ."';");
- }
-
- $out .= "<script type=\"text/javascript\" src=\"" . $ckeditorPath . 'ckeditor.js' . $args . "\"></script>\n";
-
- $extraCode = "";
- if ($this->timestamp != $this->_timestamp) {
- $extraCode .= ($extraCode ? "\n" : "") . "CKEDITOR.timestamp = '". $this->timestamp ."';";
- }
- if ($extraCode) {
- $out .= $this->script($extraCode);
- }
-
- $initComplete = $this->initialized = true;
-
- return $out;
- }
-
- /**
- * Return path to ckeditor.js.
- * \private
- */
- function ckeditorPath()
- {
- if (!empty($this->basePath)) {
- return $this->basePath;
- }
-
- /**
- * The absolute pathname of the currently executing script.
- * Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
- * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
- */
- if (isset($_SERVER['SCRIPT_FILENAME'])) {
- $realPath = dirname($_SERVER['SCRIPT_FILENAME']);
- }
- else {
- /**
- * realpath — Returns canonicalized absolute pathname
- */
- $realPath = realpath( './' ) ;
- }
-
- /**
- * The filename of the currently executing script, relative to the document root.
- * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
- * would be /test.php/foo.bar.
- */
- $selfPath = dirname($_SERVER['PHP_SELF']);
- $file = str_replace("\\", "/", __FILE__);
-
- if (!$selfPath || !$realPath || !$file) {
- return "/ckeditor/";
- }
-
- $documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath));
- $fileUrl = substr($file, strlen($documentRoot));
- $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl);
-
- return $ckeditorUrl;
- }
-
- /**
- * This little function provides a basic JSON support.
- * http://php.net/manual/en/function.json-encode.php
- * \private
- *
- * @param mixed $val
- * @return string
- */
- function jsEncode($val)
- {
- if (is_null($val)) {
- return 'null';
- }
- if ($val === false) {
- return 'false';
- }
- if ($val === true) {
- return 'true';
- }
- if (is_scalar($val))
- {
- if (is_float($val))
- {
- // Always use "." for floats.
- $val = str_replace(",", ".", strval($val));
- }
-
- // Use @@ to not use quotes when outputting string value
- if (strpos($val, '@@') === 0) {
- return substr($val, 2);
- }
- else {
- // All scalars are converted to strings to avoid indeterminism.
- // PHP's "1" and 1 are equal for all PHP operators, but
- // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend,
- // we should get the same result in the JS frontend (string).
- // Character replacements for JSON.
- static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'),
- array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
-
- $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);
-
- return '"' . $val . '"';
- }
- }
- $isList = true;
- for ($i = 0, reset($val); $i < count($val); $i++, next($val))
- {
- if (key($val) !== $i)
- {
- $isList = false;
- break;
- }
- }
- $result = array();
- if ($isList)
- {
- foreach ($val as $v) $result[] = $this->jsEncode($v);
- return '[ ' . join(', ', $result) . ' ]';
- }
- else
- {
- foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);
- return '{ ' . join(', ', $result) . ' }';
- }
- }
-}
+<?php
+/*
+* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+* For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+/**
+ * \brief CKEditor class that can be used to create editor
+ * instances in PHP pages on server side.
+ * @see http://ckeditor.com
+ *
+ * Sample usage:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->editor("editor1", "<p>Initial value.</p>");
+ * @endcode
+ */
+class CKEditor
+{
+ /**
+ * The version of %CKEditor.
+ * \private
+ */
+ var $version = '3.2.2';
+ /**
+ * A constant string unique for each release of %CKEditor.
+ * \private
+ */
+ var $_timestamp = 'A4SD49X';
+
+ /**
+ * URL to the %CKEditor installation directory (absolute or relative to document root).
+ * If not set, CKEditor will try to guess it's path.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->basePath = '/ckeditor/';
+ * @endcode
+ */
+ var $basePath;
+ /**
+ * An array that holds the global %CKEditor configuration.
+ * For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->config['height'] = 400;
+ * // Use @@ at the beggining of a string to ouput it without surrounding quotes.
+ * $CKEditor->config['width'] = '@@screen.width * 0.8';
+ * @endcode
+ */
+ var $config = array();
+ /**
+ * A boolean variable indicating whether CKEditor has been initialized.
+ * Set it to true only if you have already included
+ * &lt;script&gt; tag loading ckeditor.js in your website.
+ */
+ var $initialized = false;
+ /**
+ * Boolean variable indicating whether created code should be printed out or returned by a function.
+ *
+ * Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->returnOutput = true;
+ * $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
+ * echo "<p>Editor 1:</p>";
+ * echo $code;
+ * @endcode
+ */
+ var $returnOutput = false;
+ /**
+ * An array with textarea attributes.
+ *
+ * When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created,
+ * it will be displayed to anyone with JavaScript disabled or with incompatible browser.
+ */
+ var $textareaAttributes = array( "rows" => 8, "cols" => 60 );
+ /**
+ * A string indicating the creation date of %CKEditor.
+ * Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
+ */
+ var $timestamp = "A4SD49X";
+ /**
+ * An array that holds event listeners.
+ * \private
+ */
+ var $_events = array();
+ /**
+ * An array that holds global event listeners.
+ * \private
+ */
+ var $_globalEvents = array();
+
+ /**
+ * Main Constructor.
+ *
+ * @param $basePath (string) URL to the %CKEditor installation directory (optional).
+ */
+ function CKEditor($basePath = null) {
+ if (!empty($basePath)) {
+ $this->basePath = $basePath;
+ }
+ }
+
+ /**
+ * Creates a %CKEditor instance.
+ * In incompatible browsers %CKEditor will downgrade to plain HTML &lt;textarea&gt; element.
+ *
+ * @param $name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
+ * @param $value (string) Initial value (optional).
+ * @param $config (array) The specific configurations to apply to this editor instance (optional).
+ * @param $events (array) Event listeners for this editor instance (optional).
+ *
+ * Example usage:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->editor("field1", "<p>Initial value.</p>");
+ * @endcode
+ *
+ * Advanced example:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $config = array();
+ * $config['toolbar'] = array(
+ * array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
+ * array( 'Image', 'Link', 'Unlink', 'Anchor' )
+ * );
+ * $events['instanceReady'] = 'function (ev) {
+ * alert("Loaded: " + ev.editor.name);
+ * }';
+ * $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);
+ * @endcode
+ */
+ function editor($name, $value = "", $config = array(), $events = array())
+ {
+ $attr = "";
+ foreach ($this->textareaAttributes as $key => $val) {
+ $attr.= " " . $key . '="' . str_replace('"', '&quot;', $val) . '"';
+ }
+ $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings($config, $events);
+
+ $js = $this->returnGlobalEvents();
+ if (!empty($_config))
+ $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
+ else
+ $js .= "CKEDITOR.replace('".$name."');";
+
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Replaces a &lt;textarea&gt; with a %CKEditor instance.
+ *
+ * @param $id (string) The id or name of textarea element.
+ * @param $config (array) The specific configurations to apply to this editor instance (optional).
+ * @param $events (array) Event listeners for this editor instance (optional).
+ *
+ * Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replace("article");
+ * @endcode
+ */
+ function replace($id, $config = array(), $events = array())
+ {
+ $out = "";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings($config, $events);
+
+ $js = $this->returnGlobalEvents();
+ if (!empty($_config)) {
+ $js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
+ }
+ else {
+ $js .= "CKEDITOR.replace('".$id."');";
+ }
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Replace all &lt;textarea&gt; elements available in the document with editor instances.
+ *
+ * @param $className (string) If set, replace all textareas with class className in the page.
+ *
+ * Example 1: replace all &lt;textarea&gt; elements in the page.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replaceAll();
+ * @endcode
+ *
+ * Example 2: replace all &lt;textarea class="myClassName"&gt; elements in the page.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replaceAll( 'myClassName' );
+ * @endcode
+ */
+ function replaceAll($className = null)
+ {
+ $out = "";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings();
+
+ $js = $this->returnGlobalEvents();
+ if (empty($_config)) {
+ if (empty($className)) {
+ $js .= "CKEDITOR.replaceAll();";
+ }
+ else {
+ $js .= "CKEDITOR.replaceAll('".$className."');";
+ }
+ }
+ else {
+ $classDetection = "";
+ $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
+ if (!empty($className)) {
+ $js .= " var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
+ $js .= " if (!classRegex.test(textarea.className))\n";
+ $js .= " return false;\n";
+ }
+ $js .= " CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
+ $js .= "} );";
+
+ }
+
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Adds event listener.
+ * Events are fired by %CKEditor in various situations.
+ *
+ * @param $event (string) Event name.
+ * @param $javascriptCode (string) Javascript anonymous function or function name.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->addEventHandler('instanceReady', 'function (ev) {
+ * alert("Loaded: " + ev.editor.name);
+ * }');
+ * @endcode
+ */
+ function addEventHandler($event, $javascriptCode)
+ {
+ if (!isset($this->_events[$event])) {
+ $this->_events[$event] = array();
+ }
+ // Avoid duplicates.
+ if (!in_array($javascriptCode, $this->_events[$event])) {
+ $this->_events[$event][] = $javascriptCode;
+ }
+ }
+
+ /**
+ * Clear registered event handlers.
+ * Note: this function will have no effect on already created editor instances.
+ *
+ * @param $event (string) Event name, if not set all event handlers will be removed (optional).
+ */
+ function clearEventHandlers($event = null)
+ {
+ if (!empty($event)) {
+ $this->_events[$event] = array();
+ }
+ else {
+ $this->_events = array();
+ }
+ }
+
+ /**
+ * Adds global event listener.
+ *
+ * @param $event (string) Event name.
+ * @param $javascriptCode (string) Javascript anonymous function or function name.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
+ * alert("Loading dialog: " + ev.data.name);
+ * }');
+ * @endcode
+ */
+ function addGlobalEventHandler($event, $javascriptCode)
+ {
+ if (!isset($this->_globalEvents[$event])) {
+ $this->_globalEvents[$event] = array();
+ }
+ // Avoid duplicates.
+ if (!in_array($javascriptCode, $this->_globalEvents[$event])) {
+ $this->_globalEvents[$event][] = $javascriptCode;
+ }
+ }
+
+ /**
+ * Clear registered global event handlers.
+ * Note: this function will have no effect if the event handler has been already printed/returned.
+ *
+ * @param $event (string) Event name, if not set all event handlers will be removed (optional).
+ */
+ function clearGlobalEventHandlers($event = null)
+ {
+ if (!empty($event)) {
+ $this->_globalEvents[$event] = array();
+ }
+ else {
+ $this->_globalEvents = array();
+ }
+ }
+
+ /**
+ * Prints javascript code.
+ * \private
+ *
+ * @param string $js
+ */
+ function script($js)
+ {
+ $out = "<script type=\"text/javascript\">";
+ $out .= "//<![CDATA[\n";
+ $out .= $js;
+ $out .= "\n//]]>";
+ $out .= "</script>\n";
+
+ return $out;
+ }
+
+ /**
+ * Returns the configuration array (global and instance specific settings are merged into one array).
+ * \private
+ *
+ * @param $config (array) The specific configurations to apply to editor instance.
+ * @param $events (array) Event listeners for editor instance.
+ */
+ function configSettings($config = array(), $events = array())
+ {
+ $_config = $this->config;
+ $_events = $this->_events;
+
+ if (is_array($config) && !empty($config)) {
+ $_config = array_merge($_config, $config);
+ }
+
+ if (is_array($events) && !empty($events)) {
+ foreach ($events as $eventName => $code) {
+ if (!isset($_events[$eventName])) {
+ $_events[$eventName] = array();
+ }
+ if (!in_array($code, $_events[$eventName])) {
+ $_events[$eventName][] = $code;
+ }
+ }
+ }
+
+ if (!empty($_events)) {
+ foreach($_events as $eventName => $handlers) {
+ if (empty($handlers)) {
+ continue;
+ }
+ else if (count($handlers) == 1) {
+ $_config['on'][$eventName] = '@@'.$handlers[0];
+ }
+ else {
+ $_config['on'][$eventName] = '@@function (ev){';
+ foreach ($handlers as $handler => $code) {
+ $_config['on'][$eventName] .= '('.$code.')(ev);';
+ }
+ $_config['on'][$eventName] .= '}';
+ }
+ }
+ }
+
+ return $_config;
+ }
+
+ /**
+ * Return global event handlers.
+ * \private
+ */
+ function returnGlobalEvents()
+ {
+ static $returnedEvents;
+ $out = "";
+
+ if (!isset($returnedEvents)) {
+ $returnedEvents = array();
+ }
+
+ if (!empty($this->_globalEvents)) {
+ foreach ($this->_globalEvents as $eventName => $handlers) {
+ foreach ($handlers as $handler => $code) {
+ if (!isset($returnedEvents[$eventName])) {
+ $returnedEvents[$eventName] = array();
+ }
+ // Return only new events
+ if (!in_array($code, $returnedEvents[$eventName])) {
+ $out .= ($code ? "\n" : "") . "CKEDITOR.on('". $eventName ."', $code);";
+ $returnedEvents[$eventName][] = $code;
+ }
+ }
+ }
+ }
+
+ return $out;
+ }
+
+ /**
+ * Initializes CKEditor (executed only once).
+ * \private
+ */
+ function init()
+ {
+ static $initComplete;
+ $out = "";
+
+ if (!empty($initComplete)) {
+ return "";
+ }
+
+ if ($this->initialized) {
+ $initComplete = true;
+ return "";
+ }
+
+ $args = "";
+ $ckeditorPath = $this->ckeditorPath();
+
+ if (!empty($this->timestamp) && $this->timestamp != "%"."TIMESTAMP%") {
+ $args = '?t=' . $this->timestamp;
+ }
+
+ // Skip relative paths...
+ if (strpos($ckeditorPath, '..') !== 0) {
+ $out .= $this->script("window.CKEDITOR_BASEPATH='". $ckeditorPath ."';");
+ }
+
+ $out .= "<script type=\"text/javascript\" src=\"" . $ckeditorPath . 'ckeditor.js' . $args . "\"></script>\n";
+
+ $extraCode = "";
+ if ($this->timestamp != $this->_timestamp) {
+ $extraCode .= ($extraCode ? "\n" : "") . "CKEDITOR.timestamp = '". $this->timestamp ."';";
+ }
+ if ($extraCode) {
+ $out .= $this->script($extraCode);
+ }
+
+ $initComplete = $this->initialized = true;
+
+ return $out;
+ }
+
+ /**
+ * Return path to ckeditor.js.
+ * \private
+ */
+ function ckeditorPath()
+ {
+ if (!empty($this->basePath)) {
+ return $this->basePath;
+ }
+
+ /**
+ * The absolute pathname of the currently executing script.
+ * Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
+ * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
+ */
+ if (isset($_SERVER['SCRIPT_FILENAME'])) {
+ $realPath = dirname($_SERVER['SCRIPT_FILENAME']);
+ }
+ else {
+ /**
+ * realpath — Returns canonicalized absolute pathname
+ */
+ $realPath = realpath( './' ) ;
+ }
+
+ /**
+ * The filename of the currently executing script, relative to the document root.
+ * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
+ * would be /test.php/foo.bar.
+ */
+ $selfPath = dirname($_SERVER['PHP_SELF']);
+ $file = str_replace("\\", "/", __FILE__);
+
+ if (!$selfPath || !$realPath || !$file) {
+ return "/ckeditor/";
+ }
+
+ $documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath));
+ $fileUrl = substr($file, strlen($documentRoot));
+ $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl);
+
+ return $ckeditorUrl;
+ }
+
+ /**
+ * This little function provides a basic JSON support.
+ * http://php.net/manual/en/function.json-encode.php
+ * \private
+ *
+ * @param mixed $val
+ * @return string
+ */
+ function jsEncode($val)
+ {
+ if (is_null($val)) {
+ return 'null';
+ }
+ if ($val === false) {
+ return 'false';
+ }
+ if ($val === true) {
+ return 'true';
+ }
+ if (is_scalar($val))
+ {
+ if (is_float($val))
+ {
+ // Always use "." for floats.
+ $val = str_replace(",", ".", strval($val));
+ }
+
+ // Use @@ to not use quotes when outputting string value
+ if (strpos($val, '@@') === 0) {
+ return substr($val, 2);
+ }
+ else {
+ // All scalars are converted to strings to avoid indeterminism.
+ // PHP's "1" and 1 are equal for all PHP operators, but
+ // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend,
+ // we should get the same result in the JS frontend (string).
+ // Character replacements for JSON.
+ static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'),
+ array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
+
+ $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);
+
+ return '"' . $val . '"';
+ }
+ }
+ $isList = true;
+ for ($i = 0, reset($val); $i < count($val); $i++, next($val))
+ {
+ if (key($val) !== $i)
+ {
+ $isList = false;
+ break;
+ }
+ }
+ $result = array();
+ if ($isList)
+ {
+ foreach ($val as $v) $result[] = $this->jsEncode($v);
+ return '[ ' . join(', ', $result) . ' ]';
+ }
+ else
+ {
+ foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);
+ return '{ ' . join(', ', $result) . ' }';
+ }
+ }
+}
diff --git a/modules/ckeditor/ckeditor_php5.php b/modules/ckeditor/ckeditor_php5.php
index 7844a43446..fd4cddd343 100644
--- a/modules/ckeditor/ckeditor_php5.php
+++ b/modules/ckeditor/ckeditor_php5.php
@@ -1,583 +1,583 @@
-<?php
-/*
-* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-* For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * \brief CKEditor class that can be used to create editor
- * instances in PHP pages on server side.
- * @see http://ckeditor.com
- *
- * Sample usage:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->editor("editor1", "<p>Initial value.</p>");
- * @endcode
- */
-class CKEditor
-{
- /**
- * The version of %CKEditor.
- */
- const version = '3.2.2';
- /**
- * A constant string unique for each release of %CKEditor.
- */
- const timestamp = 'A4SD49X';
-
- /**
- * URL to the %CKEditor installation directory (absolute or relative to document root).
- * If not set, CKEditor will try to guess it's path.
- *
- * Example usage:
- * @code
- * $CKEditor->basePath = '/ckeditor/';
- * @endcode
- */
- public $basePath;
- /**
- * An array that holds the global %CKEditor configuration.
- * For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
- *
- * Example usage:
- * @code
- * $CKEditor->config['height'] = 400;
- * // Use @@ at the beggining of a string to ouput it without surrounding quotes.
- * $CKEditor->config['width'] = '@@screen.width * 0.8';
- * @endcode
- */
- public $config = array();
- /**
- * A boolean variable indicating whether CKEditor has been initialized.
- * Set it to true only if you have already included
- * &lt;script&gt; tag loading ckeditor.js in your website.
- */
- public $initialized = false;
- /**
- * Boolean variable indicating whether created code should be printed out or returned by a function.
- *
- * Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->returnOutput = true;
- * $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
- * echo "<p>Editor 1:</p>";
- * echo $code;
- * @endcode
- */
- public $returnOutput = false;
- /**
- * An array with textarea attributes.
- *
- * When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created,
- * it will be displayed to anyone with JavaScript disabled or with incompatible browser.
- */
- public $textareaAttributes = array( "rows" => 8, "cols" => 60 );
- /**
- * A string indicating the creation date of %CKEditor.
- * Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
- */
- public $timestamp = "A4SD49X";
- /**
- * An array that holds event listeners.
- */
- private $events = array();
- /**
- * An array that holds global event listeners.
- */
- private $globalEvents = array();
-
- /**
- * Main Constructor.
- *
- * @param $basePath (string) URL to the %CKEditor installation directory (optional).
- */
- function __construct($basePath = null) {
- if (!empty($basePath)) {
- $this->basePath = $basePath;
- }
- }
-
- /**
- * Creates a %CKEditor instance.
- * In incompatible browsers %CKEditor will downgrade to plain HTML &lt;textarea&gt; element.
- *
- * @param $name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
- * @param $value (string) Initial value (optional).
- * @param $config (array) The specific configurations to apply to this editor instance (optional).
- * @param $events (array) Event listeners for this editor instance (optional).
- *
- * Example usage:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->editor("field1", "<p>Initial value.</p>");
- * @endcode
- *
- * Advanced example:
- * @code
- * $CKEditor = new CKEditor();
- * $config = array();
- * $config['toolbar'] = array(
- * array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
- * array( 'Image', 'Link', 'Unlink', 'Anchor' )
- * );
- * $events['instanceReady'] = 'function (ev) {
- * alert("Loaded: " + ev.editor.name);
- * }';
- * $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);
- * @endcode
- */
- public function editor($name, $value = "", $config = array(), $events = array())
- {
- $attr = "";
- foreach ($this->textareaAttributes as $key => $val) {
- $attr.= " " . $key . '="' . str_replace('"', '&quot;', $val) . '"';
- }
- $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings($config, $events);
-
- $js = $this->returnGlobalEvents();
- if (!empty($_config))
- $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
- else
- $js .= "CKEDITOR.replace('".$name."');";
-
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Replaces a &lt;textarea&gt; with a %CKEditor instance.
- *
- * @param $id (string) The id or name of textarea element.
- * @param $config (array) The specific configurations to apply to this editor instance (optional).
- * @param $events (array) Event listeners for this editor instance (optional).
- *
- * Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element:
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replace("article");
- * @endcode
- */
- public function replace($id, $config = array(), $events = array())
- {
- $out = "";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings($config, $events);
-
- $js = $this->returnGlobalEvents();
- if (!empty($_config)) {
- $js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
- }
- else {
- $js .= "CKEDITOR.replace('".$id."');";
- }
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Replace all &lt;textarea&gt; elements available in the document with editor instances.
- *
- * @param $className (string) If set, replace all textareas with class className in the page.
- *
- * Example 1: replace all &lt;textarea&gt; elements in the page.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replaceAll();
- * @endcode
- *
- * Example 2: replace all &lt;textarea class="myClassName"&gt; elements in the page.
- * @code
- * $CKEditor = new CKEditor();
- * $CKEditor->replaceAll( 'myClassName' );
- * @endcode
- */
- public function replaceAll($className = null)
- {
- $out = "";
- if (!$this->initialized) {
- $out .= $this->init();
- }
-
- $_config = $this->configSettings();
-
- $js = $this->returnGlobalEvents();
- if (empty($_config)) {
- if (empty($className)) {
- $js .= "CKEDITOR.replaceAll();";
- }
- else {
- $js .= "CKEDITOR.replaceAll('".$className."');";
- }
- }
- else {
- $classDetection = "";
- $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
- if (!empty($className)) {
- $js .= " var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
- $js .= " if (!classRegex.test(textarea.className))\n";
- $js .= " return false;\n";
- }
- $js .= " CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
- $js .= "} );";
-
- }
-
- $out .= $this->script($js);
-
- if (!$this->returnOutput) {
- print $out;
- $out = "";
- }
-
- return $out;
- }
-
- /**
- * Adds event listener.
- * Events are fired by %CKEditor in various situations.
- *
- * @param $event (string) Event name.
- * @param $javascriptCode (string) Javascript anonymous function or function name.
- *
- * Example usage:
- * @code
- * $CKEditor->addEventHandler('instanceReady', 'function (ev) {
- * alert("Loaded: " + ev.editor.name);
- * }');
- * @endcode
- */
- public function addEventHandler($event, $javascriptCode)
- {
- if (!isset($this->events[$event])) {
- $this->events[$event] = array();
- }
- // Avoid duplicates.
- if (!in_array($javascriptCode, $this->events[$event])) {
- $this->events[$event][] = $javascriptCode;
- }
- }
-
- /**
- * Clear registered event handlers.
- * Note: this function will have no effect on already created editor instances.
- *
- * @param $event (string) Event name, if not set all event handlers will be removed (optional).
- */
- public function clearEventHandlers($event = null)
- {
- if (!empty($event)) {
- $this->events[$event] = array();
- }
- else {
- $this->events = array();
- }
- }
-
- /**
- * Adds global event listener.
- *
- * @param $event (string) Event name.
- * @param $javascriptCode (string) Javascript anonymous function or function name.
- *
- * Example usage:
- * @code
- * $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
- * alert("Loading dialog: " + ev.data.name);
- * }');
- * @endcode
- */
- public function addGlobalEventHandler($event, $javascriptCode)
- {
- if (!isset($this->globalEvents[$event])) {
- $this->globalEvents[$event] = array();
- }
- // Avoid duplicates.
- if (!in_array($javascriptCode, $this->globalEvents[$event])) {
- $this->globalEvents[$event][] = $javascriptCode;
- }
- }
-
- /**
- * Clear registered global event handlers.
- * Note: this function will have no effect if the event handler has been already printed/returned.
- *
- * @param $event (string) Event name, if not set all event handlers will be removed (optional).
- */
- public function clearGlobalEventHandlers($event = null)
- {
- if (!empty($event)) {
- $this->globalEvents[$event] = array();
- }
- else {
- $this->globalEvents = array();
- }
- }
-
- /**
- * Prints javascript code.
- *
- * @param string $js
- */
- private function script($js)
- {
- $out = "<script type=\"text/javascript\">";
- $out .= "//<![CDATA[\n";
- $out .= $js;
- $out .= "\n//]]>";
- $out .= "</script>\n";
-
- return $out;
- }
-
- /**
- * Returns the configuration array (global and instance specific settings are merged into one array).
- *
- * @param $config (array) The specific configurations to apply to editor instance.
- * @param $events (array) Event listeners for editor instance.
- */
- private function configSettings($config = array(), $events = array())
- {
- $_config = $this->config;
- $_events = $this->events;
-
- if (is_array($config) && !empty($config)) {
- $_config = array_merge($_config, $config);
- }
-
- if (is_array($events) && !empty($events)) {
- foreach ($events as $eventName => $code) {
- if (!isset($_events[$eventName])) {
- $_events[$eventName] = array();
- }
- if (!in_array($code, $_events[$eventName])) {
- $_events[$eventName][] = $code;
- }
- }
- }
-
- if (!empty($_events)) {
- foreach($_events as $eventName => $handlers) {
- if (empty($handlers)) {
- continue;
- }
- else if (count($handlers) == 1) {
- $_config['on'][$eventName] = '@@'.$handlers[0];
- }
- else {
- $_config['on'][$eventName] = '@@function (ev){';
- foreach ($handlers as $handler => $code) {
- $_config['on'][$eventName] .= '('.$code.')(ev);';
- }
- $_config['on'][$eventName] .= '}';
- }
- }
- }
-
- return $_config;
- }
-
- /**
- * Return global event handlers.
- */
- private function returnGlobalEvents()
- {
- static $returnedEvents;
- $out = "";
-
- if (!isset($returnedEvents)) {
- $returnedEvents = array();
- }
-
- if (!empty($this->globalEvents)) {
- foreach ($this->globalEvents as $eventName => $handlers) {
- foreach ($handlers as $handler => $code) {
- if (!isset($returnedEvents[$eventName])) {
- $returnedEvents[$eventName] = array();
- }
- // Return only new events
- if (!in_array($code, $returnedEvents[$eventName])) {
- $out .= ($code ? "\n" : "") . "CKEDITOR.on('". $eventName ."', $code);";
- $returnedEvents[$eventName][] = $code;
- }
- }
- }
- }
-
- return $out;
- }
-
- /**
- * Initializes CKEditor (executed only once).
- */
- private function init()
- {
- static $initComplete;
- $out = "";
-
- if (!empty($initComplete)) {
- return "";
- }
-
- if ($this->initialized) {
- $initComplete = true;
- return "";
- }
-
- $args = "";
- $ckeditorPath = $this->ckeditorPath();
-
- if (!empty($this->timestamp) && $this->timestamp != "%"."TIMESTAMP%") {
- $args = '?t=' . $this->timestamp;
- }
-
- // Skip relative paths...
- if (strpos($ckeditorPath, '..') !== 0) {
- $out .= $this->script("window.CKEDITOR_BASEPATH='". $ckeditorPath ."';");
- }
-
- $out .= "<script type=\"text/javascript\" src=\"" . $ckeditorPath . 'ckeditor.js' . $args . "\"></script>\n";
-
- $extraCode = "";
- if ($this->timestamp != self::timestamp) {
- $extraCode .= ($extraCode ? "\n" : "") . "CKEDITOR.timestamp = '". $this->timestamp ."';";
- }
- if ($extraCode) {
- $out .= $this->script($extraCode);
- }
-
- $initComplete = $this->initialized = true;
-
- return $out;
- }
-
- /**
- * Return path to ckeditor.js.
- */
- private function ckeditorPath()
- {
- if (!empty($this->basePath)) {
- return $this->basePath;
- }
-
- /**
- * The absolute pathname of the currently executing script.
- * Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
- * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
- */
- if (isset($_SERVER['SCRIPT_FILENAME'])) {
- $realPath = dirname($_SERVER['SCRIPT_FILENAME']);
- }
- else {
- /**
- * realpath — Returns canonicalized absolute pathname
- */
- $realPath = realpath( './' ) ;
- }
-
- /**
- * The filename of the currently executing script, relative to the document root.
- * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
- * would be /test.php/foo.bar.
- */
- $selfPath = dirname($_SERVER['PHP_SELF']);
- $file = str_replace("\\", "/", __FILE__);
-
- if (!$selfPath || !$realPath || !$file) {
- return "/ckeditor/";
- }
-
- $documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath));
- $fileUrl = substr($file, strlen($documentRoot));
- $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl);
-
- return $ckeditorUrl;
- }
-
- /**
- * This little function provides a basic JSON support.
- * http://php.net/manual/en/function.json-encode.php
- *
- * @param mixed $val
- * @return string
- */
- private function jsEncode($val)
- {
- if (is_null($val)) {
- return 'null';
- }
- if ($val === false) {
- return 'false';
- }
- if ($val === true) {
- return 'true';
- }
- if (is_scalar($val))
- {
- if (is_float($val))
- {
- // Always use "." for floats.
- $val = str_replace(",", ".", strval($val));
- }
-
- // Use @@ to not use quotes when outputting string value
- if (strpos($val, '@@') === 0) {
- return substr($val, 2);
- }
- else {
- // All scalars are converted to strings to avoid indeterminism.
- // PHP's "1" and 1 are equal for all PHP operators, but
- // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend,
- // we should get the same result in the JS frontend (string).
- // Character replacements for JSON.
- static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'),
- array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
-
- $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);
-
- return '"' . $val . '"';
- }
- }
- $isList = true;
- for ($i = 0, reset($val); $i < count($val); $i++, next($val))
- {
- if (key($val) !== $i)
- {
- $isList = false;
- break;
- }
- }
- $result = array();
- if ($isList)
- {
- foreach ($val as $v) $result[] = $this->jsEncode($v);
- return '[ ' . join(', ', $result) . ' ]';
- }
- else
- {
- foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);
- return '{ ' . join(', ', $result) . ' }';
- }
- }
-}
+<?php
+/*
+* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+* For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+/**
+ * \brief CKEditor class that can be used to create editor
+ * instances in PHP pages on server side.
+ * @see http://ckeditor.com
+ *
+ * Sample usage:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->editor("editor1", "<p>Initial value.</p>");
+ * @endcode
+ */
+class CKEditor
+{
+ /**
+ * The version of %CKEditor.
+ */
+ const version = '3.2.2';
+ /**
+ * A constant string unique for each release of %CKEditor.
+ */
+ const timestamp = 'A4SD49X';
+
+ /**
+ * URL to the %CKEditor installation directory (absolute or relative to document root).
+ * If not set, CKEditor will try to guess it's path.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->basePath = '/ckeditor/';
+ * @endcode
+ */
+ public $basePath;
+ /**
+ * An array that holds the global %CKEditor configuration.
+ * For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->config['height'] = 400;
+ * // Use @@ at the beggining of a string to ouput it without surrounding quotes.
+ * $CKEditor->config['width'] = '@@screen.width * 0.8';
+ * @endcode
+ */
+ public $config = array();
+ /**
+ * A boolean variable indicating whether CKEditor has been initialized.
+ * Set it to true only if you have already included
+ * &lt;script&gt; tag loading ckeditor.js in your website.
+ */
+ public $initialized = false;
+ /**
+ * Boolean variable indicating whether created code should be printed out or returned by a function.
+ *
+ * Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->returnOutput = true;
+ * $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
+ * echo "<p>Editor 1:</p>";
+ * echo $code;
+ * @endcode
+ */
+ public $returnOutput = false;
+ /**
+ * An array with textarea attributes.
+ *
+ * When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created,
+ * it will be displayed to anyone with JavaScript disabled or with incompatible browser.
+ */
+ public $textareaAttributes = array( "rows" => 8, "cols" => 60 );
+ /**
+ * A string indicating the creation date of %CKEditor.
+ * Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
+ */
+ public $timestamp = "A4SD49X";
+ /**
+ * An array that holds event listeners.
+ */
+ private $events = array();
+ /**
+ * An array that holds global event listeners.
+ */
+ private $globalEvents = array();
+
+ /**
+ * Main Constructor.
+ *
+ * @param $basePath (string) URL to the %CKEditor installation directory (optional).
+ */
+ function __construct($basePath = null) {
+ if (!empty($basePath)) {
+ $this->basePath = $basePath;
+ }
+ }
+
+ /**
+ * Creates a %CKEditor instance.
+ * In incompatible browsers %CKEditor will downgrade to plain HTML &lt;textarea&gt; element.
+ *
+ * @param $name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
+ * @param $value (string) Initial value (optional).
+ * @param $config (array) The specific configurations to apply to this editor instance (optional).
+ * @param $events (array) Event listeners for this editor instance (optional).
+ *
+ * Example usage:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->editor("field1", "<p>Initial value.</p>");
+ * @endcode
+ *
+ * Advanced example:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $config = array();
+ * $config['toolbar'] = array(
+ * array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
+ * array( 'Image', 'Link', 'Unlink', 'Anchor' )
+ * );
+ * $events['instanceReady'] = 'function (ev) {
+ * alert("Loaded: " + ev.editor.name);
+ * }';
+ * $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);
+ * @endcode
+ */
+ public function editor($name, $value = "", $config = array(), $events = array())
+ {
+ $attr = "";
+ foreach ($this->textareaAttributes as $key => $val) {
+ $attr.= " " . $key . '="' . str_replace('"', '&quot;', $val) . '"';
+ }
+ $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings($config, $events);
+
+ $js = $this->returnGlobalEvents();
+ if (!empty($_config))
+ $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
+ else
+ $js .= "CKEDITOR.replace('".$name."');";
+
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Replaces a &lt;textarea&gt; with a %CKEditor instance.
+ *
+ * @param $id (string) The id or name of textarea element.
+ * @param $config (array) The specific configurations to apply to this editor instance (optional).
+ * @param $events (array) Event listeners for this editor instance (optional).
+ *
+ * Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element:
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replace("article");
+ * @endcode
+ */
+ public function replace($id, $config = array(), $events = array())
+ {
+ $out = "";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings($config, $events);
+
+ $js = $this->returnGlobalEvents();
+ if (!empty($_config)) {
+ $js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
+ }
+ else {
+ $js .= "CKEDITOR.replace('".$id."');";
+ }
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Replace all &lt;textarea&gt; elements available in the document with editor instances.
+ *
+ * @param $className (string) If set, replace all textareas with class className in the page.
+ *
+ * Example 1: replace all &lt;textarea&gt; elements in the page.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replaceAll();
+ * @endcode
+ *
+ * Example 2: replace all &lt;textarea class="myClassName"&gt; elements in the page.
+ * @code
+ * $CKEditor = new CKEditor();
+ * $CKEditor->replaceAll( 'myClassName' );
+ * @endcode
+ */
+ public function replaceAll($className = null)
+ {
+ $out = "";
+ if (!$this->initialized) {
+ $out .= $this->init();
+ }
+
+ $_config = $this->configSettings();
+
+ $js = $this->returnGlobalEvents();
+ if (empty($_config)) {
+ if (empty($className)) {
+ $js .= "CKEDITOR.replaceAll();";
+ }
+ else {
+ $js .= "CKEDITOR.replaceAll('".$className."');";
+ }
+ }
+ else {
+ $classDetection = "";
+ $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
+ if (!empty($className)) {
+ $js .= " var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
+ $js .= " if (!classRegex.test(textarea.className))\n";
+ $js .= " return false;\n";
+ }
+ $js .= " CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
+ $js .= "} );";
+
+ }
+
+ $out .= $this->script($js);
+
+ if (!$this->returnOutput) {
+ print $out;
+ $out = "";
+ }
+
+ return $out;
+ }
+
+ /**
+ * Adds event listener.
+ * Events are fired by %CKEditor in various situations.
+ *
+ * @param $event (string) Event name.
+ * @param $javascriptCode (string) Javascript anonymous function or function name.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->addEventHandler('instanceReady', 'function (ev) {
+ * alert("Loaded: " + ev.editor.name);
+ * }');
+ * @endcode
+ */
+ public function addEventHandler($event, $javascriptCode)
+ {
+ if (!isset($this->events[$event])) {
+ $this->events[$event] = array();
+ }
+ // Avoid duplicates.
+ if (!in_array($javascriptCode, $this->events[$event])) {
+ $this->events[$event][] = $javascriptCode;
+ }
+ }
+
+ /**
+ * Clear registered event handlers.
+ * Note: this function will have no effect on already created editor instances.
+ *
+ * @param $event (string) Event name, if not set all event handlers will be removed (optional).
+ */
+ public function clearEventHandlers($event = null)
+ {
+ if (!empty($event)) {
+ $this->events[$event] = array();
+ }
+ else {
+ $this->events = array();
+ }
+ }
+
+ /**
+ * Adds global event listener.
+ *
+ * @param $event (string) Event name.
+ * @param $javascriptCode (string) Javascript anonymous function or function name.
+ *
+ * Example usage:
+ * @code
+ * $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
+ * alert("Loading dialog: " + ev.data.name);
+ * }');
+ * @endcode
+ */
+ public function addGlobalEventHandler($event, $javascriptCode)
+ {
+ if (!isset($this->globalEvents[$event])) {
+ $this->globalEvents[$event] = array();
+ }
+ // Avoid duplicates.
+ if (!in_array($javascriptCode, $this->globalEvents[$event])) {
+ $this->globalEvents[$event][] = $javascriptCode;
+ }
+ }
+
+ /**
+ * Clear registered global event handlers.
+ * Note: this function will have no effect if the event handler has been already printed/returned.
+ *
+ * @param $event (string) Event name, if not set all event handlers will be removed (optional).
+ */
+ public function clearGlobalEventHandlers($event = null)
+ {
+ if (!empty($event)) {
+ $this->globalEvents[$event] = array();
+ }
+ else {
+ $this->globalEvents = array();
+ }
+ }
+
+ /**
+ * Prints javascript code.
+ *
+ * @param string $js
+ */
+ private function script($js)
+ {
+ $out = "<script type=\"text/javascript\">";
+ $out .= "//<![CDATA[\n";
+ $out .= $js;
+ $out .= "\n//]]>";
+ $out .= "</script>\n";
+
+ return $out;
+ }
+
+ /**
+ * Returns the configuration array (global and instance specific settings are merged into one array).
+ *
+ * @param $config (array) The specific configurations to apply to editor instance.
+ * @param $events (array) Event listeners for editor instance.
+ */
+ private function configSettings($config = array(), $events = array())
+ {
+ $_config = $this->config;
+ $_events = $this->events;
+
+ if (is_array($config) && !empty($config)) {
+ $_config = array_merge($_config, $config);
+ }
+
+ if (is_array($events) && !empty($events)) {
+ foreach ($events as $eventName => $code) {
+ if (!isset($_events[$eventName])) {
+ $_events[$eventName] = array();
+ }
+ if (!in_array($code, $_events[$eventName])) {
+ $_events[$eventName][] = $code;
+ }
+ }
+ }
+
+ if (!empty($_events)) {
+ foreach($_events as $eventName => $handlers) {
+ if (empty($handlers)) {
+ continue;
+ }
+ else if (count($handlers) == 1) {
+ $_config['on'][$eventName] = '@@'.$handlers[0];
+ }
+ else {
+ $_config['on'][$eventName] = '@@function (ev){';
+ foreach ($handlers as $handler => $code) {
+ $_config['on'][$eventName] .= '('.$code.')(ev);';
+ }
+ $_config['on'][$eventName] .= '}';
+ }
+ }
+ }
+
+ return $_config;
+ }
+
+ /**
+ * Return global event handlers.
+ */
+ private function returnGlobalEvents()
+ {
+ static $returnedEvents;
+ $out = "";
+
+ if (!isset($returnedEvents)) {
+ $returnedEvents = array();
+ }
+
+ if (!empty($this->globalEvents)) {
+ foreach ($this->globalEvents as $eventName => $handlers) {
+ foreach ($handlers as $handler => $code) {
+ if (!isset($returnedEvents[$eventName])) {
+ $returnedEvents[$eventName] = array();
+ }
+ // Return only new events
+ if (!in_array($code, $returnedEvents[$eventName])) {
+ $out .= ($code ? "\n" : "") . "CKEDITOR.on('". $eventName ."', $code);";
+ $returnedEvents[$eventName][] = $code;
+ }
+ }
+ }
+ }
+
+ return $out;
+ }
+
+ /**
+ * Initializes CKEditor (executed only once).
+ */
+ private function init()
+ {
+ static $initComplete;
+ $out = "";
+
+ if (!empty($initComplete)) {
+ return "";
+ }
+
+ if ($this->initialized) {
+ $initComplete = true;
+ return "";
+ }
+
+ $args = "";
+ $ckeditorPath = $this->ckeditorPath();
+
+ if (!empty($this->timestamp) && $this->timestamp != "%"."TIMESTAMP%") {
+ $args = '?t=' . $this->timestamp;
+ }
+
+ // Skip relative paths...
+ if (strpos($ckeditorPath, '..') !== 0) {
+ $out .= $this->script("window.CKEDITOR_BASEPATH='". $ckeditorPath ."';");
+ }
+
+ $out .= "<script type=\"text/javascript\" src=\"" . $ckeditorPath . 'ckeditor.js' . $args . "\"></script>\n";
+
+ $extraCode = "";
+ if ($this->timestamp != self::timestamp) {
+ $extraCode .= ($extraCode ? "\n" : "") . "CKEDITOR.timestamp = '". $this->timestamp ."';";
+ }
+ if ($extraCode) {
+ $out .= $this->script($extraCode);
+ }
+
+ $initComplete = $this->initialized = true;
+
+ return $out;
+ }
+
+ /**
+ * Return path to ckeditor.js.
+ */
+ private function ckeditorPath()
+ {
+ if (!empty($this->basePath)) {
+ return $this->basePath;
+ }
+
+ /**
+ * The absolute pathname of the currently executing script.
+ * Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
+ * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
+ */
+ if (isset($_SERVER['SCRIPT_FILENAME'])) {
+ $realPath = dirname($_SERVER['SCRIPT_FILENAME']);
+ }
+ else {
+ /**
+ * realpath — Returns canonicalized absolute pathname
+ */
+ $realPath = realpath( './' ) ;
+ }
+
+ /**
+ * The filename of the currently executing script, relative to the document root.
+ * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
+ * would be /test.php/foo.bar.
+ */
+ $selfPath = dirname($_SERVER['PHP_SELF']);
+ $file = str_replace("\\", "/", __FILE__);
+
+ if (!$selfPath || !$realPath || !$file) {
+ return "/ckeditor/";
+ }
+
+ $documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath));
+ $fileUrl = substr($file, strlen($documentRoot));
+ $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl);
+
+ return $ckeditorUrl;
+ }
+
+ /**
+ * This little function provides a basic JSON support.
+ * http://php.net/manual/en/function.json-encode.php
+ *
+ * @param mixed $val
+ * @return string
+ */
+ private function jsEncode($val)
+ {
+ if (is_null($val)) {
+ return 'null';
+ }
+ if ($val === false) {
+ return 'false';
+ }
+ if ($val === true) {
+ return 'true';
+ }
+ if (is_scalar($val))
+ {
+ if (is_float($val))
+ {
+ // Always use "." for floats.
+ $val = str_replace(",", ".", strval($val));
+ }
+
+ // Use @@ to not use quotes when outputting string value
+ if (strpos($val, '@@') === 0) {
+ return substr($val, 2);
+ }
+ else {
+ // All scalars are converted to strings to avoid indeterminism.
+ // PHP's "1" and 1 are equal for all PHP operators, but
+ // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend,
+ // we should get the same result in the JS frontend (string).
+ // Character replacements for JSON.
+ static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'),
+ array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
+
+ $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);
+
+ return '"' . $val . '"';
+ }
+ }
+ $isList = true;
+ for ($i = 0, reset($val); $i < count($val); $i++, next($val))
+ {
+ if (key($val) !== $i)
+ {
+ $isList = false;
+ break;
+ }
+ }
+ $result = array();
+ if ($isList)
+ {
+ foreach ($val as $v) $result[] = $this->jsEncode($v);
+ return '[ ' . join(', ', $result) . ' ]';
+ }
+ else
+ {
+ foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);
+ return '{ ' . join(', ', $result) . ' }';
+ }
+ }
+}
diff --git a/modules/clippings/clippings_ctrl.php b/modules/clippings/clippings_ctrl.php
index 6c0ecdd6c9..0adc126d64 100644
--- a/modules/clippings/clippings_ctrl.php
+++ b/modules/clippings/clippings_ctrl.php
@@ -1,652 +1,652 @@
-<?php
-/**
-* Controller for the Clippings Page
-*
-* 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 Charts
-* @version $Id: clippings_ctrl.php 6607 2009-12-23 17:43:48Z yalnifj $
-*/
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_CLIPPINGS_CTRL', '');
-
-require_once WT_ROOT.'includes/classes/class_person.php';
-require_once WT_ROOT.'includes/functions/functions.php';
-require_once WT_ROOT.'includes/controllers/basecontrol.php';
-require_once WT_ROOT.'library/pclzip.lib.php';
-
-function same_group($a, $b) {
- if ($a['type'] == $b['type'])
- return strnatcasecmp($a['id'], $b['id']);
- if ($a['type'] == 'source')
- return 1;
- if ($a['type'] == 'indi')
- return -1;
- if ($b['type'] == 'source')
- return -1;
- if ($b['type'] == 'indi')
- return 1;
- return 0;
-}
-
-function id_in_cart($id) {
- global $cart, $GEDCOM;
- $ct = count($cart);
- for ($i = 0; $i < $ct; $i++) {
- $temp = $cart[$i];
- if ($temp['id'] == $id && $temp['gedcom'] == $GEDCOM) {
- return true;
- }
- }
- return false;
-}
-
-/**
-* Main controller class for the Clippings page.
-*/
-class ClippingsController extends BaseController {
-
- var $download_data;
- var $media_list = array();
- var $addCount = 0;
- var $privCount = 0;
- var $type="";
- var $id="";
- var $IncludeMedia;
- var $conv_path;
- var $conv_slashes;
- var $privatize_export;
- var $Zip;
- var $level1; // number of levels of ancestors
- var $level2;
- var $level3; // number of levels of descendents
-
- /**
- * @param string $thing the id of the person
- */
- function ClippingsControllerRoot() {
- parent :: BaseController();
- }
- //----------------beginning of function definitions for ClippingsControllerRoot
- function init() {
- global $SCRIPT_NAME, $MEDIA_DIRECTORY, $MEDIA_FIREWALL_ROOTDIR, $GEDCOM, $cart;
-
- if (!isset($_SESSION['exportConvPath'])) $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY;
- if (!isset($_SESSION['exportConvSlashes'])) $_SESSION['exportConvSlashes'] = 'forward';
-
- $this->action = safe_GET("action");
- $this->id = safe_GET('id');
- $remove = safe_GET('remove',"","no");
- $convert = safe_GET('convert',"","no");
- $this->Zip = safe_GET('Zip');
- $this->IncludeMedia = safe_GET('IncludeMedia');
- $this->conv_path = safe_GET('conv_path', WT_REGEX_NOSCRIPT, $_SESSION['exportConvPath']);
- $this->conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']);
- $this->privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin'));
- $this->level1 = safe_GET('level1');
- $this->level2 = safe_GET('level2');
- $this->level3 = safe_GET('level3');
- $others = safe_GET('others');
- $item = safe_GET('item');
- if (!isset($cart)) $cart = $_SESSION['cart'];
- $this->type = safe_GET('type');
-
- $this->conv_path = stripLRMRLM($this->conv_path);
- $_SESSION['exportConvPath'] = $this->conv_path; // remember this for the next Download
- $_SESSION['exportConvSlashes'] = $this->conv_slashes;
-
- if ($this->action == 'add') {
- if (empty($this->type) && !empty($this->id)) {
- $this->type="";
- $obj = GedcomRecord::getInstance($this->id);
- if (is_null($obj)) {
- $this->id="";
- $this->action="";
- }
- else $this->type = strtolower($obj->getType());
- }
- else if (empty($this->id)) $this->action="";
- if (!empty($this->id) && $this->type != 'fam' && $this->type != 'indi' && $this->type != 'sour')
- $this->action = 'add1';
- }
-
- if ($this->action == 'add1') {
- $clipping = array ();
- $clipping['type'] = $this->type;
- $clipping['id'] = $this->id;
- $clipping['gedcom'] = $GEDCOM;
- $ret = $this->add_clipping($clipping);
- if ($ret) {
- if ($this->type == 'sour') {
- if ($others == 'linked') {
- foreach (fetch_linked_indi($this->id, 'SOUR', WT_GED_ID) as $indi) {
- if ($indi->canDisplayName()) {
- $this->add_clipping(array('type'=>'indi', 'id'=>$indi->getXref()));
- }
- }
- foreach (fetch_linked_fam($this->id, 'SOUR', WT_GED_ID) as $fam) {
- if ($fam->canDisplayName()) {
- $this->add_clipping(array('type'=>'fam', 'id'=>$fam->getXref()));
- }
- }
- }
- }
- if ($this->type == 'fam') {
- if ($others == 'parents') {
- $parents = find_parents($this->id);
- if (!empty ($parents["HUSB"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["HUSB"];
- $ret = $this->add_clipping($clipping);
- }
- if (!empty ($parents["WIFE"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["WIFE"];
- $ret = $this->add_clipping($clipping);
- }
- } else
- if ($others == "members") {
- $this->add_family_members($this->id);
- } else
- if ($others == "descendants") {
- $this->add_family_descendancy($this->id);
- }
- } else
- if ($this->type == 'indi') {
- if ($others == 'parents') {
- $famids = find_family_ids($this->id);
- foreach ($famids as $indexval => $famid) {
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $famid;
- $ret = $this->add_clipping($clipping);
- if ($ret) {
- $this->add_family_members($famid);
- }
- }
- } else
- if ($others == 'ancestors') {
- $this->add_ancestors_to_cart($this->id, $this->level1);
- } else
- if ($others == 'ancestorsfamilies') {
- $this->add_ancestors_to_cart_families($this->id, $this->level2);
- } else
- if ($others == 'members') {
- $famids = find_sfamily_ids($this->id);
- foreach ($famids as $indexval => $famid) {
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $famid;
- $ret = $this->add_clipping($clipping);
- if ($ret)
- $this->add_family_members($famid);
- }
- } else
- if ($others == 'descendants') {
- $famids = find_sfamily_ids($this->id);
- foreach ($famids as $indexval => $famid) {
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $famid;
- $ret = $this->add_clipping($clipping);
- if ($ret)
- $this->add_family_descendancy($famid, $this->level3);
- }
- }
- }
- }
- } else
- if ($this->action == 'remove') {
- $ct = count($cart);
- for ($i = $item +1; $i < $ct; $i++) {
- $cart[$i -1] = $cart[$i];
- }
- unset ($cart[$ct -1]);
- } else
- if ($this->action == 'empty') {
- $cart = array ();
- $_SESSION["cart"] = $cart;
- } else
- if ($this->action == 'download') {
- usort($cart, "same_group");
- $media = array ();
- $mediacount = 0;
- $ct = count($cart);
- $filetext = "0 HEAD\n1 SOUR ".WT_WEBTREES."\n2 NAME ".WT_WEBTREES."\n2 VERS ".WT_VERSION_TEXT."\n1 DEST DISKETTE\n1 DATE " . date("j M Y") . "\n2 TIME " . date("H:i:s") . "\n";
- $filetext .= "1 GEDC\n2 VERS 5.5\n2 FORM LINEAGE-LINKED\n1 CHAR UTF-8\n";
- $head = find_gedcom_record("HEAD", WT_GED_ID);
- $placeform = trim(get_sub_record(1, "1 PLAC", $head));
- if (!empty ($placeform))
- $filetext .= $placeform . "\n";
- else
- $filetext .= "1 PLAC\n2 FORM " . "City, County, State/Province, Country" . "\n";
- if ($convert == "yes") {
- $filetext = str_replace("UTF-8", "ANSI", $filetext);
- $filetext = utf8_decode($filetext);
- }
-
- $tempUserID = '#ExPoRt#';
- if ($this->privatize_export!='none') {
- // Create a temporary userid
- $export_user_id = createTempUser($tempUserID, $this->privatize_export, $GEDCOM); // Create a temporary userid
-
- // Temporarily become this user
- $_SESSION["org_user"]=$_SESSION["wt_user"];
- $_SESSION["wt_user"]=$export_user_id;
- }
-
- for ($i = 0; $i < $ct; $i++) {
- $clipping = $cart[$i];
- if ($clipping['gedcom'] == $GEDCOM) {
- $record = find_gedcom_record($clipping['id'], WT_GED_ID);
- $savedRecord = $record; // Save this for the "does this file exist" check
- if ($clipping['type']=='obje') $record = convert_media_path($record, $this->conv_path, $this->conv_slashes);
- $record = privatize_gedcom($record);
- $record = remove_custom_tags($record, $remove);
- if ($convert == "yes")
- $record = utf8_decode($record);
- switch ($clipping['type']) {
- case 'indi':
- $ft = preg_match_all("/1 FAMC @(.*)@/", $record, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- if (!id_in_cart($match[$k][1])) {
- $record = preg_replace("/1 FAMC @" . $match[$k][1] . "@.*/", "", $record);
- }
- }
- $ft = preg_match_all("/1 FAMS @(.*)@/", $record, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- if (!id_in_cart($match[$k][1])) {
- $record = preg_replace("/1 FAMS @" . $match[$k][1] . "@.*/", "", $record);
- }
- }
- $filetext .= trim($record) . "\n";
- $filetext .= "1 SOUR @WEBTREES@\n";
- $filetext .= "2 PAGE ".WT_SERVER_NAME.WT_SCRIPT_PATH."individual.php?pid={$clipping['id']}&ged={$clipping['gedcom']}\n";
- break;
-
- case 'fam':
- $ft = preg_match_all("/1 CHIL @(.*)@/", $record, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- if (!id_in_cart($match[$k][1])) {
- /* if the child is not in the list delete the record of it */
- $record = preg_replace("/1 CHIL @" . $match[$k][1] . "@.*/", "", $record);
- }
- }
-
- $ft = preg_match_all("/1 HUSB @(.*)@/", $record, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- if (!id_in_cart($match[$k][1])) {
- /* if the husband is not in the list delete the record of him */
- $record = preg_replace("/1 HUSB @" . $match[$k][1] . "@.*/", "", $record);
- }
- }
-
- $ft = preg_match_all("/1 WIFE @(.*)@/", $record, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- if (!id_in_cart($match[$k][1])) {
- /* if the wife is not in the list delete the record of her */
- $record = preg_replace("/1 WIFE @" . $match[$k][1] . "@.*/", "", $record);
- }
- }
-
- $filetext .= trim($record) . "\n";
- $filetext .= "1 SOUR @WEBTREES@\n";
- $filetext .= "2 PAGE " . WT_SERVER_NAME.WT_SCRIPT_PATH . "family.php?famid={$clipping['id']}&ged={$clipping['gedcom']}\n";
- break;
-
- case 'source':
- $filetext .= trim($record) . "\n";
- $filetext .= "1 NOTE " . WT_SERVER_NAME.WT_SCRIPT_PATH . "source.php?sid={$clipping['id']}&ged={$clipping['gedcom']}\n";
- break;
-
- default:
- $ft = preg_match_all("/\n\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER);
- for ($k = 0; $k < $ft; $k++) {
- $filename = $MEDIA_DIRECTORY.extract_filename($match[$k][1]);
- if (file_exists($filename)) {
- $media[$mediacount] = array (PCLZIP_ATT_FILE_NAME => $filename);
- $mediacount++;
- } else {
- $filename = $MEDIA_FIREWALL_ROOTDIR.$MEDIA_DIRECTORY.extract_filename($match[$k][1]);
- if (file_exists($filename)) {
- // Don't include firewall directory in zipfile. It may start ../
- $media[$mediacount] = array (
- PCLZIP_ATT_FILE_NAME => $filename,
- PCLZIP_ATT_FILE_NEW_FULL_NAME => $MEDIA_DIRECTORY.extract_filename($match[$k][1])
- );
- $mediacount++;
- }
- }
- }
- $filetext .= trim($record) . "\n";
- break;
- }
- }
- }
-
- if ($this->privatize_export!='none') {
- $_SESSION["wt_user"]=$_SESSION["org_user"];
- delete_user($export_user_id);
- AddToLog("deleted dummy user -> {$tempUserID} <-", 'auth');
- }
-
- if($this->IncludeMedia == "yes")
- {
- $this->media_list = $media;
- }
- $filetext .= "0 @WEBTREES@ SOUR\n1 TITL ".WT_SERVER_NAME.WT_SCRIPT_PATH."\n";
- if ($user_id=get_gedcom_setting(WT_GED_ID, 'CONTACT_EMAIL')) {
- $filetext .= "1 AUTH " . getUserFullName($user_id) . "\n";
- }
- $filetext .= "0 TRLR\n";
- //-- make sure the preferred line endings are used
- $filetext = preg_replace("/[\r\n]+/", WT_EOL, $filetext);
- $this->download_data = $filetext;
- $this->download_clipping();
- }
- }
- /**
- * Loads everything in the clippings cart into a zip file.
- */
- function zip_cart()
- {
- $INDEX_DIRECTORY=get_site_setting('INDEX_DIRECTORY');
-
- $tempFileName = 'clipping'.rand().'.ged';
- $fp = fopen($INDEX_DIRECTORY.$tempFileName, "wb");
- if($fp)
- {
- flock($fp,LOCK_EX);
- fwrite($fp,$this->download_data);
- flock($fp,LOCK_UN);
- fclose($fp);
- $zipName = "clippings".rand(0, 1500).".zip";
- $fname = $INDEX_DIRECTORY.$zipName;
- $comment = "Created by ".WT_WEBTREES." ".WT_VERSION_TEXT." on ".date("d M Y").".";
- $archive = new PclZip($fname);
- // add the ged file to the root of the zip file (strip off the index_directory)
- $this->media_list[]= array (PCLZIP_ATT_FILE_NAME => $INDEX_DIRECTORY.$tempFileName, PCLZIP_ATT_FILE_NEW_FULL_NAME => $tempFileName);
- $v_list = $archive->create($this->media_list, PCLZIP_OPT_COMMENT, $comment);
- if ($v_list == 0) print "Error : ".$archive->errorInfo(true)."</td></tr>";
- else {
- $openedFile = fopen($fname,"rb");
- $this->download_data = fread($openedFile,filesize($fname));
- fclose($openedFile);
- unlink($fname);
- }
- unlink($INDEX_DIRECTORY.$tempFileName);
- }
- else
- {
- print i18n::translate('Cannot create')." ".$INDEX_DIRECTORY."$tempFileName ".i18n::translate('Check access rights on this directory.')."<br /><br />";
- }
- }
- /**
- * Brings up the download dialog box and allows the user to download the file
- * based on the options he or she selected
- */
- function download_clipping(){
- if ($this->IncludeMedia == "yes" || $this->Zip == "yes") {
- header('Content-Type: application/zip');
- header('Content-Disposition: attachment; filename="clipping.zip"');
- $this->zip_cart();
- } else {
- header('Content-Type: text/plain');
- header('Content-Disposition: attachment; filename="clipping.ged"');
- }
-
- header("Content-length: ".strlen($this->download_data));
- print_r ($this->download_data);
- exit;
- }
- /**
- * Inserts a clipping into the clipping cart
- *
- * @param
- */
- function add_clipping($clipping) {
- global $cart, $MULTI_MEDIA, $GEDCOM;
- if (($clipping['id'] == false) || ($clipping['id'] == ""))
- return false;
-
- if (!id_in_cart($clipping['id'])) {
- $clipping['gedcom'] = $GEDCOM;
- $ged_id=get_id_from_gedcom($GEDCOM);
- $gedrec=find_gedcom_record($clipping['id'], $ged_id);
- if (canDisplayRecord($ged_id, $gedrec) || showLivingNameById($clipping['id'])) {
- $cart[] = $clipping;
- $this->addCount++;
- } else {
- $this->privCount++;
- return false;
- }
- //-- look in the gedcom record for any linked SOUR, NOTE, or OBJE and also add them to the
- //- clippings cart
- $gedrec = find_gedcom_record($clipping['id'], WT_GED_ID);
- $st = preg_match_all("/\d SOUR @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
- for ($i = 0; $i < $st; $i++) {
- if (canDisplayRecord(WT_GED_ID, find_source_record($match[$i][1], WT_GED_ID))) {
- // add SOUR
- $clipping = array ();
- $clipping['type'] = "source";
- $clipping['id'] = $match[$i][1];
- $clipping['gedcom'] = $GEDCOM;
- $this->add_clipping($clipping);
- // add REPO
- $sourec = find_gedcom_record($match[$i][1], WT_GED_ID);
- $rt = preg_match_all("/\d REPO @(.*)@/", $sourec, $rmatch, PREG_SET_ORDER);
- for ($j = 0; $j < $rt; $j++) {
- if (canDisplayRecord(WT_GED_ID, find_other_record($rmatch[$j][1], WT_GED_ID))) {
- $clipping = array ();
- $clipping['type'] = "repository";
- $clipping['id'] = $rmatch[$j][1];
- $clipping['gedcom'] = $GEDCOM;
- $this->add_clipping($clipping);
- }
- }
- }
- }
- $nt = preg_match_all("/\d NOTE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
- for ($i = 0; $i < $nt; $i++) {
- if (canDisplayRecord(WT_GED_ID, find_other_record($match[$i][1], WT_GED_ID))) {
- $clipping = array ();
- $clipping['type'] = "note";
- $clipping['id'] = $match[$i][1];
- $clipping['gedcom'] = $GEDCOM;
- $this->add_clipping($clipping);
- }
- }
- if ($MULTI_MEDIA) {
- $nt = preg_match_all("/\d OBJE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
- for ($i = 0; $i < $nt; $i++) {
- if (canDisplayRecord(WT_GED_ID, find_media_record($match[$i][1], WT_GED_ID))) {
- $clipping = array ();
- $clipping['type'] = "obje";
- $clipping['id'] = $match[$i][1];
- $clipping['gedcom'] = $GEDCOM;
- $this->add_clipping($clipping);
- }
- }
- }
- }
- return true;
- }
-
- // --------------------------------- Recursive function to traverse the tree
- function add_family_descendancy($famid, $level="") {
- global $cart;
-
- if (!$famid)
- return;
- $famrec = find_family_record($famid, WT_GED_ID);
- if ($famrec) {
- $parents = find_parents_in_record($famrec);
- if (!empty ($parents["HUSB"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["HUSB"];
- $this->add_clipping($clipping);
- }
- if (!empty ($parents["WIFE"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["WIFE"];
- $this->add_clipping($clipping);
- }
- $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
- for ($i = 0; $i < $num; $i++) {
- $cfamids = find_sfamily_ids($smatch[$i][1]);
- if (count($cfamids) > 0) {
- foreach ($cfamids as $indexval => $cfamid) {
- if (!id_in_cart($cfamid)) {
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $cfamid;
- $ret = $this->add_clipping($clipping); // add the childs family
- if ($level=="" || $level>0) {
- if ($level!="") $level--;
- $this->add_family_descendancy($cfamid, $level); // recurse on the childs family
- }
- }
- }
- } else {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $smatch[$i][1];
- $this->add_clipping($clipping);
- }
- }
- }
- }
-
- function add_family_members($famid) {
- global $cart;
- $parents = find_parents($famid);
- if (!empty ($parents["HUSB"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["HUSB"];
- $this->add_clipping($clipping);
- }
- if (!empty ($parents["WIFE"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["WIFE"];
- $this->add_clipping($clipping);
- }
- $famrec = find_family_record($famid, WT_GED_ID);
- if ($famrec) {
- $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
- for ($i = 0; $i < $num; $i++) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $smatch[$i][1];
- $this->add_clipping($clipping);
- }
- }
- }
-
- //-- recursively adds direct-line ancestors to cart
- function add_ancestors_to_cart($pid, $level="") {
- global $cart;
- $famids = find_family_ids($pid);
- if (count($famids) > 0) {
- foreach ($famids as $indexval => $famid) {
- if ($level=="" || $level > 0) {
- if ($level!="") $level = $level -1;
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $famid;
- $ret = $this->add_clipping($clipping);
- if ($ret) {
- $parents = find_parents($famid);
- if (!empty ($parents["HUSB"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["HUSB"];
- $this->add_clipping($clipping);
- $this->add_ancestors_to_cart($parents["HUSB"], $level);
- }
- if (!empty ($parents["WIFE"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["WIFE"];
- $this->add_clipping($clipping);
- $this->add_ancestors_to_cart($parents["WIFE"], $level);
- }
- }
- }
- }
- }
- }
-
- //-- recursively adds direct-line ancestors and their families to the cart
- function add_ancestors_to_cart_families($pid, $level="") {
- global $cart;
- $famids = find_family_ids($pid);
- if (count($famids) > 0) {
- foreach ($famids as $indexval => $famid) {
- if ($level=="" || $level > 0) {
- if ($level!="")$level = $level -1;
- $clipping = array ();
- $clipping['type'] = "fam";
- $clipping['id'] = $famid;
- $ret = $this->add_clipping($clipping);
- if ($ret) {
- $parents = find_parents($famid);
- if (!empty ($parents["HUSB"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["HUSB"];
- $ret = $this->add_clipping($clipping);
- $this->add_ancestors_to_cart_families($parents["HUSB"], $level);
- }
- if (!empty ($parents["WIFE"])) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $parents["WIFE"];
- $ret = $this->add_clipping($clipping);
- $this->add_ancestors_to_cart_families($parents["WIFE"], $level);
- }
- $famrec = find_family_record($famid, WT_GED_ID);
- if ($famrec) {
- $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
- for ($i = 0; $i < $num; $i++) {
- $clipping = array ();
- $clipping['type'] = "indi";
- $clipping['id'] = $smatch[$i][1];
- $this->add_clipping($clipping);
- }
- }
- }
- }
- }
- }
- }
-}
+<?php
+/**
+* Controller for the Clippings Page
+*
+* 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 Charts
+* @version $Id$
+*/
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+define('WT_CLIPPINGS_CTRL', '');
+
+require_once WT_ROOT.'includes/classes/class_person.php';
+require_once WT_ROOT.'includes/functions/functions.php';
+require_once WT_ROOT.'includes/controllers/basecontrol.php';
+require_once WT_ROOT.'library/pclzip.lib.php';
+
+function same_group($a, $b) {
+ if ($a['type'] == $b['type'])
+ return strnatcasecmp($a['id'], $b['id']);
+ if ($a['type'] == 'source')
+ return 1;
+ if ($a['type'] == 'indi')
+ return -1;
+ if ($b['type'] == 'source')
+ return -1;
+ if ($b['type'] == 'indi')
+ return 1;
+ return 0;
+}
+
+function id_in_cart($id) {
+ global $cart, $GEDCOM;
+ $ct = count($cart);
+ for ($i = 0; $i < $ct; $i++) {
+ $temp = $cart[$i];
+ if ($temp['id'] == $id && $temp['gedcom'] == $GEDCOM) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+* Main controller class for the Clippings page.
+*/
+class ClippingsController extends BaseController {
+
+ var $download_data;
+ var $media_list = array();
+ var $addCount = 0;
+ var $privCount = 0;
+ var $type="";
+ var $id="";
+ var $IncludeMedia;
+ var $conv_path;
+ var $conv_slashes;
+ var $privatize_export;
+ var $Zip;
+ var $level1; // number of levels of ancestors
+ var $level2;
+ var $level3; // number of levels of descendents
+
+ /**
+ * @param string $thing the id of the person
+ */
+ function ClippingsControllerRoot() {
+ parent :: BaseController();
+ }
+ //----------------beginning of function definitions for ClippingsControllerRoot
+ function init() {
+ global $SCRIPT_NAME, $MEDIA_DIRECTORY, $MEDIA_FIREWALL_ROOTDIR, $GEDCOM, $cart;
+
+ if (!isset($_SESSION['exportConvPath'])) $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY;
+ if (!isset($_SESSION['exportConvSlashes'])) $_SESSION['exportConvSlashes'] = 'forward';
+
+ $this->action = safe_GET("action");
+ $this->id = safe_GET('id');
+ $remove = safe_GET('remove',"","no");
+ $convert = safe_GET('convert',"","no");
+ $this->Zip = safe_GET('Zip');
+ $this->IncludeMedia = safe_GET('IncludeMedia');
+ $this->conv_path = safe_GET('conv_path', WT_REGEX_NOSCRIPT, $_SESSION['exportConvPath']);
+ $this->conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']);
+ $this->privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin'));
+ $this->level1 = safe_GET('level1');
+ $this->level2 = safe_GET('level2');
+ $this->level3 = safe_GET('level3');
+ $others = safe_GET('others');
+ $item = safe_GET('item');
+ if (!isset($cart)) $cart = $_SESSION['cart'];
+ $this->type = safe_GET('type');
+
+ $this->conv_path = stripLRMRLM($this->conv_path);
+ $_SESSION['exportConvPath'] = $this->conv_path; // remember this for the next Download
+ $_SESSION['exportConvSlashes'] = $this->conv_slashes;
+
+ if ($this->action == 'add') {
+ if (empty($this->type) && !empty($this->id)) {
+ $this->type="";
+ $obj = GedcomRecord::getInstance($this->id);
+ if (is_null($obj)) {
+ $this->id="";
+ $this->action="";
+ }
+ else $this->type = strtolower($obj->getType());
+ }
+ else if (empty($this->id)) $this->action="";
+ if (!empty($this->id) && $this->type != 'fam' && $this->type != 'indi' && $this->type != 'sour')
+ $this->action = 'add1';
+ }
+
+ if ($this->action == 'add1') {
+ $clipping = array ();
+ $clipping['type'] = $this->type;
+ $clipping['id'] = $this->id;
+ $clipping['gedcom'] = $GEDCOM;
+ $ret = $this->add_clipping($clipping);
+ if ($ret) {
+ if ($this->type == 'sour') {
+ if ($others == 'linked') {
+ foreach (fetch_linked_indi($this->id, 'SOUR', WT_GED_ID) as $indi) {
+ if ($indi->canDisplayName()) {
+ $this->add_clipping(array('type'=>'indi', 'id'=>$indi->getXref()));
+ }
+ }
+ foreach (fetch_linked_fam($this->id, 'SOUR', WT_GED_ID) as $fam) {
+ if ($fam->canDisplayName()) {
+ $this->add_clipping(array('type'=>'fam', 'id'=>$fam->getXref()));
+ }
+ }
+ }
+ }
+ if ($this->type == 'fam') {
+ if ($others == 'parents') {
+ $parents = find_parents($this->id);
+ if (!empty ($parents["HUSB"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["HUSB"];
+ $ret = $this->add_clipping($clipping);
+ }
+ if (!empty ($parents["WIFE"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["WIFE"];
+ $ret = $this->add_clipping($clipping);
+ }
+ } else
+ if ($others == "members") {
+ $this->add_family_members($this->id);
+ } else
+ if ($others == "descendants") {
+ $this->add_family_descendancy($this->id);
+ }
+ } else
+ if ($this->type == 'indi') {
+ if ($others == 'parents') {
+ $famids = find_family_ids($this->id);
+ foreach ($famids as $indexval => $famid) {
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $famid;
+ $ret = $this->add_clipping($clipping);
+ if ($ret) {
+ $this->add_family_members($famid);
+ }
+ }
+ } else
+ if ($others == 'ancestors') {
+ $this->add_ancestors_to_cart($this->id, $this->level1);
+ } else
+ if ($others == 'ancestorsfamilies') {
+ $this->add_ancestors_to_cart_families($this->id, $this->level2);
+ } else
+ if ($others == 'members') {
+ $famids = find_sfamily_ids($this->id);
+ foreach ($famids as $indexval => $famid) {
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $famid;
+ $ret = $this->add_clipping($clipping);
+ if ($ret)
+ $this->add_family_members($famid);
+ }
+ } else
+ if ($others == 'descendants') {
+ $famids = find_sfamily_ids($this->id);
+ foreach ($famids as $indexval => $famid) {
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $famid;
+ $ret = $this->add_clipping($clipping);
+ if ($ret)
+ $this->add_family_descendancy($famid, $this->level3);
+ }
+ }
+ }
+ }
+ } else
+ if ($this->action == 'remove') {
+ $ct = count($cart);
+ for ($i = $item +1; $i < $ct; $i++) {
+ $cart[$i -1] = $cart[$i];
+ }
+ unset ($cart[$ct -1]);
+ } else
+ if ($this->action == 'empty') {
+ $cart = array ();
+ $_SESSION["cart"] = $cart;
+ } else
+ if ($this->action == 'download') {
+ usort($cart, "same_group");
+ $media = array ();
+ $mediacount = 0;
+ $ct = count($cart);
+ $filetext = "0 HEAD\n1 SOUR ".WT_WEBTREES."\n2 NAME ".WT_WEBTREES."\n2 VERS ".WT_VERSION_TEXT."\n1 DEST DISKETTE\n1 DATE " . date("j M Y") . "\n2 TIME " . date("H:i:s") . "\n";
+ $filetext .= "1 GEDC\n2 VERS 5.5\n2 FORM LINEAGE-LINKED\n1 CHAR UTF-8\n";
+ $head = find_gedcom_record("HEAD", WT_GED_ID);
+ $placeform = trim(get_sub_record(1, "1 PLAC", $head));
+ if (!empty ($placeform))
+ $filetext .= $placeform . "\n";
+ else
+ $filetext .= "1 PLAC\n2 FORM " . "City, County, State/Province, Country" . "\n";
+ if ($convert == "yes") {
+ $filetext = str_replace("UTF-8", "ANSI", $filetext);
+ $filetext = utf8_decode($filetext);
+ }
+
+ $tempUserID = '#ExPoRt#';
+ if ($this->privatize_export!='none') {
+ // Create a temporary userid
+ $export_user_id = createTempUser($tempUserID, $this->privatize_export, $GEDCOM); // Create a temporary userid
+
+ // Temporarily become this user
+ $_SESSION["org_user"]=$_SESSION["wt_user"];
+ $_SESSION["wt_user"]=$export_user_id;
+ }
+
+ for ($i = 0; $i < $ct; $i++) {
+ $clipping = $cart[$i];
+ if ($clipping['gedcom'] == $GEDCOM) {
+ $record = find_gedcom_record($clipping['id'], WT_GED_ID);
+ $savedRecord = $record; // Save this for the "does this file exist" check
+ if ($clipping['type']=='obje') $record = convert_media_path($record, $this->conv_path, $this->conv_slashes);
+ $record = privatize_gedcom($record);
+ $record = remove_custom_tags($record, $remove);
+ if ($convert == "yes")
+ $record = utf8_decode($record);
+ switch ($clipping['type']) {
+ case 'indi':
+ $ft = preg_match_all("/1 FAMC @(.*)@/", $record, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ if (!id_in_cart($match[$k][1])) {
+ $record = preg_replace("/1 FAMC @" . $match[$k][1] . "@.*/", "", $record);
+ }
+ }
+ $ft = preg_match_all("/1 FAMS @(.*)@/", $record, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ if (!id_in_cart($match[$k][1])) {
+ $record = preg_replace("/1 FAMS @" . $match[$k][1] . "@.*/", "", $record);
+ }
+ }
+ $filetext .= trim($record) . "\n";
+ $filetext .= "1 SOUR @WEBTREES@\n";
+ $filetext .= "2 PAGE ".WT_SERVER_NAME.WT_SCRIPT_PATH."individual.php?pid={$clipping['id']}&ged={$clipping['gedcom']}\n";
+ break;
+
+ case 'fam':
+ $ft = preg_match_all("/1 CHIL @(.*)@/", $record, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ if (!id_in_cart($match[$k][1])) {
+ /* if the child is not in the list delete the record of it */
+ $record = preg_replace("/1 CHIL @" . $match[$k][1] . "@.*/", "", $record);
+ }
+ }
+
+ $ft = preg_match_all("/1 HUSB @(.*)@/", $record, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ if (!id_in_cart($match[$k][1])) {
+ /* if the husband is not in the list delete the record of him */
+ $record = preg_replace("/1 HUSB @" . $match[$k][1] . "@.*/", "", $record);
+ }
+ }
+
+ $ft = preg_match_all("/1 WIFE @(.*)@/", $record, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ if (!id_in_cart($match[$k][1])) {
+ /* if the wife is not in the list delete the record of her */
+ $record = preg_replace("/1 WIFE @" . $match[$k][1] . "@.*/", "", $record);
+ }
+ }
+
+ $filetext .= trim($record) . "\n";
+ $filetext .= "1 SOUR @WEBTREES@\n";
+ $filetext .= "2 PAGE " . WT_SERVER_NAME.WT_SCRIPT_PATH . "family.php?famid={$clipping['id']}&ged={$clipping['gedcom']}\n";
+ break;
+
+ case 'source':
+ $filetext .= trim($record) . "\n";
+ $filetext .= "1 NOTE " . WT_SERVER_NAME.WT_SCRIPT_PATH . "source.php?sid={$clipping['id']}&ged={$clipping['gedcom']}\n";
+ break;
+
+ default:
+ $ft = preg_match_all("/\n\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER);
+ for ($k = 0; $k < $ft; $k++) {
+ $filename = $MEDIA_DIRECTORY.extract_filename($match[$k][1]);
+ if (file_exists($filename)) {
+ $media[$mediacount] = array (PCLZIP_ATT_FILE_NAME => $filename);
+ $mediacount++;
+ } else {
+ $filename = $MEDIA_FIREWALL_ROOTDIR.$MEDIA_DIRECTORY.extract_filename($match[$k][1]);
+ if (file_exists($filename)) {
+ // Don't include firewall directory in zipfile. It may start ../
+ $media[$mediacount] = array (
+ PCLZIP_ATT_FILE_NAME => $filename,
+ PCLZIP_ATT_FILE_NEW_FULL_NAME => $MEDIA_DIRECTORY.extract_filename($match[$k][1])
+ );
+ $mediacount++;
+ }
+ }
+ }
+ $filetext .= trim($record) . "\n";
+ break;
+ }
+ }
+ }
+
+ if ($this->privatize_export!='none') {
+ $_SESSION["wt_user"]=$_SESSION["org_user"];
+ delete_user($export_user_id);
+ AddToLog("deleted dummy user -> {$tempUserID} <-", 'auth');
+ }
+
+ if($this->IncludeMedia == "yes")
+ {
+ $this->media_list = $media;
+ }
+ $filetext .= "0 @WEBTREES@ SOUR\n1 TITL ".WT_SERVER_NAME.WT_SCRIPT_PATH."\n";
+ if ($user_id=get_gedcom_setting(WT_GED_ID, 'CONTACT_EMAIL')) {
+ $filetext .= "1 AUTH " . getUserFullName($user_id) . "\n";
+ }
+ $filetext .= "0 TRLR\n";
+ //-- make sure the preferred line endings are used
+ $filetext = preg_replace("/[\r\n]+/", WT_EOL, $filetext);
+ $this->download_data = $filetext;
+ $this->download_clipping();
+ }
+ }
+ /**
+ * Loads everything in the clippings cart into a zip file.
+ */
+ function zip_cart()
+ {
+ $INDEX_DIRECTORY=get_site_setting('INDEX_DIRECTORY');
+
+ $tempFileName = 'clipping'.rand().'.ged';
+ $fp = fopen($INDEX_DIRECTORY.$tempFileName, "wb");
+ if($fp)
+ {
+ flock($fp,LOCK_EX);
+ fwrite($fp,$this->download_data);
+ flock($fp,LOCK_UN);
+ fclose($fp);
+ $zipName = "clippings".rand(0, 1500).".zip";
+ $fname = $INDEX_DIRECTORY.$zipName;
+ $comment = "Created by ".WT_WEBTREES." ".WT_VERSION_TEXT." on ".date("d M Y").".";
+ $archive = new PclZip($fname);
+ // add the ged file to the root of the zip file (strip off the index_directory)
+ $this->media_list[]= array (PCLZIP_ATT_FILE_NAME => $INDEX_DIRECTORY.$tempFileName, PCLZIP_ATT_FILE_NEW_FULL_NAME => $tempFileName);
+ $v_list = $archive->create($this->media_list, PCLZIP_OPT_COMMENT, $comment);
+ if ($v_list == 0) print "Error : ".$archive->errorInfo(true)."</td></tr>";
+ else {
+ $openedFile = fopen($fname,"rb");
+ $this->download_data = fread($openedFile,filesize($fname));
+ fclose($openedFile);
+ unlink($fname);
+ }
+ unlink($INDEX_DIRECTORY.$tempFileName);
+ }
+ else
+ {
+ print i18n::translate('Cannot create')." ".$INDEX_DIRECTORY."$tempFileName ".i18n::translate('Check access rights on this directory.')."<br /><br />";
+ }
+ }
+ /**
+ * Brings up the download dialog box and allows the user to download the file
+ * based on the options he or she selected
+ */
+ function download_clipping(){
+ if ($this->IncludeMedia == "yes" || $this->Zip == "yes") {
+ header('Content-Type: application/zip');
+ header('Content-Disposition: attachment; filename="clipping.zip"');
+ $this->zip_cart();
+ } else {
+ header('Content-Type: text/plain');
+ header('Content-Disposition: attachment; filename="clipping.ged"');
+ }
+
+ header("Content-length: ".strlen($this->download_data));
+ print_r ($this->download_data);
+ exit;
+ }
+ /**
+ * Inserts a clipping into the clipping cart
+ *
+ * @param
+ */
+ function add_clipping($clipping) {
+ global $cart, $MULTI_MEDIA, $GEDCOM;
+ if (($clipping['id'] == false) || ($clipping['id'] == ""))
+ return false;
+
+ if (!id_in_cart($clipping['id'])) {
+ $clipping['gedcom'] = $GEDCOM;
+ $ged_id=get_id_from_gedcom($GEDCOM);
+ $gedrec=find_gedcom_record($clipping['id'], $ged_id);
+ if (canDisplayRecord($ged_id, $gedrec) || showLivingNameById($clipping['id'])) {
+ $cart[] = $clipping;
+ $this->addCount++;
+ } else {
+ $this->privCount++;
+ return false;
+ }
+ //-- look in the gedcom record for any linked SOUR, NOTE, or OBJE and also add them to the
+ //- clippings cart
+ $gedrec = find_gedcom_record($clipping['id'], WT_GED_ID);
+ $st = preg_match_all("/\d SOUR @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
+ for ($i = 0; $i < $st; $i++) {
+ if (canDisplayRecord(WT_GED_ID, find_source_record($match[$i][1], WT_GED_ID))) {
+ // add SOUR
+ $clipping = array ();
+ $clipping['type'] = "source";
+ $clipping['id'] = $match[$i][1];
+ $clipping['gedcom'] = $GEDCOM;
+ $this->add_clipping($clipping);
+ // add REPO
+ $sourec = find_gedcom_record($match[$i][1], WT_GED_ID);
+ $rt = preg_match_all("/\d REPO @(.*)@/", $sourec, $rmatch, PREG_SET_ORDER);
+ for ($j = 0; $j < $rt; $j++) {
+ if (canDisplayRecord(WT_GED_ID, find_other_record($rmatch[$j][1], WT_GED_ID))) {
+ $clipping = array ();
+ $clipping['type'] = "repository";
+ $clipping['id'] = $rmatch[$j][1];
+ $clipping['gedcom'] = $GEDCOM;
+ $this->add_clipping($clipping);
+ }
+ }
+ }
+ }
+ $nt = preg_match_all("/\d NOTE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
+ for ($i = 0; $i < $nt; $i++) {
+ if (canDisplayRecord(WT_GED_ID, find_other_record($match[$i][1], WT_GED_ID))) {
+ $clipping = array ();
+ $clipping['type'] = "note";
+ $clipping['id'] = $match[$i][1];
+ $clipping['gedcom'] = $GEDCOM;
+ $this->add_clipping($clipping);
+ }
+ }
+ if ($MULTI_MEDIA) {
+ $nt = preg_match_all("/\d OBJE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
+ for ($i = 0; $i < $nt; $i++) {
+ if (canDisplayRecord(WT_GED_ID, find_media_record($match[$i][1], WT_GED_ID))) {
+ $clipping = array ();
+ $clipping['type'] = "obje";
+ $clipping['id'] = $match[$i][1];
+ $clipping['gedcom'] = $GEDCOM;
+ $this->add_clipping($clipping);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ // --------------------------------- Recursive function to traverse the tree
+ function add_family_descendancy($famid, $level="") {
+ global $cart;
+
+ if (!$famid)
+ return;
+ $famrec = find_family_record($famid, WT_GED_ID);
+ if ($famrec) {
+ $parents = find_parents_in_record($famrec);
+ if (!empty ($parents["HUSB"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["HUSB"];
+ $this->add_clipping($clipping);
+ }
+ if (!empty ($parents["WIFE"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["WIFE"];
+ $this->add_clipping($clipping);
+ }
+ $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
+ for ($i = 0; $i < $num; $i++) {
+ $cfamids = find_sfamily_ids($smatch[$i][1]);
+ if (count($cfamids) > 0) {
+ foreach ($cfamids as $indexval => $cfamid) {
+ if (!id_in_cart($cfamid)) {
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $cfamid;
+ $ret = $this->add_clipping($clipping); // add the childs family
+ if ($level=="" || $level>0) {
+ if ($level!="") $level--;
+ $this->add_family_descendancy($cfamid, $level); // recurse on the childs family
+ }
+ }
+ }
+ } else {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $smatch[$i][1];
+ $this->add_clipping($clipping);
+ }
+ }
+ }
+ }
+
+ function add_family_members($famid) {
+ global $cart;
+ $parents = find_parents($famid);
+ if (!empty ($parents["HUSB"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["HUSB"];
+ $this->add_clipping($clipping);
+ }
+ if (!empty ($parents["WIFE"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["WIFE"];
+ $this->add_clipping($clipping);
+ }
+ $famrec = find_family_record($famid, WT_GED_ID);
+ if ($famrec) {
+ $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
+ for ($i = 0; $i < $num; $i++) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $smatch[$i][1];
+ $this->add_clipping($clipping);
+ }
+ }
+ }
+
+ //-- recursively adds direct-line ancestors to cart
+ function add_ancestors_to_cart($pid, $level="") {
+ global $cart;
+ $famids = find_family_ids($pid);
+ if (count($famids) > 0) {
+ foreach ($famids as $indexval => $famid) {
+ if ($level=="" || $level > 0) {
+ if ($level!="") $level = $level -1;
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $famid;
+ $ret = $this->add_clipping($clipping);
+ if ($ret) {
+ $parents = find_parents($famid);
+ if (!empty ($parents["HUSB"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["HUSB"];
+ $this->add_clipping($clipping);
+ $this->add_ancestors_to_cart($parents["HUSB"], $level);
+ }
+ if (!empty ($parents["WIFE"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["WIFE"];
+ $this->add_clipping($clipping);
+ $this->add_ancestors_to_cart($parents["WIFE"], $level);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //-- recursively adds direct-line ancestors and their families to the cart
+ function add_ancestors_to_cart_families($pid, $level="") {
+ global $cart;
+ $famids = find_family_ids($pid);
+ if (count($famids) > 0) {
+ foreach ($famids as $indexval => $famid) {
+ if ($level=="" || $level > 0) {
+ if ($level!="")$level = $level -1;
+ $clipping = array ();
+ $clipping['type'] = "fam";
+ $clipping['id'] = $famid;
+ $ret = $this->add_clipping($clipping);
+ if ($ret) {
+ $parents = find_parents($famid);
+ if (!empty ($parents["HUSB"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["HUSB"];
+ $ret = $this->add_clipping($clipping);
+ $this->add_ancestors_to_cart_families($parents["HUSB"], $level);
+ }
+ if (!empty ($parents["WIFE"])) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $parents["WIFE"];
+ $ret = $this->add_clipping($clipping);
+ $this->add_ancestors_to_cart_families($parents["WIFE"], $level);
+ }
+ $famrec = find_family_record($famid, WT_GED_ID);
+ if ($famrec) {
+ $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
+ for ($i = 0; $i < $num; $i++) {
+ $clipping = array ();
+ $clipping['type'] = "indi";
+ $clipping['id'] = $smatch[$i][1];
+ $this->add_clipping($clipping);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/modules/clippings/index.php b/modules/clippings/index.php
index a0300451bd..acc75154b4 100644
--- a/modules/clippings/index.php
+++ b/modules/clippings/index.php
@@ -1,319 +1,319 @@
-<?php
-/**
- * Family Tree Clippings Cart
- *
- * Uses the $_SESSION["cart"] to store the ids of clippings to download
- * @TODO print a message if people are not included due to privacy
- *
- * 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 Charts
- * @version $Id: index.php 6652 2010-01-01 20:32:39Z yalnifj $
- */
-
-require_once WT_ROOT.'modules/clippings/clippings_ctrl.php';
-
-global $ENABLE_AUTOCOMPLETE, $cart, $MAX_PEDIGREE_GENERATIONS, $TEXT_DIRECTION, $GEDCOM, $WT_IMAGES;
-
-$controller = new ClippingsController();
-$controller->init();
-
-// -- print html header information
-print_header(i18n::translate('Clippings cart'));
-
-if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
-
-echo WT_JS_START;
-echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
-echo WT_JS_END;
-
-if (count($cart)==0) {?>
-<h2><?php print i18n::translate('Family Tree Clippings Cart');?></h2>
-<?php }
-
-if ($controller->action=='add') {
- $person = GedcomRecord::getInstance($controller->id);
- print "<b>".$person->getFullName()."</b>";
- if ($controller->type=='fam') {?>
- <form action="module.php" method="get">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <table>
- <tr><td class="topbottombar"><?php print i18n::translate('Which other links from this family would you like to add?')?>
- <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
- <input type="hidden" name="type" value="<?php print $controller->type ?>" />
- <input type="hidden" name="action" value="add1" /></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this family record.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="parents" /><?php print i18n::translate('Add parents\' records together with this family record.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="members" /><?php print i18n::translate('Add parents\' and children\'s records together with this family record.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="descendants" /><?php print i18n::translate('Add parents\' and all descendants\' records together with this family record.')?></td></tr>
- <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" /></td></tr>
-
- </table>
- </form>
- <?php }
- else if ($controller->type=='indi') {?>
- <form action="module.php" method="get">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <table>
- <tr><td class="topbottombar"><?php print i18n::translate('Which links from this person would you also like to add?')?>
- <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
- <input type="hidden" name="type" value="<?php print $controller->type ?>" />
- <input type="hidden" name="action" value="add1" /></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this person.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="parents" /><?php print i18n::translate('Add this person, his parents, and siblings.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors" /><?php print i18n::translate('Add this person and his direct line ancestors.')?><br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level1" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"/></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies" /><?php print i18n::translate('Add this person, his direct line ancestors, and their families.')?><br >
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level2" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');" /></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="members" /><?php print i18n::translate('Add this person, his spouse, and children.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants" /><?php print i18n::translate('Add this person, his spouse, and all descendants.')?><br >
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level3" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');" /></td></tr>
- <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" />
- </table>
- </form>
- <?php } else if ($controller->type=='sour') {?>
- <form action="module.php" method="get">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <table>
- <tr><td class="topbottombar"><?php print i18n::translate('Which records linked to this source should be added?')?>
- <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
- <input type="hidden" name="type" value="<?php print $controller->type ?>" />
- <input type="hidden" name="action" value="add1" /></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this source.')?></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="linked" /><?php print i18n::translate('Add this source and families/people linked to it.')?></td></tr>
- <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" />
- </table>
- </form>
- <?php }
- }
-$ct = count($cart);
-
-if ($controller->privCount>0) {
- print "<span class=\"error\">".i18n::translate('Some items could not be added due to privacy restrictions')."</span><br /><br />\n";
-}
-
-if ($ct==0) {
-
- // -- new lines, added by Jans, to display helptext when cart is empty
- if ($controller->action!='add') {
-
- echo i18n::translate('The Clippings Cart allows you to take extracts ("clippings") from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br /><ul><li>How to take clippings?<br />This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to Clippings Cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br />Once you have items in your cart, you can download them just by clicking the <b>Download Now</b> link. Follow the instructions and links.</li></ul>');
-
- echo WT_JS_START;
- echo 'var pastefield;';
- echo 'function paste_id(value) {pastefield.value=value;}';
- echo WT_JS_END;
- ?>
- <form method="get" name="addin" action="module.php">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <table>
- <tr>
- <td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo i18n::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
- </td>
- </tr>
- <tr>
- <td class="optionbox">
- <input type="hidden" name="action" value="add"/>
- <input type="text" name="id" id="cart_item_id" size="5"/>
- </td>
- <td class="optionbox">
- <?php print_findindi_link('cart_item_id', ''); ?>
- <?php print_findfamily_link('cart_item_id', ''); ?>
- <?php print_findsource_link('cart_item_id', ''); ?>
- <input type="submit" value="<?php print i18n::translate('Add');?>"/>
-
- </td>
- </tr>
- </table>
- </form>
- <?php
- }
-
- // -- end new lines
- print "\r\n\t\t<br /><br />".i18n::translate('Your Clippings Cart is empty.')."<br /><br />";
-} else {
- if ($controller->action != 'download' && $controller->action != 'add') { ?>
- <table><tr><td class="width33" valign="top" rowspan="3">
- <form method="get" action="module.php">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <input type="hidden" name="action" value="download" />
- <table>
- <tr><td colspan="2" class="topbottombar"><h2><?php print i18n::translate('File Information') ?></h2></td></tr>
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Zip File(s)'), help_link('zip'); ?></td>
- <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked="checked" /></td></tr>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Include media (automatically zips files)'), help_link('include_media'); ?></td>
- <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked="checked" /></td></tr>
-
- <?php
- // Determine the Privatize options available to this user
- if (WT_USER_IS_ADMIN) {
- $radioPrivatizeNone = 'checked="checked" ';
- $radioPrivatizeVisitor = '';
- $radioPrivatizeUser = '';
- $radioPrivatizeGedadmin = '';
- $radioPrivatizeAdmin = '';
- } else if (WT_USER_GEDCOM_ADMIN) {
- $radioPrivatizeNone = 'DISABLED ';
- $radioPrivatizeVisitor = 'checked="checked" ';
- $radioPrivatizeUser = '';
- $radioPrivatizeGedadmin = '';
- $radioPrivatizeAdmin = 'DISABLED ';
- } else if (WT_USER_ID) {
- $radioPrivatizeNone = 'DISABLED ';
- $radioPrivatizeVisitor = 'checked="checked" ';
- $radioPrivatizeUser = '';
- $radioPrivatizeGedadmin = 'DISABLED ';
- $radioPrivatizeAdmin = 'DISABLED ';
- } else {
- $radioPrivatizeNone = 'DISABLED ';
- $radioPrivatizeVisitor = 'checked="checked" DISABLED ';
- $radioPrivatizeUser = 'DISABLED ';
- $radioPrivatizeGedadmin = 'DISABLED ';
- $radioPrivatizeAdmin = 'DISABLED ';
- }
- ?>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Apply privacy settings?'), help_link('apply_privacy'); ?></td>
- <td class="list_value">
- <input type="radio" name="privatize_export" value="none" <?php print $radioPrivatizeNone; ?>/>&nbsp;<?php print i18n::translate('None'); ?><br />
- <input type="radio" name="privatize_export" value="visitor" <?php print $radioPrivatizeVisitor; ?>/>&nbsp;<?php print i18n::translate('Visitor'); ?><br />
- <input type="radio" name="privatize_export" value="user" <?php print $radioPrivatizeUser; ?>/>&nbsp;<?php print i18n::translate('Authenticated user'); ?><br />
- <input type="radio" name="privatize_export" value="gedadmin" <?php print $radioPrivatizeGedadmin; ?>/>&nbsp;<?php print i18n::translate('GEDCOM administrator'); ?>
- </td></tr>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert from UTF-8 to ANSI (ISO-8859-1)'), help_link('utf8_ansi'); ?></td>
- <td class="optionbox"><input type="checkbox" name="convert" value="yes" /></td></tr>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Remove custom webtrees tags? (eg. _WT_USER, _THUM)'), help_link('remove_tags'); ?></td>
- <td class="optionbox"><input type="checkbox" name="remove" value="yes" checked="checked" /></td></tr>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert media path to'), help_link('convertPath'); ?></td>
- <td class="list_value"><input type="text" name="conv_path" size="30" value="<?php echo getLRM(), $controller->conv_path, getLRM();?>" /></td></tr>
-
- <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert media folder separators to'), help_link('convertSlashes'); ?></td>
- <td class="list_value">
- <input type="radio" name="conv_slashes" value="forward" <?php if ($controller->conv_slashes=='forward') print "checked=\"checked\" "; ?>/>&nbsp;<?php print i18n::translate('Forward slashes : /');?><br />
- <input type="radio" name="conv_slashes" value="backward" <?php if ($controller->conv_slashes=='backward') print "checked=\"checked\" "; ?>/>&nbsp;<?php print i18n::translate('Backslashes : \\');?>
- </td></tr>
-
- <tr><td class="topbottombar" colspan="2">
- <input type="submit" value="<?php print i18n::translate('Download Now'); ?>" />
- </form>
- </td></tr>
- </table>
- </td></tr>
- </table>
- <br />
-
- <script language="JavaScript" type="text/javascript">
- <!--
- var pastefield;
- function paste_id(value)
- {
- pastefield.value=value;
- }
- //-->
- </script>
- <form method="get" name="addin" action="module.php">
- <input type="hidden" name="mod" value="clippings" />
- <input type="hidden" name="mod_action" value="index" />
- <table>
- <tr>
- <td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo i18n::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
- </td>
- </tr>
- <tr>
- <td class="optionbox">
- <input type="hidden" name="action" value="add"/>
- <input type="text" name="id" id="cart_item_id" size="8" />
- </td>
- <td class="optionbox">
- <?php print_findindi_link('cart_item_id', ''); ?>
- <?php print_findfamily_link('cart_item_id', ''); ?>
- <?php print_findsource_link('cart_item_id', ''); ?>
- <input type="submit" value="<?php print i18n::translate('Add');?>"/>
-
- </td>
- </tr>
- </table>
- </form>
-
-
- <?php } ?>
- <br /><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo i18n::translate('Empty Cart');?></a><?php echo help_link('empty_cart', $this->getName()); ?>
- </td></tr>
-
- <tr><td class="topbottombar"><h2><?php echo i18n::translate('Family Tree Clippings Cart'), help_link('clip_cart', $this->getName()); ?></h2></td></tr>
-
- <tr><td valign="top">
- <table id="mycart" class="sortable list_table width100">
- <tr>
- <th class="list_label"><?php echo i18n::translate('Type')?></th>
- <th class="list_label"><?php echo i18n::translate('ID')?></th>
- <th class="list_label"><?php echo i18n::translate('Name / Description')?></th>
- <th class="list_label"><?php echo i18n::translate('Remove')?></th>
- </tr>
-<?php
- for ($i=0; $i<$ct; $i++) {
- $clipping = $cart[$i];
- $tag = strtoupper(substr($clipping['type'], 0, 4)); // source => SOUR
- //print_r($clipping);
- //-- don't show clippings from other gedcoms
- if ($clipping['gedcom']==$GEDCOM) {
- if ($tag=='INDI') $icon = "indis";
- if ($tag=='FAM' ) $icon = "sfamily";
- if ($tag=='SOUR') $icon = "source";
- if ($tag=='REPO') $icon = "repository";
- if ($tag=='NOTE') $icon = "notes";
- if ($tag=='OBJE') $icon = "media";
- ?>
- <tr><td class="list_value">
- <?php if (!empty($icon)) { ?><img src="<?php echo $WT_IMAGES[$icon];?>" border="0" alt="<?php echo $tag;?>" title="<?php echo $tag;?>" /><?php } ?>
- </td>
- <td class="list_value ltr"><?php echo $clipping['id']?></td>
- <td class="list_value">
- <?php
- $record=GedcomRecord::getInstance($clipping['id']);
- if ($record) echo '<a href="', encode_url($record->getLinkUrl()), '">', PrintReady($record->getListName()), '</a>';
- ?>
- </td>
- <td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;item=<?php echo $i;?>"><img src="<?php echo $WT_IMAGES["remove"];?>" border="0" alt="<?php echo i18n::translate('Remove')?>" title="<?php echo i18n::translate('Remove');?>" /></a></td>
- </tr>
- <?php
- }
- }
-?>
- </table>
- </td></tr></table>
-<?php
-}
-if (isset($_SESSION["cart"])) $_SESSION["cart"]=$cart;
-print_footer();
-?>
+<?php
+/**
+ * Family Tree Clippings Cart
+ *
+ * Uses the $_SESSION["cart"] to store the ids of clippings to download
+ * @TODO print a message if people are not included due to privacy
+ *
+ * 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 Charts
+ * @version $Id$
+ */
+
+require_once WT_ROOT.'modules/clippings/clippings_ctrl.php';
+
+global $ENABLE_AUTOCOMPLETE, $cart, $MAX_PEDIGREE_GENERATIONS, $TEXT_DIRECTION, $GEDCOM, $WT_IMAGES;
+
+$controller = new ClippingsController();
+$controller->init();
+
+// -- print html header information
+print_header(i18n::translate('Clippings cart'));
+
+if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
+
+echo WT_JS_START;
+echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
+echo WT_JS_END;
+
+if (count($cart)==0) {?>
+<h2><?php print i18n::translate('Family Tree Clippings Cart');?></h2>
+<?php }
+
+if ($controller->action=='add') {
+ $person = GedcomRecord::getInstance($controller->id);
+ print "<b>".$person->getFullName()."</b>";
+ if ($controller->type=='fam') {?>
+ <form action="module.php" method="get">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <table>
+ <tr><td class="topbottombar"><?php print i18n::translate('Which other links from this family would you like to add?')?>
+ <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
+ <input type="hidden" name="type" value="<?php print $controller->type ?>" />
+ <input type="hidden" name="action" value="add1" /></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this family record.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="parents" /><?php print i18n::translate('Add parents\' records together with this family record.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="members" /><?php print i18n::translate('Add parents\' and children\'s records together with this family record.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="descendants" /><?php print i18n::translate('Add parents\' and all descendants\' records together with this family record.')?></td></tr>
+ <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" /></td></tr>
+
+ </table>
+ </form>
+ <?php }
+ else if ($controller->type=='indi') {?>
+ <form action="module.php" method="get">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <table>
+ <tr><td class="topbottombar"><?php print i18n::translate('Which links from this person would you also like to add?')?>
+ <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
+ <input type="hidden" name="type" value="<?php print $controller->type ?>" />
+ <input type="hidden" name="action" value="add1" /></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this person.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="parents" /><?php print i18n::translate('Add this person, his parents, and siblings.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors" /><?php print i18n::translate('Add this person and his direct line ancestors.')?><br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level1" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"/></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies" /><?php print i18n::translate('Add this person, his direct line ancestors, and their families.')?><br >
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level2" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');" /></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="members" /><?php print i18n::translate('Add this person, his spouse, and children.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants" /><?php print i18n::translate('Add this person, his spouse, and all descendants.')?><br >
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print i18n::translate('Number of generations:') ?> <input type="text" size="5" name="level3" value="<?php print $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');" /></td></tr>
+ <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" />
+ </table>
+ </form>
+ <?php } else if ($controller->type=='sour') {?>
+ <form action="module.php" method="get">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <table>
+ <tr><td class="topbottombar"><?php print i18n::translate('Which records linked to this source should be added?')?>
+ <input type="hidden" name="id" value="<?php print $controller->id; ?>" />
+ <input type="hidden" name="type" value="<?php print $controller->type ?>" />
+ <input type="hidden" name="action" value="add1" /></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" checked value="none" /><?php print i18n::translate('Add just this source.')?></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="linked" /><?php print i18n::translate('Add this source and families/people linked to it.')?></td></tr>
+ <tr><td class="topbottombar"><input type="submit" value="<?php print i18n::translate('Continue Adding')?>" />
+ </table>
+ </form>
+ <?php }
+ }
+$ct = count($cart);
+
+if ($controller->privCount>0) {
+ print "<span class=\"error\">".i18n::translate('Some items could not be added due to privacy restrictions')."</span><br /><br />\n";
+}
+
+if ($ct==0) {
+
+ // -- new lines, added by Jans, to display helptext when cart is empty
+ if ($controller->action!='add') {
+
+ echo i18n::translate('The Clippings Cart allows you to take extracts ("clippings") from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br /><ul><li>How to take clippings?<br />This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to Clippings Cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br />Once you have items in your cart, you can download them just by clicking the <b>Download Now</b> link. Follow the instructions and links.</li></ul>');
+
+ echo WT_JS_START;
+ echo 'var pastefield;';
+ echo 'function paste_id(value) {pastefield.value=value;}';
+ echo WT_JS_END;
+ ?>
+ <form method="get" name="addin" action="module.php">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <table>
+ <tr>
+ <td colspan="2" class="topbottombar" style="text-align:center; ">
+ <?php echo i18n::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="optionbox">
+ <input type="hidden" name="action" value="add"/>
+ <input type="text" name="id" id="cart_item_id" size="5"/>
+ </td>
+ <td class="optionbox">
+ <?php print_findindi_link('cart_item_id', ''); ?>
+ <?php print_findfamily_link('cart_item_id', ''); ?>
+ <?php print_findsource_link('cart_item_id', ''); ?>
+ <input type="submit" value="<?php print i18n::translate('Add');?>"/>
+
+ </td>
+ </tr>
+ </table>
+ </form>
+ <?php
+ }
+
+ // -- end new lines
+ print "\r\n\t\t<br /><br />".i18n::translate('Your Clippings Cart is empty.')."<br /><br />";
+} else {
+ if ($controller->action != 'download' && $controller->action != 'add') { ?>
+ <table><tr><td class="width33" valign="top" rowspan="3">
+ <form method="get" action="module.php">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <input type="hidden" name="action" value="download" />
+ <table>
+ <tr><td colspan="2" class="topbottombar"><h2><?php print i18n::translate('File Information') ?></h2></td></tr>
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Zip File(s)'), help_link('zip'); ?></td>
+ <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked="checked" /></td></tr>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Include media (automatically zips files)'), help_link('include_media'); ?></td>
+ <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked="checked" /></td></tr>
+
+ <?php
+ // Determine the Privatize options available to this user
+ if (WT_USER_IS_ADMIN) {
+ $radioPrivatizeNone = 'checked="checked" ';
+ $radioPrivatizeVisitor = '';
+ $radioPrivatizeUser = '';
+ $radioPrivatizeGedadmin = '';
+ $radioPrivatizeAdmin = '';
+ } else if (WT_USER_GEDCOM_ADMIN) {
+ $radioPrivatizeNone = 'DISABLED ';
+ $radioPrivatizeVisitor = 'checked="checked" ';
+ $radioPrivatizeUser = '';
+ $radioPrivatizeGedadmin = '';
+ $radioPrivatizeAdmin = 'DISABLED ';
+ } else if (WT_USER_ID) {
+ $radioPrivatizeNone = 'DISABLED ';
+ $radioPrivatizeVisitor = 'checked="checked" ';
+ $radioPrivatizeUser = '';
+ $radioPrivatizeGedadmin = 'DISABLED ';
+ $radioPrivatizeAdmin = 'DISABLED ';
+ } else {
+ $radioPrivatizeNone = 'DISABLED ';
+ $radioPrivatizeVisitor = 'checked="checked" DISABLED ';
+ $radioPrivatizeUser = 'DISABLED ';
+ $radioPrivatizeGedadmin = 'DISABLED ';
+ $radioPrivatizeAdmin = 'DISABLED ';
+ }
+ ?>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Apply privacy settings?'), help_link('apply_privacy'); ?></td>
+ <td class="list_value">
+ <input type="radio" name="privatize_export" value="none" <?php print $radioPrivatizeNone; ?>/>&nbsp;<?php print i18n::translate('None'); ?><br />
+ <input type="radio" name="privatize_export" value="visitor" <?php print $radioPrivatizeVisitor; ?>/>&nbsp;<?php print i18n::translate('Visitor'); ?><br />
+ <input type="radio" name="privatize_export" value="user" <?php print $radioPrivatizeUser; ?>/>&nbsp;<?php print i18n::translate('Authenticated user'); ?><br />
+ <input type="radio" name="privatize_export" value="gedadmin" <?php print $radioPrivatizeGedadmin; ?>/>&nbsp;<?php print i18n::translate('GEDCOM administrator'); ?>
+ </td></tr>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert from UTF-8 to ANSI (ISO-8859-1)'), help_link('utf8_ansi'); ?></td>
+ <td class="optionbox"><input type="checkbox" name="convert" value="yes" /></td></tr>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Remove custom webtrees tags? (eg. _WT_USER, _THUM)'), help_link('remove_tags'); ?></td>
+ <td class="optionbox"><input type="checkbox" name="remove" value="yes" checked="checked" /></td></tr>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert media path to'), help_link('convertPath'); ?></td>
+ <td class="list_value"><input type="text" name="conv_path" size="30" value="<?php echo getLRM(), $controller->conv_path, getLRM();?>" /></td></tr>
+
+ <tr><td class="descriptionbox width50 wrap"><?php echo i18n::translate('Convert media folder separators to'), help_link('convertSlashes'); ?></td>
+ <td class="list_value">
+ <input type="radio" name="conv_slashes" value="forward" <?php if ($controller->conv_slashes=='forward') print "checked=\"checked\" "; ?>/>&nbsp;<?php print i18n::translate('Forward slashes : /');?><br />
+ <input type="radio" name="conv_slashes" value="backward" <?php if ($controller->conv_slashes=='backward') print "checked=\"checked\" "; ?>/>&nbsp;<?php print i18n::translate('Backslashes : \\');?>
+ </td></tr>
+
+ <tr><td class="topbottombar" colspan="2">
+ <input type="submit" value="<?php print i18n::translate('Download Now'); ?>" />
+ </form>
+ </td></tr>
+ </table>
+ </td></tr>
+ </table>
+ <br />
+
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ var pastefield;
+ function paste_id(value)
+ {
+ pastefield.value=value;
+ }
+ //-->
+ </script>
+ <form method="get" name="addin" action="module.php">
+ <input type="hidden" name="mod" value="clippings" />
+ <input type="hidden" name="mod_action" value="index" />
+ <table>
+ <tr>
+ <td colspan="2" class="topbottombar" style="text-align:center; ">
+ <?php echo i18n::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="optionbox">
+ <input type="hidden" name="action" value="add"/>
+ <input type="text" name="id" id="cart_item_id" size="8" />
+ </td>
+ <td class="optionbox">
+ <?php print_findindi_link('cart_item_id', ''); ?>
+ <?php print_findfamily_link('cart_item_id', ''); ?>
+ <?php print_findsource_link('cart_item_id', ''); ?>
+ <input type="submit" value="<?php print i18n::translate('Add');?>"/>
+
+ </td>
+ </tr>
+ </table>
+ </form>
+
+
+ <?php } ?>
+ <br /><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo i18n::translate('Empty Cart');?></a><?php echo help_link('empty_cart', $this->getName()); ?>
+ </td></tr>
+
+ <tr><td class="topbottombar"><h2><?php echo i18n::translate('Family Tree Clippings Cart'), help_link('clip_cart', $this->getName()); ?></h2></td></tr>
+
+ <tr><td valign="top">
+ <table id="mycart" class="sortable list_table width100">
+ <tr>
+ <th class="list_label"><?php echo i18n::translate('Type')?></th>
+ <th class="list_label"><?php echo i18n::translate('ID')?></th>
+ <th class="list_label"><?php echo i18n::translate('Name / Description')?></th>
+ <th class="list_label"><?php echo i18n::translate('Remove')?></th>
+ </tr>
+<?php
+ for ($i=0; $i<$ct; $i++) {
+ $clipping = $cart[$i];
+ $tag = strtoupper(substr($clipping['type'], 0, 4)); // source => SOUR
+ //print_r($clipping);
+ //-- don't show clippings from other gedcoms
+ if ($clipping['gedcom']==$GEDCOM) {
+ if ($tag=='INDI') $icon = "indis";
+ if ($tag=='FAM' ) $icon = "sfamily";
+ if ($tag=='SOUR') $icon = "source";
+ if ($tag=='REPO') $icon = "repository";
+ if ($tag=='NOTE') $icon = "notes";
+ if ($tag=='OBJE') $icon = "media";
+ ?>
+ <tr><td class="list_value">
+ <?php if (!empty($icon)) { ?><img src="<?php echo $WT_IMAGES[$icon];?>" border="0" alt="<?php echo $tag;?>" title="<?php echo $tag;?>" /><?php } ?>
+ </td>
+ <td class="list_value ltr"><?php echo $clipping['id']?></td>
+ <td class="list_value">
+ <?php
+ $record=GedcomRecord::getInstance($clipping['id']);
+ if ($record) echo '<a href="', encode_url($record->getLinkUrl()), '">', PrintReady($record->getListName()), '</a>';
+ ?>
+ </td>
+ <td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;item=<?php echo $i;?>"><img src="<?php echo $WT_IMAGES["remove"];?>" border="0" alt="<?php echo i18n::translate('Remove')?>" title="<?php echo i18n::translate('Remove');?>" /></a></td>
+ </tr>
+ <?php
+ }
+ }
+?>
+ </table>
+ </td></tr></table>
+<?php
+}
+if (isset($_SESSION["cart"])) $_SESSION["cart"]=$cart;
+print_footer();
+?>
diff --git a/modules/death_report/module.php b/modules/death_report/module.php
index 0a1ad6cca1..ae7e60515e 100644
--- a/modules/death_report/module.php
+++ b/modules/death_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/descendancy/module.php b/modules/descendancy/module.php
index 70852a4fec..ce49bc52a8 100644
--- a/modules/descendancy/module.php
+++ b/modules/descendancy/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/descendancy_report/module.php b/modules/descendancy_report/module.php
index 9b51016bc0..31ef70faa7 100644
--- a/modules/descendancy_report/module.php
+++ b/modules/descendancy_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/families/module.php b/modules/families/module.php
index 1bdd3577ac..3f41bb45b9 100644
--- a/modules/families/module.php
+++ b/modules/families/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/family_group_report/module.php b/modules/family_group_report/module.php
index 4e7b9128c0..2baa564e5a 100644
--- a/modules/family_group_report/module.php
+++ b/modules/family_group_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/family_nav/module.php b/modules/family_nav/module.php
index 77c9622243..c89765cbb7 100644
--- a/modules/family_nav/module.php
+++ b/modules/family_nav/module.php
@@ -1,783 +1,783 @@
-<?php
-/**
- * Classes and libraries for module system
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2009 John Finlay
- *
- * 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 Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-require_once WT_ROOT.'includes/classes/class_module.php';
-require_once WT_ROOT.'includes/functions/functions_charts.php';
-require_once WT_ROOT.'includes/controllers/individual_ctrl.php';
-
-class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
- // Extend WT_Module
- public function getTitle() {
- return i18n::translate('Family Navigator');
- }
-
- // Extend WT_Module
- public function getDescription() {
- return i18n::translate('Adds a tab to the individual page which displays a family navigator on the individual page.');
- }
-
- // Implement WT_Module_Sidebar
- public function defaultSidebarOrder() {
- return 10;
- }
-
- // Implement WT_Module_Sidebar
- public function hasSidebarContent() {
- return true;
- }
-
- // Implement WT_Module_Sidebar
- public function getSidebarContent() {
- global $WT_IMAGES;
-
- $out = '<div id="sb_family_nav_content">';
-
- if ($this->controller) {
- $root = null;
- if ($this->controller->pid) {
- $root = Person::getInstance($this->controller->pid);
- }
- else if ($this->controller->famid) {
- $fam = Family::getInstance($this->controller->famid);
- if ($fam) $root = $fam->getHusband();
- if (!$root) $root = $fam->getWife();
- }
- if ($root!=null) {
- $this->controller = new IndividualController();
- $this->controller->indi=$root;
- $this->controller->pid=$root->getXref();
- $this->setController($this->controller);
- $out .= $this->getTabContent();
- }
- }
- $out .= '</div>';
- return $out;
- }
-
- // Implement WT_Module_Sidebar
- public function getSidebarAjaxContent() {
- return "";
- }
-
- public function getLinkUrl(&$person) {
-
- }
-
- // TODO: These functions aren't really part of the WT_Module_Tab interface, as
- // this module no longer provides a tab.
- public function hasTabContent() {
- return true;
- }
- public function getTabContent() {
- $out = '';
- ob_start();
- // -----------------------------------------------------------------------------
- // Function Family Nav for PHPGedView - called by individual_ctrl.php
- // -----------------------------------------------------------------------------
- // function family_nav() {
- // ------------------------------------------------------------------------------
-
- global $edit, $tabno, $GEDCOM, $pid;
- $edit=$edit;
- global $show_full, $tabno;
- $show_full="1";
-
- // =====================================================================
-
- echo WT_JS_START;
- echo 'function familyNavLoad(url) {
- window.location = url+"#"+jQuery("#tabs li:eq("+jQuery("#tabs").tabs("option", "selected")+") a").attr("title");
- return false;
- }
- ';
- echo WT_JS_END;
-
- // Start Family Nav Table ----------------------------
- echo "<table class=\"nav_content\" cellpadding=\"0\">";
- global $WT_IMAGES, $spouselinks, $parentlinks, $DeathYr, $BirthYr, $TEXT_DIRECTION;
-
- $personcount=0;
- $families = $this->controller->indi->getChildFamilies();
-
- //-- parent families -------------------------------------------------------------
- foreach($families as $famid=>$family) {
- $label = $this->controller->indi->getChildFamilyLabel($family);
- $people = $this->controller->buildFamilyList($family, "parents");
- $styleadd = "";
- ?>
- <tr>
- <td style="padding-bottom:4px;" align="center" colspan="2">
- <?php
- echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
- echo "<b>".$label."</b>";
- echo "</a>";
- ?>
- </td>
- </tr>
- <?php
- if (isset($people["husb"])) {
- $menu = new Menu("&nbsp;" . $people["husb"]->getLabel() . "&nbsp;". "\n");
- // $menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
- if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]);?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
- print PrintReady($people["husb"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- }
-
- if (isset($people["wife"])) {
- $menu = new Menu("&nbsp;" . $people["wife"]->getLabel() . "&nbsp;". "\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
- if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
- print PrintReady($people["wife"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- }
-
- if (isset($people["children"])) {
- $elderdate = $family->getMarriageDate();
- foreach($people["children"] as $key=>$child) {
- if ($pid == $child->getXref() ){
- }else{
- $menu = new Menu("&nbsp;" . $child->getLabel() . "\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
- $slabel .= $spouselinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
- }
- if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
- if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
-
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php
- if ($pid == $child->getXref() ) {
- echo $child->getLabel();
- } else {
- echo $menu->getMenu();
- }
- ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
- <?php
- if ($pid == $child->getXref()) {
- print "<span style=\"font: 12px tahoma, arial, helvetica, sans-serif;\">".PrintReady($child->getFullName())."</span>";
- print "<br /><span style=\"font:9px tahoma, arial, helvetica, sans-serif;\">" . $BirthYr . " - " . $DeathYr . "</span>";
- }else{
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
- print PrintReady($child->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- }
- ?>
- </td>
- </tr>
- <?php
- $elderdate = $child->getBirthDate();
- }
- }
- }
-
- //-- step families ----------------------------------------------------------------
- foreach($this->controller->indi->getStepFamilies() as $famid=>$family) {
- $label = $this->controller->indi->getStepFamilyLabel($family);
- $people = $this->controller->buildFamilyList($family, "step");
- if ($people){
- echo "<tr><td><br /></td><td></td></tr>";
- }
- $styleadd = "";
- $elderdate = "";
- ?>
- <tr>
- <td style="padding-bottom: 4px;" align="center" colspan="2">
- <?php
- echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\"href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
- echo "<b>".$label."</b>";
- echo "</a>";
- ?>
- </td>
- </tr>
- <?php
-
- //if (isset($people["husb"]) && $people["husb"]->getLabel() == ".") {
- if (isset($people["husb"]) ) {
- $menu = new Menu();
- if ($people["husb"]->getLabel() == ".") {
- $menu->addLabel(i18n::translate('Step-Father')."\n");
- }else{
- $menu->addLabel($people["husb"]->getLabel()."\n");
- }
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
- if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
- ?>
-
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]); ?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
- print PrintReady($people["husb"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- $elderdate = $people["husb"]->getBirthDate();
- }
-
- $styleadd = "";
- //if (isset($people["wife"]) && $people["wife"]->getLabel() == ".") {
- if (isset($people["wife"]) ) {
- $menu = new Menu();
- if ($people["wife"]->getLabel() == ".") {
- $menu->addLabel(i18n::translate('Step-Mother')."\n");
- }else{
- $menu->addLabel($people["wife"]->getLabel()."\n");
- }
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
- if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
- print PrintReady($people["wife"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- }
-
- $styleadd = "";
- if (isset($people["children"])) {
- $elderdate = $family->getMarriageDate();
- foreach($people["children"] as $key=>$child) {
- $menu = new Menu($child->getLabel()."\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
- $slabel .= $spouselinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
- if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
- print PrintReady($child->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- //$elderdate = $child->getBirthDate();
- }
- }
- }
-
- //-- spouse and children --------------------------------------------------
- $families = $this->controller->indi->getSpouseFamilies();
- foreach($families as $famid=>$family) {
- echo "<tr><td><br /></td><td></td></tr>";
- ?>
- <tr>
- <td style="padding-bottom: 4px;" align="center" colspan="2">
- <?php
- echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
- echo "<b>".i18n::translate('Immediate Family')."</b>";
- echo "</a>";
- ?>
- </td>
- </tr>
- <?php
-
- //$personcount = 0;
- $people = $this->controller->buildFamilyList($family, "spouse");
- if ($this->controller->indi->equals($people["husb"])){
- $spousetag = 'WIFE';
- }else{
- $spousetag = 'HUSB';
- }
- $styleadd = "";
- if ( isset($people["husb"]) && $spousetag == 'HUSB' ) {
- $menu = new Menu("&nbsp;" . $people["husb"]->getLabel() . "&nbsp;". "\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
- if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]); ?> nam">
- <?php
- if ($pid == $people["husb"]->getXref()) {
- print PrintReady($people["husb"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- }else{
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
- print PrintReady($people["husb"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- }
- ?>
- </td>
- </tr>
- <?php
- }
-
- if ( isset($people["wife"]) && $spousetag == 'WIFE') {
- $menu = new Menu("&nbsp;" . $people["wife"]->getLabel() . "&nbsp;". "\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
- $slabel .= $parentlinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubMenu($submenu);
-
- if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
- if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
- <?php
- if ($pid == $people["wife"]->getXref()) {
- print PrintReady($people["wife"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- }else{
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
- print PrintReady($people["wife"]->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- }
- ?>
- </td>
- </tr>
- <?php
- }
-
- $styleadd = "";
- if (isset($people["children"])) {
- foreach($people["children"] as $key=>$child) {
- $menu = new Menu("&nbsp;" . $child->getLabel() . "&nbsp;". "\n");
- //$menu->addClass("", "", "submenu");
- if ($TEXT_DIRECTION=="ltr") {
- $menu->addClass("", "", "submenu flyout2");
- }else{
- $menu->addClass("", "", "submenu flyout2rtl");
- }
- $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
- $slabel .= $spouselinks."<a>";
- $submenu = new Menu($slabel);
- $menu->addSubmenu($submenu);
-
- if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
- if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
- ?>
- <tr>
- <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
- <?php echo $menu->getMenu(); ?>
- </td>
- <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
- <?php
- print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
- print PrintReady($child->getFullName());
- print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
- print "</a>";
- ?>
- </td>
- </tr>
- <?php
- }
- }
-
- }
- echo "</table>";
-
- // -----------------------------------------------------------------------------
- // }
- // -----------------------------------------------------------------------------
- // End Family Nav Table
- // -----------------------------------------------------------------------------
-
- $out .= ob_get_contents();
- ob_end_clean();
- return $out;
-
- } // End public function getTabContent()
-
-function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") {
- global $HIDE_LIVE_PEOPLE, $SHOW_LIVING_NAMES, $ZOOM_BOXES, $LINK_ICONS, $SCRIPT_NAME, $GEDCOM;
- global $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $bwidth, $bheight, $PEDIGREE_FULL_DETAILS, $SHOW_PEDIGREE_PLACES;
- global $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT, $MEDIA_DIRECTORY;
- global $WT_IMAGES, $ABBREVIATE_CHART_LABELS, $USE_MEDIA_VIEWER;
- global $chart_style, $box_width, $generations, $show_spouse, $show_full;
- global $CHART_BOX_TAGS, $SHOW_LDS_AT_GLANCE, $PEDIGREE_SHOW_GENDER;
- global $SEARCH_SPIDER;
-
- global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent, $tabno, $theme_name, $spousetag;
- global $natdad, $natmom;
-
- if ($style != 2) $style=1;
- if (empty($show_full)) $show_full = 0;
- if (empty($PEDIGREE_FULL_DETAILS)) $PEDIGREE_FULL_DETAILS = 0;
-
- if (!isset($OLD_PGENS)) $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS;
- if (!isset($talloffset)) $talloffset = $PEDIGREE_LAYOUT;
-
- $person=Person::getInstance($pid);
- if ($pid==false || empty($person)) {
- $spouselinks = false;
- $parentlinks = false;
- $step_parentlinks = false;
- }
-
- $tmp=array('M'=>'','F'=>'F', 'U'=>'NN');
- $isF=$tmp[$person->getSex()];
- $spouselinks = "";
- $parentlinks = "";
- $step_parentlinks = "";
- $disp=$person->canDisplayDetails();
-
- if ($person->canDisplayName()) {
- if (empty($SEARCH_SPIDER)) {
- if ($LINK_ICONS!="disabled") {
- //-- draw a box for the family flyout
- $parentlinks .= "<span class=\"flyout4\"><b>".i18n::translate('Parents')."</b></span><br />";
- $step_parentlinks .= "<span class=\"flyout4\"><b>".i18n::translate('Parents')."</b></span><br />";
- $spouselinks .= "<span class=\"flyout4\"><b>".i18n::translate('Family')."</b></span><br />";
-
- $persons = "";
- $person_parent = "";
- $person_step = "";
-
-
-
- //-- parent families --------------------------------------
- $fams = $person->getChildFamilies();
- foreach($fams as $famid=>$family) {
-
- if (!is_null($family)) {
- $husb = $family->getHusband($person);
- $wife = $family->getWife($person);
- // $spouse = $family->getSpouse($person);
- $children = $family->getChildren();
- $num = count($children);
-
- // Husband ------------------------------
- if ($husb || $num>0) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Family book chart').": ".$famid;
- }else{
- $title = $famid." :".i18n::translate('Family book chart');
- }
- if ($husb) {
- $person_parent="Yes";
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Individual information').": ".$husb->getXref();
- }else{
- $title = $husb->getXref()." :".i18n::translate('Individual information');
- }
- $parentlinks .= "<a id=\"phusb\" href=\"".encode_url($husb->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($husb->getLinkUrl())."');\">";
- $parentlinks .= "&nbsp;".PrintReady($husb->getFullName());
- $parentlinks .= "</a>";
- $parentlinks .= "<br />";
- $natdad = "yes";
- }
- }
-
- // Wife ------------------------------
- if ($wife || $num>0) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Family book chart').": ".$famid;
- }else{
- $title = $famid." :".i18n::translate('Family book chart');
- }
- if ($wife) {
- $person_parent="Yes";
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Individual information').": ".$wife->getXref();
- }else{
- $title = $wife->getXref()." :".i18n::translate('Individual information');
- }
- $parentlinks .= "<a id=\"pwife\" href=\"".encode_url($wife->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($wife->getLinkUrl())."');\">";
- $parentlinks .= "&nbsp;".PrintReady($wife->getFullName());
- $parentlinks .= "</a>";
- $parentlinks .= "<br />";
- $natmom = "yes";
- }
- }
- }
- }
-
- //-- step families -----------------------------------------
- $fams = $person->getStepFamilies();
- foreach($fams as $famid=>$family) {
- if (!is_null($family)) {
- $husb = $family->getHusband($person);
- $wife = $family->getWife($person);
- // $spouse = $family->getSpouse($person);
- $children = $family->getChildren();
- $num = count($children);
-
- if ($natdad == "yes") {
- }else{
- // Husband -----------------------
- if ($husb || $num>0) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Family book chart').": ".$famid;
- }else{
- $title = $famid." :".i18n::translate('Family book chart');
- }
- if ($husb) {
- $person_step="Yes";
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Individual information').": ".$husb->getXref();
- }else{
- $title = $husb->getXref()." :".i18n::translate('Individual information');
- }
- $parentlinks .= "<a id=\"shusb\" href=\"".encode_url($husb->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($husb->getLinkUrl())."');\">";
- $parentlinks .= "&nbsp;".PrintReady($husb->getFullName());
- $parentlinks .= "</a>";
- $parentlinks .= "<br />";
- }
- }
- }
-
- if ($natmom == "yes") {
- }else{
- // Wife ----------------------------
- if ($wife || $num>0) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Family book chart').": ".$famid;
- }else{
- $title = $famid." :".i18n::translate('Family book chart');
- }
- if ($wife) {
- $person_step="Yes";
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Individual information').": ".$wife->getXref();
- }else{
- $title = $wife->getXref()." :".i18n::translate('Individual information');
- }
- $parentlinks .= "<a id=\"swife\" href=\"".encode_url($wife->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($wife->getLinkUrl())."');\">";
- $parentlinks .= "&nbsp;".PrintReady($wife->getFullName());
- $parentlinks .= "</a>";
- $parentlinks .= "<br />";
- }
- }
- }
- }
- }
-
- // Spouse Families -------------------------------------- @var $family Family
- $fams = $person->getSpouseFamilies();
- foreach($fams as $famid=>$family) {
- if (!is_null($family)) {
- $spouse = $family->getSpouse($person);
- $children = $family->getChildren();
- $num = count($children);
-
- // Spouse ------------------------------
- if ($spouse || $num>0) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Family book chart').": ".$famid;
- }else{
- $title = $famid." :".i18n::translate('Family book chart');
- }
- if ($spouse) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = i18n::translate('Individual information').": ".$spouse->getXref();
- }else{
- $title = $spouse->getXref()." :".i18n::translate('Individual information');
- }
- $spouselinks .= "<a id=\"spouse\" href=\"".encode_url($spouse->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($spouse->getLinkUrl())."');\">";
- $spouselinks .= "&nbsp;".PrintReady($spouse->getFullName());
- $spouselinks .= "</a>";
- $spouselinks .= "<br />";
- if ($spouse->getFullName() != "") {
- $persons = "Yes";
- }
- }
- }
-
- // Children ------------------------------ @var $child Person
- $hasChildren = 'No';
- foreach($children as $c=>$child) {
- if ($child) {
- if ($hasChildren == 'No') {
- $hasChildren = 'Yes';
- $spouselinks .= "\n<ul class=\"clist ".$TEXT_DIRECTION."\">";
- }
- $persons="Yes";
- $title = i18n::translate('Individual information').": ".$child->getXref();
- $spouselinks .= "\n<li id=\"flyout3\">";
- $spouselinks .= "<a href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
- $spouselinks .= PrintReady($child->getFullName());
- $spouselinks .= "</a>";
- }
- }
- if ($hasChildren == 'Yes') {
- $spouselinks .= "\n</ul>";
- } else {
- $spouselinks .= "<br /><img src=\"images/small/childless.gif\" alt=\"".i18n::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".i18n::translate('This family remained childless');
- }
- }
- }
-
- if ($persons != "Yes") {
- $spouselinks .= "&nbsp;(".i18n::translate('none').")\n\t\t";
- }
- if ($person_parent != "Yes") {
- $parentlinks .= "&nbsp;(".i18n::translate_c('unknown family', 'unknown').")\n\t\t";
- }
- if ($person_step != "Yes") {
- $step_parentlinks .= "&nbsp;(".i18n::translate_c('unknown family', 'unknown').")\n\t\t";
- }
- }
- }
- }
-}
-
-}
+<?php
+/**
+ * Classes and libraries for module system
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2009 John Finlay
+ *
+ * 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 Modules
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+require_once WT_ROOT.'includes/classes/class_module.php';
+require_once WT_ROOT.'includes/functions/functions_charts.php';
+require_once WT_ROOT.'includes/controllers/individual_ctrl.php';
+
+class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
+ // Extend WT_Module
+ public function getTitle() {
+ return i18n::translate('Family Navigator');
+ }
+
+ // Extend WT_Module
+ public function getDescription() {
+ return i18n::translate('Adds a tab to the individual page which displays a family navigator on the individual page.');
+ }
+
+ // Implement WT_Module_Sidebar
+ public function defaultSidebarOrder() {
+ return 10;
+ }
+
+ // Implement WT_Module_Sidebar
+ public function hasSidebarContent() {
+ return true;
+ }
+
+ // Implement WT_Module_Sidebar
+ public function getSidebarContent() {
+ global $WT_IMAGES;
+
+ $out = '<div id="sb_family_nav_content">';
+
+ if ($this->controller) {
+ $root = null;
+ if ($this->controller->pid) {
+ $root = Person::getInstance($this->controller->pid);
+ }
+ else if ($this->controller->famid) {
+ $fam = Family::getInstance($this->controller->famid);
+ if ($fam) $root = $fam->getHusband();
+ if (!$root) $root = $fam->getWife();
+ }
+ if ($root!=null) {
+ $this->controller = new IndividualController();
+ $this->controller->indi=$root;
+ $this->controller->pid=$root->getXref();
+ $this->setController($this->controller);
+ $out .= $this->getTabContent();
+ }
+ }
+ $out .= '</div>';
+ return $out;
+ }
+
+ // Implement WT_Module_Sidebar
+ public function getSidebarAjaxContent() {
+ return "";
+ }
+
+ public function getLinkUrl(&$person) {
+
+ }
+
+ // TODO: These functions aren't really part of the WT_Module_Tab interface, as
+ // this module no longer provides a tab.
+ public function hasTabContent() {
+ return true;
+ }
+ public function getTabContent() {
+ $out = '';
+ ob_start();
+ // -----------------------------------------------------------------------------
+ // Function Family Nav for PHPGedView - called by individual_ctrl.php
+ // -----------------------------------------------------------------------------
+ // function family_nav() {
+ // ------------------------------------------------------------------------------
+
+ global $edit, $tabno, $GEDCOM, $pid;
+ $edit=$edit;
+ global $show_full, $tabno;
+ $show_full="1";
+
+ // =====================================================================
+
+ echo WT_JS_START;
+ echo 'function familyNavLoad(url) {
+ window.location = url+"#"+jQuery("#tabs li:eq("+jQuery("#tabs").tabs("option", "selected")+") a").attr("title");
+ return false;
+ }
+ ';
+ echo WT_JS_END;
+
+ // Start Family Nav Table ----------------------------
+ echo "<table class=\"nav_content\" cellpadding=\"0\">";
+ global $WT_IMAGES, $spouselinks, $parentlinks, $DeathYr, $BirthYr, $TEXT_DIRECTION;
+
+ $personcount=0;
+ $families = $this->controller->indi->getChildFamilies();
+
+ //-- parent families -------------------------------------------------------------
+ foreach($families as $famid=>$family) {
+ $label = $this->controller->indi->getChildFamilyLabel($family);
+ $people = $this->controller->buildFamilyList($family, "parents");
+ $styleadd = "";
+ ?>
+ <tr>
+ <td style="padding-bottom:4px;" align="center" colspan="2">
+ <?php
+ echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
+ echo "<b>".$label."</b>";
+ echo "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ if (isset($people["husb"])) {
+ $menu = new Menu("&nbsp;" . $people["husb"]->getLabel() . "&nbsp;". "\n");
+ // $menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
+ if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]);?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
+ print PrintReady($people["husb"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+
+ if (isset($people["wife"])) {
+ $menu = new Menu("&nbsp;" . $people["wife"]->getLabel() . "&nbsp;". "\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
+ if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
+ print PrintReady($people["wife"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+
+ if (isset($people["children"])) {
+ $elderdate = $family->getMarriageDate();
+ foreach($people["children"] as $key=>$child) {
+ if ($pid == $child->getXref() ){
+ }else{
+ $menu = new Menu("&nbsp;" . $child->getLabel() . "\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
+ $slabel .= $spouselinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+ }
+ if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
+ if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
+
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php
+ if ($pid == $child->getXref() ) {
+ echo $child->getLabel();
+ } else {
+ echo $menu->getMenu();
+ }
+ ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
+ <?php
+ if ($pid == $child->getXref()) {
+ print "<span style=\"font: 12px tahoma, arial, helvetica, sans-serif;\">".PrintReady($child->getFullName())."</span>";
+ print "<br /><span style=\"font:9px tahoma, arial, helvetica, sans-serif;\">" . $BirthYr . " - " . $DeathYr . "</span>";
+ }else{
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
+ print PrintReady($child->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ $elderdate = $child->getBirthDate();
+ }
+ }
+ }
+
+ //-- step families ----------------------------------------------------------------
+ foreach($this->controller->indi->getStepFamilies() as $famid=>$family) {
+ $label = $this->controller->indi->getStepFamilyLabel($family);
+ $people = $this->controller->buildFamilyList($family, "step");
+ if ($people){
+ echo "<tr><td><br /></td><td></td></tr>";
+ }
+ $styleadd = "";
+ $elderdate = "";
+ ?>
+ <tr>
+ <td style="padding-bottom: 4px;" align="center" colspan="2">
+ <?php
+ echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\"href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
+ echo "<b>".$label."</b>";
+ echo "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+
+ //if (isset($people["husb"]) && $people["husb"]->getLabel() == ".") {
+ if (isset($people["husb"]) ) {
+ $menu = new Menu();
+ if ($people["husb"]->getLabel() == ".") {
+ $menu->addLabel(i18n::translate('Step-Father')."\n");
+ }else{
+ $menu->addLabel($people["husb"]->getLabel()."\n");
+ }
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
+ if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
+ ?>
+
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]); ?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
+ print PrintReady($people["husb"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ $elderdate = $people["husb"]->getBirthDate();
+ }
+
+ $styleadd = "";
+ //if (isset($people["wife"]) && $people["wife"]->getLabel() == ".") {
+ if (isset($people["wife"]) ) {
+ $menu = new Menu();
+ if ($people["wife"]->getLabel() == ".") {
+ $menu->addLabel(i18n::translate('Step-Mother')."\n");
+ }else{
+ $menu->addLabel($people["wife"]->getLabel()."\n");
+ }
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
+ if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
+ print PrintReady($people["wife"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+
+ $styleadd = "";
+ if (isset($people["children"])) {
+ $elderdate = $family->getMarriageDate();
+ foreach($people["children"] as $key=>$child) {
+ $menu = new Menu($child->getLabel()."\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
+ $slabel .= $spouselinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
+ if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
+ print PrintReady($child->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ //$elderdate = $child->getBirthDate();
+ }
+ }
+ }
+
+ //-- spouse and children --------------------------------------------------
+ $families = $this->controller->indi->getSpouseFamilies();
+ foreach($families as $famid=>$family) {
+ echo "<tr><td><br /></td><td></td></tr>";
+ ?>
+ <tr>
+ <td style="padding-bottom: 4px;" align="center" colspan="2">
+ <?php
+ echo "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"family.php?famid=".$famid."\" onclick=\"return familyNavLoad('family.php?famid=".$famid."');\">";
+ echo "<b>".i18n::translate('Immediate Family')."</b>";
+ echo "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+
+ //$personcount = 0;
+ $people = $this->controller->buildFamilyList($family, "spouse");
+ if ($this->controller->indi->equals($people["husb"])){
+ $spousetag = 'WIFE';
+ }else{
+ $spousetag = 'HUSB';
+ }
+ $styleadd = "";
+ if ( isset($people["husb"]) && $spousetag == 'HUSB' ) {
+ $menu = new Menu("&nbsp;" . $people["husb"]->getLabel() . "&nbsp;". "\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); }
+ if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["husb"]); ?> nam">
+ <?php
+ if ($pid == $people["husb"]->getXref()) {
+ print PrintReady($people["husb"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ }else{
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["husb"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['husb']->getLinkUrl())."');\">";
+ print PrintReady($people["husb"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+
+ if ( isset($people["wife"]) && $spousetag == 'WIFE') {
+ $menu = new Menu("&nbsp;" . $people["wife"]->getLabel() . "&nbsp;". "\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++);
+ $slabel .= $parentlinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubMenu($submenu);
+
+ if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); }
+ if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($people["wife"]); ?> nam">
+ <?php
+ if ($pid == $people["wife"]->getXref()) {
+ print PrintReady($people["wife"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ }else{
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($people["wife"]->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($people['wife']->getLinkUrl())."');\">";
+ print PrintReady($people["wife"]->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+
+ $styleadd = "";
+ if (isset($people["children"])) {
+ foreach($people["children"] as $key=>$child) {
+ $menu = new Menu("&nbsp;" . $child->getLabel() . "&nbsp;". "\n");
+ //$menu->addClass("", "", "submenu");
+ if ($TEXT_DIRECTION=="ltr") {
+ $menu->addClass("", "", "submenu flyout2");
+ }else{
+ $menu->addClass("", "", "submenu flyout2rtl");
+ }
+ $slabel = "</a>".$this->print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++);
+ $slabel .= $spouselinks."<a>";
+ $submenu = new Menu($slabel);
+ $menu->addSubmenu($submenu);
+
+ if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); }
+ if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); }
+ ?>
+ <tr>
+ <td class="facts_label<?php print $styleadd; ?>" nowrap="nowrap" style="width:75px;">
+ <?php echo $menu->getMenu(); ?>
+ </td>
+ <td align="center" class="<?php print $this->controller->getPersonStyle($child); ?> nam">
+ <?php
+ print "<a style=\"font:12px tahoma, arial, helvetica, sans-serif; padding:0px; width:100%;\" href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
+ print PrintReady($child->getFullName());
+ print "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>";
+ print "</a>";
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+ }
+
+ }
+ echo "</table>";
+
+ // -----------------------------------------------------------------------------
+ // }
+ // -----------------------------------------------------------------------------
+ // End Family Nav Table
+ // -----------------------------------------------------------------------------
+
+ $out .= ob_get_contents();
+ ob_end_clean();
+ return $out;
+
+ } // End public function getTabContent()
+
+function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") {
+ global $HIDE_LIVE_PEOPLE, $SHOW_LIVING_NAMES, $ZOOM_BOXES, $LINK_ICONS, $SCRIPT_NAME, $GEDCOM;
+ global $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $bwidth, $bheight, $PEDIGREE_FULL_DETAILS, $SHOW_PEDIGREE_PLACES;
+ global $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT, $MEDIA_DIRECTORY;
+ global $WT_IMAGES, $ABBREVIATE_CHART_LABELS, $USE_MEDIA_VIEWER;
+ global $chart_style, $box_width, $generations, $show_spouse, $show_full;
+ global $CHART_BOX_TAGS, $SHOW_LDS_AT_GLANCE, $PEDIGREE_SHOW_GENDER;
+ global $SEARCH_SPIDER;
+
+ global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent, $tabno, $theme_name, $spousetag;
+ global $natdad, $natmom;
+
+ if ($style != 2) $style=1;
+ if (empty($show_full)) $show_full = 0;
+ if (empty($PEDIGREE_FULL_DETAILS)) $PEDIGREE_FULL_DETAILS = 0;
+
+ if (!isset($OLD_PGENS)) $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS;
+ if (!isset($talloffset)) $talloffset = $PEDIGREE_LAYOUT;
+
+ $person=Person::getInstance($pid);
+ if ($pid==false || empty($person)) {
+ $spouselinks = false;
+ $parentlinks = false;
+ $step_parentlinks = false;
+ }
+
+ $tmp=array('M'=>'','F'=>'F', 'U'=>'NN');
+ $isF=$tmp[$person->getSex()];
+ $spouselinks = "";
+ $parentlinks = "";
+ $step_parentlinks = "";
+ $disp=$person->canDisplayDetails();
+
+ if ($person->canDisplayName()) {
+ if (empty($SEARCH_SPIDER)) {
+ if ($LINK_ICONS!="disabled") {
+ //-- draw a box for the family flyout
+ $parentlinks .= "<span class=\"flyout4\"><b>".i18n::translate('Parents')."</b></span><br />";
+ $step_parentlinks .= "<span class=\"flyout4\"><b>".i18n::translate('Parents')."</b></span><br />";
+ $spouselinks .= "<span class=\"flyout4\"><b>".i18n::translate('Family')."</b></span><br />";
+
+ $persons = "";
+ $person_parent = "";
+ $person_step = "";
+
+
+
+ //-- parent families --------------------------------------
+ $fams = $person->getChildFamilies();
+ foreach($fams as $famid=>$family) {
+
+ if (!is_null($family)) {
+ $husb = $family->getHusband($person);
+ $wife = $family->getWife($person);
+ // $spouse = $family->getSpouse($person);
+ $children = $family->getChildren();
+ $num = count($children);
+
+ // Husband ------------------------------
+ if ($husb || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Family book chart').": ".$famid;
+ }else{
+ $title = $famid." :".i18n::translate('Family book chart');
+ }
+ if ($husb) {
+ $person_parent="Yes";
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Individual information').": ".$husb->getXref();
+ }else{
+ $title = $husb->getXref()." :".i18n::translate('Individual information');
+ }
+ $parentlinks .= "<a id=\"phusb\" href=\"".encode_url($husb->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($husb->getLinkUrl())."');\">";
+ $parentlinks .= "&nbsp;".PrintReady($husb->getFullName());
+ $parentlinks .= "</a>";
+ $parentlinks .= "<br />";
+ $natdad = "yes";
+ }
+ }
+
+ // Wife ------------------------------
+ if ($wife || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Family book chart').": ".$famid;
+ }else{
+ $title = $famid." :".i18n::translate('Family book chart');
+ }
+ if ($wife) {
+ $person_parent="Yes";
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Individual information').": ".$wife->getXref();
+ }else{
+ $title = $wife->getXref()." :".i18n::translate('Individual information');
+ }
+ $parentlinks .= "<a id=\"pwife\" href=\"".encode_url($wife->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($wife->getLinkUrl())."');\">";
+ $parentlinks .= "&nbsp;".PrintReady($wife->getFullName());
+ $parentlinks .= "</a>";
+ $parentlinks .= "<br />";
+ $natmom = "yes";
+ }
+ }
+ }
+ }
+
+ //-- step families -----------------------------------------
+ $fams = $person->getStepFamilies();
+ foreach($fams as $famid=>$family) {
+ if (!is_null($family)) {
+ $husb = $family->getHusband($person);
+ $wife = $family->getWife($person);
+ // $spouse = $family->getSpouse($person);
+ $children = $family->getChildren();
+ $num = count($children);
+
+ if ($natdad == "yes") {
+ }else{
+ // Husband -----------------------
+ if ($husb || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Family book chart').": ".$famid;
+ }else{
+ $title = $famid." :".i18n::translate('Family book chart');
+ }
+ if ($husb) {
+ $person_step="Yes";
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Individual information').": ".$husb->getXref();
+ }else{
+ $title = $husb->getXref()." :".i18n::translate('Individual information');
+ }
+ $parentlinks .= "<a id=\"shusb\" href=\"".encode_url($husb->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($husb->getLinkUrl())."');\">";
+ $parentlinks .= "&nbsp;".PrintReady($husb->getFullName());
+ $parentlinks .= "</a>";
+ $parentlinks .= "<br />";
+ }
+ }
+ }
+
+ if ($natmom == "yes") {
+ }else{
+ // Wife ----------------------------
+ if ($wife || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Family book chart').": ".$famid;
+ }else{
+ $title = $famid." :".i18n::translate('Family book chart');
+ }
+ if ($wife) {
+ $person_step="Yes";
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Individual information').": ".$wife->getXref();
+ }else{
+ $title = $wife->getXref()." :".i18n::translate('Individual information');
+ }
+ $parentlinks .= "<a id=\"swife\" href=\"".encode_url($wife->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($wife->getLinkUrl())."');\">";
+ $parentlinks .= "&nbsp;".PrintReady($wife->getFullName());
+ $parentlinks .= "</a>";
+ $parentlinks .= "<br />";
+ }
+ }
+ }
+ }
+ }
+
+ // Spouse Families -------------------------------------- @var $family Family
+ $fams = $person->getSpouseFamilies();
+ foreach($fams as $famid=>$family) {
+ if (!is_null($family)) {
+ $spouse = $family->getSpouse($person);
+ $children = $family->getChildren();
+ $num = count($children);
+
+ // Spouse ------------------------------
+ if ($spouse || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Family book chart').": ".$famid;
+ }else{
+ $title = $famid." :".i18n::translate('Family book chart');
+ }
+ if ($spouse) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = i18n::translate('Individual information').": ".$spouse->getXref();
+ }else{
+ $title = $spouse->getXref()." :".i18n::translate('Individual information');
+ }
+ $spouselinks .= "<a id=\"spouse\" href=\"".encode_url($spouse->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($spouse->getLinkUrl())."');\">";
+ $spouselinks .= "&nbsp;".PrintReady($spouse->getFullName());
+ $spouselinks .= "</a>";
+ $spouselinks .= "<br />";
+ if ($spouse->getFullName() != "") {
+ $persons = "Yes";
+ }
+ }
+ }
+
+ // Children ------------------------------ @var $child Person
+ $hasChildren = 'No';
+ foreach($children as $c=>$child) {
+ if ($child) {
+ if ($hasChildren == 'No') {
+ $hasChildren = 'Yes';
+ $spouselinks .= "\n<ul class=\"clist ".$TEXT_DIRECTION."\">";
+ }
+ $persons="Yes";
+ $title = i18n::translate('Individual information').": ".$child->getXref();
+ $spouselinks .= "\n<li id=\"flyout3\">";
+ $spouselinks .= "<a href=\"".encode_url($child->getLinkUrl())."\" onclick=\"return familyNavLoad('".encode_url($child->getLinkUrl())."');\">";
+ $spouselinks .= PrintReady($child->getFullName());
+ $spouselinks .= "</a>";
+ }
+ }
+ if ($hasChildren == 'Yes') {
+ $spouselinks .= "\n</ul>";
+ } else {
+ $spouselinks .= "<br /><img src=\"images/small/childless.gif\" alt=\"".i18n::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".i18n::translate('This family remained childless');
+ }
+ }
+ }
+
+ if ($persons != "Yes") {
+ $spouselinks .= "&nbsp;(".i18n::translate('none').")\n\t\t";
+ }
+ if ($person_parent != "Yes") {
+ $parentlinks .= "&nbsp;(".i18n::translate_c('unknown family', 'unknown').")\n\t\t";
+ }
+ if ($person_step != "Yes") {
+ $step_parentlinks .= "&nbsp;(".i18n::translate_c('unknown family', 'unknown').")\n\t\t";
+ }
+ }
+ }
+ }
+}
+
+}
diff --git a/modules/individual_ext_report/module.php b/modules/individual_ext_report/module.php
index 7ccda66807..ff7ab3da1f 100644
--- a/modules/individual_ext_report/module.php
+++ b/modules/individual_ext_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/individual_report/module.php b/modules/individual_report/module.php
index 248e8a5a08..1de7509405 100644
--- a/modules/individual_report/module.php
+++ b/modules/individual_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/individuals/module.php b/modules/individuals/module.php
index 9b642253dc..8fde5f231a 100644
--- a/modules/individuals/module.php
+++ b/modules/individuals/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/marriage_report/module.php b/modules/marriage_report/module.php
index b9d9f55c4b..13f5d18a24 100644
--- a/modules/marriage_report/module.php
+++ b/modules/marriage_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/missing_facts_report/module.php b/modules/missing_facts_report/module.php
index 66145b12e2..a551cebc29 100644
--- a/modules/missing_facts_report/module.php
+++ b/modules/missing_facts_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/personal_facts/module.php b/modules/personal_facts/module.php
index b123442222..660a7748f4 100644
--- a/modules/personal_facts/module.php
+++ b/modules/personal_facts/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/relative_ext_report/module.php b/modules/relative_ext_report/module.php
index c3704b206f..81b26a37e5 100644
--- a/modules/relative_ext_report/module.php
+++ b/modules/relative_ext_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/relative_report/module.php b/modules/relative_report/module.php
index 906bbb6729..839caa58b3 100644
--- a/modules/relative_report/module.php
+++ b/modules/relative_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/source_report/module.php b/modules/source_report/module.php
index d1c5ac96da..8f67471801 100644
--- a/modules/source_report/module.php
+++ b/modules/source_report/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/modules/sources_tab/module.php b/modules/sources_tab/module.php
index ca2cc21989..b571133feb 100644
--- a/modules/sources_tab/module.php
+++ b/modules/sources_tab/module.php
@@ -24,7 +24,7 @@
*
* @package webtrees
* @subpackage Modules
- * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/themes/clouds/templates/block_main_temp.php b/themes/clouds/templates/block_main_temp.php
index ab89a1e3ee..1c557b3581 100644
--- a/themes/clouds/templates/block_main_temp.php
+++ b/themes/clouds/templates/block_main_temp.php
@@ -29,7 +29,7 @@
*
* @package webtrees
* @subpackage Themes
- * @version $Id: block_main_temp.php 7697 2010-03-28 20:53:09Z rob $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/themes/clouds/templates/block_small_temp.php b/themes/clouds/templates/block_small_temp.php
index 802b04f35d..41d4bfe91e 100644
--- a/themes/clouds/templates/block_small_temp.php
+++ b/themes/clouds/templates/block_small_temp.php
@@ -1,56 +1,56 @@
-<?php
-/**
- * Template for drawing the height-restricted blocks on the portal pages
- *
- * This template expects that the following variables will be set
- * $id - the DOM id for the block div
- * $title - the title of the block
- * $content - the content of the block
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 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 Themes
- * @version $Id: block_small_temp.php 7697 2010-03-28 20:53:09Z rob $
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-?>
-<div id="<?php print $id; ?>" class="block" >
- <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
- <tr>
- <td class="blockh1" ></td>
- <td class="blockh2" >
- <div class="blockhc"><b><?php print $title ?></b></div>
- </td>
- <td class="blockh3"></td>
- </tr>
- </table>
- <div class="blockcontent">
- <div class="small_inner_block">
- <?php print $content ?>
- </div>
- </div>
-</div>
+<?php
+/**
+ * Template for drawing the height-restricted blocks on the portal pages
+ *
+ * This template expects that the following variables will be set
+ * $id - the DOM id for the block div
+ * $title - the title of the block
+ * $content - the content of the block
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 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 Themes
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+?>
+<div id="<?php print $id; ?>" class="block" >
+ <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
+ <tr>
+ <td class="blockh1" ></td>
+ <td class="blockh2" >
+ <div class="blockhc"><b><?php print $title ?></b></div>
+ </td>
+ <td class="blockh3"></td>
+ </tr>
+ </table>
+ <div class="blockcontent">
+ <div class="small_inner_block">
+ <?php print $content ?>
+ </div>
+ </div>
+</div>
diff --git a/themes/clouds/templates/personbox_template.php b/themes/clouds/templates/personbox_template.php
index 281c8e6711..292a781a19 100644
--- a/themes/clouds/templates/personbox_template.php
+++ b/themes/clouds/templates/personbox_template.php
@@ -28,7 +28,7 @@
*
* @package webtrees
* @subpackage Themes
- * @version $Id: personbox_template.php 8345 2010-05-17 11:56:12Z greg $
+ * @version $Id$
*/
if (!defined('WT_WEBTREES')) {
diff --git a/themes/colors/templates/block_small_temp.php b/themes/colors/templates/block_small_temp.php
index 5cd54473b8..41d4bfe91e 100644
--- a/themes/colors/templates/block_small_temp.php
+++ b/themes/colors/templates/block_small_temp.php
@@ -1,56 +1,56 @@
-<?php
-/**
- * Template for drawing the height-restricted blocks on the portal pages
- *
- * This template expects that the following variables will be set
- * $id - the DOM id for the block div
- * $title - the title of the block
- * $content - the content of the block
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 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 Themes
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-?>
-<div id="<?php print $id; ?>" class="block" >
- <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
- <tr>
- <td class="blockh1" ></td>
- <td class="blockh2" >
- <div class="blockhc"><b><?php print $title ?></b></div>
- </td>
- <td class="blockh3"></td>
- </tr>
- </table>
- <div class="blockcontent">
- <div class="small_inner_block">
- <?php print $content ?>
- </div>
- </div>
-</div>
+<?php
+/**
+ * Template for drawing the height-restricted blocks on the portal pages
+ *
+ * This template expects that the following variables will be set
+ * $id - the DOM id for the block div
+ * $title - the title of the block
+ * $content - the content of the block
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 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 Themes
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+?>
+<div id="<?php print $id; ?>" class="block" >
+ <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
+ <tr>
+ <td class="blockh1" ></td>
+ <td class="blockh2" >
+ <div class="blockhc"><b><?php print $title ?></b></div>
+ </td>
+ <td class="blockh3"></td>
+ </tr>
+ </table>
+ <div class="blockcontent">
+ <div class="small_inner_block">
+ <?php print $content ?>
+ </div>
+ </div>
+</div>
diff --git a/themes/webtrees/templates/block_main_temp.php b/themes/webtrees/templates/block_main_temp.php
index 97bc829099..d1b6278587 100644
--- a/themes/webtrees/templates/block_main_temp.php
+++ b/themes/webtrees/templates/block_main_temp.php
@@ -1,54 +1,54 @@
-<?php
-/**
- * Template for drawing the main blocks on the portal pages
- *
- * This template expects that the following variables will be set
- * $id - the DOM id for the block div
- * $title - the title of the block
- * $content - the content of the block
- *
- * 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 Themes
- * @version $Id: block_main_temp.php 4703 2009-01-07 19:46:30Z canajun2eh $
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-?>
-<div id="<?php print $id; ?>" class="block" >
- <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
- <tr>
- <td class="blockh1" ></td>
- <td class="blockh2" >
- <div class="blockhc"><b><?php print $title ?></b></div>
- </td>
- <td class="blockh3"></td>
- </tr>
- </table>
- <div class="blockcontent">
- <?php print $content ?>
- </div>
-</div>
+<?php
+/**
+ * Template for drawing the main blocks on the portal pages
+ *
+ * This template expects that the following variables will be set
+ * $id - the DOM id for the block div
+ * $title - the title of the block
+ * $content - the content of the block
+ *
+ * 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 Themes
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+?>
+<div id="<?php print $id; ?>" class="block" >
+ <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
+ <tr>
+ <td class="blockh1" ></td>
+ <td class="blockh2" >
+ <div class="blockhc"><b><?php print $title ?></b></div>
+ </td>
+ <td class="blockh3"></td>
+ </tr>
+ </table>
+ <div class="blockcontent">
+ <?php print $content ?>
+ </div>
+</div>
diff --git a/themes/webtrees/templates/block_small_temp.php b/themes/webtrees/templates/block_small_temp.php
index ea0dd05acd..d47d60b147 100644
--- a/themes/webtrees/templates/block_small_temp.php
+++ b/themes/webtrees/templates/block_small_temp.php
@@ -1,56 +1,56 @@
-<?php
-/**
- * Template for drawing the height-restricted blocks on the portal pages
- *
- * This template expects that the following variables will be set
- * $id - the DOM id for the block div
- * $title - the title of the block
- * $content - the content of the block
- *
- * 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 Themes
- * @version $Id: block_small_temp.php 4703 2009-01-07 19:46:30Z canajun2eh $
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-?>
-<div id="<?php print $id; ?>" class="block" >
- <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
- <tr>
- <td class="blockh1" ></td>
- <td class="blockh2" >
- <div class="blockhc"><b><?php print $title ?></b></div>
- </td>
- <td class="blockh3"></td>
- </tr>
- </table>
- <div class="blockcontent">
- <div class="small_inner_block">
- <?php print $content ?>
- </div>
- </div>
-</div>
+<?php
+/**
+ * Template for drawing the height-restricted blocks on the portal pages
+ *
+ * This template expects that the following variables will be set
+ * $id - the DOM id for the block div
+ * $title - the title of the block
+ * $content - the content of the block
+ *
+ * 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 Themes
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+?>
+<div id="<?php print $id; ?>" class="block" >
+ <table class="blockheader" cellpadding="0" cellspacing="0" style="padding:0;margin:0;">
+ <tr>
+ <td class="blockh1" ></td>
+ <td class="blockh2" >
+ <div class="blockhc"><b><?php print $title ?></b></div>
+ </td>
+ <td class="blockh3"></td>
+ </tr>
+ </table>
+ <div class="blockcontent">
+ <div class="small_inner_block">
+ <?php print $content ?>
+ </div>
+ </div>
+</div>
diff --git a/themes/webtrees/templates/personbox_template.php b/themes/webtrees/templates/personbox_template.php
index 923910a783..a623359e33 100644
--- a/themes/webtrees/templates/personbox_template.php
+++ b/themes/webtrees/templates/personbox_template.php
@@ -1,63 +1,63 @@
-<?php
-/**
- * Template for drawing person boxes
- * This template expects that the following variables will be set
- * $pid, $boxID, $personlinks, $icons, $GEDCOM, $style,
- * $name, $classfacts, $genderImage, $BirthDeath, $isF, $outBoxAdd,
- * $addname, $showid, $float
- *
- * 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 Themes
- * @version $Id: personbox_template.php 4194 2008-10-30 10:45:46Z fisharebest $
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-?>
-<div id="I<?php print $boxID; ?>links"
- style="position:absolute; left:0px; top:0px; width:<?php print $lbwidth; ?>px; visibility:hidden; z-index:100;">
-<?php print $personlinks; ?></div>
-<div id="out-<?php print $boxID; ?>" <?php print $outBoxAdd; ?>>
-<!-- table helps to maintain spacing -->
-<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">
- <div class="noprint" id="icons-<?php print $boxID; ?>"
- style="<?php print $iconsStyleAdd; ?> width: 25px; height: 50px;"><?php print $icons; ?>
- </div>
- <?php print $thumbnail; ?>
- <a onclick="event.cancelBubble = true;" href="individual.php?pid=<?php print $pid; ?>&amp;ged=<?php print $GEDCOM; ?>">
- <span id="namedef-<?php print $boxID; ?>" class="name<?php print $style; ?> <?php print $classfacts; ?>">
- <?php print $name.$addname; ?>
- </span>
- <span class="name<?php print $style; ?>"> <?php print $genderImage; ?></span>
- <?php print $showid; ?> </a>
- <div id="fontdef-<?php print $boxID; ?>" class="details<?php print $style; ?>">
- <div id="inout2-<?php print $boxID; ?>" style="display: block;"><?php print $BirthDeath; ?></div>
- </div>
- <div id="inout-<?php print $boxID; ?>" style="display: none;">
- <div id="LOADING-inout-<?php print $boxID; ?>"><?php print i18n::translate('Loading...'); ?></div>
- </div>
-</td></tr></table>
-</div>
+<?php
+/**
+ * Template for drawing person boxes
+ * This template expects that the following variables will be set
+ * $pid, $boxID, $personlinks, $icons, $GEDCOM, $style,
+ * $name, $classfacts, $genderImage, $BirthDeath, $isF, $outBoxAdd,
+ * $addname, $showid, $float
+ *
+ * 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 Themes
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+?>
+<div id="I<?php print $boxID; ?>links"
+ style="position:absolute; left:0px; top:0px; width:<?php print $lbwidth; ?>px; visibility:hidden; z-index:100;">
+<?php print $personlinks; ?></div>
+<div id="out-<?php print $boxID; ?>" <?php print $outBoxAdd; ?>>
+<!-- table helps to maintain spacing -->
+<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">
+ <div class="noprint" id="icons-<?php print $boxID; ?>"
+ style="<?php print $iconsStyleAdd; ?> width: 25px; height: 50px;"><?php print $icons; ?>
+ </div>
+ <?php print $thumbnail; ?>
+ <a onclick="event.cancelBubble = true;" href="individual.php?pid=<?php print $pid; ?>&amp;ged=<?php print $GEDCOM; ?>">
+ <span id="namedef-<?php print $boxID; ?>" class="name<?php print $style; ?> <?php print $classfacts; ?>">
+ <?php print $name.$addname; ?>
+ </span>
+ <span class="name<?php print $style; ?>"> <?php print $genderImage; ?></span>
+ <?php print $showid; ?> </a>
+ <div id="fontdef-<?php print $boxID; ?>" class="details<?php print $style; ?>">
+ <div id="inout2-<?php print $boxID; ?>" style="display: block;"><?php print $BirthDeath; ?></div>
+ </div>
+ <div id="inout-<?php print $boxID; ?>" style="display: none;">
+ <div id="LOADING-inout-<?php print $boxID; ?>"><?php print i18n::translate('Loading...'); ?></div>
+ </div>
+</td></tr></table>
+</div>