summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2014-08-14 10:35:02 +0100
committerGreg Roach <fisharebest@gmail.com>2014-08-14 10:35:02 +0100
commitb91ce4e162976f6e4d1c308524ea1bf460430bc8 (patch)
treece015689ba12e7e28a481cff8c199f41fbfb29f8
parentbcb3a83fa321f35dade827c7d6b46f73a8fd84a9 (diff)
downloadwebtrees-b91ce4e162976f6e4d1c308524ea1bf460430bc8.tar.gz
webtrees-b91ce4e162976f6e4d1c308524ea1bf460430bc8.tar.bz2
webtrees-b91ce4e162976f6e4d1c308524ea1bf460430bc8.zip
Import classes, per PSR autoloading standards
-rw-r--r--action.php22
-rw-r--r--addmedia.php21
-rw-r--r--admin.php11
-rw-r--r--admin_media.php4
-rw-r--r--admin_media_upload.php13
-rw-r--r--admin_module_blocks.php4
-rw-r--r--admin_module_menus.php4
-rw-r--r--admin_module_reports.php4
-rw-r--r--admin_module_sidebar.php4
-rw-r--r--admin_module_tabs.php4
-rw-r--r--admin_modules.php4
-rw-r--r--admin_pgv_to_wt.php11
-rw-r--r--admin_site_access.php4
-rw-r--r--admin_site_change.php15
-rw-r--r--admin_site_clean.php4
-rw-r--r--admin_site_config.php4
-rw-r--r--admin_site_info.php4
-rw-r--r--admin_site_logs.php15
-rw-r--r--admin_site_merge.php4
-rw-r--r--admin_site_other.php4
-rw-r--r--admin_site_readme.php14
-rw-r--r--admin_site_upgrade.php4
-rw-r--r--admin_trees_check.php4
-rw-r--r--admin_trees_config.php9
-rw-r--r--admin_trees_download.php4
-rw-r--r--admin_trees_export.php4
-rw-r--r--admin_trees_manage.php11
-rw-r--r--admin_trees_merge.php4
-rw-r--r--admin_trees_places.php4
-rw-r--r--admin_trees_renumber.php4
-rw-r--r--admin_users.php36
-rw-r--r--admin_users_bulk.php4
-rw-r--r--block_edit.php6
-rw-r--r--edit_changes.php9
-rw-r--r--edit_interface.php14
-rw-r--r--editnews.php4
-rw-r--r--edituser.php32
-rw-r--r--famlist.php12
-rw-r--r--find.php8
-rw-r--r--help_text.php4
-rw-r--r--includes/authentication.php11
-rw-r--r--includes/functions/functions_db.php7
-rw-r--r--includes/functions/functions_import.php4
-rw-r--r--includes/functions/functions_mediadb.php4
-rw-r--r--includes/functions/functions_print.php8
-rw-r--r--includes/functions/functions_print_facts.php3
-rwxr-xr-xincludes/session.php27
-rw-r--r--index.php4
-rw-r--r--index_edit.php8
-rw-r--r--indilist.php12
-rw-r--r--inverselink.php4
-rw-r--r--library/WT/Controller/Family.php4
-rw-r--r--library/WT/Controller/Individual.php9
-rw-r--r--library/WT/Controller/Media.php4
-rw-r--r--library/WT/Controller/Note.php4
-rw-r--r--library/WT/Controller/Repository.php4
-rw-r--r--library/WT/Controller/Search.php4
-rw-r--r--library/WT/Controller/Source.php4
-rw-r--r--library/WT/Filter.php3
-rwxr-xr-xlibrary/WT/GedcomRecord.php19
-rw-r--r--library/WT/I18N.php6
-rw-r--r--library/WT/Mail.php15
-rw-r--r--library/WT/Media.php16
-rw-r--r--library/WT/MenuBar.php6
-rw-r--r--library/WT/Module.php6
-rw-r--r--library/WT/Report/PDF.php3
-rw-r--r--library/WT/Site.php4
-rw-r--r--library/WT/Stats.php36
-rw-r--r--library/WT/Tree.php12
-rw-r--r--login.php51
-rw-r--r--logout.php9
-rwxr-xr-xmediafirewall.php6
-rwxr-xr-xmessage.php20
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php4
-rw-r--r--modules_v3/batch_update/admin_batch_update.php6
-rw-r--r--modules_v3/batch_update/module.php4
-rw-r--r--modules_v3/clippings/clippings_ctrl.php4
-rw-r--r--modules_v3/googlemap/module.php35
-rw-r--r--modules_v3/lightbox/module.php4
-rw-r--r--modules_v3/review_changes/module.php4
-rw-r--r--modules_v3/sitemap/module.php4
-rw-r--r--modules_v3/user_messages/module.php8
-rw-r--r--modules_v3/user_welcome/module.php6
-rw-r--r--save.php21
-rw-r--r--themes/_administration/header.php8
-rw-r--r--themes/clouds/header.php4
-rw-r--r--themes/colors/header.php4
-rw-r--r--themes/colors/theme.php12
-rw-r--r--themes/fab/header.php4
-rw-r--r--themes/minimal/header.php4
-rw-r--r--themes/webtrees/header.php4
-rw-r--r--themes/xenea/header.php4
92 files changed, 518 insertions, 314 deletions
diff --git a/action.php b/action.php
index 1bb77a2233..a1fe552f12 100644
--- a/action.php
+++ b/action.php
@@ -36,6 +36,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'action.php');
require './includes/session.php';
@@ -179,20 +183,20 @@ case 'delete-source':
break;
case 'delete-user':
- $user = \WT\User::find(WT_Filter::postInteger('user_id'));
+ $user = User::find(WT_Filter::postInteger('user_id'));
- if ($user && \WT\Auth::isAdmin() && \WT\Auth::user() !== $user) {
- \WT\Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
+ if ($user && Auth::isAdmin() && Auth::user() !== $user) {
+ Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
$user->delete();
}
break;
case 'masquerade':
- $user = \WT\User::find(WT_Filter::postInteger('user_id'));
+ $user = User::find(WT_Filter::postInteger('user_id'));
- if ($user && \WT\Auth::isAdmin() && \WT\Auth::user() !== $user) {
- \WT\Log::addAuthenticationLog('Masquerade as user: ' . $user->getUserName());
- \WT\Auth::login($user);
+ if ($user && Auth::isAdmin() && Auth::user() !== $user) {
+ Log::addAuthenticationLog('Masquerade as user: ' . $user->getUserName());
+ Auth::login($user);
} else {
header('HTTP/1.0 406 Not Acceptable');
}
@@ -243,9 +247,9 @@ case 'theme':
$theme_dir=WT_Filter::post('theme');
if (WT_Site::preference('ALLOW_USER_THEMES') && in_array($theme_dir, get_theme_names())) {
$WT_SESSION->theme_dir=$theme_dir;
- if (\WT\Auth::id()) {
+ if (Auth::id()) {
// Remember our selection
- \WT\Auth::user()->setSetting('theme', $theme_dir);
+ Auth::user()->setSetting('theme', $theme_dir);
}
} else {
// Request for a non-existant theme.
diff --git a/addmedia.php b/addmedia.php
index 55db0c3fd9..c5ad817566 100644
--- a/addmedia.php
+++ b/addmedia.php
@@ -22,6 +22,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
define('WT_SCRIPT_NAME', 'addmedia.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
@@ -43,7 +46,7 @@ $controller = new WT_Controller_Simple();
$controller
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();')
- ->restrictAccess(\WT\Auth::isMember());
+ ->restrictAccess(Auth::isMember());
$disp = true;
$media = WT_Media::getInstance($pid);
@@ -174,7 +177,7 @@ case 'create': // Save the information from the “showcreateform” action
}
if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
chmod($serverFileName, WT_PERM_FILE);
- \WT\Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
+ Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
} else {
WT_FlashMessages::addMessage(
WT_I18N::translate('There was an error uploading your file.') .
@@ -198,7 +201,7 @@ case 'create': // Save the information from the “showcreateform” action
$serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile;
if (move_uploaded_file($_FILES['thumbnail']['tmp_name'], $serverFileName)) {
chmod($serverFileName, WT_PERM_FILE);
- \WT\Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
+ Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
}
}
}
@@ -220,10 +223,10 @@ case 'create': // Save the information from the “showcreateform” action
if ($linktoid) {
$record = WT_GedcomRecord::getInstance($linktoid);
$record->createFact('1 OBJE @' . $media->getXref() . '@', true);
- \WT\Log::addEditLog('Media ID '.$media->getXref()." successfully added to $linktoid.");
+ Log::addEditLog('Media ID '.$media->getXref()." successfully added to $linktoid.");
$controller->addInlineJavascript('closePopupAndReloadParent();');
} else {
- \WT\Log::addEditLog('Media ID '.$media->getXref().' successfully added.');
+ Log::addEditLog('Media ID '.$media->getXref().' successfully added.');
$controller->addInlineJavascript('openerpasteid("' . $media->getXref() . '");');
}
echo '<button onclick="closePopupAndReloadParent();">', WT_I18N::translate('close'), '</button>';
@@ -375,7 +378,7 @@ case 'update': // Save the information from the “editmedia” action
if ($pid && $linktoid) {
$record = WT_GedcomRecord::getInstance($linktoid);
$record->createFact('1 OBJE @' . $pid . '@', true);
- \WT\Log::addEditLog('Media ID '.$pid." successfully added to $linktoid.");
+ Log::addEditLog('Media ID '.$pid." successfully added to $linktoid.");
}
$controller->pageHeader();
if ($messages) {
@@ -508,7 +511,7 @@ if (!$isExternal) {
echo '<option';
if ($folder == '') echo ' selected="selected"';
echo ' value=""> ', WT_I18N::translate('Choose: '), ' </option>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<option value="other" disabled>', WT_I18N::translate('Other folder… please type in'), "</option>";
}
foreach ($mediaFolders as $f) {
@@ -521,7 +524,7 @@ if (!$isExternal) {
} else {
echo $folder;
}
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<br><span dir="ltr"><input type="text" name="folder" size="40" value="', $folder, '"></span>';
if ($gedfile == 'FILE') {
echo '<p class="sub">', WT_I18N::translate('This entry is ignored if you have entered a URL into the file name field.'), '</p>';
@@ -695,7 +698,7 @@ if (!empty($gedrec)) {
add_simple_tag(($sourceLevel+1) .' QUAY '. $sourceQUAY);
}
}
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
echo "<tr><td class=\"descriptionbox wrap width25\">";
echo WT_Gedcom_Tag::getLabel('CHAN'), "</td><td class=\"optionbox wrap\">";
if ($NO_UPDATE_CHAN) {
diff --git a/admin.php b/admin.php
index c05490b182..23a0cf3d70 100644
--- a/admin.php
+++ b/admin.php
@@ -18,6 +18,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin.php');
require './includes/session.php';
@@ -25,7 +28,7 @@ require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->addInlineJavascript('jQuery("#x").accordion({heightStyle: "content"});')
->addInlineJavascript('jQuery("#tree_stats").accordion();')
->addInlineJavascript('jQuery("#changes").accordion();')
@@ -55,7 +58,7 @@ foreach (old_paths() as $path) {
}
// Total number of users
-$total_users = \WT\User::count();
+$total_users = User::count();
// Total number of administrators
$total_administrators = WT_DB::prepare(
@@ -104,7 +107,7 @@ $stats = new WT_Stats(WT_GEDCOM);
<p>
<?php echo /* I18N: %s is a URL/link to the project website */ WT_I18N::translate('Support and documentation can be found at %s.', ' <a class="current" href="http://webtrees.net/">webtrees.net</a>'); ?>
</p>
- <?php if (\WT\Auth::isAdmin() && $latest_version && version_compare(WT_VERSION, $latest_version)<0) { ?>
+ <?php if (Auth::isAdmin() && $latest_version && version_compare(WT_VERSION, $latest_version)<0) { ?>
<p>
<?php echo WT_I18N::translate('A new version of webtrees is available.'); ?>
<a href="admin_site_upgrade.php" class="error">
@@ -114,7 +117,7 @@ $stats = new WT_Stats(WT_GEDCOM);
<?php } ?>
</div>
- <?php if (\WT\Auth::isAdmin() && $old_files) { ?>
+ <?php if (Auth::isAdmin() && $old_files) { ?>
<h2><span class="warning"><?php echo WT_I18N::translate('Old files found'); ?></span></h2>
<div>
<p>
diff --git a/admin_media.php b/admin_media.php
index 1c06725be5..1eb54c5132 100644
--- a/admin_media.php
+++ b/admin_media.php
@@ -16,6 +16,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_media.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
@@ -515,7 +517,7 @@ $table_id=md5($files.$media_folder.$media_path.$subfolders);
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Media'))
->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
->pageHeader()
diff --git a/admin_media_upload.php b/admin_media_upload.php
index d5b47cf07f..35c7f505ee 100644
--- a/admin_media_upload.php
+++ b/admin_media_upload.php
@@ -21,13 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
define('WT_SCRIPT_NAME', 'admin_media_upload.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_mediadb.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Upload media files'));
$action = WT_Filter::post('action');
@@ -134,7 +137,7 @@ if ($action == "upload") {
if (move_uploaded_file($_FILES['mediafile' . $i]['tmp_name'], $serverFileName)) {
WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was uploaded.', '<span class="filename">' . $serverFileName . '</span>'));
chmod($serverFileName, WT_PERM_FILE);
- \WT\Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
+ Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
} else {
WT_FlashMessages::addMessage(
WT_I18N::translate('There was an error uploading your file.') .
@@ -153,7 +156,7 @@ if ($action == "upload") {
if (move_uploaded_file($_FILES['thumbnail' . $i]['tmp_name'], $serverFileName)) {
WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was uploaded.', '<span class="filename">' . $serverFileName . '</span>'));
chmod($serverFileName, WT_PERM_FILE);
- \WT\Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
+ Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
}
}
}
@@ -213,12 +216,12 @@ for ($i=1; $i<6; $i++) {
echo '<span dir="ltr"><select name="folder_list', $i, '" onchange="document.uploadmedia.folder', $i, '.value=this.options[this.selectedIndex].value;">';
echo '<option';
echo ' value="/"> ', WT_I18N::translate('Choose: '), ' </option>';
- if (\WT\Auth::isAdmin()) echo '<option value="other" disabled>', WT_I18N::translate('Other folder… please type in'), "</option>";
+ if (Auth::isAdmin()) echo '<option value="other" disabled>', WT_I18N::translate('Other folder… please type in'), "</option>";
foreach ($mediaFolders as $f) {
echo '<option value="', WT_Filter::escapeHtml($f), '">', WT_Filter::escapeHtml($f), "</option>";
}
echo "</select></span>";
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<br><span dir="ltr"><input name="folder', $i, '" type="text" size="40" value=""></span>';
} else {
echo '<input name="folder', $i, '" type="hidden" value="">';
diff --git a/admin_module_blocks.php b/admin_module_blocks.php
index e72bbc6bbf..4ec04edae8 100644
--- a/admin_module_blocks.php
+++ b/admin_module_blocks.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_module_blocks.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'))
->pageHeader();
diff --git a/admin_module_menus.php b/admin_module_menus.php
index 035224a6db..28cfd635a3 100644
--- a/admin_module_menus.php
+++ b/admin_module_menus.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_module_menus.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'))
->pageHeader()
->addInlineJavascript('
diff --git a/admin_module_reports.php b/admin_module_reports.php
index b6b411d1c8..5c6c87ca61 100644
--- a/admin_module_reports.php
+++ b/admin_module_reports.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_module_reports.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'))
->pageHeader();
diff --git a/admin_module_sidebar.php b/admin_module_sidebar.php
index 8824959b36..678171e70d 100644
--- a/admin_module_sidebar.php
+++ b/admin_module_sidebar.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_module_sidebar.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'))
->pageHeader()
->addInlineJavascript('
diff --git a/admin_module_tabs.php b/admin_module_tabs.php
index df32be4d7f..f3ac95de34 100644
--- a/admin_module_tabs.php
+++ b/admin_module_tabs.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_module_tabs.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'))
->pageHeader()
->addInlineJavascript('
diff --git a/admin_modules.php b/admin_modules.php
index 8f7608a615..02316a23f2 100644
--- a/admin_modules.php
+++ b/admin_modules.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_modules.php');
require 'includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Module administration'));
$modules = WT_Module::getInstalledModules('disabled');
diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php
index b6e1769798..24cdb0f4e2 100644
--- a/admin_pgv_to_wt.php
+++ b/admin_pgv_to_wt.php
@@ -18,19 +18,22 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
require './includes/session.php';
//require WT_ROOT.'includes/functions/functions_edit.php';
// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
-if (WT_GED_ID || count(\WT\User::all()) > 1) {
+if (WT_GED_ID || count(User::all()) > 1) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
}
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
$error = '';
@@ -653,7 +656,7 @@ foreach ($GEDCOMS as $GEDCOM=>$GED_DATA) {
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'COMMON_NAMES_ADD', $COMMON_NAMES_ADD));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'COMMON_NAMES_REMOVE', $COMMON_NAMES_REMOVE));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'COMMON_NAMES_THRESHOLD', $COMMON_NAMES_THRESHOLD));
- $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'CONTACT_USER_ID', \WT\User::findByIdentifier($CONTACT_EMAIL)->getUserId()));
+ $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'CONTACT_USER_ID', User::findByIdentifier($CONTACT_EMAIL)->getUserId()));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'DEFAULT_PEDIGREE_GENERATIONS', $DEFAULT_PEDIGREE_GENERATIONS));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'EXPAND_NOTES', $EXPAND_NOTES));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'EXPAND_RELATIVES_EVENTS', $EXPAND_RELATIVES_EVENTS));
@@ -779,7 +782,7 @@ foreach ($GEDCOMS as $GEDCOM=>$GED_DATA) {
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RIN', $USE_RIN));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'WATERMARK_THUMB', $WATERMARK_THUMB));
- @$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'WEBMASTER_USER_ID', \WT\User::findByIdentifier($WEBMASTER_EMAIL)->getUserId()));
+ @$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'WEBMASTER_USER_ID', User::findByIdentifier($WEBMASTER_EMAIL)->getUserId()));
$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES));
}
WT_DB::prepare("DELETE FROM `##gedcom_setting` WHERE setting_name in ('config', 'privacy', 'path', 'pgv_ver', 'imported')")->execute();
diff --git a/admin_site_access.php b/admin_site_access.php
index 1861bf974e..2607da3e04 100644
--- a/admin_site_access.php
+++ b/admin_site_access.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_access.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)
->setPageTitle(WT_I18N::translate('Site access rules'));
diff --git a/admin_site_change.php b/admin_site_change.php
index 932f0ecf3d..20bab3d20d 100644
--- a/admin_site_change.php
+++ b/admin_site_change.php
@@ -18,12 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_site_change.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Changes'));
require WT_ROOT.'includes/functions/functions_edit.php';
@@ -51,7 +54,7 @@ $user = WT_Filter::get('user');
$search = WT_Filter::get('search');
$search = isset($search['value']) ? $search['value'] : null;
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
// Administrators can see all logs
$gedc = WT_Filter::get('gedc');
} else {
@@ -150,7 +153,7 @@ case 'load_json':
$length = WT_Filter::getInteger('length');
$search = WT_Filter::get('search');
$search = $search['value'];
- \WT\Auth::user()->setSetting('admin_site_change_page_size', $length);
+ Auth::user()->setSetting('admin_site_change_page_size', $length);
if ($length>0) {
$LIMIT = " LIMIT " . $start . ',' . $length;
} else {
@@ -222,7 +225,7 @@ $controller
jQueryUI: true,
autoWidth: false,
sorting: [[ 0, "desc" ]],
- pageLength: ' . \WT\Auth::user()->getSetting('admin_site_change_page_size', 10) . ',
+ pageLength: ' . Auth::user()->getSetting('admin_site_change_page_size', 10) . ',
pagingType: "full_numbers",
columns: [
/* Timestamp */ { },
@@ -247,7 +250,7 @@ $url=
'&amp;gedc='.rawurlencode($gedc);
$users_array = array();
-foreach (\WT\User::all() as $tmp_user) {
+foreach (User::all() as $tmp_user) {
$users_array[$tmp_user->getUserName()] = $tmp_user->getUserName();
}
@@ -277,7 +280,7 @@ echo
WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''),
'</td>',
'<td>',
- WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, \WT\Auth::isAdmin() ? '' : 'disabled'),
+ WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'),
'</td>',
'</tr><tr>',
'<td colspan="6">',
diff --git a/admin_site_clean.php b/admin_site_clean.php
index 74cd0c4aac..26dfcac985 100644
--- a/admin_site_clean.php
+++ b/admin_site_clean.php
@@ -19,12 +19,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_clean.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(/* I18N: The “Data folder” is a configuration setting */ WT_I18N::translate('Clean up data folder'))
->pageHeader();
diff --git a/admin_site_config.php b/admin_site_config.php
index bae32a9998..02945eeb8b 100644
--- a/admin_site_config.php
+++ b/admin_site_config.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_config.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)
->addInlineJavascript('jQuery("#tabs").tabs();')
->setPageTitle(WT_I18N::translate('Site configuration'))
diff --git a/admin_site_info.php b/admin_site_info.php
index b4ad7726f0..7201340a0f 100644
--- a/admin_site_info.php
+++ b/admin_site_info.php
@@ -23,12 +23,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_info.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('PHP information'))
->pageHeader();
diff --git a/admin_site_logs.php b/admin_site_logs.php
index 1639194aca..21d126b03b 100644
--- a/admin_site_logs.php
+++ b/admin_site_logs.php
@@ -18,12 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_site_logs.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Logs'));
require WT_ROOT.'includes/functions/functions_edit.php';
@@ -43,7 +46,7 @@ $user = WT_Filter::get('user');
$search = WT_Filter::get('search');
$search = isset($search['value']) ? $search['value'] : null;
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
// Administrators can see all logs
$gedc = WT_Filter::get('gedc');
} else {
@@ -130,7 +133,7 @@ case 'load_json':
Zend_Session::writeClose();
$start = WT_Filter::getInteger('start');
$length = WT_Filter::getInteger('length');
- \WT\Auth::user()->setSetting('admin_site_log_page_size', $length);
+ Auth::user()->setSetting('admin_site_log_page_size', $length);
if ($length>0) {
$LIMIT=" LIMIT " . $start . ',' . $length;
@@ -193,7 +196,7 @@ $controller
jQueryUI: true,
autoWidth: false,
sorting: [[ 0, "desc" ]],
- pageLength: ' . \WT\Auth::user()->getSetting('admin_site_log_page_size', 20) . ',
+ pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ',
pagingType: "full_numbers"
});
');
@@ -208,7 +211,7 @@ $url=
'&amp;gedc='.rawurlencode($gedc);
$users_array = array();
-foreach (\WT\User::all() as $tmp_user) {
+foreach (User::all() as $tmp_user) {
$users_array[$tmp_user->getUserName()] = $tmp_user->getUserName();
}
@@ -235,7 +238,7 @@ echo
WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''),
'</td>',
'<td>',
- WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, \WT\Auth::isAdmin() ? '' : 'disabled'),
+ WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'),
'</td>',
'</tr><tr>',
'<td colspan="6">',
diff --git a/admin_site_merge.php b/admin_site_merge.php
index ca577586c0..8a3f7783ea 100644
--- a/admin_site_merge.php
+++ b/admin_site_merge.php
@@ -23,12 +23,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
$controller=new WT_Controller_Page;
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Merge records'))
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();')
diff --git a/admin_site_other.php b/admin_site_other.php
index 8bd2357fa4..014d300c4e 100644
--- a/admin_site_other.php
+++ b/admin_site_other.php
@@ -21,13 +21,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_other.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Add unlinked records'))
->pageHeader();
diff --git a/admin_site_readme.php b/admin_site_readme.php
index 0710cf8618..c476426130 100644
--- a/admin_site_readme.php
+++ b/admin_site_readme.php
@@ -18,24 +18,20 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use Michelf\MarkdownExtra;
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_readme.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('README documentation'))
->pageHeader();
-// This information is always LTR/English
?>
<div class="markdown" dir="ltr" lang="en">
- <?php
- use \Michelf\MarkdownExtra;
-
- echo MarkdownExtra::defaultTransform(
- file_get_contents('README.md')
- );
- ?>
+ <?php echo MarkdownExtra::defaultTransform(file_get_contents('README.md')); ?>
</div> \ No newline at end of file
diff --git a/admin_site_upgrade.php b/admin_site_upgrade.php
index 31b8775de2..e706caefff 100644
--- a/admin_site_upgrade.php
+++ b/admin_site_upgrade.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_site_upgrade.php');
require './includes/session.php';
@@ -51,7 +53,7 @@ $themes_action = WT_Filter::post('themes', 'ignore|disable');
$controller = new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Upgrade wizard'))
->pageHeader();
diff --git a/admin_trees_check.php b/admin_trees_check.php
index f89610ef99..b1ed39f641 100644
--- a/admin_trees_check.php
+++ b/admin_trees_check.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_check.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Check for errors'))
->pageHeader();
diff --git a/admin_trees_config.php b/admin_trees_config.php
index ca8214b734..b16f0f24a7 100644
--- a/admin_trees_config.php
+++ b/admin_trees_config.php
@@ -21,13 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_trees_config.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Family tree configuration'));
require WT_ROOT.'includes/functions/functions_edit.php';
@@ -401,7 +404,7 @@ $controller
<td><select name="NEW_CONTACT_USER_ID">
<?php
$CONTACT_USER_ID = get_gedcom_setting(WT_GED_ID, 'CONTACT_USER_ID');
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getSetting('verified_by_admin')) {
echo "<option value=\"" . $user->getUserId() . "\"";
if ($CONTACT_USER_ID == $user->getUserId()) {
@@ -421,7 +424,7 @@ $controller
<td><select name="NEW_WEBMASTER_USER_ID">
<?php
$WEBMASTER_USER_ID = get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
- foreach (\WT\User::allAdmins() as $user) {
+ foreach (User::allAdmins() as $user) {
echo '<option value="' . $user->getUserId() . '"';
if ($WEBMASTER_USER_ID == $user->getUserId()) {
echo ' selected="selected"';
diff --git a/admin_trees_download.php b/admin_trees_download.php
index 18f24cba2a..fe2dd335a9 100644
--- a/admin_trees_download.php
+++ b/admin_trees_download.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_download.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_export.php';
@@ -28,7 +30,7 @@ require WT_ROOT.'includes/functions/functions_export.php';
$controller=new WT_Controller_Page();
$controller
->setPageTitle(WT_I18N::translate('Download GEDCOM'))
- ->restrictAccess(\WT\Auth::isManager());
+ ->restrictAccess(Auth::isManager());
// Validate user parameters
$action = WT_Filter::get('action', 'download');
diff --git a/admin_trees_export.php b/admin_trees_export.php
index 2637c6513c..1bc2425881 100644
--- a/admin_trees_export.php
+++ b/admin_trees_export.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_export.php');
require './includes/session.php';
$controller=new WT_Controller_Ajax();
$controller
->pageHeader()
- ->restrictAccess(\WT\Auth::isManager());
+ ->restrictAccess(Auth::isManager());
$filename = WT_DATA_DIR . $WT_TREE->tree_name;
// Force a ".ged" suffix
diff --git a/admin_trees_manage.php b/admin_trees_manage.php
index b40751503e..682962a46e 100644
--- a/admin_trees_manage.php
+++ b/admin_trees_manage.php
@@ -18,13 +18,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_trees_manage.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Family trees'));
// Don’t allow the user to cancel the request. We do not want to be left
@@ -174,7 +177,7 @@ case 'importform':
// List the gedcoms available to this user
foreach (WT_Tree::GetAll() as $tree) {
- if (\WT\Auth::isManager($tree)) {
+ if (Auth::isManager($tree)) {
echo
'<table class="gedcom_table">',
@@ -238,7 +241,7 @@ foreach (WT_Tree::GetAll() as $tree) {
}
// Options for creating new gedcoms and setting defaults
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
echo '<table class="gedcom_table2"><tr>';
if (count(WT_Tree::GetAll())>1) {
echo '<th>', WT_I18N::translate('Default family tree'), help_link('default_gedcom'), '</th>';
@@ -264,7 +267,7 @@ if (\WT\Auth::isAdmin()) {
'</tr></table><br>';
// display link to PGV-WT transfer wizard on first visit to this page, before any GEDCOM is loaded
- if (count(WT_Tree::GetAll())==0 && count(\WT\User::all())==1) {
+ if (count(WT_Tree::GetAll())==0 && count(User::all())==1) {
echo
'<div class="center">',
'<a style="color:green; font-weight:bold;" href="admin_pgv_to_wt.php">',
diff --git a/admin_trees_merge.php b/admin_trees_merge.php
index 5cf50d8b47..4bd3571865 100644
--- a/admin_trees_merge.php
+++ b/admin_trees_merge.php
@@ -18,13 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_merge.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Merge family trees'))
->pageHeader();
diff --git a/admin_trees_places.php b/admin_trees_places.php
index c351adaa63..b87556ba4b 100644
--- a/admin_trees_places.php
+++ b/admin_trees_places.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_places.php');
require './includes/session.php';
@@ -76,7 +78,7 @@ if ($search && $replace) {
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Administration - place edit'))
->pageHeader();
?>
diff --git a/admin_trees_renumber.php b/admin_trees_renumber.php
index bbc0cdc775..43fbbdc7bf 100644
--- a/admin_trees_renumber.php
+++ b/admin_trees_renumber.php
@@ -18,12 +18,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_trees_renumber.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Renumber family tree'))
->pageHeader();
diff --git a/admin_users.php b/admin_users.php
index e6f2bdf7a2..2273083247 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -21,12 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'admin_users.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('User administration'));
require_once WT_ROOT.'includes/functions/functions_edit.php';
@@ -85,7 +89,7 @@ case 'loadrows':
" email LIKE CONCAT('%', ?, '%'))";
$ARGS=array($search, $search, $search);
}
- \WT\Auth::user()->setSetting('admin_users_page_size', $length);
+ Auth::user()->setSetting('admin_users_page_size', $length);
if ($length > 0) {
$LIMIT = " LIMIT " . $start . ',' . $length;
} else {
@@ -166,7 +170,7 @@ case 'loadrows':
// Total filtered/unfiltered rows
$recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchOne();
- $recordsTotal = \WT\User::count();
+ $recordsTotal = User::count();
Zend_Session::writeClose();
header('Content-type: application/json');
@@ -180,7 +184,7 @@ case 'loadrows':
case 'load1row':
// Generate an AJAX response for datatables to load expanded row
$user_id = WT_Filter::getInteger('user_id');
- $user = \WT\User::find($user_id);
+ $user = User::find($user_id);
Zend_Session::writeClose();
header('Content-type: text/html; charset=UTF-8');
echo '<h2>', WT_I18N::translate('Details'), '</h2>';
@@ -213,7 +217,7 @@ case 'load1row':
echo '<dd><a href="#" onclick="modalDialog(\'index_edit.php?user_id='.$user_id.'\', \'', WT_I18N::translate('Change the blocks on this page'), '\');">', WT_I18N::translate('Change the blocks on this page'), '</a></dd>';
// Masquerade as others users - but not other administrators
- if (!\WT\Auth::isAdmin($user)) {
+ if (!Auth::isAdmin($user)) {
echo '<dt>', /* I18N: Pretend to be another user, by logging in as them */ WT_I18N::translate('Masquerade as this user'), '</dt>';
echo '<dd><a href="#" onclick="return masquerade(', $user_id, ')">', /* I18N: verb: pretend to be someone else */ WT_I18N::translate('masquerade'), '</a></dd>';
}
@@ -256,17 +260,17 @@ case 'load1row':
case 'createuser':
if (!WT_Filter::checkCsrf()) {
$action='createform';
- } elseif (\WT\User::findByIdentifier($username)) {
+ } elseif (User::findByIdentifier($username)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
$action='createform';
- } elseif (\WT\User::findByIdentifier($emailaddress)) {
+ } elseif (User::findByIdentifier($emailaddress)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.'));
$action='createform';
} elseif ($pass1!=$pass2) {
WT_FlashMessages::addMessage(WT_I18N::translate('Passwords do not match.'));
$action='createform';
} else {
- $user = \WT\User::create($username, $realname, $emailaddress, $pass1);
+ $user = User::create($username, $realname, $emailaddress, $pass1);
$user
->setSetting('reg_timestamp', date('U'))
->setSetting('sessiontime', '0')
@@ -291,7 +295,7 @@ case 'createuser':
$tree->userPreference($user->getUserId(), 'RELATIONSHIP_PATH_LENGTH', null);
}
}
- \WT\Log::addAuthenticationLog("User ->{$username}<- created");
+ Log::addAuthenticationLog("User ->{$username}<- created");
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME);
WT_Session::writeClose();
exit;
@@ -415,7 +419,7 @@ case 'createform':
</td>';
}
echo '</tr>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<tr>
<td>', WT_I18N::translate('Admin comments on user'), '</td>
<td colspan="3"><textarea style="width:95%;" rows="5" name="new_comment" value="', WT_Filter::escapeHtml($new_comment), '"></textarea></td>
@@ -504,7 +508,7 @@ case 'cleanup':
<?php
// Check users not logged in too long
$ucnt = 0;
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getSetting('sessiontime') == "0") {
$datelogin = (int)$user->getSetting('reg_timestamp');
} else {
@@ -519,7 +523,7 @@ case 'cleanup':
}
// Check unverified users
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if (((date("U") - (int)$user->getSetting('reg_timestamp')) > 604800) && !$user->getSetting('verified')) {
?><tr><td><?php echo WT_Filter::escapeHtml($user->getUserName()), " - ", WT_Filter::escapeHtml($user->getRealName()), ":&nbsp;&nbsp;", WT_I18N::translate('User didn’t verify within 7 days.');
$ucnt++;
@@ -528,7 +532,7 @@ case 'cleanup':
}
// Check users not verified by admin
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if (!$user->getSetting('verified_by_admin') && $user->getSetting('verified')) {
?><tr><td><?php echo WT_Filter::escapeHtml($user->getUserName()), " - ", WT_Filter::escapeHtml($user->getRealName()), ":&nbsp;&nbsp;", WT_I18N::translate('User not verified by administrator.');
?></td><td><input type="checkbox" name="del_<?php echo $user->getUserId(); ?>" value="1"></td></tr><?php
@@ -549,9 +553,9 @@ case 'cleanup':
</form><?php
break;
case 'cleanup2':
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if (WT_Filter::post('del_' . $user->getUserId()) == '1') {
- \WT\Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
+ Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
echo WT_I18N::translate('Deleted user: '), $user->getUserName(), '<br>';
$user->delete();
}
@@ -595,7 +599,7 @@ default:
ajax: "'.WT_SCRIPT_NAME.'?action=loadrows",
jQueryUI: true,
autoWidth: false,
- pageLength: ' . \WT\Auth::user()->getSetting('admin_users_page_size', 10).',
+ pageLength: ' . Auth::user()->getSetting('admin_users_page_size', 10).',
pagingType: "full_numbers",
sorting: [[2,"asc"]],
columns: [
diff --git a/admin_users_bulk.php b/admin_users_bulk.php
index 498a7729aa..576c724f8e 100644
--- a/admin_users_bulk.php
+++ b/admin_users_bulk.php
@@ -23,12 +23,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'admin_users_bulk.php');
require './includes/session.php';
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Send broadcast messages'))
->pageHeader();
diff --git a/block_edit.php b/block_edit.php
index 562bde936b..dae1438c37 100644
--- a/block_edit.php
+++ b/block_edit.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
@@ -30,8 +32,8 @@ $block = WT_DB::prepare(
// managers, (3) user blocks require the user or an admin
if (
!$block ||
- $block->gedcom_id && !\WT\Auth::isManager(WT_Tree::get($block->gedcom_id)) ||
- $block->user_id && $block->user_id != \WT\Auth::id() && !\WT\Auth::isAdmin()
+ $block->gedcom_id && !Auth::isManager(WT_Tree::get($block->gedcom_id)) ||
+ $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()
) {
exit;
}
diff --git a/edit_changes.php b/edit_changes.php
index 2bce261a6c..c4f25e991d 100644
--- a/edit_changes.php
+++ b/edit_changes.php
@@ -21,13 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
define('WT_SCRIPT_NAME', 'edit_changes.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Simple();
$controller
- ->restrictAccess(\WT\Auth::isModerator())
+ ->restrictAccess(Auth::isModerator())
->setPageTitle(WT_I18N::translate('Pending changes'))
->pageHeader()
->addInlineJavascript("
@@ -81,7 +84,7 @@ case 'accept':
update_record($change->new_gedcom, $gedcom_id, false);
}
WT_DB::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id));
- \WT\Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database");
+ Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database");
}
break;
case 'undoall':
@@ -108,7 +111,7 @@ case 'acceptall':
update_record($change->new_gedcom, $change->gedcom_id, false);
}
WT_DB::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id));
- \WT\Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database");
+ Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database");
}
break;
}
diff --git a/edit_interface.php b/edit_interface.php
index ca93506006..68288fae90 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'edit_interface.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
@@ -29,7 +31,7 @@ $action = WT_Filter::post('action', null, WT_Filter::get('action'));
$controller=new WT_Controller_Simple();
$controller
- ->restrictAccess(\WT\Auth::isEditor())
+ ->restrictAccess(Auth::isEditor())
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();')
->addInlineJavascript('
@@ -312,7 +314,7 @@ case 'edit':
}
break;
}
- if (\WT\Auth::isAdmin() || $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || $SHOW_GEDCOM_RECORD) {
echo
'<br><br><a href="edit_interface.php?action=editrawfact&amp;xref=', $xref, '&amp;fact_id=', $fact_id, '&amp;ged=', WT_GEDURL, '">',
WT_I18N::translate('Edit raw GEDCOM'),
@@ -715,7 +717,7 @@ case 'add_parent_to_individual_action':
////////////////////////////////////////////////////////////////////////////////
case 'add_unlinked_indi':
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->setPageTitle(WT_I18N::translate('Create a new individual'))
->pageHeader();
@@ -735,7 +737,7 @@ case 'add_unlinked_indi_action':
}
$controller
- ->restrictAccess(\WT\Auth::isManager())
+ ->restrictAccess(Auth::isManager())
->pageHeader();
splitSOUR();
@@ -2255,7 +2257,7 @@ case 'reorder_fams_update':
function keep_chan(WT_GedcomRecord $record=null) {
global $NO_UPDATE_CHAN;
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
$checked = $NO_UPDATE_CHAN ? ' checked="checked"' : '';
if ($record) {
@@ -2726,7 +2728,7 @@ function print_indi_form($nextaction, WT_Individual $person=null, WT_Family $fam
}
// If we are editing an existing name, allow raw GEDCOM editing
- if ($name_fact && (\WT\Auth::isAdmin() || $SHOW_GEDCOM_RECORD)) {
+ if ($name_fact && (Auth::isAdmin() || $SHOW_GEDCOM_RECORD)) {
echo
'<br><br><a href="edit_interface.php?action=editrawfact&amp;xref=', $xref, '&amp;fact_id=', $name_fact->getFactId(), '&amp;ged=', WT_GEDURL, '">',
WT_I18N::translate('Edit raw GEDCOM'),
diff --git a/editnews.php b/editnews.php
index f893eec6b1..b4df806e65 100644
--- a/editnews.php
+++ b/editnews.php
@@ -23,13 +23,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'editnews.php');
require './includes/session.php';
$controller=new WT_Controller_Simple();
$controller
->setPageTitle(WT_I18N::translate('Add/edit a journal/news entry'))
- ->restrictAccess(\WT\Auth::isMember())
+ ->restrictAccess(Auth::isMember())
->pageHeader();
$action = WT_Filter::get('action', 'compose|save|delete', 'compose');
diff --git a/edituser.php b/edituser.php
index f057090cf3..4d6beeff40 100644
--- a/edituser.php
+++ b/edituser.php
@@ -21,13 +21,17 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'edituser.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
require WT_ROOT.'includes/functions/functions_edit.php';
// prevent users with editing account disabled from being able to edit their account
-if (!\WT\Auth::id() || !\WT\Auth::user()->getSetting('editaccount')) {
+if (!Auth::id() || !Auth::user()->getSetting('editaccount')) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
}
@@ -53,24 +57,24 @@ $form_visible_online = WT_Filter::postBool('form_visible_online');
// Respond to form action
if ($form_action=='update' && WT_Filter::checkCsrf()) {
- if ($form_username != \WT\Auth::user()->getUserName() && \WT\User::findByIdentifier($form_username)) {
+ if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
- } elseif ($form_email != \WT\Auth::user()->getEmail() && \WT\User::findByIdentifier($form_email)) {
+ } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.'));
} else {
// Change username
if ($form_username != WT_USER_NAME) {
- \WT\Log::addAuthenticationLog('User ' . \WT\Auth::user()->getUserName() . ' renamed to ' . $form_username);
- \WT\Auth::user()->setUserName($form_username);
+ Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username);
+ Auth::user()->setUserName($form_username);
}
// Change password
if ($form_pass1 && $form_pass1 == $form_pass2) {
- \WT\Auth::user()->setPassword($form_pass1);
+ Auth::user()->setPassword($form_pass1);
}
// Change other settings
- \WT\Auth::user()
+ Auth::user()
->setRealName($form_realname)
->setEmail($form_email)
->setSetting('theme', $form_theme)
@@ -130,9 +134,9 @@ echo '<div id="edituser-page">
', WT_Filter::getCsrf(), '
<div id="edituser-table">
<div class="label">', WT_I18N::translate('Username'), help_link('username'), '</div>
- <div class="value"><input type="text" name="form_username" value="', WT_Filter::escapeHtml(\WT\Auth::user()->getUserName()), '" autofocus></div>
+ <div class="value"><input type="text" name="form_username" value="', WT_Filter::escapeHtml(Auth::user()->getUserName()), '" autofocus></div>
<div class="label">', WT_I18N::translate('Real name'), help_link('real_name'), '</div>
- <div class="value"><input type="text" name="form_realname" value="', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '"></div>';
+ <div class="value"><input type="text" name="form_realname" value="', WT_Filter::escapeHtml(Auth::user()->getRealName()), '"></div>';
$person = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
if ($person) {
echo '<div class="label">', WT_I18N::translate('Individual record'), help_link('edituser_gedcomid'), '</div>
@@ -151,16 +155,16 @@ echo '<div id="edituser-page">
<div class="label">', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '</div>
<div class="value"><input type="password" name="form_pass2"></div>
<div class="label">', WT_I18N::translate('Language'), '</div>
- <div class="value">', edit_field_language('form_language', \WT\Auth::user()->getSetting('language')), '</div>
+ <div class="value">', edit_field_language('form_language', Auth::user()->getSetting('language')), '</div>
<div class="label">', WT_I18N::translate('Email address'), help_link('email'), '</div>
- <div class="value"><input type="email" name="form_email" value="', WT_Filter::escapeHtml(\WT\Auth::user()->getEmail()), '" size="50"></div>
+ <div class="value"><input type="email" name="form_email" value="', WT_Filter::escapeHtml(Auth::user()->getEmail()), '" size="50"></div>
<div class="label">', WT_I18N::translate('Theme'), help_link('THEME'), '</div>
<div class="value">
<select name="form_theme">
<option value="">', WT_Filter::escapeHtml(/* I18N: default option in list of themes */ WT_I18N::translate('<default theme>')), '</option>';
foreach (get_theme_names() as $themename=>$themedir) {
echo '<option value="', $themedir, '"';
- if ($themedir == \WT\Auth::user()->getSetting('theme')) {
+ if ($themedir == Auth::user()->getSetting('theme')) {
echo ' selected="selected"';
}
echo '>', $themename, '</option>';
@@ -168,9 +172,9 @@ echo '<div id="edituser-page">
echo '</select>
</div>
<div class="label">', WT_I18N::translate('Preferred contact method'), help_link('edituser_contact_meth'), '</div>
- <div class="value">', edit_field_contact('form_contact_method', \WT\Auth::user()->getSetting('contactmethod')), '</div>
+ <div class="value">', edit_field_contact('form_contact_method', Auth::user()->getSetting('contactmethod')), '</div>
<div class="label">', WT_I18N::translate('Visible to other users when online'), help_link('useradmin_visibleonline'), '</div>
- <div class="value">', checkbox('form_visible_online', \WT\Auth::user()->getSetting('visibleonline')), '</div>
+ <div class="value">', checkbox('form_visible_online', Auth::user()->getSetting('visibleonline')), '</div>
</div>'; // close edituser-table
echo '<div id="edituser_submit"><input type="submit" value="', WT_I18N::translate('save'), '"></div>';
echo '</form>
diff --git a/famlist.php b/famlist.php
index 0c50c39596..d8fea2ddd9 100644
--- a/famlist.php
+++ b/famlist.php
@@ -24,6 +24,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'famlist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
@@ -46,18 +48,18 @@ if ($show_all_firstnames=='yes') {
switch (WT_Filter::get('show_marnm', 'no|yes')) {
case 'no':
$show_marnm = false;
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting(WT_USER_ID, WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
+ if (Auth::id()) {
+ Auth::user()->setSetting(WT_USER_ID, WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
}
break;
case 'yes':
$show_marnm = true;
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting(WT_USER_ID, WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
+ if (Auth::id()) {
+ Auth::user()->setSetting(WT_USER_ID, WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
}
break;
default:
- $show_marnm = \WT\Auth::id() && \WT\Auth::user()->getSetting(WT_SCRIPT_NAME.'_show_marnm');
+ $show_marnm = Auth::id() && Auth::user()->getSetting(WT_SCRIPT_NAME.'_show_marnm');
}
// Make sure selections are consistent.
diff --git a/find.php b/find.php
index 0a749f38eb..327678fbc2 100644
--- a/find.php
+++ b/find.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'find.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
@@ -91,12 +93,12 @@ case "source":
case "specialchar":
$controller->setPageTitle(WT_I18N::translate('Find a special character'));
$language_filter = WT_Filter::get('language_filter');
- if (\WT\Auth::id()) {
+ if (Auth::id()) {
// Users will probably always want the same language, so remember their setting
if (!$language_filter) {
- $language_filter = \WT\Auth::user()->getSetting('default_language_filter');
+ $language_filter = Auth::user()->getSetting('default_language_filter');
} else {
- \WT\Auth::user()->setSetting('default_language_filter', $language_filter);
+ Auth::user()->setSetting('default_language_filter', $language_filter);
}
}
require WT_ROOT.'includes/specialchars.php';
diff --git a/help_text.php b/help_text.php
index 6f770e579a..0aae054dc9 100644
--- a/help_text.php
+++ b/help_text.php
@@ -26,6 +26,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'help_text.php');
require './includes/session.php';
@@ -1332,7 +1334,7 @@ case 'pending_changes':
'</p><p>'.
WT_I18N::translate('Pending changes are only shown when your account has permission to edit. When you log out, you will no longer be able to see them. Also, pending changes are only shown on certain pages. For example, they are not shown in lists, reports, or search results.').
'</p>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
$text.=
'<p>'.
WT_I18N::translate('Each user account has an option to “automatically accept changes”. When this is enabled, any changes made by that user are saved immediately. Many administrators enable this for their own user account.').
diff --git a/includes/authentication.php b/includes/authentication.php
index b2ba9175a2..f2bc2fde7c 100644
--- a/includes/authentication.php
+++ b/includes/authentication.php
@@ -28,6 +28,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -39,7 +42,7 @@ if (!defined('WT_WEBTREES')) {
* @deprecated
*/
function getUserFullName($user_id) {
- return \WT\User::find($user_id)->getRealName();
+ return User::find($user_id)->getRealName();
}
//-- requires a string to add into the searchlog-file
@@ -63,8 +66,8 @@ function addMessage($message) {
$success = true;
- $sender = \WT\User::findByIdentifier($message['from']);
- $recipient = \WT\User::findByIdentifier($message['to']);
+ $sender = User::findByIdentifier($message['from']);
+ $recipient = User::findByIdentifier($message['to']);
// Sender may not be a webtrees user
if ($sender) {
@@ -123,7 +126,7 @@ function addMessage($message) {
}
// Add another footer - unless we are an admin
- if (!\WT\Auth::isAdmin()) {
+ if (!Auth::isAdmin()) {
if (!empty($message['url'])) {
$message['body'] .=
WT_Mail::EOL . WT_Mail::EOL .
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index 6bffc416a0..00a3f97a90 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -21,6 +21,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -43,11 +46,11 @@ function fetch_all_links($xref, $gedcom_id) {
}
// Find out if there are any pending changes that a given user may accept
-function exists_pending_change(\WT\User $user = null, WT_Tree $tree = null) {
+function exists_pending_change(User $user = null, WT_Tree $tree = null) {
global $WT_TREE;
if ($user === null) {
- $user = \WT\Auth::user();
+ $user = Auth::user();
}
if ($tree === null) {
diff --git a/includes/functions/functions_import.php b/includes/functions/functions_import.php
index c31f3071d1..4382eadd4d 100644
--- a/includes/functions/functions_import.php
+++ b/includes/functions/functions_import.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -1039,7 +1041,7 @@ function accept_all_changes($xref, $ged_id) {
" SET status='accepted'".
" WHERE status='pending' AND xref=? AND gedcom_id=?"
)->execute(array($xref, $ged_id));
- \WT\Log::addEditLog("Accepted change {$change->change_id} for {$xref} / {$change->gedcom_name} into database");
+ Log::addEditLog("Accepted change {$change->change_id} for {$xref} / {$change->gedcom_name} into database");
}
}
diff --git a/includes/functions/functions_mediadb.php b/includes/functions/functions_mediadb.php
index 6c060bd949..67a391ad66 100644
--- a/includes/functions/functions_mediadb.php
+++ b/includes/functions/functions_mediadb.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -65,7 +67,7 @@ function hasMemoryForImage($serverFilename) {
} else {
// not enough memory to load this file
$image_info = sprintf('%.2fKB, %d × %d %d bits %d channels', filesize($serverFilename)/1024, $imgsize[0], $imgsize[1], $imgsize['bits'], $imgsize['channels']);
- \WT\Log::addMediaLog('Cannot create thumbnail '.$serverFilename.' ('.$image_info.') memory avail: '.$memoryAvailable.' used: '.$memoryUsed.' needed: '.$memoryNeeded.' spare: '.$memorySpare);
+ Log::addMediaLog('Cannot create thumbnail '.$serverFilename.' ('.$image_info.') memory avail: '.$memoryAvailable.' used: '.$memoryUsed.' needed: '.$memoryNeeded.' spare: '.$memorySpare);
return false;
}
} else {
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 1a639bc52f..670d61a53e 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -28,6 +28,8 @@ if (!defined('WT_WEBTREES')) {
exit;
}
use Rhumsaa\Uuid\Uuid;
+use WT\Auth;
+use WT\User;
/**
* print the information for an individual chart box
@@ -294,8 +296,8 @@ function whoisonline() {
$NumAnonymous = 0;
$loggedusers = array ();
$content='';
- foreach (\WT\User::allLoggedIn() as $user) {
- if (\WT\Auth::isAdmin() || $user->getSetting('visibleonline')) {
+ foreach (User::allLoggedIn() as $user) {
+ if (Auth::isAdmin() || $user->getSetting('visibleonline')) {
$loggedusers[] = $user;
} else {
$NumAnonymous++;
@@ -332,7 +334,7 @@ function whoisonline() {
// Print a link to allow email/messaging contact with a user
// Optionally specify a method (used for webmaster/genealogy contacts)
function user_contact_link($user_id) {
- $user = \WT\User::find($user_id);
+ $user = User::find($user_id);
if ($user) {
$method = $user->getSetting('contactmethod');
diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php
index 57f22672fe..9d0e658864 100644
--- a/includes/functions/functions_print_facts.php
+++ b/includes/functions/functions_print_facts.php
@@ -28,6 +28,7 @@ if (!defined('WT_WEBTREES')) {
exit;
}
use Rhumsaa\Uuid\Uuid;
+use WT\User;
// Print a fact record, for the individual/family/source/repository/etc. pages.
//
@@ -389,7 +390,7 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) {
}
break;
case '_WT_USER':
- $user = \WT\User::findByIdentifier($match[2]); // may not exist
+ $user = User::findByIdentifier($match[2]); // may not exist
if ($user) {
echo WT_Gedcom_Tag::getLabelValue('_WT_USER', WT_Filter::escapeHtml($user->getRealName()));
} else {
diff --git a/includes/session.php b/includes/session.php
index c0a9133543..838f4d7378 100755
--- a/includes/session.php
+++ b/includes/session.php
@@ -21,6 +21,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
// WT_SCRIPT_NAME is defined in each script that the user is permitted to load.
if (!defined('WT_SCRIPT_NAME')) {
header('HTTP/1.0 403 Forbidden');
@@ -267,7 +270,7 @@ set_error_handler(function ($errno, $errstr) {
}
}
echo $fmt_msg;
- \WT\Log::addErrorLog($log_msg);
+ Log::addErrorLog($log_msg);
if ($errno == 1) {
die();
}
@@ -393,7 +396,7 @@ session_set_save_handler(
" ip_address = VALUES(ip_address)," .
" session_data = VALUES(session_data)," .
" session_time = CURRENT_TIMESTAMP - SECOND(CURRENT_TIMESTAMP)"
- )->execute(array($id, (int)\WT\Auth::id(), $WT_REQUEST->getClientIp(), $data));
+ )->execute(array($id, (int)Auth::id(), $WT_REQUEST->getClientIp(), $data));
return true;
},
// destroy
@@ -437,8 +440,8 @@ if (!$SEARCH_SPIDER && !$WT_SESSION->initiated) {
}
// Who are we?
-define('WT_USER_ID', \WT\Auth::id());
-define('WT_USER_NAME', \WT\Auth::id() ? \WT\Auth::user()->getUserName() : '');
+define('WT_USER_ID', Auth::id());
+define('WT_USER_NAME', Auth::id() ? Auth::user()->getUserName() : '');
// Set the active GEDCOM
if (isset($_REQUEST['ged'])) {
@@ -456,7 +459,7 @@ if (isset($_REQUEST['ged'])) {
$WT_TREE=null;
foreach (WT_Tree::getAll() as $tree) {
$WT_TREE=$tree;
- if ($WT_TREE->tree_name == $GEDCOM && ($WT_TREE->imported || \WT\Auth::isAdmin())) {
+ if ($WT_TREE->tree_name == $GEDCOM && ($WT_TREE->imported || Auth::isAdmin())) {
break;
}
}
@@ -468,10 +471,10 @@ if ($WT_TREE) {
define('WT_GEDURL', $WT_TREE->tree_name_url);
define('WT_TREE_TITLE', $WT_TREE->tree_title_html);
define('WT_IMPORTED', $WT_TREE->imported);
- define('WT_USER_GEDCOM_ADMIN', \WT\Auth::isManager($WT_TREE));
- define('WT_USER_CAN_ACCEPT', \WT\Auth::isModerator($WT_TREE));
- define('WT_USER_CAN_EDIT', \WT\Auth::isEditor($WT_TREE));
- define('WT_USER_CAN_ACCESS', \WT\Auth::isMember($WT_TREE));
+ define('WT_USER_GEDCOM_ADMIN', Auth::isManager($WT_TREE));
+ define('WT_USER_CAN_ACCEPT', Auth::isModerator($WT_TREE));
+ define('WT_USER_CAN_EDIT', Auth::isEditor($WT_TREE));
+ define('WT_USER_CAN_ACCESS', Auth::isMember($WT_TREE));
define('WT_USER_GEDCOM_ID', $WT_TREE->userPreference(WT_USER_ID, 'gedcomid'));
define('WT_USER_ROOT_ID', $WT_TREE->userPreference(WT_USER_ID, 'rootid') ? $WT_TREE->userPreference(WT_USER_ID, 'rootid') : WT_USER_GEDCOM_ID);
define('WT_USER_PATH_LENGTH', $WT_TREE->userPreference(WT_USER_ID, 'RELATIONSHIP_PATH_LENGTH'));
@@ -537,7 +540,7 @@ if (WT_Site::preference('LOGIN_URL')) {
// If there is no current tree and we need one, then redirect somewhere
if (WT_SCRIPT_NAME!='admin_trees_manage.php' && WT_SCRIPT_NAME!='admin_pgv_to_wt.php' && WT_SCRIPT_NAME!='login.php' && WT_SCRIPT_NAME!='logout.php' && WT_SCRIPT_NAME!='import.php' && WT_SCRIPT_NAME!='help_text.php' && WT_SCRIPT_NAME!='message.php') {
if (!$WT_TREE || !WT_IMPORTED) {
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'admin_trees_manage.php');
} else {
header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(WT_SCRIPT_NAME . (isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')), true, 301);
@@ -547,10 +550,10 @@ if (WT_SCRIPT_NAME!='admin_trees_manage.php' && WT_SCRIPT_NAME!='admin_pgv_to_wt
}
}
-if (\WT\Auth::id()) {
+if (Auth::id()) {
// Update the login time every 5 minutes
if (WT_TIMESTAMP - $WT_SESSION->activity_time > 300) {
- \WT\Auth::user()->setSetting('sessiontime', WT_TIMESTAMP);
+ Auth::user()->setSetting('sessiontime', WT_TIMESTAMP);
$WT_SESSION->activity_time = WT_TIMESTAMP;
}
}
diff --git a/index.php b/index.php
index 16ed8e982f..64b9537c53 100644
--- a/index.php
+++ b/index.php
@@ -24,6 +24,8 @@
// webtrees requires a modern version of PHP
// Note - maintaining this check requires that this file can be parsed by PHP5.2
+use WT\Auth;
+
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
// RFC2616 requires an absolute URL, but we don’t have it here.
header('Location: site-php-version.php');
@@ -81,7 +83,7 @@ if ($action == 'ajax') {
$controller=new WT_Controller_Page();
if ($ctype=='user') {
- $controller->restrictAccess(\WT\Auth::isMember());
+ $controller->restrictAccess(Auth::isMember());
}
$controller
->setPageTitle($ctype=='user' ? WT_I18N::translate('My page') : WT_TREE_TITLE)
diff --git a/index_edit.php b/index_edit.php
index b9f567b36a..1f1568acca 100644
--- a/index_edit.php
+++ b/index_edit.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'index_edit.php');
require './includes/session.php';
@@ -38,9 +40,9 @@ if ($user_id) {
// Only managers can edit the "home page"
// Only a user or an admin can edit a user’s "my page"
if (
- $gedcom_id < 0 && !\WT\Auth::isAdmin() ||
- $gedcom_id > 0 && !\WT\Auth::isManager(WT_Tree::get($gedcom_id)) ||
- $user_id && \WT\Auth::id() != $user_id && !\WT\Auth::isAdmin()
+ $gedcom_id < 0 && !Auth::isAdmin() ||
+ $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) ||
+ $user_id && Auth::id() != $user_id && !Auth::isAdmin()
) {
$controller->pageHeader();
$controller->addInlineJavascript('window.location.reload();');
diff --git a/indilist.php b/indilist.php
index bee273ddf1..a94773d89b 100644
--- a/indilist.php
+++ b/indilist.php
@@ -24,6 +24,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'indilist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
@@ -46,18 +48,18 @@ if ($show_all_firstnames=='yes') {
switch (WT_Filter::get('show_marnm', 'no|yes')) {
case 'no':
$show_marnm = false;
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting(WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
+ if (Auth::id()) {
+ Auth::user()->setSetting(WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
}
break;
case 'yes':
$show_marnm = true;
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting(WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
+ if (Auth::id()) {
+ Auth::user()->setSetting(WT_SCRIPT_NAME.'_show_marnm', $show_marnm);
}
break;
default:
- $show_marnm = \WT\Auth::id() && \WT\Auth::user()->getSetting(WT_SCRIPT_NAME.'_show_marnm');
+ $show_marnm = Auth::id() && Auth::user()->getSetting(WT_SCRIPT_NAME.'_show_marnm');
}
// Make sure selections are consistent.
diff --git a/inverselink.php b/inverselink.php
index e1c7bc43d7..bde73b16d0 100644
--- a/inverselink.php
+++ b/inverselink.php
@@ -23,13 +23,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
define('WT_SCRIPT_NAME', 'inverselink.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Simple();
$controller
- ->restrictAccess(\WT\Auth::isEditor())
+ ->restrictAccess(Auth::isEditor())
->setPageTitle(WT_I18N::translate('Link to an existing media object'))
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();')
diff --git a/library/WT/Controller/Family.php b/library/WT/Controller/Family.php
index d2eb2c0a02..b36b7b59cf 100644
--- a/library/WT/Controller/Family.php
+++ b/library/WT/Controller/Family.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -107,7 +109,7 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord {
}
// edit raw
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-fam-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php
index 5cc5069698..b8ae9fbe87 100644
--- a/library/WT/Controller/Individual.php
+++ b/library/WT/Controller/Individual.php
@@ -21,6 +21,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -140,8 +143,8 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord {
$dummy->setPrimaryName(0);
echo '<dd class="field">', $dummy->getFullName();
if ($this->name_count == 1) {
- if (\WT\Auth::isAdmin()) {
- $user = \WT\User::findByGenealogyRecord($WT_TREE, $this->record);
+ if (Auth::isAdmin()) {
+ $user = User::findByGenealogyRecord($WT_TREE, $this->record);
if ($user) {
echo '<span> - <a class="warning" href="admin_users.php?filter=' . WT_Filter::escapeHtml($user->getUserName()) . '">' . WT_Filter::escapeHtml($user->getUserName()) . '</a></span>';
}
@@ -301,7 +304,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord {
}
// edit raw
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-indi-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Controller/Media.php b/library/WT/Controller/Media.php
index 1450ebffa0..dcceac8d08 100644
--- a/library/WT/Controller/Media.php
+++ b/library/WT/Controller/Media.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -81,7 +83,7 @@ class WT_Controller_Media extends WT_Controller_GedcomRecord {
}
// edit raw
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Controller/Note.php b/library/WT/Controller/Note.php
index 32a0e23184..c125a1567d 100644
--- a/library/WT/Controller/Note.php
+++ b/library/WT/Controller/Note.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -53,7 +55,7 @@ class WT_Controller_Note extends WT_Controller_GedcomRecord {
// edit raw
/* Does not currently work - NOTE records do not contain nice level 1 facts
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-note-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Controller/Repository.php b/library/WT/Controller/Repository.php
index 61f6f8941d..3a48cdf039 100644
--- a/library/WT/Controller/Repository.php
+++ b/library/WT/Controller/Repository.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -66,7 +68,7 @@ class WT_Controller_Repository extends WT_Controller_GedcomRecord {
}
// edit raw
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Controller/Search.php b/library/WT/Controller/Search.php
index b9bee174cf..cf212c5ee2 100644
--- a/library/WT/Controller/Search.php
+++ b/library/WT/Controller/Search.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
class WT_Controller_Search extends WT_Controller_Page {
public $action;
// TODO: decide if these variables are public/private/protected (or unused)
@@ -381,7 +383,7 @@ class WT_Controller_Search extends WT_Controller_Page {
return;
}
- \WT\Log::addEditLog("Search And Replace old:".$oldquery." new:".$this->replace);
+ Log::addEditLog("Search And Replace old:".$oldquery." new:".$this->replace);
$manual_save = true;
// Include edit functions.
require_once WT_ROOT.'includes/functions/functions_edit.php';
diff --git a/library/WT/Controller/Source.php b/library/WT/Controller/Source.php
index 5b8e3d6d04..19399bb950 100644
--- a/library/WT/Controller/Source.php
+++ b/library/WT/Controller/Source.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
require_once WT_ROOT.'includes/functions/functions_import.php';
@@ -66,7 +68,7 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
}
// edit raw
- if (\WT\Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
+ if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-sour-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
diff --git a/library/WT/Filter.php b/library/WT/Filter.php
index b93b1e961d..e039b3ccfe 100644
--- a/library/WT/Filter.php
+++ b/library/WT/Filter.php
@@ -19,6 +19,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use Michelf\MarkdownExtra;
+use WT\Log;
class WT_Filter {
// REGEX to match a URL
@@ -291,7 +292,7 @@ class WT_Filter {
public static function checkCsrf() {
if (WT_Filter::post('csrf') !== WT_Filter::getCsrfToken()) {
// Oops. Something is not quite right
- \WT\Log::addAuthenticationLog('CSRF mismatch - session expired or malicious attack');
+ Log::addAuthenticationLog('CSRF mismatch - session expired or malicious attack');
WT_FlashMessages::addMessage(WT_I18N::translate('This form has expired. Try again.'));
return false;
}
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php
index db41b4f89d..73250acdcd 100755
--- a/library/WT/GedcomRecord.php
+++ b/library/WT/GedcomRecord.php
@@ -21,6 +21,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
class WT_GedcomRecord {
const RECORD_TYPE = 'UNKNOWN';
const SQL_FETCH = "SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=?";
@@ -918,7 +921,7 @@ class WT_GedcomRecord {
$this->pending = $new_gedcom;
- if (\WT\Auth::user()->getSetting('auto_accept')) {
+ if (Auth::user()->getSetting('auto_accept')) {
accept_all_changes($this->xref, $this->gedcom_id);
$this->gedcom = $new_gedcom;
$this->pending = null;
@@ -961,14 +964,14 @@ class WT_GedcomRecord {
));
// Accept this pending change
- if (\WT\Auth::user()->getSetting('auto_accept')) {
+ if (Auth::user()->getSetting('auto_accept')) {
accept_all_changes($xref, $gedcom_id);
}
// Clear this record from the cache
self::$pending_record_cache = null;
- \WT\Log::addEditLog('Create: ' . $type . ' ' . $xref);
+ Log::addEditLog('Create: ' . $type . ' ' . $xref);
// Return the newly created record
return WT_GedcomRecord::getInstance($xref);
@@ -1004,7 +1007,7 @@ class WT_GedcomRecord {
$this->pending = $gedcom;
// Accept this pending change
- if (\WT\Auth::user()->getSetting('auto_accept')) {
+ if (Auth::user()->getSetting('auto_accept')) {
accept_all_changes($this->xref, $this->gedcom_id);
$this->gedcom = $gedcom;
$this->pending = null;
@@ -1012,7 +1015,7 @@ class WT_GedcomRecord {
$this->parseFacts();
- \WT\Log::addEditLog('Update: ' . static::RECORD_TYPE . ' ' . $this->xref);
+ Log::addEditLog('Update: ' . static::RECORD_TYPE . ' ' . $this->xref);
}
public function deleteRecord() {
@@ -1023,11 +1026,11 @@ class WT_GedcomRecord {
$this->gedcom_id,
$this->xref,
$this->getGedcom(),
- \WT\Auth::id(),
+ Auth::id(),
));
// Accept this pending change
- if (\WT\Auth::user()->getSetting('auto_accept')) {
+ if (Auth::user()->getSetting('auto_accept')) {
accept_all_changes($this->xref, $this->gedcom_id);
}
@@ -1035,7 +1038,7 @@ class WT_GedcomRecord {
self::$gedcom_record_cache = null;
self::$pending_record_cache = null;
- \WT\Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref);
+ Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref);
}
// Remove all links from this record to $xref
diff --git a/library/WT/I18N.php b/library/WT/I18N.php
index 2b46bc19be..0c0cd9c3b8 100644
--- a/library/WT/I18N.php
+++ b/library/WT/I18N.php
@@ -25,6 +25,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
class WT_I18N {
// Lookup table to convert unicode code-points into scripts.
// See https://en.wikipedia.org/wiki/Unicode_block
@@ -87,8 +89,8 @@ class WT_I18N {
$locale = WT_Filter::get('lang');
if ($locale && array_key_exists($locale, $installed_languages)) {
// Requested in the URL?
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting('language', $locale);
+ if (Auth::id()) {
+ Auth::user()->setSetting('language', $locale);
}
} elseif (array_key_exists($WT_SESSION->locale, $installed_languages)) {
// Rembered from a previous visit?
diff --git a/library/WT/Mail.php b/library/WT/Mail.php
index 217d362fd2..22e70510b9 100644
--- a/library/WT/Mail.php
+++ b/library/WT/Mail.php
@@ -18,6 +18,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+use WT\User;
+
class WT_Mail {
const EOL = "<br>\r\n"; // End-of-line that works for both TEXT and HTML messages
@@ -46,7 +49,7 @@ class WT_Mail {
->setReplyTo ($replyto_email, $replyto_name)
->send (WT_Mail::transport());
} catch (Exception $ex) {
- \WT\Log::addErrorLog('Mail: ' . $ex->getMessage());
+ Log::addErrorLog('Mail: ' . $ex->getMessage());
return false;
}
return true;
@@ -55,14 +58,14 @@ class WT_Mail {
/**
* Send an automated system message (such as a password reminder) from a tree to a user.
*
- * @param WT_Tree $tree
- * @param \WT\User $user
- * @param string $subject
- * @param string $message
+ * @param WT_Tree $tree
+ * @param User $user
+ * @param string $subject
+ * @param string $message
*
* @return bool
*/
- public static function system_message(WT_Tree $tree, \WT\User $user, $subject, $message) {
+ public static function system_message(WT_Tree $tree, User $user, $subject, $message) {
return self::send(
$tree,
$user->getEmail(), $user->getRealName(),
diff --git a/library/WT/Media.php b/library/WT/Media.php
index 8662628a5b..9b479c6c38 100644
--- a/library/WT/Media.php
+++ b/library/WT/Media.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
class WT_Media extends WT_GedcomRecord {
const RECORD_TYPE = 'OBJE';
const SQL_FETCH = "SELECT m_gedcom FROM `##media` WHERE m_id=? AND m_file=?";
@@ -121,13 +123,13 @@ class WT_Media extends WT_GedcomRecord {
}
// Does the folder exist for this thumbnail?
if (!is_dir(dirname($file)) && !@mkdir(dirname($file), WT_PERM_EXE, true)) {
- \WT\Log::addMediaLog('The folder ' . dirname($file) . ' could not be created for ' . $this->getXref());
+ Log::addMediaLog('The folder ' . dirname($file) . ' could not be created for ' . $this->getXref());
return $file;
}
// Is there a corresponding main image?
$main_file = WT_DATA_DIR . $MEDIA_DIRECTORY . $this->file;
if (!file_exists($main_file)) {
- \WT\Log::addMediaLog('The file ' . $main_file . ' does not exist for ' . $this->getXref());
+ Log::addMediaLog('The file ' . $main_file . ' does not exist for ' . $this->getXref());
return $file;
}
// Try to create a thumbnail automatically
@@ -135,7 +137,7 @@ class WT_Media extends WT_GedcomRecord {
if ($imgsize[0] && $imgsize[1]) {
// Image small enough to be its own thumbnail?
if ($imgsize[0] < $THUMBNAIL_WIDTH) {
- \WT\Log::addMediaLog('Thumbnail created for ' . $main_file . ' (copy of main image)');
+ Log::addMediaLog('Thumbnail created for ' . $main_file . ' (copy of main image)');
@copy($main_file, $file);
} else {
if (hasMemoryForImage($main_file)) {
@@ -162,12 +164,12 @@ class WT_Media extends WT_GedcomRecord {
}
@imagedestroy($main_image);
@imagedestroy($thumb_image);
- \WT\Log::addMediaLog('Thumbnail created for ' . $main_file);
+ Log::addMediaLog('Thumbnail created for ' . $main_file);
} else {
- \WT\Log::addMediaLog('Failed to create thumbnail for ' . $main_file);
+ Log::addMediaLog('Failed to create thumbnail for ' . $main_file);
}
} else {
- \WT\Log::addMediaLog('Not enough memory to create thumbnail for ' . $main_file);
+ Log::addMediaLog('Not enough memory to create thumbnail for ' . $main_file);
}
}
}
@@ -331,7 +333,7 @@ class WT_Media extends WT_GedcomRecord {
if ($this->fileExists($which)) {
// alert the admin if we cannot determine the mime type of an existing file
// as the media firewall will be unable to serve this file properly
- \WT\Log::addMediaLog('Media Firewall error: >Unknown Mimetype< for file >' . $this->file . '<');
+ Log::addMediaLog('Media Firewall error: >Unknown Mimetype< for file >' . $this->file . '<');
}
} else {
$imgsize['mime']=$mime[$imgsize['ext']];
diff --git a/library/WT/MenuBar.php b/library/WT/MenuBar.php
index 8296721b37..08029686b5 100644
--- a/library/WT/MenuBar.php
+++ b/library/WT/MenuBar.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
class WT_MenuBar {
public static function getGedcomMenu() {
$menu = new WT_Menu(WT_I18N::translate('Home page'), 'index.php?ctype=gedcom&amp;ged='.WT_GEDURL, 'menu-tree');
@@ -44,7 +46,7 @@ class WT_MenuBar {
$showFull = ($PEDIGREE_FULL_DETAILS) ? 1 : 0;
$showLayout = ($PEDIGREE_LAYOUT) ? 1 : 0;
- if (!\WT\Auth::id()) {
+ if (!Auth::id()) {
return null;
}
@@ -55,7 +57,7 @@ class WT_MenuBar {
$submenu = new WT_Menu(WT_I18N::translate('My page'), 'index.php?ctype=user&amp;ged='.WT_GEDURL, 'menu-mypage');
$menu->addSubmenu($submenu);
//-- editaccount submenu
- if (\WT\Auth::user()->getSetting('editaccount')) {
+ if (Auth::user()->getSetting('editaccount')) {
$submenu = new WT_Menu(WT_I18N::translate('My account'), 'edituser.php', 'menu-myaccount');
$menu->addSubmenu($submenu);
}
diff --git a/library/WT/Module.php b/library/WT/Module.php
index a9cdaff752..255f6088f7 100644
--- a/library/WT/Module.php
+++ b/library/WT/Module.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
abstract class WT_Module {
private $_title = null;
@@ -117,7 +119,7 @@ abstract class WT_Module {
$modules[$module_name]=new $class();
} else {
// Module has been deleted from disk? Disable it.
- \WT\Log::addConfigurationLog("Module {$module_name} has been deleted from disk - disabling it");
+ Log::addConfigurationLog("Module {$module_name} has been deleted from disk - disabling it");
WT_DB::prepare(
"UPDATE `##module` SET status='disabled' WHERE module_name=?"
)->execute(array($module_name));
@@ -147,7 +149,7 @@ abstract class WT_Module {
$array[$module_name]=new $class();
} else {
// Module has been deleted from disk? Disable it.
- \WT\Log::addConfigurationLog("Module {$module_name} has been deleted from disk - disabling it");
+ Log::addConfigurationLog("Module {$module_name} has been deleted from disk - disabling it");
WT_DB::prepare(
"UPDATE `##module` SET status='disabled' WHERE module_name=?"
)->execute(array($module_name));
diff --git a/library/WT/Report/PDF.php b/library/WT/Report/PDF.php
index 2c48befd6c..8ed832a9f7 100644
--- a/library/WT/Report/PDF.php
+++ b/library/WT/Report/PDF.php
@@ -22,6 +22,7 @@
// 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
+use WT\Auth;
/**
* Main WT Report Class for PDF
@@ -86,7 +87,7 @@ class WT_Report_PDF extends WT_Report_Base {
// Set the document information
// Only admin should see the version number
$appversion = WT_WEBTREES;
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
$appversion .= " ".WT_VERSION;
}
$this->pdf->SetCreator($appversion . " (" . parent::wt_url . ")");
diff --git a/library/WT/Site.php b/library/WT/Site.php
index 4c9cb76259..a1731da09a 100644
--- a/library/WT/Site.php
+++ b/library/WT/Site.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
class WT_Site {
static $setting=null;
@@ -42,7 +44,7 @@ class WT_Site {
// If parameter two is specified, then SET the setting
if (self::preference($setting_name)!=$setting_value) {
// Audit log of changes
- \WT\Log::addConfigurationLog('Site setting "' . $setting_name . '" set to "' . $setting_value . '"');
+ Log::addConfigurationLog('Site setting "' . $setting_name . '" set to "' . $setting_value . '"');
}
WT_DB::prepare(
"REPLACE INTO `##site_setting` (setting_name, setting_value) VALUES (?, LEFT(?, 255))"
diff --git a/library/WT/Stats.php b/library/WT/Stats.php
index 0611e94c66..968740d568 100644
--- a/library/WT/Stats.php
+++ b/library/WT/Stats.php
@@ -26,6 +26,8 @@
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
use Rhumsaa\Uuid\Uuid;
+use WT\Auth;
+use WT\User;
class WT_Stats {
private $_gedcom;
@@ -657,19 +659,19 @@ class WT_Stats {
static function totalUsers($params=null) {
if (!empty($params[0])) {
- $total = count(\WT\User::all()) + (int)$params[0];
+ $total = count(User::all()) + (int)$params[0];
} else {
- $total = count(\WT\User::all());
+ $total = count(User::all());
}
return WT_I18N::number($total);
}
static function totalAdmins() {
- return WT_I18N::number(count(\WT\User::allAdmins()));
+ return WT_I18N::number(count(User::allAdmins()));
}
static function totalNonAdmins() {
- return WT_I18N::number(count(\WT\User::all()) - count(\WT\User::allAdmins()));
+ return WT_I18N::number(count(User::all()) - count(User::allAdmins()));
}
function _totalMediaType($type='all') {
@@ -3401,8 +3403,8 @@ class WT_Stats {
// List active users
$NumAnonymous = 0;
$loggedusers = array ();
- foreach (\WT\User::allLoggedIn() as $user) {
- if (\WT\Auth::isAdmin() || $user->getSetting('visibleonline')) {
+ foreach (User::allLoggedIn() as $user) {
+ if (Auth::isAdmin() || $user->getSetting('visibleonline')) {
$loggedusers[] = $user;
} else {
$NumAnonymous++;
@@ -3430,7 +3432,7 @@ class WT_Stats {
$content .= ': ';
}
}
- if (\WT\Auth::check()) {
+ if (Auth::check()) {
foreach ($loggedusers as $user) {
if ($type == 'list') {
$content .= "<li>" . WT_Filter::escapeHtml($user->getRealName()) . ' - ' . WT_Filter::escapeHtml($user->getUserName());
@@ -3458,8 +3460,8 @@ class WT_Stats {
static function _usersLoggedInTotal($type='all') {
$anon = 0;
$visible = 0;
- foreach (\WT\User::allLoggedIn() as $user) {
- if (\WT\Auth::isAdmin() || $user->getSetting('visibleonline')) {
+ foreach (User::allLoggedIn() as $user) {
+ if (Auth::isAdmin() || $user->getSetting('visibleonline')) {
$visible++;
} else {
$anon++;
@@ -3482,13 +3484,13 @@ class WT_Stats {
static function usersLoggedInTotalVisible() { return self::_usersLoggedInTotal('visible'); }
static function userID() {
- return \WT\Auth::id();
+ return Auth::id();
}
static function userName($params = null) {
- if (\WT\Auth::check()) {
- return \WT\Auth::user()->getUserName();
+ if (Auth::check()) {
+ return Auth::user()->getUserName();
} elseif (is_array($params) && isset($params[0]) && $params[0] != '') {
# if #username:visitor# was specified, then "visitor" will be returned when the user is not logged in
return $params[0];
@@ -3497,7 +3499,7 @@ class WT_Stats {
}
}
static function userFullName() {
- return \WT\Auth::check() ? \WT\Auth::user()->getRealName() : '';
+ return Auth::check() ? Auth::user()->getRealName() : '';
}
static function _getLatestUserData($type = 'userid', $params = null) {
@@ -3505,9 +3507,9 @@ class WT_Stats {
static $user_id = null;
if ($user_id === null) {
- $user = \WT\User::findLatestToRegister();
+ $user = User::findLatestToRegister();
} else {
- $user = \WT\User::find($user_id);
+ $user = User::find($user_id);
}
switch($type) {
@@ -3602,8 +3604,8 @@ class WT_Stats {
$page_parameter='gedcom:'.get_id_from_gedcom($page_parameter ? $page_parameter : WT_GEDCOM);
} elseif ($page_name=='index.php') {
// index.php?ctype=user
- $user = \WT\User::findByIdentifier($page_parameter);
- $page_parameter='user:'.($user ? $user->getUserId() : \WT\Auth::id());
+ $user = User::findByIdentifier($page_parameter);
+ $page_parameter='user:'.($user ? $user->getUserId() : Auth::id());
} else {
// indi/fam/sour/etc.
}
diff --git a/library/WT/Tree.php b/library/WT/Tree.php
index b89b7d0945..2c2b253beb 100644
--- a/library/WT/Tree.php
+++ b/library/WT/Tree.php
@@ -18,6 +18,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+use WT\User;
+
class WT_Tree {
// Tree attributes
public $tree_id =null; // The "gedcom ID" number
@@ -73,7 +77,7 @@ class WT_Tree {
if ($this->preference($setting_name)!=$setting_value) {
$this->preference[$setting_name]=$setting_value;
// Audit log of changes
- \WT\Log::addConfigurationLog('Gedcom setting "' . $setting_name . '" set to "' . $setting_value . '"');
+ Log::addConfigurationLog('Gedcom setting "' . $setting_name . '" set to "' . $setting_value . '"');
}
WT_DB::prepare(
"REPLACE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value) VALUES (?, ?, LEFT(?, 255))"
@@ -103,7 +107,7 @@ class WT_Tree {
// If parameter two is specified, then SET the setting.
if ($this->preference($setting_name)!=$setting_value) {
// Audit log of changes
- \WT\Log::addConfigurationLog('Gedcom setting "'.$setting_name.'" set to "'.$setting_value.'"');
+ Log::addConfigurationLog('Gedcom setting "'.$setting_name.'" set to "'.$setting_value.'"');
}
WT_DB::prepare(
"REPLACE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value) VALUES (?, ?, ?, LEFT(?, 255))"
@@ -113,8 +117,8 @@ class WT_Tree {
}
// Can a user accept changes for this tree?
- public function canAcceptChanges(\WT\User $user) {
- return \WT\Auth::isModerator($this, $user);
+ public function canAcceptChanges(User $user) {
+ return Auth::isModerator($this, $user);
}
// Fetch all the trees that we have permission to access.
diff --git a/login.php b/login.php
index 556150c72e..046824568c 100644
--- a/login.php
+++ b/login.php
@@ -25,6 +25,9 @@ define('WT_SCRIPT_NAME', 'login.php');
require './includes/session.php';
require WT_ROOT.'includes/functions/functions_edit.php';
use Rhumsaa\Uuid\Uuid;
+use WT\Auth;
+use WT\Log;
+use WT\User;
// If we are already logged in, then go to the “Home page”
if (WT_USER_ID && WT_GED_ID) {
@@ -62,38 +65,38 @@ switch ($action) {
case 'login':
try {
if (!$_COOKIE) {
- \WT\Log::addAuthenticationLog('Login failed (no session cookies): ' . $username);
+ Log::addAuthenticationLog('Login failed (no session cookies): ' . $username);
throw new Exception(WT_I18N::translate('You cannot login because your browser does not accept cookies.'));
}
- $user = \WT\User::findByIdentifier($username);
+ $user = User::findByIdentifier($username);
if (!$user) {
- \WT\Log::addAuthenticationLog('Login failed (no such user/email): ' . $username);
+ Log::addAuthenticationLog('Login failed (no such user/email): ' . $username);
throw new Exception(WT_I18N::translate('The username or password is incorrect.'));
}
if (!$user->checkPassword($password)) {
- \WT\Log::addAuthenticationLog('Login failed (incorrect password): ' . $username);
+ Log::addAuthenticationLog('Login failed (incorrect password): ' . $username);
throw new Exception(WT_I18N::translate('The username or password is incorrect.'));
}
if (!$user->getSetting('verified')) {
- \WT\Log::addAuthenticationLog('Login failed (not verified by user): ' . $username);
+ Log::addAuthenticationLog('Login failed (not verified by user): ' . $username);
throw new Exception(WT_I18N::translate('This account has not been verified. Please check your email for a verification message.'));
}
if (!$user->getSetting('verified_by_admin')) {
- \WT\Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username);
+ Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username);
throw new Exception(WT_I18N::translate('This account has not been approved. Please wait for an administrator to approve it.'));
}
- \WT\Auth::login($user);
- \WT\Log::addAuthenticationLog('Login: ' . \WT\Auth::user()->getUserName() . '/' . \WT\Auth::user()->getRealName());
+ Auth::login($user);
+ Log::addAuthenticationLog('Login: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName());
$WT_SESSION->timediff = $timediff;
- $WT_SESSION->locale = \WT\Auth::user()->getSetting('language');
- $WT_SESSION->theme_dir = \WT\Auth::user()->getSetting('theme');
+ $WT_SESSION->locale = Auth::user()->getSetting('language');
+ $WT_SESSION->theme_dir = Auth::user()->getSetting('theme');
// If we’ve clicked login from the login page, we don’t want to go back there.
if (strpos($url, WT_SCRIPT_NAME) === 0) {
@@ -101,7 +104,7 @@ case 'login':
}
// We're logging in as an administrator
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
// Check for updates
$latest_version_txt = fetch_latest_version();
if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
@@ -219,7 +222,7 @@ case 'requestpw':
echo '<div id="login-page">';
$user_name = WT_Filter::post('new_passwd_username', WT_REGEX_USERNAME);
- $user = \WT\User::findByIdentifier($user_name);
+ $user = User::findByIdentifier($user_name);
if ($user) {
$passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$user_new_pw = '';
@@ -230,7 +233,7 @@ case 'requestpw':
}
$user->setPassword($user_new_pw);
- \WT\Log::addAuthenticationLog('Password request was sent to user: ' . $user->getUserName());
+ Log::addAuthenticationLog('Password request was sent to user: ' . $user->getUserName());
WT_Mail::system_message(
$WT_TREE,
@@ -267,22 +270,22 @@ case 'register':
if ($WT_SESSION->good_to_send && $user_name && $user_password01 && $user_password01==$user_password02 && $user_realname && $user_email && $user_comments) {
// These validation errors cannot be shown in the client.
- if (\WT\User::findByIdentifier($user_name)) {
+ if (User::findByIdentifier($user_name)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
- } elseif (\WT\User::findByIdentifier($user_email)) {
+ } elseif (User::findByIdentifier($user_email)) {
WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.'));
} elseif (preg_match('/(?!'.preg_quote(WT_SERVER_NAME, '/').')(((?:ftp|http|https):\/\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) {
WT_FlashMessages::addMessage(
WT_I18N::translate('You are not allowed to send messages that contain external links.') . ' ' .
WT_I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1])
);
- \WT\Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"');
+ Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"');
} else {
// Everything looks good - create the user
$controller->pageHeader();
- \WT\Log::addAuthenticationLog('User registration requested for: ' . $user_name);
+ Log::addAuthenticationLog('User registration requested for: ' . $user_name);
- $user = \WT\User::create($user_name, $user_realname, $user_email, $user_password01);
+ $user = User::create($user_name, $user_realname, $user_email, $user_password01);
$user
->setSetting('language', WT_LOCALE)
->setSetting('verified', 0)
@@ -298,7 +301,7 @@ case 'register':
->setSetting('sessiontime', 0);
// Generate an email in the admin’s language
- $webmaster = \WT\User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
+ $webmaster = User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
WT_I18N::init($webmaster->getSetting('language'));
$mail1_body =
@@ -452,7 +455,7 @@ case 'userverify':
}
// Change to the new user’s language
- $user = \WT\User::findByIdentifier($user_name);
+ $user = User::findByIdentifier($user_name);
WT_I18N::init($user->getSetting('language'));
@@ -489,10 +492,10 @@ case 'verify_hash':
}
// switch language to webmaster settings
- $webmaster = \WT\User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
+ $webmaster = User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
WT_I18N::init($webmaster->getSetting('language'));
- $user = \WT\User::findByIdentifier($user_name);
+ $user = User::findByIdentifier($user_name);
$mail1_body =
WT_I18N::translate('Hello administrator…') . WT_Mail::EOL . WT_Mail::EOL .
/* I18N: %1$s is a real-name, %2$s is a username, %3$s is an email address */
@@ -555,7 +558,7 @@ case 'verify_hash':
if (!$REQUIRE_ADMIN_AUTH_REGISTRATION) {
set_user_setting($user_id, 'verified_by_admin', 1);
}
- \WT\Log::addAuthenticationLog('User ' . $user_name . ' verified their email address');
+ Log::addAuthenticationLog('User ' . $user_name . ' verified their email address');
echo '<br><br>'.WT_I18N::translate('You have confirmed your request to become a registered user.').'<br><br>';
if ($REQUIRE_ADMIN_AUTH_REGISTRATION && !$user->getSetting('verified_by_admin')) {
@@ -565,7 +568,7 @@ case 'verify_hash':
}
echo '<br><br>';
} else {
- \WT\Log::addAuthenticationLog('User ' . $user_name . ' failed to verify their email address');
+ Log::addAuthenticationLog('User ' . $user_name . ' failed to verify their email address');
echo '<br><br>';
echo '<span class="warning">';
echo WT_I18N::translate('Data was not correct, please try again');
diff --git a/logout.php b/logout.php
index 36f19007bd..dae4c4d8ee 100644
--- a/logout.php
+++ b/logout.php
@@ -18,12 +18,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
define('WT_SCRIPT_NAME', 'logout.php');
require './includes/session.php';
-if (\WT\Auth::id()) {
- \WT\Log::addAuthenticationLog('Logout: ' . \WT\Auth::user()->getUserName() . '/' . \WT\Auth::user()->getRealName());
- \WT\Auth::logout();
+if (Auth::id()) {
+ Log::addAuthenticationLog('Logout: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName());
+ Auth::logout();
}
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); \ No newline at end of file
diff --git a/mediafirewall.php b/mediafirewall.php
index ef58172101..ce079ccb3b 100755
--- a/mediafirewall.php
+++ b/mediafirewall.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Log;
+
define('WT_SCRIPT_NAME', 'mediafirewall.php');
require './includes/session.php';
@@ -201,7 +203,7 @@ function textlength($t, $mxl, $text) {
function imagettftextErrorHandler($errno, $errstr, $errfile, $errline) {
global $useTTF, $serverFilename;
// log the error
- \WT\Log::addErrorLog("Media Firewall error: >" . $errstr . "< in file >" . $serverFilename . "<");
+ Log::addErrorLog("Media Firewall error: >" . $errstr . "< in file >" . $serverFilename . "<");
// change value of useTTF to false so the fallback watermarking can be used.
$useTTF = false;
@@ -361,7 +363,7 @@ if ($generatewatermark) {
} else {
// this image is defective. log it
- \WT\Log::addMediaLog("Media Firewall error: >" . WT_I18N::translate('This media file is broken and cannot be watermarked') . "< in file >" . $serverFilename . "< memory used: " . memory_get_usage());
+ Log::addMediaLog("Media Firewall error: >" . WT_I18N::translate('This media file is broken and cannot be watermarked') . "< in file >" . $serverFilename . "< memory used: " . memory_get_usage());
// set usewatermark to false so image will simply be passed through below
$usewatermark = false;
diff --git a/message.php b/message.php
index ed4af29716..654094b0d6 100755
--- a/message.php
+++ b/message.php
@@ -21,6 +21,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'message.php');
require './includes/session.php';
@@ -39,10 +43,10 @@ $url = WT_Filter::postUrl('url', WT_Filter::getUrl('url'));
$controller=new WT_Controller_Simple();
$controller->setPageTitle(WT_I18N::translate('webtrees message'));
-$to_user = \WT\User::findByIdentifier($to);
+$to_user = User::findByIdentifier($to);
// Only admins can send broadcast messages
-if ((!$to_user || $to=='all' || $to=='last_6mo' || $to=='never_logged') && !\WT\Auth::isAdmin()) {
+if ((!$to_user || $to=='all' || $to=='last_6mo' || $to=='never_logged') && !Auth::isAdmin()) {
// TODO, what if we have a user called "all" or "last_6mo" or "never_logged" ???
WT_FlashMessages::addMessage(WT_I18N::translate('Message was not sent'));
$controller->pageHeader();
@@ -67,7 +71,7 @@ if (WT_USER_ID) {
$errors.=
'<p class="ui-state-error">'.WT_I18N::translate('You are not allowed to send messages that contain external links.').'</p>'.
'<p class="ui-state-highlight">'./* I18N: e.g. ‘You should delete the “http://” from “http://www.example.com” and try again.’ */ WT_I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1]).'</p>'.
- \WT\Log::addAuthenticationLog('Possible spam message from "'.$from_name.'"/"'.$from_email.'", subject="'.$subject.'", body="'.$body.'"');
+ Log::addAuthenticationLog('Possible spam message from "'.$from_name.'"/"'.$from_email.'", subject="'.$subject.'", body="'.$body.'"');
$action='compose';
}
$from=$from_email;
@@ -82,7 +86,7 @@ case 'compose':
case 'send':
// Only send messages if we've come straight from the compose page.
if (!$WT_SESSION->good_to_send) {
- \WT\Log::addAuthenticationLog('Attempt to send message without visiting the compose page. Spam attack?');
+ Log::addAuthenticationLog('Attempt to send message without visiting the compose page. Spam attack?');
$action='compose';
}
if (!WT_Filter::checkCsrf()) {
@@ -157,13 +161,13 @@ case 'send':
$toarray = array($to);
if ($to == 'all') {
$toarray = array();
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
$toarray[$user->getUserId()] = $user->getUserName();
}
}
if ($to == 'never_logged') {
$toarray = array();
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getSetting('verified_by_admin') && $user->getSetting('reg_timestamp') > $user->getSetting('sessiontime')) {
$toarray[$user->getUserId()] = $user->getUserName();
}
@@ -172,7 +176,7 @@ case 'send':
if ($to == 'last_6mo') {
$toarray = array();
$sixmos = 60*60*24*30*6; //-- timestamp for six months
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getSetting('sessiontime')>0 && (WT_TIMESTAMP - $user->getSetting('sessiontime') > $sixmos)) {
$toarray[$user->getUserId()] = $user->getUserName();
} elseif (!$user->getSetting('verified_by_admin') && (WT_TIMESTAMP - $user->getSetting('reg_timestamp') > $sixmos)) {
@@ -200,7 +204,7 @@ case 'send':
WT_FlashMessages::addMessage(WT_I18N::translate('Message successfully sent to %s', WT_Filter::escapeHtml($to)));
} else {
WT_FlashMessages::addMessage(WT_I18N::translate('Message was not sent'));
- \WT\Log::addErrorLog('Unable to send message. FROM:'.$from.' TO:'.$to.' (failed to send)');
+ Log::addErrorLog('Unable to send message. FROM:'.$from.' TO:'.$to.' (failed to send)');
}
$i++;
}
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
index 7d9545b1a2..6c55777102 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
@@ -26,6 +26,8 @@
// GEDFact Media assistant replacement code for inverselink.php: ===========================
//-- extra page parameters and checking
+use WT\Auth;
+
$more_links = WT_Filter::get('more_links');
$exist_links = WT_Filter::get('exist_links');
$gid = WT_Filter::get('gid', WT_REGEX_XREF);
@@ -572,7 +574,7 @@ function shiftlinks() {
</tr>
<?php
// Admin Option CHAN log update override =======================
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo "<tr><td class=\"descriptionbox wrap width25\">";
echo WT_Gedcom_Tag::getLabel('CHAN'), "</td><td class=\"optionbox wrap\">";
if ($NO_UPDATE_CHAN) {
diff --git a/modules_v3/batch_update/admin_batch_update.php b/modules_v3/batch_update/admin_batch_update.php
index e7abf1f5f4..006eca6ccd 100644
--- a/modules_v3/batch_update/admin_batch_update.php
+++ b/modules_v3/batch_update/admin_batch_update.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -71,7 +73,7 @@ class batch_update {
}
$html.='</td></tr>';
- if (!\WT\Auth::user()->getSetting('auto_accept'))
+ if (!Auth::user()->getSetting('auto_accept'))
$html.='<tr><td colspan="2" class="warning">'.WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.').'</td></tr>';
// If a plugin is selected, display the details
@@ -345,7 +347,7 @@ class base_plugin {
// Default buttons are update and update_all
function getActionButtons($xref) {
- if (\WT\Auth::user()->getSetting('auto_accept')) {
+ if (Auth::user()->getSetting('auto_accept')) {
return array(
batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'),
batch_update::createSubmitButton(WT_I18N::translate('Update all'), $xref, 'update_all')
diff --git a/modules_v3/batch_update/module.php b/modules_v3/batch_update/module.php
index d4d4f7c02d..b4427b73cc 100644
--- a/modules_v3/batch_update/module.php
+++ b/modules_v3/batch_update/module.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -41,7 +43,7 @@ class batch_update_WT_Module extends WT_Module implements WT_Module_Config{
$controller=new WT_Controller_Page();
$controller
->setPageTitle(WT_I18N::translate('Batch update'))
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->pageHeader();
// TODO: these files should be methods in this class
diff --git a/modules_v3/clippings/clippings_ctrl.php b/modules_v3/clippings/clippings_ctrl.php
index 36e918c82d..761f63ec03 100644
--- a/modules_v3/clippings/clippings_ctrl.php
+++ b/modules_v3/clippings/clippings_ctrl.php
@@ -23,6 +23,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\User;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -248,7 +250,7 @@ class WT_Controller_Clippings {
}
$filetext .= "0 @WEBTREES@ SOUR\n1 TITL ".WT_SERVER_NAME.WT_SCRIPT_PATH."\n";
if ($user_id = get_gedcom_setting(WT_GED_ID, 'CONTACT_EMAIL')) {
- $user = \WT\User::find($user_id);
+ $user = User::find($user_id);
$filetext .= "1 AUTH " . $user->getRealName() . "\n";
}
$filetext .= "0 TRLR\n";
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index 4dad7d5f3a..7c39e1b08a 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -21,6 +21,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\Log;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -155,7 +158,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<table width="100%" border="0" class="facts_table">';
echo '<tr><td valign="top">';
echo '<div id="map_pane" style="border: 1px solid gray; color: black; width: 100%; height: ', $this->getSetting('GM_YSIZE'), 'px"></div>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<table width="100%"><tr>';
echo '<td width="40%" align="left">';
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>';
@@ -201,7 +204,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$html='<table class="facts_table">';
$html.='<tr><td colspan="2" class="facts_value">'.WT_I18N::translate('No map data for this person');
$html.='</td></tr>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
$html.='<tr><td class="center" colspan="2">';
$html.='<a href="module.php?mod=googlemap&amp;mod_action=admin_config">'.WT_I18N::translate('Google Maps™ preferences'). '</a>';
$html.='</td></tr>';
@@ -214,7 +217,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
public function hasTabContent() {
global $SEARCH_SPIDER;
- return !$SEARCH_SPIDER && (array_key_exists('googlemap', WT_Module::getActiveModules()) || \WT\Auth::isAdmin());
+ return !$SEARCH_SPIDER && (array_key_exists('googlemap', WT_Module::getActiveModules()) || Auth::isAdmin());
}
// Implement WT_Module_Tab
@@ -229,7 +232,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Google Maps™'))
->pageHeader()
->addInlineJavascript('jQuery("#tabs").tabs();');
@@ -259,7 +262,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$this->setSetting('GM_POSTFIX_' . $i, WT_Filter::post('NEW_GM_POSTFIX_' . $i));
}
- \WT\Log::addConfigurationLog('Googlemap config updated');
+ Log::addConfigurationLog('Googlemap config updated');
}
// TODO There are functions in functions_edit.php to edit these...
@@ -821,7 +824,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<td valign="top">';
echo '<div id="pm_map" style="border: 1px solid gray; height: ', $this->getSetting('GM_YSIZE'), 'px; font-size: 0.9em;';
echo '"><i class="icon-loading-large"></i></div>';
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo '<table width="100%">';
echo '<tr><td align="left">';
echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>';
@@ -1473,7 +1476,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Google Maps™'))
->pageHeader();
@@ -2502,7 +2505,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$plzoom = $latlng['pl_zoom']; // Map zoom level
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
$placecheck_url = 'module.php?mod=googlemap&amp;mod_action=admin_placecheck';
if ($parent && isset($parent[0]) ) {
$placecheck_url .= '&amp;country='.$parent[0];
@@ -2590,7 +2593,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
/* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation')."<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='".$sv_pitch."'>".
WT_I18N::translate('Zoom')."<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='".$sv_zoom."'>
");
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">";
} else {
echo "<table align=\"center\" style=\"display:none; \">";
@@ -2700,7 +2703,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$this->print_how_many_people($level+1, $parent);
}
echo '<br>', WT_I18N::translate('This place has no coordinates');
- if (\WT\Auth::isAdmin())
+ if (Auth::isAdmin())
echo "<br><a href='module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent=", $levelm, "&amp;display=inactive'>", WT_I18N::translate('Geographic data'), "</a>";
echo "</div>\", icon_type, \"", str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n";
} else {
@@ -3106,7 +3109,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$controller=new WT_Controller_Simple();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Geographic data'))
->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");')
->pageHeader();
@@ -3115,7 +3118,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$level=count($where_am_i);
$link = 'module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent='.$placeid;
- if ($action=='addrecord' && \WT\Auth::isAdmin()) {
+ if ($action=='addrecord' && Auth::isAdmin()) {
$statement=
WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
@@ -3133,7 +3136,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
exit;
}
- if ($action=='updaterecord' && \WT\Auth::isAdmin()) {
+ if ($action=='updaterecord' && Auth::isAdmin()) {
$statement=
WT_DB::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
@@ -3153,7 +3156,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// Update placelocation STREETVIEW fields
// TODO: This ought to be a POST request, rather than a GET request
- if ($action == 'update_sv_params' && \WT\Auth::isAdmin()) {
+ if ($action == 'update_sv_params' && Auth::isAdmin()) {
WT_DB::prepare(
"UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?"
)->execute(array(
@@ -3932,9 +3935,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if (!isset($inactive)) $inactive=false;
$controller=new WT_Controller_Page();
- $controller->restrictAccess(\WT\Auth::isAdmin());
+ $controller->restrictAccess(Auth::isAdmin());
- if ($action=='ExportFile' && \WT\Auth::isAdmin()) {
+ if ($action=='ExportFile' && Auth::isAdmin()) {
Zend_Session::writeClose();
$tmp = $this->place_id_to_hierarchy($parent);
$maxLevel = $this->getHighestLevel();
diff --git a/modules_v3/lightbox/module.php b/modules_v3/lightbox/module.php
index 7ee4e64b5b..aa2f614ae8 100644
--- a/modules_v3/lightbox/module.php
+++ b/modules_v3/lightbox/module.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -142,7 +144,7 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Tab {
$submenu->addOnclick("return window.open('addmedia.php?action=editmedia&amp;pid=".$media->getXref()."', '_blank', edit_window_specs);");
$submenu->addClass("submenuitem");
$menu->addSubMenu($submenu);
- if (\WT\Auth::isAdmin()) {
+ if (Auth::isAdmin()) {
// Manage Links
if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Manage links'));
diff --git a/modules_v3/review_changes/module.php b/modules_v3/review_changes/module.php
index c1a9b20a27..49554a4672 100644
--- a/modules_v3/review_changes/module.php
+++ b/modules_v3/review_changes/module.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\User;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -63,7 +65,7 @@ class review_changes_WT_Module extends WT_Module implements WT_Module_Block {
// There are pending changes - tell moderators/managers/administrators about them.
if (WT_TIMESTAMP - WT_Site::preference('LAST_CHANGE_EMAIL') > (60*60*24*$days)) {
// Which users have pending changes?
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getSetting('contactmethod') !== 'none') {
foreach (WT_Tree::getAll() as $tree) {
if (exists_pending_change($user, $tree)) {
diff --git a/modules_v3/sitemap/module.php b/modules_v3/sitemap/module.php
index 5c9378fef4..b33001677b 100644
--- a/modules_v3/sitemap/module.php
+++ b/modules_v3/sitemap/module.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -217,7 +219,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
private function admin() {
$controller=new WT_Controller_Page();
$controller
- ->restrictAccess(\WT\Auth::isAdmin())
+ ->restrictAccess(Auth::isAdmin())
->setPageTitle($this->getTitle())
->pageHeader();
diff --git a/modules_v3/user_messages/module.php b/modules_v3/user_messages/module.php
index 32ee41aa94..1cd9edaf44 100644
--- a/modules_v3/user_messages/module.php
+++ b/modules_v3/user_messages/module.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\User;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -65,10 +67,10 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
$class=$this->getName().'_block';
$title=WT_I18N::plural('%s message', '%s messages',count($messages), WT_I18N::number(count($messages)));
$content='<form name="messageform" action="index.php?ctype='.$ctype.'" method="get" onsubmit="return confirm(\''.WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.').'\');">';
- if (count(\WT\User::all()) > 1) {
+ if (count(User::all()) > 1) {
$content.='<br>'.WT_I18N::translate('Send message')." <select name=\"touser\">";
$content.='<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
- foreach (\WT\User::all() as $user) {
+ foreach (User::all() as $user) {
if ($user->getUserId() != WT_USER_ID && $user->getSetting('verified_by_admin') && $user->getSetting('contactmethod') != 'none') {
$content.='<option value="' . WT_Filter::escapeHtml($user->getUserName()) . '">';
$content.='<span dir="auto">'.WT_Filter::escapeHtml($user->getRealName()).'</span> - <span dir="auto">' . WT_Filter::escapeHtml($user->getUserName()) . '</span>';
@@ -93,7 +95,7 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
$content.='<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message'.$message->message_id.'\');"><i id="message'.$message->message_id.'_img" class="icon-plus"></i> <b dir="auto">'.WT_Filter::escapeHtml($message->subject).'</b></a></td>';
$content.='<td class="list_value_wrap">'.format_timestamp($message->created).'</td>';
$content.='<td class="list_value_wrap">';
- $user = \WT\User::findByIdentifier($message->sender);
+ $user = User::findByIdentifier($message->sender);
if ($user) {
$content.='<span dir="auto">' . $user->getRealName() . '</span>';
$content.=' - <span dir="auto">' . $user->getEmail() . '</span>';
diff --git a/modules_v3/user_welcome/module.php b/modules_v3/user_welcome/module.php
index 954b9e4917..378e2e0406 100644
--- a/modules_v3/user_welcome/module.php
+++ b/modules_v3/user_welcome/module.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -41,9 +43,9 @@ class user_welcome_WT_Module extends WT_Module implements WT_Module_Block {
public function getBlock($block_id, $template=true, $cfg=null) {
$id=$this->getName().$block_id;
$class=$this->getName().'_block';
- $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ WT_I18N::translate('Welcome %s', \WT\Auth::user()->getRealName()) . '</span>';
+ $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>';
$content = '<table><tr>';
- if (\WT\Auth::user()->getSetting('editaccount')) {
+ if (Auth::user()->getSetting('editaccount')) {
$content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>'.WT_I18N::translate('My account').'</a></td>';
}
if (WT_USER_GEDCOM_ID) {
diff --git a/save.php b/save.php
index a5bcde19bf..97f2b3d7ca 100644
--- a/save.php
+++ b/save.php
@@ -18,6 +18,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+use WT\User;
+
define('WT_SCRIPT_NAME', 'save.php');
require './includes/session.php';
@@ -61,7 +64,7 @@ case 'site_setting':
//////////////////////////////////////////////////////////////////////////////
// Authorisation
- if (!\WT\Auth::isAdmin()) {
+ if (!Auth::isAdmin()) {
fail();
}
@@ -144,7 +147,7 @@ case 'site_access_rule':
// ID format: site_access_rule-{column_name}-{user_id}
//////////////////////////////////////////////////////////////////////////////
- if (!\WT\Auth::isAdmin()) {
+ if (!Auth::isAdmin()) {
fail();
}
switch ($id1) {
@@ -172,10 +175,10 @@ case 'user':
// ID format: user-{column_name}-{user_id}
//////////////////////////////////////////////////////////////////////////////
- $user = \WT\User::find($id2);
+ $user = User::find($id2);
// Authorisation
- if (!\WT\Auth::isAdmin() && WT::currentUser() != $user) {
+ if (!Auth::isAdmin() && WT::currentUser() != $user) {
fail();
}
@@ -216,7 +219,7 @@ case 'user_gedcom_setting':
case 'canedit':
case 'RELATIONSHIP_PATH_LENGTH':
$tree = WT_Tree::get($id2);
- if (\WT\Auth::isManager($tree)) {
+ if (Auth::isManager($tree)) {
$tree->userPreference($id1, $id3, $value);
ok();
break;
@@ -231,9 +234,9 @@ case 'user_setting':
// ID format: user_setting-{user_id}-{setting_name}
//////////////////////////////////////////////////////////////////////////////
- $user = \WT\User::find($id1);
+ $user = User::find($id1);
// Authorisation
- if (!(\WT\Auth::isAdmin() || $user && $user->getSetting('editaccount') && in_array($id2, array('language','visible_online','contact_method')))) {
+ if (!(Auth::isAdmin() || $user && $user->getSetting('editaccount') && in_array($id2, array('language','visible_online','contact_method')))) {
fail();
}
@@ -241,7 +244,7 @@ case 'user_setting':
switch ($id2) {
case 'canadmin':
// Cannot change our own admin status - either to add it or remove it
- if (\WT\Auth::user() == $user) {
+ if (Auth::user() == $user) {
fail();
}
break;
@@ -285,7 +288,7 @@ case 'module':
//////////////////////////////////////////////////////////////////////////////
// Authorisation
- if (!\WT\Auth::isAdmin()) {
+ if (!Auth::isAdmin()) {
fail();
}
diff --git a/themes/_administration/header.php b/themes/_administration/header.php
index 1876b66c41..b20c9eedb7 100644
--- a/themes/_administration/header.php
+++ b/themes/_administration/header.php
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -91,7 +93,7 @@ echo
'<div id="admin_menu" class="ui-widget-content">',
'<ul>',
'<li><a ', (WT_SCRIPT_NAME=='admin.php' ? 'class="current" ' : ''), 'href="admin.php">', WT_I18N::translate('Administration'), '</a></li>';
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
echo
'<li><ul>',
'<li><a ', (WT_SCRIPT_NAME=='admin_site_config.php' ? 'class="current" ' : ''), 'href="admin_site_config.php">', WT_I18N::translate('Site configuration' ), '</a></li>',
@@ -108,7 +110,7 @@ if (\WT\Auth::isAdmin()) {
echo '<li><ul>';
//-- gedcom list
foreach (WT_Tree::getAll() as $tree) {
- if (\WT\Auth::isManager($tree)) {
+ if (Auth::isManager($tree)) {
// Add a title="" element, since long tree titles are cropped
echo
'<li><span><a ', (WT_SCRIPT_NAME=='admin_trees_config.php' && WT_GED_ID==$tree->tree_id ? 'class="current" ' : ''), 'href="admin_trees_config.php?ged='.$tree->tree_name_url.'" title="', WT_Filter::escapeHtml($tree->tree_title), '" dir="auto">', $tree->tree_title_html,
@@ -124,7 +126,7 @@ echo
'<li><a href="index_edit.php?gedcom_id=-1" onclick="return modalDialog(\'index_edit.php?gedcom_id=-1'.'\', \'', WT_I18N::translate('Set the default blocks for new family trees'), '\');">', WT_I18N::translate('Set the default blocks'), '</a></li>',
'</ul></li>';
-if (\WT\Auth::isAdmin()) {
+if (Auth::isAdmin()) {
echo
'<li><a ', (WT_SCRIPT_NAME=='admin_users.php' && WT_Filter::get('action')!="cleanup"&& WT_Filter::get('action')!="createform" ? 'class="current" ' : ''), 'href="admin_users.php">',
WT_I18N::translate('Users'),
diff --git a/themes/clouds/header.php b/themes/clouds/header.php
index e415206d4c..8ff4508d16 100644
--- a/themes/clouds/header.php
+++ b/themes/clouds/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -109,7 +111,7 @@ if ($view!='simple') { // Use "simple" headers for popup windows
'<div id="menu-right">',
'<ul class="makeMenu">';
if (WT_USER_ID) {
- echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
+ echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
}
diff --git a/themes/colors/header.php b/themes/colors/header.php
index 9ecac4c1a3..362e6f0fee 100644
--- a/themes/colors/header.php
+++ b/themes/colors/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -80,7 +82,7 @@ if ($view!='simple') { // Use "simple" headers for popup windows
'<ul class="makeMenu">';
if (WT_USER_ID) {
- echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
+ echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\', \'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
}
diff --git a/themes/colors/theme.php b/themes/colors/theme.php
index 3590833eb1..0e932161cc 100644
--- a/themes/colors/theme.php
+++ b/themes/colors/theme.php
@@ -22,6 +22,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// PNG Icons By: Alessandro Rei; License: GPL; www.deviantdark.com
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -95,9 +97,9 @@ $COLOR_THEME_LIST=array(
if (isset($_GET['themecolor']) && array_key_exists($_GET['themecolor'], $COLOR_THEME_LIST)) {
// Request to change color
$subColor = $_GET['themecolor'];
- if (\WT\Auth::id()) {
- \WT\Auth::user()->setSetting('themecolor', $subColor);
- if (\WT\Auth::isAdmin()) {
+ if (Auth::id()) {
+ Auth::user()->setSetting('themecolor', $subColor);
+ if (Auth::isAdmin()) {
WT_Site::preference('DEFAULT_COLOR_PALETTE', $subColor);
}
}
@@ -107,8 +109,8 @@ if (isset($_GET['themecolor']) && array_key_exists($_GET['themecolor'], $COLOR_T
}
// If we are logged in, use our preference
$subColor = null;
-if (\WT\Auth::id()) {
- $subColor = \WT\Auth::user()->getSetting('themecolor');
+if (Auth::id()) {
+ $subColor = Auth::user()->getSetting('themecolor');
}
// If not logged in or no preference, use one we selected earlier in the session?
if (!$subColor) {
diff --git a/themes/fab/header.php b/themes/fab/header.php
index 8510fe2fd4..b5cd1842b2 100644
--- a/themes/fab/header.php
+++ b/themes/fab/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -63,7 +65,7 @@ if ($view!='simple') { // Use “simple” headers for popup windows
echo '<div id="header" class="block">';
echo '<div id="header-user-links"><ul class="makeMenu">';
if (WT_USER_ID) {
- echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
+ echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\',chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
}
diff --git a/themes/minimal/header.php b/themes/minimal/header.php
index 1ecb9ca069..54cc8c49b0 100644
--- a/themes/minimal/header.php
+++ b/themes/minimal/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -66,7 +68,7 @@ if ($view!='simple') {
echo '<div id="header-user-links">';
echo '<ul class="makeMenu">';
if (WT_USER_ID) {
- echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
+ echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\',chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
}
diff --git a/themes/webtrees/header.php b/themes/webtrees/header.php
index bf995a3698..3b4cb8249e 100644
--- a/themes/webtrees/header.php
+++ b/themes/webtrees/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -58,7 +60,7 @@ $this
<li>
<?php
if (WT_USER_ID) {
- echo '<a href="edituser.php">', WT_I18N::translate('Logged in as '), ' ', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li> <li>', logout_link();
+ echo '<a href="edituser.php">', WT_I18N::translate('Logged in as '), ' ', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link();
} else {
echo login_link();
}
diff --git a/themes/xenea/header.php b/themes/xenea/header.php
index 388703708a..a3d28a2715 100644
--- a/themes/xenea/header.php
+++ b/themes/xenea/header.php
@@ -21,6 +21,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Auth;
+
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
@@ -97,7 +99,7 @@ if ($view!='simple') { // Use "simple" headers for popup windows
'<div id="login-menu">',
'<ul class="makeMenu">';
if (WT_USER_ID) {
- echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(\WT\Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
+ echo '<li><a href="edituser.php">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link(), '</li>';
if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\', \'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
}