summaryrefslogtreecommitdiff
path: root/modules_v3
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-11-16 20:40:29 +0000
committerfisharebest <fisharebest@gmail.com>2011-11-16 20:40:29 +0000
commit6ec79e67b545abe44ab5dc5c00089bfcc18654f9 (patch)
tree84984a9037dea518e63303f3839dc7b64f165637 /modules_v3
parent84d3e732f946191629d59872449d1337391b673d (diff)
downloadwebtrees-6ec79e67b545abe44ab5dc5c00089bfcc18654f9.tar.gz
webtrees-6ec79e67b545abe44ab5dc5c00089bfcc18654f9.tar.bz2
webtrees-6ec79e67b545abe44ab5dc5c00089bfcc18654f9.zip
Remove unreachable code - we have already checked for access
Diffstat (limited to 'modules_v3')
-rw-r--r--modules_v3/googlemap/module.php65
-rw-r--r--modules_v3/lightbox/module.php10
-rw-r--r--modules_v3/media/module.php33
-rw-r--r--modules_v3/notes/module.php88
-rw-r--r--modules_v3/personal_facts/module.php69
-rw-r--r--modules_v3/sources_tab/module.php8
6 files changed, 114 insertions, 159 deletions
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index 94a2362646..27b67dbed1 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -110,47 +110,38 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
echo '<table border="0" width="100%"><tr><td>';
- if (!$controller->record->canDisplayName()) {
- echo '<table class="facts_table">';
- echo '<tr><td class="facts_value">';
- print_privacy_error();
- echo '</td></tr>';
- echo '</table><br />';
- echo WT_JS_START, 'function ResizeMap () {}', WT_JS_END;
- } else {
- echo '<table width="100%" border="0" class="facts_table">';
- echo '<tr><td valign="top">';
- echo '<div id="googlemap_left">';
- echo '<img src="', $WT_IMAGES['hline'], '" width="', $GOOGLEMAP_XSIZE, '" height="0" alt="" />';
- echo '<div id="map_pane" style="border: 1px solid gray; color: black; width: 100%; height: ', $GOOGLEMAP_YSIZE, 'px"></div>';
- if (WT_USER_IS_ADMIN) {
- echo '<table width="100%"><tr>';
- echo '<td width="40%" align="left">';
- echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>';
- echo '</td>';
- echo '<td width="35%" class="center">';
- echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>';
- echo '</td>';
- echo '<td width="25%" align="right">';
- echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place Check'),'</a>';
- echo '</td>';
- echo '</tr></table>';
- }
- echo '</div>';
+ echo '<table width="100%" border="0" class="facts_table">';
+ echo '<tr><td valign="top">';
+ echo '<div id="googlemap_left">';
+ echo '<img src="', $WT_IMAGES['hline'], '" width="', $GOOGLEMAP_XSIZE, '" height="0" alt="" />';
+ echo '<div id="map_pane" style="border: 1px solid gray; color: black; width: 100%; height: ', $GOOGLEMAP_YSIZE, 'px"></div>';
+ if (WT_USER_IS_ADMIN) {
+ echo '<table width="100%"><tr>';
+ echo '<td width="40%" align="left">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>';
echo '</td>';
- echo '<td valign="top" width="30%">';
- echo '<div id="map_content">';
- $famids = array();
- $families = $controller->record->getSpouseFamilies();
- foreach ($families as $family) {
- $famids[] = $family->getXref();
- }
- $controller->record->add_family_facts(false);
- build_indiv_map($controller->record->getIndiFacts(), $famids);
- echo '</div>';
+ echo '<td width="35%" class="center">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>';
+ echo '</td>';
+ echo '<td width="25%" align="right">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place Check'),'</a>';
echo '</td>';
echo '</tr></table>';
}
+ echo '</div>';
+ echo '</td>';
+ echo '<td valign="top" width="30%">';
+ echo '<div id="map_content">';
+ $famids = array();
+ $families = $controller->record->getSpouseFamilies();
+ foreach ($families as $family) {
+ $famids[] = $family->getXref();
+ }
+ $controller->record->add_family_facts(false);
+ build_indiv_map($controller->record->getIndiFacts(), $famids);
+ echo '</div>';
+ echo '</td>';
+ echo '</tr></table>';
// start
echo '<img src="', $WT_IMAGES['spacer'], '" id="marker6" width="1" height="1" alt="" />';
// end
diff --git a/modules_v3/lightbox/module.php b/modules_v3/lightbox/module.php
index 907beae767..b7c8da0233 100644
--- a/modules_v3/lightbox/module.php
+++ b/modules_v3/lightbox/module.php
@@ -80,15 +80,7 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Config, WT_Modul
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_head.php';
$media_found = false;
- if (!$controller->record->canDisplayDetails()) {
- echo '<table class="facts_table" cellpadding="0">';
- echo '<tr><td class="facts_value">';
- print_privacy_error();
- echo '</td></tr>';
- echo '</table>';
- } else {
- require WT_ROOT.WT_MODULES_DIR.'lightbox/album.php';
- }
+ require WT_ROOT.WT_MODULES_DIR.'lightbox/album.php';
return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
}
diff --git a/modules_v3/media/module.php b/modules_v3/media/module.php
index 607fd424cc..c1fb15afcd 100644
--- a/modules_v3/media/module.php
+++ b/modules_v3/media/module.php
@@ -81,30 +81,23 @@ class media_WT_Module extends WT_Module implements WT_Module_Tab {
echo '</td></tr>';
}
$media_found = false;
- if (!$controller->record->canDisplayDetails()) {
- echo "<tr><td class=\"facts_value\">";
- print_privacy_error();
- echo "</td></tr>";
- }
- else {
- $media_found = print_main_media($controller->record->getXref(), 0, true);
- if (!$media_found) echo "<tr><td id=\"no_tab4\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no media objects for this individual.')."</td></tr>";
- //-- New Media link
- if (WT_USER_CAN_EDIT && $controller->record->canDisplayDetails() && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
+ $media_found = print_main_media($controller->record->getXref(), 0, true);
+ if (!$media_found) echo "<tr><td id=\"no_tab4\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no media objects for this individual.')."</td></tr>";
+ //-- New Media link
+ if (WT_USER_CAN_EDIT && $controller->record->canDisplayDetails() && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
?>
- <tr>
- <td class="facts_label"><?php echo WT_I18N::translate('Add media'), help_link('add_media'); ?></td>
- <td class="facts_value">
- <a href="#" onclick="window.open('addmedia.php?action=showmediaform&linktoid=<?php echo $controller->record->getXref(); ?>', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false;"> <?php echo WT_I18N::translate('Add a new media object'); ?></a><br />
- <a href="#" onclick="window.open('inverselink.php?linktoid=<?php echo $controller->record->getXref(); ?>&linkto=person', '_blank', 'top=50,left=50,width=400,height=300,resizable=1,scrollbars=1'); return false;"><?php echo WT_I18N::translate('Link to an existing media object'); ?></a>
- </td>
- </tr>
- <?php
- }
+ <tr>
+ <td class="facts_label"><?php echo WT_I18N::translate('Add media'), help_link('add_media'); ?></td>
+ <td class="facts_value">
+ <a href="#" onclick="window.open('addmedia.php?action=showmediaform&linktoid=<?php echo $controller->record->getXref(); ?>', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false;"> <?php echo WT_I18N::translate('Add a new media object'); ?></a><br />
+ <a href="#" onclick="window.open('inverselink.php?linktoid=<?php echo $controller->record->getXref(); ?>&linkto=person', '_blank', 'top=50,left=50,width=400,height=300,resizable=1,scrollbars=1'); return false;"><?php echo WT_I18N::translate('Link to an existing media object'); ?></a>
+ </td>
+ </tr>
+ <?php
}
?>
</table>
- <?php
+ <?php
return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
}
diff --git a/modules_v3/notes/module.php b/modules_v3/notes/module.php
index 3536e09bbe..2388b9c872 100644
--- a/modules_v3/notes/module.php
+++ b/modules_v3/notes/module.php
@@ -53,13 +53,6 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab {
ob_start();
?>
<table class="facts_table">
- <?php
- if (!$controller->record->canDisplayDetails()) {
- echo "<tr><td class=\"facts_value\">";
- print_privacy_error();
- echo "</td></tr>";
- } else {
- ?>
<tr>
<td colspan="2" class="descriptionbox rela">
<input id="checkbox_note2" type="checkbox" <?php if ($SHOW_LEVEL2_NOTES) echo " checked=\"checked\""; ?> onclick="jQuery('tr.row_note2').toggle();" />
@@ -67,51 +60,50 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab {
<?php echo help_link('show_fact_sources'); ?>
</td>
</tr>
- <?php
- $globalfacts = $controller->getGlobalFacts();
- foreach ($globalfacts as $key => $event) {
- $fact = $event->getTag();
- if ($fact=="NAME") {
- print_main_notes($event->getGedcomRecord(), 2, $controller->record->getXref(), $event->getLineNumber(), true);
- }
- $FACT_COUNT++;
- }
- $otherfacts = $controller->getOtherFacts();
- foreach ($otherfacts as $key => $event) {
- $fact = $event->getTag();
- if ($fact=="NOTE") {
- print_main_notes($event->getGedcomRecord(), 1, $controller->record->getXref(), $event->getLineNumber());
- }
- $FACT_COUNT++;
+ <?php
+ $globalfacts = $controller->getGlobalFacts();
+ foreach ($globalfacts as $key => $event) {
+ $fact = $event->getTag();
+ if ($fact=="NAME") {
+ print_main_notes($event->getGedcomRecord(), 2, $controller->record->getXref(), $event->getLineNumber(), true);
}
- // 2nd to 5th level notes/sources
- $controller->record->add_family_facts(false);
- foreach ($controller->getIndiFacts() as $key => $factrec) {
- for ($i=2; $i<6; $i++) {
- print_main_notes($factrec->getGedcomRecord(), $i, $controller->record->getXref(), $factrec->getLineNumber(), true);
- }
+ $FACT_COUNT++;
+ }
+ $otherfacts = $controller->getOtherFacts();
+ foreach ($otherfacts as $key => $event) {
+ $fact = $event->getTag();
+ if ($fact=="NOTE") {
+ print_main_notes($event->getGedcomRecord(), 1, $controller->record->getXref(), $event->getLineNumber());
}
- if ($this->get_note_count()==0) echo "<tr><td id=\"no_tab2\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no Notes for this individual.')."</td></tr>";
- //-- New Note Link
- if ($controller->record->canEdit()) {
- ?>
- <tr>
- <td class="facts_label"><?php echo WT_I18N::translate('Add Note'), help_link('add_note'); ?></td>
- <td class="facts_value"><a href="#"
- onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','NOTE'); return false;"><?php echo WT_I18N::translate('Add a new note'); ?></a>
- <br />
- </td>
- </tr>
- <tr>
- <td class="facts_label"><?php echo WT_I18N::translate('Add Shared Note'), help_link('add_shared_note'); ?></td>
- <td class="facts_value"><a href="#"
- onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','SHARED_NOTE'); return false;"><?php echo WT_I18N::translate('Add a new shared note'); ?></a>
- <br />
- </td>
- </tr>
- <?php
+ $FACT_COUNT++;
+ }
+ // 2nd to 5th level notes/sources
+ $controller->record->add_family_facts(false);
+ foreach ($controller->getIndiFacts() as $key => $factrec) {
+ for ($i=2; $i<6; $i++) {
+ print_main_notes($factrec->getGedcomRecord(), $i, $controller->record->getXref(), $factrec->getLineNumber(), true);
}
}
+ if ($this->get_note_count()==0) echo "<tr><td id=\"no_tab2\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no Notes for this individual.')."</td></tr>";
+ //-- New Note Link
+ if ($controller->record->canEdit()) {
+ ?>
+ <tr>
+ <td class="facts_label"><?php echo WT_I18N::translate('Add Note'), help_link('add_note'); ?></td>
+ <td class="facts_value"><a href="#"
+ onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','NOTE'); return false;"><?php echo WT_I18N::translate('Add a new note'); ?></a>
+ <br />
+ </td>
+ </tr>
+ <tr>
+ <td class="facts_label"><?php echo WT_I18N::translate('Add Shared Note'), help_link('add_shared_note'); ?></td>
+ <td class="facts_value"><a href="#"
+ onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','SHARED_NOTE'); return false;"><?php echo WT_I18N::translate('Add a new shared note'); ?></a>
+ <br />
+ </td>
+ </tr>
+ <?php
+ }
?>
</table>
<br />
diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php
index ef26a60260..c6a8dd6115 100644
--- a/modules_v3/personal_facts/module.php
+++ b/modules_v3/personal_facts/module.php
@@ -65,49 +65,44 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
ob_start();
?>
<table class="facts_table" style="margin-top:-2px;" cellpadding="0">
- <?php if (!$controller->record->canDisplayDetails()) {
- echo '<tr><td class="facts_value" colspan="2">';
- print_privacy_error();
- echo '</td></tr>';
- } else {
- $indifacts = $controller->getIndiFacts();
- if (count($indifacts)==0) { ?>
- <tr>
- <td id="no_tab1" colspan="2" class="facts_value"><?php echo WT_I18N::translate('There are no Facts for this individual.'); ?>
- </td>
- </tr>
- <?php }
- if (!isset($controller->skipFamilyFacts)) {
- ?>
- <tr id="row_top">
- <td colspan="2" class="descriptionbox rela">
- <input id="checkbox_rela_facts" type="checkbox" <?php if ($EXPAND_RELATIVES_EVENTS) echo ' checked="checked"'; ?> onclick="jQuery('tr.row_rela').toggle();" />
- <label for="checkbox_rela_facts"><?php echo WT_I18N::translate('Events of close relatives'); ?></label>
- <?php if (file_exists(get_site_setting('INDEX_DIRECTORY').'histo.'.WT_LOCALE.'.php')) { ?>
- <input id="checkbox_histo" type="checkbox" <?php if ($EXPAND_HISTO_EVENTS) echo ' checked="checked"'; ?> onclick="jQuery('tr.row_histo').toggle();" />
- <label for="checkbox_histo"><?php echo WT_I18N::translate('Historical facts'); ?></label>
- <?php } ?>
+ <?php
+ $indifacts = $controller->getIndiFacts();
+ if (count($indifacts)==0) { ?>
+ <tr>
+ <td id="no_tab1" colspan="2" class="facts_value"><?php echo WT_I18N::translate('There are no Facts for this individual.'); ?>
</td>
</tr>
- <?php
+ <?php }
+ if (!isset($controller->skipFamilyFacts)) {
+ ?>
+ <tr id="row_top">
+ <td colspan="2" class="descriptionbox rela">
+ <input id="checkbox_rela_facts" type="checkbox" <?php if ($EXPAND_RELATIVES_EVENTS) echo ' checked="checked"'; ?> onclick="jQuery('tr.row_rela').toggle();" />
+ <label for="checkbox_rela_facts"><?php echo WT_I18N::translate('Events of close relatives'); ?></label>
+ <?php if (file_exists(get_site_setting('INDEX_DIRECTORY').'histo.'.WT_LOCALE.'.php')) { ?>
+ <input id="checkbox_histo" type="checkbox" <?php if ($EXPAND_HISTO_EVENTS) echo ' checked="checked"'; ?> onclick="jQuery('tr.row_histo').toggle();" />
+ <label for="checkbox_histo"><?php echo WT_I18N::translate('Historical facts'); ?></label>
+ <?php } ?>
+ </td>
+ </tr>
+ <?php
+ }
+ $yetdied=false;
+ foreach ($indifacts as $fact) {
+ if (strstr(WT_EVENTS_DEAT, $fact->getTag()) && $fact->getParentObject()->getXref()==$controller->record->getXref()) {
+ $yetdied = true;
}
- $yetdied=false;
- foreach ($indifacts as $fact) {
- if (strstr(WT_EVENTS_DEAT, $fact->getTag()) && $fact->getParentObject()->getXref()==$controller->record->getXref()) {
- $yetdied = true;
+ if (!is_null($fact->getFamilyId())) {
+ if (!$yetdied) {
+ print_fact($fact, $controller->record);
}
- if (!is_null($fact->getFamilyId())) {
- if (!$yetdied) {
- print_fact($fact, $controller->record);
- }
- } else {
- //$reftags = array ('CHAN', 'IDNO', 'RFN', 'AFN', 'REFN', 'RIN', '_UID');// list of tags used in "Extra information" sidebar module
- if (!in_array($fact->getTag(), WT_Gedcom_Tag::getReferenceFacts()) || !array_key_exists('extra_info', WT_Module::getActiveSidebars())) {
- print_fact($fact, $controller->record);
- }
+ } else {
+ //$reftags = array ('CHAN', 'IDNO', 'RFN', 'AFN', 'REFN', 'RIN', '_UID');// list of tags used in "Extra information" sidebar module
+ if (!in_array($fact->getTag(), WT_Gedcom_Tag::getReferenceFacts()) || !array_key_exists('extra_info', WT_Module::getActiveSidebars())) {
+ print_fact($fact, $controller->record);
}
- $FACT_COUNT++;
}
+ $FACT_COUNT++;
}
//-- new fact link
if ($controller->record->canEdit()) {
diff --git a/modules_v3/sources_tab/module.php b/modules_v3/sources_tab/module.php
index 5d32650c72..5ab60044ed 100644
--- a/modules_v3/sources_tab/module.php
+++ b/modules_v3/sources_tab/module.php
@@ -53,13 +53,6 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab {
ob_start();
?>
<table class="facts_table">
- <?php
- if (!$controller->record->canDisplayDetails()) {
- echo "<tr><td class=\"facts_value\">";
- print_privacy_error();
- echo "</td></tr>";
- } else {
- ?>
<tr>
<td colspan="2" class="descriptionbox rela">
<input id="checkbox_sour2" type="checkbox" <?php if ($SHOW_LEVEL2_NOTES) echo " checked=\"checked\""; ?> onclick="jQuery('tr.row_sour2').toggle();" />
@@ -72,7 +65,6 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab {
if ($event->getTag()=="SOUR") print_main_sources($event->getGedcomRecord(), 1, $controller->record->getXref(), $event->getLineNumber());
$FACT_COUNT++;
}
- }
// 2nd level sources [ 1712181 ]
$controller->record->add_family_facts(false);
foreach ($controller->getIndiFacts() as $key => $factrec) {