summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-11-10 17:54:28 +0000
committerfisharebest <fisharebest@gmail.com>2011-11-10 17:54:28 +0000
commite2e3f918261e085390931ff57d4d9f922e71b136 (patch)
tree2f4eb0537fa1eed1050c06f568dce23a04551680
parentecd8d5f6b4a2bfad78f0473859511842ec879b2d (diff)
downloadwebtrees-e2e3f918261e085390931ff57d4d9f922e71b136.tar.gz
webtrees-e2e3f918261e085390931ff57d4d9f922e71b136.tar.bz2
webtrees-e2e3f918261e085390931ff57d4d9f922e71b136.zip
Fix: sidebar modules should use the module interface for their AJAX callback. Note that some of the "mod_action" and "sb_action" can be combined/simplified.
-rw-r--r--help_text.php7
-rw-r--r--includes/db_schema/db_schema_15_16.php47
-rw-r--r--library/WT/DB.php22
-rw-r--r--modules_v3/clippings/module.php17
-rw-r--r--modules_v3/descendancy/module.php22
-rw-r--r--modules_v3/families/module.php22
-rw-r--r--modules_v3/googlemap/module.php1
-rw-r--r--modules_v3/individuals/module.php22
-rw-r--r--robots-example.txt1
-rw-r--r--setup.php18
10 files changed, 158 insertions, 21 deletions
diff --git a/help_text.php b/help_text.php
index 217b1adbb6..1d6004dbd1 100644
--- a/help_text.php
+++ b/help_text.php
@@ -735,7 +735,12 @@ case 'NSFX':
case 'OBJE':
$title=WT_Gedcom_Tag::getLabel('OBJE');
- $text='';
+ $text=
+ '<p>'.
+ WT_I18N::translate('A media object is a record in the family tree that contains information about a media file. This information may include a title, a copyright notice, a transcript, privacy restictions, etc. The actual media file, such as a photo or video, is stored externally. This file can be either be stored locally on this webserver or remotely on a file-sharing webserver.').
+ '<p></p>'.
+ WT_I18N::translate('Thumbnails will be created automatically from images. You may wish to specify your own thumbnail, such as a still image from a video or a photograph of the speaker in an audio recording. Thumbnails must be stored locally. You cannot specify a location on a remote webserver.').
+ '</p>';
break;
case 'OCCU':
diff --git a/includes/db_schema/db_schema_15_16.php b/includes/db_schema/db_schema_15_16.php
new file mode 100644
index 0000000000..7ffc9e7183
--- /dev/null
+++ b/includes/db_schema/db_schema_15_16.php
@@ -0,0 +1,47 @@
+<?php
+// Update the database schema from version 15 to 16
+// - delete old config settings
+// - add extra columns to wt_default_resn
+// - add a table to store language preferences
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 Greg Roach
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// Remove the i_isdead column
+self::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES')");
+self::exec("DELETE FROM `##user_setting` WHERE setting_name='default'");
+
+// There is no way to add a RESN tag to NOTE objects
+self::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
+
diff --git a/library/WT/DB.php b/library/WT/DB.php
index 6bad5ce11a..0377901732 100644
--- a/library/WT/DB.php
+++ b/library/WT/DB.php
@@ -225,6 +225,21 @@ class WT_DB {
// It will only be a problem if we can't subsequently create it.
$current_version=0;
}
+
+ //
+ $need_to_update_config_data=false;
+ $need_to_update_stored_procedures=false;
+
+ // -1 is set during installation to indicate that the DB schema is up-to-date,
+ // but that we still need to update config data and stored procedures.
+ if ($current_version==-1) {
+ $need_config_data=true;
+ //$need_stored_procedures=true;
+ $current_version=$target_version;
+ }
+
+ //
+
if ($current_version<$target_version) {
while ($current_version<$target_version) {
$next_version=$current_version+1;
@@ -240,5 +255,12 @@ class WT_DB {
require $schema_dir.'delete_old_files.php';
}
}
+
+ if ($need_to_update_config_data) {
+ require $schema_dir.'config_data.php';
+ }
+ if ($need_to_update_stored_procedures) {
+ require $schema_dir.'stored_procedures.php';
+ }
}
}
diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php
index ce5f8191b1..9d1a6becc3 100644
--- a/modules_v3/clippings/module.php
+++ b/modules_v3/clippings/module.php
@@ -47,6 +47,10 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
// Extend WT_Module
public function modAction($mod_action) {
switch($mod_action) {
+ case 'ajax':
+ header('Content-Type: text/html; charset=UTF-8');
+ echo $this->getSidebarAjaxContent();
+ break;
case 'index':
global $ENABLE_AUTOCOMPLETE, $MAX_PEDIGREE_GENERATIONS, $TEXT_DIRECTION, $WT_IMAGES, $controller, $WT_SESSION;
@@ -332,6 +336,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
break;
default:
header('HTTP/1.0 404 Not Found');
+ break;
}
}
@@ -489,7 +494,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
$out .= ' ('.$record->getLifeSpan().')';
}
$out .= '</a>';
- $out .= '<a class="remove_cart" href="sidebar.php?sb_action=clippings&amp;remove='.$xref.'&amp;pid='.$pid.'">
+ $out .= '<a class="remove_cart" href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&amp;remove='.$xref.'&amp;pid='.$pid.'">
<img src="'. $WT_IMAGES["remove"].'" border="0" alt="'.WT_I18N::translate('Remove').'" title="'.WT_I18N::translate('Remove').'" /></a>';
$out .='</li>';
}
@@ -500,17 +505,17 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
if ($WT_SESSION->cart[WT_GED_ID]) {
$out.=
- '<br><a href="sidebar.php?sb_action=clippings&amp;empty=true&amp;pid='.$pid.'" class="remove_cart">'.
+ '<br><a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&amp;empty=true&amp;pid='.$pid.'" class="remove_cart">'.
WT_I18N::translate('Empty Cart').
'</a>'.help_link('empty_cart', $this->getName()).
'<br />'.
- '<a href="sidebar.php?sb_action=clippings&amp;download=true&amp;pid='.$pid.'" class="add_cart">'.
+ '<a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&amp;download=true&amp;pid='.$pid.'" class="add_cart">'.
WT_I18N::translate('Download Now').
'</a>';
}
$record=WT_Person::getInstance($pid);
if ($record && !array_key_exists($record->getXref(), $WT_SESSION->cart[WT_GED_ID])) {
- $out .= '<br><a href="sidebar.php?sb_action=clippings&amp;add='.$pid.'&amp;pid='.$pid.'" class="add_cart"><img src="'.$WT_IMAGES['clippings'].'" width="20" /> '.WT_I18N::translate('Add %s to cart', $record->getFullName()).'</a>';
+ $out .= '<br><a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&amp;add='.$pid.'&amp;pid='.$pid.'" class="add_cart"><img src="'.$WT_IMAGES['clippings'].'" width="20" /> '.WT_I18N::translate('Add %s to cart', $record->getFullName()).'</a>';
}
return $out;
}
@@ -521,7 +526,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
$out .= 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}
function continueAjax(frm) {
var others = jQuery("input[name=\'others\']:checked").val();
- var link = "sidebar.php?sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
+ var link = "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
jQuery("#sb_clippings_content").load(link);
}';
$out .= WT_JS_END;
@@ -589,7 +594,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
$out = WT_JS_START;
$out .= 'function cancelDownload() {
- var link = "sidebar.php?sb_action=clippings&pid='.$pid.'";
+ var link = "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&pid='.$pid.'";
jQuery("#sb_clippings_content").load(link);
}';
$out .= WT_JS_END;
diff --git a/modules_v3/descendancy/module.php b/modules_v3/descendancy/module.php
index 3f2ab91d37..d717b710d3 100644
--- a/modules_v3/descendancy/module.php
+++ b/modules_v3/descendancy/module.php
@@ -39,6 +39,20 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
return /* I18N: Description of the "Descendants" module */ WT_I18N::translate('A sidebar showing the descendants of an individual.');
}
+ // Implement WT_Module
+ public function modAction($modAction) {
+ switch ($modAction) {
+ case 'ajax':
+ header('Content-Type: text/html; charset=UTF-8');
+ echo $this->getSidebarAjaxContent();
+ break;
+ default:
+ header('HTTP/1.0 404 Not Found');
+ break;
+ }
+ exit;
+ }
+
// Implement WT_Module_Sidebar
public function defaultSidebarOrder() {
return 30;
@@ -74,7 +88,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
function dsearchQ() {
var query = jQuery("#sb_desc_name").attr("value");
if (query.length>1) {
- jQuery("#sb_desc_content").load("sidebar.php?sb_action=descendancy&search="+query);
+ jQuery("#sb_desc_content").load("module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=descendancy&search="+query);
}
}
@@ -110,7 +124,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
});
//-->
</script>
- <form method="post" action="sidebar.php" onsubmit="return false;">
+ <form method="post" action="module.php?mod='.$this->getName().'&mod_action=ajax" onsubmit="return false;">
<input type="text" name="sb_desc_name" id="sb_desc_name" value="'.WT_I18N::translate('Search').'" />';
$out .= '</form>';
$out .= '<div id="sb_desc_content">';
@@ -122,7 +136,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
public function getPersonLi(WT_Person $person, $generations=0) {
global $WT_IMAGES;
- $out = '<li id="sb_desc_'.$person->getXref().'" class="sb_desc_indi_li"><a href="sidebar.php?sb_action=descendancy&amp;pid='.$person->getXref().'" title="'.$person->getXref().'" class="sb_desc_indi">';
+ $out = '<li id="sb_desc_'.$person->getXref().'" class="sb_desc_indi_li"><a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=descendancy&amp;pid='.$person->getXref().'" title="'.$person->getXref().'" class="sb_desc_indi">';
if ($generations>0) {
$out .= '<img src="'.$WT_IMAGES['minus'].'" border="0" class="plusminus" alt="" />';
} else {
@@ -148,7 +162,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
public function getFamilyLi(WT_Family $family, WT_Person $person, $generations=0) {
global $WT_IMAGES;
- $out = '<li id="sb_desc_'.$family->getXref().'" class="sb_desc_indi_li"><a href="sidebar.php?sb_action=descendancy&amp;famid='.$family->getXref().'" title="'.$family->getXref().'" class="sb_desc_indi">';
+ $out = '<li id="sb_desc_'.$family->getXref().'" class="sb_desc_indi_li"><a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=descendancy&amp;famid='.$family->getXref().'" title="'.$family->getXref().'" class="sb_desc_indi">';
$out .= '<img src="'.$WT_IMAGES['minus'].'" border="0" class="plusminus" alt="" />';
$out .= $person->getSexImage().$person->getFullName();
diff --git a/modules_v3/families/module.php b/modules_v3/families/module.php
index 7abd4716e8..c9c24e85ee 100644
--- a/modules_v3/families/module.php
+++ b/modules_v3/families/module.php
@@ -39,6 +39,20 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
return /* I18N: Description of the "Families" module */ WT_I18N::translate('A sidebar showing an alphabetic list of all the families in the family tree.');
}
+ // Implement WT_Module
+ public function modAction($modAction) {
+ switch ($modAction) {
+ case 'ajax':
+ header('Content-Type: text/html; charset=UTF-8');
+ echo $this->getSidebarAjaxContent();
+ break;
+ default:
+ header('HTTP/1.0 404 Not Found');
+ break;
+ }
+ exit;
+ }
+
// Implement WT_Module_Sidebar
public function defaultSidebarOrder() {
return 50;
@@ -83,7 +97,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
function fsearchQ() {
var query = jQuery("#sb_fam_name").attr("value");
if (query.length>1) {
- jQuery("#sb_fam_content").load("sidebar.php?sb_action=families&search="+query);
+ jQuery("#sb_fam_content").load("module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&search="+query);
}
}
@@ -105,7 +119,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
if (!famloadedNames[surname]) {
jQuery.ajax({
- url: "sidebar.php?sb_action=families&alpha="+alpha+"&surname="+surname,
+ url: "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname,
cache: false,
success: function(html) {
jQuery("#sb_fam_"+surname+" div").html(html);
@@ -130,7 +144,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
});
//-->
</script>
- <form method="post" action="sidebar.php" onsubmit="return false;">
+ <form method="post" action="module.php?mod='.$this->getName().'&mod_action=ajax" onsubmit="return false;">
<input type="text" name="sb_fam_name" id="sb_fam_name" value="'.WT_I18N::translate('Search').'" />
<p>';
foreach ($initials as $letter=>$count) {
@@ -148,7 +162,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
$html=$letter;
break;
}
- $html='<a href="sidebar.php?sb_action=families&amp;alpha='.urlencode($letter).'" class="sb_fam_letter">'.PrintReady($html).'</a>';
+ $html='<a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&amp;alpha='.urlencode($letter).'" class="sb_fam_letter">'.PrintReady($html).'</a>';
$out .= $html." ";
}
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index 6554fba4ef..94a2362646 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -69,6 +69,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
break;
default:
header('HTTP/1.0 404 Not Found');
+ break;
}
}
diff --git a/modules_v3/individuals/module.php b/modules_v3/individuals/module.php
index 654ab9d9cb..20cf8f6501 100644
--- a/modules_v3/individuals/module.php
+++ b/modules_v3/individuals/module.php
@@ -39,6 +39,20 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
return /* I18N: Description of "Individuals" module */ WT_I18N::translate('A sidebar showing an alphabetic list of all the individuals in the family tree.');
}
+ // Implement WT_Module
+ public function modAction($modAction) {
+ switch ($modAction) {
+ case 'ajax':
+ header('Content-Type: text/html; charset=UTF-8');
+ echo $this->getSidebarAjaxContent();
+ break;
+ default:
+ header('HTTP/1.0 404 Not Found');
+ break;
+ }
+ exit;
+ }
+
// Implement WT_Module_Sidebar
public function defaultSidebarOrder() {
return 40;
@@ -83,7 +97,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
function isearchQ() {
var query = jQuery("#sb_indi_name").attr("value");
if (query.length>1) {
- jQuery("#sb_indi_content").load("sidebar.php?sb_action=individuals&search="+query);
+ jQuery("#sb_indi_content").load("module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=individuals&search="+query);
}
}
@@ -105,7 +119,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
if (!loadedNames[surname]) {
jQuery.ajax({
- url: "sidebar.php?sb_action=individuals&alpha="+alpha+"&surname="+surname,
+ url: "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=individuals&alpha="+alpha+"&surname="+surname,
cache: false,
success: function(html) {
jQuery("#sb_indi_"+surname+" div").html(html);
@@ -130,7 +144,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
});
//-->
</script>
- <form method="post" action="sidebar.php" onsubmit="return false;">
+ <form method="post" action="module.php?mod='.$this->getName().'&mod_action=ajax" onsubmit="return false;">
<input type="text" name="sb_indi_name" id="sb_indi_name" value="'.WT_I18N::translate('Search').'" />
<p>';
foreach ($initials as $letter=>$count) {
@@ -148,7 +162,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
$html=$letter;
break;
}
- $html='<a href="sidebar.php?sb_action=individuals&amp;alpha='.urlencode($letter).'" class="sb_indi_letter">'.PrintReady($html).'</a>';
+ $html='<a href="module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=individuals&amp;alpha='.urlencode($letter).'" class="sb_indi_letter">'.PrintReady($html).'</a>';
$out .= $html." ";
}
diff --git a/robots-example.txt b/robots-example.txt
index 3cdcbe2509..87cf93c07e 100644
--- a/robots-example.txt
+++ b/robots-example.txt
@@ -227,7 +227,6 @@ Disallow: /search.php
Disallow: /search_advanced.php
Allow: /search_engine.php
Disallow: /setup.php
-Disallow: /sidebar.php
Allow: /site-unavailable.php
Allow: /source.php
Allow: /sourcelist.php
diff --git a/setup.php b/setup.php
index 5187d736fb..dd3c3ebee1 100644
--- a/setup.php
+++ b/setup.php
@@ -687,6 +687,8 @@ try {
" xref VARCHAR(20) NULL,".
" tag_type VARCHAR(15) NULL,".
" resn ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL,".
+ " comment VARCHAR(255) NULL,".
+ " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,".
" PRIMARY KEY (default_resn_id),".
" UNIQUE KEY ux1 (gedcom_id, xref, tag_type),".
" FOREIGN KEY fk1 (gedcom_id) REFERENCES `{$TBLPREFIX}gedcom` (gedcom_id)".
@@ -952,6 +954,20 @@ try {
" FOREIGN KEY fk1 (gedcom_id) REFERENCES `{$TBLPREFIX}gedcom` (gedcom_id) /* ON DELETE CASCADE */".
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
+ $dbh->exec(
+ "CREATE TABLE IF NOT EXISTS `{$TBLPREFIX}language` (".
+ " language_tag VARCHAR(16) NOT NULL,".
+ " iso15924_code CHAR(4) NOT NULL,".
+ " cldr_code VARCHAR(16) NOT NULL,".
+ " launchpad_code VARCHAR(16) NOT NULL,".
+ " collation VARCHAR(16) NOT NULL,".
+ " language_name VARCHAR(64) NOT NULL,".
+ " language_name_base VARCHAR(64) NOT NULL,".
+ " enabled ENUM ('yes', 'no') DEFAULT 'yes' NOT NULL,".
+ " PRIMARY KEY (language_tag),".
+ " INDEX (language_name_base, language_name)"
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
$dbh->prepare(
"INSERT IGNORE INTO `{$TBLPREFIX}user` (user_id, user_name, real_name, email, password) VALUES ".
@@ -975,7 +991,7 @@ try {
$dbh->prepare(
"INSERT IGNORE INTO `{$TBLPREFIX}site_setting` (setting_name, setting_value) VALUES ".
- "('WT_SCHEMA_VERSION', '12'),".
+ "('WT_SCHEMA_VERSION', '-1'),".
"('INDEX_DIRECTORY', 'data/'),".
"('STORE_MESSAGES', '1'),".
"('USE_REGISTRATION_MODULE', '1'),".