summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit_changes.php114
-rw-r--r--edit_interface.php76
-rw-r--r--find.php47
-rw-r--r--modules_v3/individuals/module.php4
4 files changed, 147 insertions, 94 deletions
diff --git a/edit_changes.php b/edit_changes.php
index a2d8662693..1333de6c34 100644
--- a/edit_changes.php
+++ b/edit_changes.php
@@ -52,11 +52,11 @@ case 'undo':
$xref = WT_DB::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
// Undo a change, and subsequent changes to the same record
WT_DB::prepare(
- "UPDATE `##change`".
- " SET status = 'rejected'".
- " WHERE status = 'pending'".
- " AND gedcom_id = ?".
- " AND xref = ?".
+ "UPDATE `##change`" .
+ " SET status = 'rejected'" .
+ " WHERE status = 'pending'" .
+ " AND gedcom_id = ?" .
+ " AND xref = ?" .
" AND change_id >= ?"
)->execute(array($gedcom_id, $xref, $change_id));
break;
@@ -65,13 +65,13 @@ case 'accept':
$xref = WT_DB::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
// Accept a change, and all previous changes to the same record
$changes = WT_DB::prepare(
- "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom".
- " FROM `##change` c".
- " JOIN `##gedcom` g USING (gedcom_id)".
- " WHERE c.status = 'pending'".
- " AND gedcom_id = ?".
- " AND xref = ?".
- " AND change_id <= ?".
+ "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" .
+ " FROM `##change` c" .
+ " JOIN `##gedcom` g USING (gedcom_id)" .
+ " WHERE c.status = 'pending'" .
+ " AND gedcom_id = ?" .
+ " AND xref = ?" .
+ " AND change_id <= ?" .
" ORDER BY change_id"
)->execute(array($gedcom_id, $xref, $change_id))->fetchAll();
foreach ($changes as $change) {
@@ -88,17 +88,17 @@ case 'accept':
break;
case 'undoall':
WT_DB::prepare(
- "UPDATE `##change`".
- " SET status='rejected'".
+ "UPDATE `##change`" .
+ " SET status='rejected'" .
" WHERE status='pending' AND gedcom_id=?"
)->execute(array(WT_GED_ID));
break;
case 'acceptall':
- $changes=WT_DB::prepare(
- "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom".
- " FROM `##change` c".
- " JOIN `##gedcom` g USING (gedcom_id)".
- " WHERE c.status='pending' AND gedcom_id=?".
+ $changes = WT_DB::prepare(
+ "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" .
+ " FROM `##change` c" .
+ " JOIN `##gedcom` g USING (gedcom_id)" .
+ " WHERE c.status='pending' AND gedcom_id=?" .
" ORDER BY change_id"
)->execute(array(WT_GED_ID))->fetchAll();
foreach ($changes as $change) {
@@ -115,27 +115,27 @@ case 'acceptall':
break;
}
-$changed_gedcoms=WT_DB::prepare(
- "SELECT g.gedcom_name".
- " FROM `##change` c".
- " JOIN `##gedcom` g USING (gedcom_id)".
- " WHERE c.status='pending'".
+$changed_gedcoms = WT_DB::prepare(
+ "SELECT g.gedcom_name" .
+ " FROM `##change` c" .
+ " JOIN `##gedcom` g USING (gedcom_id)" .
+ " WHERE c.status='pending'" .
" GROUP BY g.gedcom_name"
)->fetchOneColumn();
if ($changed_gedcoms) {
- $changes=WT_DB::prepare(
- "SELECT c.*, u.user_name, u.real_name, g.gedcom_name, new_gedcom, old_gedcom".
- " FROM `##change` c".
- " JOIN `##user` u USING (user_id)".
- " JOIN `##gedcom` g USING (gedcom_id)".
- " WHERE c.status='pending'".
+ $changes = WT_DB::prepare(
+ "SELECT c.*, u.user_name, u.real_name, g.gedcom_name, new_gedcom, old_gedcom" .
+ " FROM `##change` c" .
+ " JOIN `##user` u USING (user_id)" .
+ " JOIN `##gedcom` g USING (gedcom_id)" .
+ " WHERE c.status='pending'" .
" ORDER BY gedcom_id, c.xref, c.change_id"
)->fetchAll();
$output = '<br><br><table class="list_table">';
- $prev_xref=null;
- $prev_gedcom_id=null;
+ $prev_xref = null;
+ $prev_gedcom_id = null;
foreach ($changes as $change) {
preg_match('/^0 @' . WT_REGEX_XREF . '@ (' . WT_REGEX_TAG . ')/', $change->old_gedcom . $change->new_gedcom, $match);
switch ($match[1]) {
@@ -163,77 +163,77 @@ if ($changed_gedcoms) {
}
if ($change->xref != $prev_xref || $change->gedcom_id != $prev_gedcom_id) {
if ($prev_xref) {
- $output.='</table></td></tr>';
+ $output .= '</table></td></tr>';
}
$prev_xref = $change->xref;
$prev_gedcom_id = $change->gedcom_id;
$output .= '<tr><td class="list_value">';
- $output .= '<b><a href="#" onclick="return show_diff(\''.$record->getHtmlUrl().'\');"> '.$record->getFullName().'</a></b>';
+ $output .= '<b><a href="#" onclick="return show_diff(\'' . $record->getHtmlUrl() . '\');"> ' . $record->getFullName() . '</a></b>';
$output .= '<div class="indent">';
$output .= '<table class="list_table"><tr>';
- $output .= '<td class="list_label">' . WT_I18N::translate('Accept') . '</td>';
- $output .= '<td class="list_label">' . WT_I18N::translate('Changes') . '</td>';
- $output .= '<td class="list_label">' . WT_I18N::translate('User') . '</td>';
- $output .= '<td class="list_label">' . WT_I18N::translate('Date') . '</td>';
+ $output .= '<td class="list_label">' . WT_I18N::translate('Accept') . '</td>';
+ $output .= '<td class="list_label">' . WT_I18N::translate('Changes') . '</td>';
+ $output .= '<td class="list_label">' . WT_I18N::translate('User') . '</td>';
+ $output .= '<td class="list_label">' . WT_I18N::translate('Date') . '</td>';
$output .= '<td class="list_label">' . WT_I18N::translate('Family tree') . '</td>';
- $output .= '<td class="list_label">' . WT_I18N::translate('Undo') . '</td>';
+ $output .= '<td class="list_label">' . WT_I18N::translate('Undo') . '</td>';
$output .= '</tr>';
}
- $output .= '<td class="list_value"><a href="edit_changes.php?action=accept&amp;change_id='.$change->change_id.'">'.WT_I18N::translate('Accept').'</a></td>';
+ $output .= '<td class="list_value"><a href="edit_changes.php?action=accept&amp;change_id=' . $change->change_id . '">' . WT_I18N::translate('Accept') . '</a></td>';
$output .= '<td class="list_value">';
foreach ($record->getFacts() as $fact) {
if ($fact->getTag() != 'CHAN') {
if ($fact->isPendingAddition()) {
- $output .= '<div class="new" title="' . strip_tags($fact->summary()) . '">' .$fact->getLabel() . '</div>';
+ $output .= '<div class="new" title="' . strip_tags($fact->summary()) . '">' . $fact->getLabel() . '</div>';
} elseif ($fact->isPendingDeletion()) {
- $output .= '<div class="old" title="' . strip_tags($fact->summary()) . '">' .$fact->getLabel() . '</div>';
+ $output .= '<div class="old" title="' . strip_tags($fact->summary()) . '">' . $fact->getLabel() . '</div>';
}
}
}
echo '</td>';
- $output .= "<td class=\"list_value\"><a href=\"#\" onclick=\"return reply('".$change->user_name."', '".WT_I18N::translate('Moderate pending changes')."')\" alt=\"".WT_I18N::translate('Send a message')."\">";
+ $output .= "<td class=\"list_value\"><a href=\"#\" onclick=\"return reply('" . $change->user_name . "', '" . WT_I18N::translate('Moderate pending changes') . "')\" alt=\"" . WT_I18N::translate('Send a message') . "\">";
$output .= WT_Filter::escapeHtml($change->real_name);
- $output .= ' - '.WT_Filter::escapeHtml($change->user_name).'</a></td>';
- $output .= '<td class="list_value">'.$change->change_time.'</td>';
- $output .= '<td class="list_value">'.$change->gedcom_name.'</td>';
- $output .= '<td class="list_value"><a href="edit_changes.php?action=undo&amp;change_id='.$change->change_id.'">'.WT_I18N::translate('Undo').'</a></td>';
- $output.='</tr>';
+ $output .= ' - ' . WT_Filter::escapeHtml($change->user_name) . '</a></td>';
+ $output .= '<td class="list_value">' . $change->change_time . '</td>';
+ $output .= '<td class="list_value">' . $change->gedcom_name . '</td>';
+ $output .= '<td class="list_value"><a href="edit_changes.php?action=undo&amp;change_id=' . $change->change_id . '">' . WT_I18N::translate('Undo') . '</a></td>';
+ $output .= '</tr>';
}
$output .= '</table></td></tr></td></tr></table>';
//-- Now for the global Action bar:
$output2 = '<br><table class="list_table">';
// Row 1 column 1: title "Accept all"
- $output2 .= '<tr><td class="list_label">'.WT_I18N::translate('Approve all changes').'</td>';
+ $output2 .= '<tr><td class="list_label">' . WT_I18N::translate('Approve all changes') . '</td>';
// Row 1 column 2: title "Undo all"
- $output2 .= '<td class="list_label">'.WT_I18N::translate('Undo all changes').'</td></tr>';
+ $output2 .= '<td class="list_label">' . WT_I18N::translate('Undo all changes') . '</td></tr>';
// Row 2 column 1: action "Accept all"
$output2 .= '<tr><td class="list_value">';
$count = 0;
foreach ($changed_gedcoms as $gedcom_name) {
if ($count != 0) {
- $output2.='<br>';
+ $output2 .= '<br>';
}
- $output2 .= '<a href="edit_changes.php?action=acceptall&amp;ged='.rawurlencode($gedcom_name).'">'.$gedcom_name.' - '.WT_I18N::translate('Approve all changes').'</a>';
- $count ++;
+ $output2 .= '<a href="edit_changes.php?action=acceptall&amp;ged=' . rawurlencode($gedcom_name) . '">' . $gedcom_name . ' - ' . WT_I18N::translate('Approve all changes') . '</a>';
+ $count++;
}
$output2 .= '</td>';
// Row 2 column 2: action "Undo all"
$output2 .= '<td class="list_value">';
$count = 0;
foreach ($changed_gedcoms as $gedcom_name) {
- if ($count!=0) {
- $output2.='<br>';
+ if ($count != 0) {
+ $output2 .= '<br>';
}
- $output2 .= '<a href="edit_changes.php?action=undoall&amp;ged='.rawurlencode($gedcom_name)."\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to undo all the changes to this family tree?')."');\">$gedcom_name - ".WT_I18N::translate('Undo all changes').'</a>';
+ $output2 .= '<a href="edit_changes.php?action=undoall&amp;ged=' . rawurlencode($gedcom_name) . "\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to undo all the changes to this family tree?') . "');\">$gedcom_name - " . WT_I18N::translate('Undo all changes') . '</a>';
$count++;
}
$output2 .= '</td></tr></table>';
echo
$output2, $output, $output2,
- '<br><br><br><br>', // TODO use margin-bottom instead of this
+ '<br><br><br><br>', // TODO use margin-bottom instead of this
'<p id="save-cancel">',
'<input type="button" class="cancel" value="', WT_I18N::translate('close'), '" onclick="window.close();">',
'</p>';
diff --git a/edit_interface.php b/edit_interface.php
index f3ee8051f7..ba81e8a992 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -426,21 +426,49 @@ case 'update':
}
$newged = "";
- if (!empty($_POST['NAME'])) $newged .= "\n1 NAME " . $_POST['NAME'];
- if (!empty($_POST['TYPE'])) $newged .= "\n2 TYPE " . $_POST['TYPE'];
- if (!empty($_POST['NPFX'])) $newged .= "\n2 NPFX " . $_POST['NPFX'];
- if (!empty($_POST['GIVN'])) $newged .= "\n2 GIVN " . $_POST['GIVN'];
- if (!empty($_POST['NICK'])) $newged .= "\n2 NICK " . $_POST['NICK'];
- if (!empty($_POST['SPFX'])) $newged .= "\n2 SPFX " . $_POST['SPFX'];
- if (!empty($_POST['SURN'])) $newged .= "\n2 SURN " . $_POST['SURN'];
- if (!empty($_POST['NSFX'])) $newged .= "\n2 NSFX " . $_POST['NSFX'];
- if (!empty($_POST['ROMN'])) $newged .= "\n2 ROMN " . $_POST['ROMN'];
- if (!empty($_POST['FONE'])) $newged .= "\n2 FONE " . $_POST['FONE'];
- if (!empty($_POST['_HEB'])) $newged .= "\n2 _HEB " . $_POST['_HEB'];
- if (!empty($_POST['_AKA'])) $newged .= "\n2 _AKA " . $_POST['_AKA'];
- if (!empty($_POST['_MARNM'])) $newged .= "\n2 _MARNM " . $_POST['_MARNM'];
+ if (!empty($_POST['NAME'])) {
+ $newged .= "\n1 NAME " . $_POST['NAME'];
+ }
+ if (!empty($_POST['TYPE'])) {
+ $newged .= "\n2 TYPE " . $_POST['TYPE'];
+ }
+ if (!empty($_POST['NPFX'])) {
+ $newged .= "\n2 NPFX " . $_POST['NPFX'];
+ }
+ if (!empty($_POST['GIVN'])) {
+ $newged .= "\n2 GIVN " . $_POST['GIVN'];
+ }
+ if (!empty($_POST['NICK'])) {
+ $newged .= "\n2 NICK " . $_POST['NICK'];
+ }
+ if (!empty($_POST['SPFX'])) {
+ $newged .= "\n2 SPFX " . $_POST['SPFX'];
+ }
+ if (!empty($_POST['SURN'])) {
+ $newged .= "\n2 SURN " . $_POST['SURN'];
+ }
+ if (!empty($_POST['NSFX'])) {
+ $newged .= "\n2 NSFX " . $_POST['NSFX'];
+ }
+ if (!empty($_POST['ROMN'])) {
+ $newged .= "\n2 ROMN " . $_POST['ROMN'];
+ }
+ if (!empty($_POST['FONE'])) {
+ $newged .= "\n2 FONE " . $_POST['FONE'];
+ }
+ if (!empty($_POST['_HEB'])) {
+ $newged .= "\n2 _HEB " . $_POST['_HEB'];
+ }
+ if (!empty($_POST['_AKA'])) {
+ $newged .= "\n2 _AKA " . $_POST['_AKA'];
+ }
+ if (!empty($_POST['_MARNM'])) {
+ $newged .= "\n2 _MARNM " . $_POST['_MARNM'];
+ }
- if (isset($_POST['NOTE'])) $NOTE = $_POST['NOTE'];
+ if (isset($_POST['NOTE'])) {
+ $NOTE = $_POST['NOTE'];
+ }
if (!empty($NOTE)) {
$tempnote = preg_split('/\r?\n/', trim($NOTE) . "\n"); // make sure only one line ending on the end
$title[] = "0 @$xref@ NOTE " . array_shift($tempnote);
@@ -1819,7 +1847,9 @@ case 'reorder_children':
$show_full = 1; // Force details to show for each child
foreach ($children as $id=>$child) {
echo '<li style="cursor:move; margin-bottom:2px; position:relative;"';
- if (!in_array($id, $ids)) echo ' class="facts_value new"';
+ if (!in_array($id, $ids)) {
+ echo ' class="facts_value new"';
+ }
echo ' id="li_', $id, '">';
echo Theme::theme()->individualBoxLarge(WT_Individual::getInstance($id));
echo '<input type="hidden" name="order[', $id, ']" value="', $i, '">';
@@ -2671,12 +2701,18 @@ function print_indi_form($nextaction, WT_Individual $person = null, WT_Family $f
if ($type != 'TYPE' && !isset($name_fields[$type]) && !isset($adv_name_fields[$type])) {
$text = '';
for ($j = 2; $j < count($fields); $j++) {
- if ($j > 2) $text .= ' ';
+ if ($j > 2) {
+ $text .= ' ';
+ }
$text .= $fields[$j];
}
while (($i + 1 < count($gedlines)) && (preg_match("/" . ($level + 1) . " (CON[CT]) ?(.*)/", $gedlines[$i + 1], $cmatch) > 0)) {
- if ($cmatch[1] == "CONT") $text .= "\n";
- if ($WORD_WRAPPED_NOTES) $text .= ' ';
+ if ($cmatch[1] == "CONT") {
+ $text .= "\n";
+ }
+ if ($WORD_WRAPPED_NOTES) {
+ $text .= ' ';
+ }
$text .= $cmatch[2];
$i++;
}
@@ -2687,7 +2723,9 @@ function print_indi_form($nextaction, WT_Individual $person = null, WT_Family $f
if (isset($gedlines[$i])) {
$fields = explode(' ', $gedlines[$i]);
$level = $fields[0];
- if (isset($fields[1])) $type = $fields[1];
+ if (isset($fields[1])) {
+ $type = $fields[1];
+ }
}
} while (($level > $glevel) && ($i < count($gedlines)));
}
diff --git a/find.php b/find.php
index 5819e0c7e9..46863132e2 100644
--- a/find.php
+++ b/find.php
@@ -164,7 +164,9 @@ if ($type == "indi") {
<input type="hidden" name="type" value="indi">
<span>', WT_I18N::translate('Name contains:'), '&nbsp;</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<input type="submit" value="', WT_I18N::translate('Filter'), '">
</form></div>';
@@ -179,7 +181,9 @@ if ($type == "fam") {
<input type="hidden" name="type" value="fam">
<span>', WT_I18N::translate('Name contains:'), '&nbsp;</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<input type="submit" value="', WT_I18N::translate('Filter'), '">
</form></div>';
@@ -196,7 +200,9 @@ if ($type == 'media') {
<input type="hidden" name="subclick">
<span>', WT_I18N::translate('Media contains:'), '</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>',
help_link('simple_filter'),
'<p><input type="submit" name="search" value="', WT_I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">&nbsp;
@@ -214,7 +220,9 @@ if ($type == "place") {
<input type="hidden" name="subclick">
<span>', WT_I18N::translate('Place contains:'), '</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<p><input type="submit" name="search" value="', WT_I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">&nbsp;
<input type="submit" name="all" value="', WT_I18N::translate('Display all'), '" onclick="this.form.subclick.value=this.name">
@@ -231,7 +239,9 @@ if ($type == "repo") {
<input type="hidden" name="subclick">
<span>', WT_I18N::translate('Repository contains:'), '</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<p><input type="submit" name="search" value="', WT_I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">&nbsp;
<input type="submit" name="all" value="', WT_I18N::translate('Display all'), '" onclick="this.form.subclick.value=this.name">
@@ -249,7 +259,9 @@ if ($type == "note") {
<input type="hidden" name="subclick">
<span>', WT_I18N::translate('Shared note contains:'), '</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<p><input type="submit" name="search" value="', WT_I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">&nbsp;
<input type="submit" name="all" value="', WT_I18N::translate('Display all'), '" onclick="this.form.subclick.value=this.name">
@@ -266,7 +278,9 @@ if ($type == "source") {
<input type="hidden" name="subclick">
<span>', WT_I18N::translate('Source contains:'), '</span>
<input type="text" name="filter" value="';
- if ($filter) echo $filter;
+ if ($filter) {
+ echo $filter;
+ }
echo '" autofocus>
<p><input type="submit" name="search" value="', WT_I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">&nbsp;
<input type="submit" name="all" value="', WT_I18N::translate('Display all'), '" onclick="this.form.subclick.value=this.name">
@@ -407,8 +421,11 @@ if ($type == "facts") {
DefaultTags=[<?php
$firstFact = true;
foreach (WT_Gedcom_Tag::getPicklistFacts() as $factId => $factName) {
- if ($firstFact) $firstFact = FALSE;
- else echo ',';
+ if ($firstFact) {
+ $firstFact = FALSE;
+ } else {
+ echo ',';
+ }
echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)';
}
?>];
@@ -596,8 +613,7 @@ if ($action == "filter") {
}
echo '</ul>
<p>', WT_I18N::translate('Places found'), '&nbsp;', count($places), '</p>';
- }
- else {
+ } else {
echo '<p>', WT_I18N::translate('No results found.'), '</p>';
}
echo '</div>';
@@ -619,8 +635,7 @@ if ($action == "filter") {
}
echo '</ul>
<p>', WT_I18N::translate('Repositories found'), " ", count($repo_list), '</p>';
- }
- else {
+ } else {
echo '<p>', WT_I18N::translate('No results found.'), '</p>';
}
echo '</div>';
@@ -642,8 +657,7 @@ if ($action == "filter") {
}
echo '</ul>
<p>', WT_I18N::translate('Shared notes found'), ' ', count($mynotelist), '</p>';
- }
- else {
+ } else {
echo '<p>', WT_I18N::translate('No results found.'), '</p>';
}
echo '</div>';
@@ -667,8 +681,7 @@ if ($action == "filter") {
}
echo '</ul>
<p>', WT_I18N::translate('Total sources: %s', count($mysourcelist)), '</p>';
- }
- else {
+ } else {
echo '<p>', WT_I18N::translate('No results found.'), '</p>';
}
echo '</div>';
diff --git a/modules_v3/individuals/module.php b/modules_v3/individuals/module.php
index f1beb30e1c..c6b34aedb2 100644
--- a/modules_v3/individuals/module.php
+++ b/modules_v3/individuals/module.php
@@ -240,7 +240,9 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
$out .= '<li><a href="'.$person->getHtmlUrl().'">'.$person->getSexImage().' '.$person->getFullName().' ';
if ($person->canShow()) {
$bd = $person->getLifeSpan();
- if (!empty($bd)) $out .= ' ('.$bd.')';
+ if (!empty($bd)) {
+ $out .= ' ('.$bd.')';
+ }
}
$out .= '</a></li>';
}