summaryrefslogtreecommitdiff
path: root/inverselink.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-02-01 00:01:36 +0000
committerGreg Roach <fisharebest@gmail.com>2015-02-02 17:34:31 +0000
commita25f0a04682c4c39c1947220c90af4118c713952 (patch)
treef7e9c2c630a50dd3e5dd76ce501dff4b1d8d4c26 /inverselink.php
parent4d2a5476ceb1c11dc1fd146bfb0be077baa5fb01 (diff)
downloadwebtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.gz
webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.bz2
webtrees-a25f0a04682c4c39c1947220c90af4118c713952.zip
Refactor classes to use namespaces, as per PSR-4. Replace GPL2 with GPL3.
Diffstat (limited to 'inverselink.php')
-rw-r--r--inverselink.php89
1 files changed, 40 insertions, 49 deletions
diff --git a/inverselink.php b/inverselink.php
index e137bc1dc8..5767b8d07c 100644
--- a/inverselink.php
+++ b/inverselink.php
@@ -1,57 +1,48 @@
<?php
-// Link media items to indi, sour and fam records
-//
-// This is the page that does the work of linking items.
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// Derived from PhpGedView
-// Copyright (C) 2002 to 2009 PGV Development Team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+namespace Webtrees;
-use WT\Auth;
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2015 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
+ */
define('WT_SCRIPT_NAME', 'inverselink.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
-$controller = new WT_Controller_Simple;
+$controller = new SimpleController;
$controller
->restrictAccess(Auth::isEditor())
- ->setPageTitle(WT_I18N::translate('Link to an existing media object'))
+ ->setPageTitle(I18N::translate('Link to an existing media object'))
->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();')
->pageHeader();
//-- page parameters and checking
-$linktoid = WT_Filter::get('linktoid', WT_REGEX_XREF);
-$mediaid = WT_Filter::get('mediaid', WT_REGEX_XREF);
-$linkto = WT_Filter::get('linkto', 'person|source|family|manage|repository|note');
-$action = WT_Filter::get('action', 'choose|update', 'choose');
+$linktoid = Filter::get('linktoid', WT_REGEX_XREF);
+$mediaid = Filter::get('mediaid', WT_REGEX_XREF);
+$linkto = Filter::get('linkto', 'person|source|family|manage|repository|note');
+$action = Filter::get('action', 'choose|update', 'choose');
// If GedFAct_assistant/_MEDIA/ installed ======================
-if ($linkto == 'manage' && array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
+if ($linkto == 'manage' && array_key_exists('GEDFact_assistant', Module::getActiveModules())) {
require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_MEDIA/media_0_inverselink.php';
} else {
//-- check for admin
$paramok = true;
if (!empty($linktoid)) {
- $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow();
+ $paramok = GedcomRecord::getInstance($linktoid)->canShow();
}
if ($action == "choose" && $paramok) {
@@ -67,17 +58,17 @@ if ($linkto == 'manage' && array_key_exists('GEDFact_assistant', WT_Module::getA
echo '<input type="hidden" name="ged" value="', $GEDCOM, '">';
echo '<table class="facts_table">';
echo '<tr><td class="topbottombar" colspan="2">';
- echo WT_I18N::translate('Link to an existing media object');
- echo '</td></tr><tr><td class="descriptionbox width20 wrap">', WT_I18N::translate('Media'), '</td>';
+ echo I18N::translate('Link to an existing media object');
+ echo '</td></tr><tr><td class="descriptionbox width20 wrap">', I18N::translate('Media'), '</td>';
echo '<td class="optionbox wrap">';
if (!empty($mediaid)) {
//-- Get the title of this existing Media item
$title =
- WT_DB::prepare("SELECT m_titl FROM `##media` where m_id=? AND m_file=?")
+ Database::prepare("SELECT m_titl FROM `##media` where m_id=? AND m_file=?")
->execute(array($mediaid, WT_GED_ID))
->fetchOne();
if ($title) {
- echo '<b>', WT_Filter::escapeHtml($title), '</b>';
+ echo '<b>', Filter::escapeHtml($title), '</b>';
} else {
echo '<b>', $mediaid, '</b>';
}
@@ -93,71 +84,71 @@ if ($linkto == 'manage' && array_key_exists('GEDFact_assistant', WT_Module::getA
echo '<tr><td class="descriptionbox">';
if ($linkto == "person") {
- echo WT_I18N::translate('Individual'), "</td>";
+ echo I18N::translate('Individual'), "</td>";
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktopid" size="3" value="', $linktoid, '"> ';
echo print_findindi_link('linktopid');
} else {
- $record = WT_Individual::getInstance($linktoid);
+ $record = Individual::getInstance($linktoid);
echo $record->format_list('span', false, $record->getFullName());
}
}
if ($linkto == "family") {
- echo WT_I18N::translate('Family'), '</td>';
+ echo I18N::translate('Family'), '</td>';
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktofamid" size="3" value="', $linktoid, '"> ';
echo print_findfamily_link('linktofamid');
} else {
- $record = WT_Family::getInstance($linktoid);
+ $record = Family::getInstance($linktoid);
echo $record->format_list('span', false, $record->getFullName());
}
}
if ($linkto == "source") {
- echo WT_I18N::translate('Source'), "</td>";
+ echo I18N::translate('Source'), "</td>";
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktosid" size="3" value="', $linktoid, '"> ';
echo print_findsource_link('linktosid');
} else {
- $record = WT_Source::getInstance($linktoid);
+ $record = Source::getInstance($linktoid);
echo $record->format_list('span', false, $record->getFullName());
}
}
if ($linkto == "repository") {
- echo WT_I18N::translate('Repository'), "</td>";
+ echo I18N::translate('Repository'), "</td>";
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktorid" size="3" value="', $linktoid, '">';
} else {
- $record = WT_Repository::getInstance($linktoid);
+ $record = Repository::getInstance($linktoid);
echo $record->format_list('span', false, $record->getFullName());
}
}
if ($linkto == "note") {
- echo WT_I18N::translate('Shared note'), "</td>";
+ echo I18N::translate('Shared note'), "</td>";
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktonid" size="3" value="', $linktoid, '">';
} else {
- $record = WT_Note::getInstance($linktoid);
+ $record = Note::getInstance($linktoid);
echo $record->format_list('span', false, $record->getFullName());
}
}
echo '</td></tr>';
- echo '<tr><td class="topbottombar" colspan="2"><input type="submit" value="', WT_I18N::translate('Set link'), '"></td></tr>';
+ echo '<tr><td class="topbottombar" colspan="2"><input type="submit" value="', I18N::translate('Set link'), '"></td></tr>';
echo '</table>';
echo '</form>';
} elseif ($action == "update" && $paramok) {
- $record = WT_GedcomRecord::getInstance($linktoid);
+ $record = GedcomRecord::getInstance($linktoid);
$record->createFact('1 OBJE @' . $mediaid . '@', true);
$controller->addInlineJavascript('closePopupAndReloadParent();');
}
- echo '<button onclick="closePopupAndReloadParent();">', WT_I18N::translate('close'), '</button>';
+ echo '<button onclick="closePopupAndReloadParent();">', I18N::translate('close'), '</button>';
}