kopia lustrzana https://github.com/jprochazka/adsb-receiver
Account management page completed.
rodzic
d967d3146c
commit
aa5f30da1f
|
@ -1,166 +1,178 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ADS-B RECEIVER PORTAL //
|
// ADS-B RECEIVER PORTAL //
|
||||||
// =============================================================================== //
|
// =============================================================================== //
|
||||||
// Copyright and Licensing Information: //
|
// Copyright and Licensing Information: //
|
||||||
// //
|
// //
|
||||||
// The MIT License (MIT) //
|
// The MIT License (MIT) //
|
||||||
// //
|
// //
|
||||||
// Copyright (c) 2015-2016 Joseph A. Prochazka //
|
// Copyright (c) 2015-2016 Joseph A. Prochazka //
|
||||||
// //
|
// //
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy //
|
// Permission is hereby granted, free of charge, to any person obtaining a copy //
|
||||||
// of this software and associated documentation files (the "Software"), to deal //
|
// of this software and associated documentation files (the "Software"), to deal //
|
||||||
// in the Software without restriction, including without limitation the rights //
|
// in the Software without restriction, including without limitation the rights //
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //
|
||||||
// copies of the Software, and to permit persons to whom the Software is //
|
// copies of the Software, and to permit persons to whom the Software is //
|
||||||
// furnished to do so, subject to the following conditions: //
|
// furnished to do so, subject to the following conditions: //
|
||||||
// //
|
// //
|
||||||
// The above copyright notice and this permission notice shall be included in all //
|
// The above copyright notice and this permission notice shall be included in all //
|
||||||
// copies or substantial portions of the Software. //
|
// copies or substantial portions of the Software. //
|
||||||
// //
|
// //
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
|
||||||
// SOFTWARE. //
|
// SOFTWARE. //
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$passwordIncorrect = FALSE;
|
$passwordIncorrect = FALSE;
|
||||||
$didNotMatch = FALSE;
|
$didNotMatch = FALSE;
|
||||||
|
|
||||||
// Load the require PHP classes.
|
// Load the require PHP classes.
|
||||||
require_once('../classes/common.class.php');
|
require_once('../classes/common.class.php');
|
||||||
require_once('../classes/account.class.php');
|
require_once('../classes/account.class.php');
|
||||||
require_once('../classes/settings.class.php');
|
require_once('../classes/settings.class.php');
|
||||||
|
|
||||||
$common = new common();
|
$common = new common();
|
||||||
$account = new account();
|
$account = new account();
|
||||||
$settings = new settings();
|
$settings = new settings();
|
||||||
|
|
||||||
// Check if the user is logged in.
|
// Check if the user is logged in.
|
||||||
if (!$account->isAuthenticated()) {
|
if (!$account->isAuthenticated()) {
|
||||||
// The user is not logged in so forward them to the login page.
|
// The user is not logged in so forward them to the login page.
|
||||||
header ("Location: login.php?origin=".urlencode('account.php'));
|
header ("Location: login.php?origin=".urlencode('account.php'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($common->postBack()) {
|
// Set updated variable to FALSE.
|
||||||
// Check that a name was supplied.
|
$updated = FALSE;
|
||||||
if (empty($_POST['name']))
|
|
||||||
$noName = TRUE;
|
if ($common->postBack()) {
|
||||||
|
// Check that a name was supplied.
|
||||||
// Check that a vailid email address was supplied.
|
$nameSupplied = FALSE;
|
||||||
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
|
if (!empty($_POST['name']))
|
||||||
$invalidEmail = TRUE;
|
$nameSupplied = TRUE;
|
||||||
|
|
||||||
// Check the length of the password.
|
// Check that a vailid email address was supplied.
|
||||||
if (strlen($_POST['password1']) <= $settings::sec_length)
|
$validEmail = FALSE;
|
||||||
$tooShort = TRUE;
|
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
|
||||||
|
$validEmail = TRUE;
|
||||||
// Check that all password reset data was supplied.
|
|
||||||
if (!empty($_POST['password']) || !empty($_POST['password1']) || !empty($_POST['password2'])) {
|
// If the current password was supplied process a password change.
|
||||||
|
$passwordChanged = FALSE;
|
||||||
// Process a password change request if the existing and new password were supplied.
|
if (!empty($_POST['password'])) {
|
||||||
if (!empty($_POST['password1']) && !empty($_POST['password1']) && !empty($_POST['password2'])) {
|
// Check the length of the password.
|
||||||
|
$tooShort = TRUE;
|
||||||
// Check that the user supplied a password matching the one currently stored in administrators.xml.
|
if (isset($_POST['password1']) && strlen($_POST['password1']) >= $settings::sec_length)
|
||||||
$authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
|
$tooShort = FALSE;
|
||||||
if (!$authenticated)
|
|
||||||
$passwordIncorrect = TRUE;
|
// Check that the supplied new passwords match.
|
||||||
if ($_POST['password1'] != $_POST['password2'])
|
$notMatching = TRUE;
|
||||||
$notMatching = TRUE;
|
if ($_POST['password1'] == $_POST['password2'])
|
||||||
|
$notMatching = FALSE;
|
||||||
if ($authenticated && $_POST['password1'] == $_POST['password2']) {
|
|
||||||
// Change the password stored in administrators.xml related to this users login.
|
// Check that the supplied current password matches that which is stored.
|
||||||
$account->changePassword($_SESSION['login'], $_POST['password1']);
|
$authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
|
||||||
|
|
||||||
// Since the password has changed we will log the user out to clear older session variables.
|
// If everything associated with passwords is validated change the password.
|
||||||
$account->logout();
|
if (!$tooShort && !$notMatching && $authenticated) {
|
||||||
}
|
// Change the password stored in administrators.xml related to this users login.
|
||||||
}
|
$account->changePassword($_SESSION['login'], $_POST['password1']);
|
||||||
} else {
|
$passwordChanged = TRUE;
|
||||||
// Only partial data was supplied to change the current password.
|
|
||||||
if (!empty($_POST['password']))
|
}
|
||||||
$noCurrent = TRUE;
|
}
|
||||||
if (!empty($_POST['password1']) || !empty($_POST['password2']))
|
|
||||||
$passwordMissing = TRUE;
|
// If validation passed make the requested changes to the administrator account data.
|
||||||
}
|
if ($nameSupplied && $validEmail) {
|
||||||
|
$account->changeName($_SESSION['login'], $_POST['name']);
|
||||||
// If validation passed make the requested changes to the administrator account data.
|
$account->changeEmail($_SESSION['login'], $_POST['email']);
|
||||||
if (!$noName && !$invalidEmail && !$tooShort && !$passwordIncorrect && !$noCurrent && !$notMatching && !$passwordMissing) {
|
$updated = TRUE;
|
||||||
$account->changeName($_SESSION['login'], $_POST['name']);
|
}
|
||||||
$account->changeEmail($_SESSION['login'], $_POST['email']);
|
|
||||||
if (!empty($_POST['password1']) && !empty($_POST['password1']) && !empty($_POST['password2']))
|
// Since the password has changed we will log the user out to clear older session variables.
|
||||||
$account->changePassword($_SESSION['login'], $_POST['password1']);
|
if ($passwordChanged) {
|
||||||
}
|
$account->logout();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
require_once('includes/header.inc.php');
|
|
||||||
|
require_once('includes/header.inc.php');
|
||||||
/////////////////////
|
|
||||||
// BEGIN HTML BODY //
|
/////////////////////
|
||||||
|
// BEGIN HTML BODY //
|
||||||
?>
|
|
||||||
<h1>Account Management</h1>
|
// Display the updated message if settings were updated.
|
||||||
<hr />
|
if ($updated) {
|
||||||
<?php
|
?>
|
||||||
if ($passwordIncorrect || $didNotMatch) {
|
<div id="settings-saved" class="alert alert-success fade in" role="alert">
|
||||||
?>
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<div id="failure-alert" class="alert alert-danger" role="alert">
|
<span aria-hidden="true">×</span>
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
</button>
|
||||||
<span aria-hidden="true">×</span>
|
Changes to your account have been saved.
|
||||||
</button>
|
</div>
|
||||||
<?php ($noName ? print "You must supply a name to associate with this account.<br />" : ''); ?>
|
<?php
|
||||||
<?php ($invalidEmail ? print "You must supply a valid email address to associate with this account.<br />" : ''); ?>
|
}
|
||||||
<?php ($passwordIncorrect || $noCurrent ? print "You did not supply the correct current password for this account.<br />" : ''); ?>
|
?>
|
||||||
<?php ($tooShort ? print "Your password must be at least ".$settings::sec_length." characters long.<br />" : ''); ?>
|
<h1>Account Management</h1>
|
||||||
<?php ($notMatching || $passwordMissing ? print "The password and password confirmation did not match or are missing.<br />" : ''); ?>
|
<hr />
|
||||||
</div>
|
<?php
|
||||||
<?php
|
if ($passwordIncorrect || $didNotMatch) {
|
||||||
}
|
?>
|
||||||
?>
|
<div id="failure-alert" class="alert alert-danger" role="alert">
|
||||||
<form id="change-password" method="post" action="account.php">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
<div class="panel panel-default">
|
</button>
|
||||||
<div class="panel-heading">Account Settings</div>
|
<?php ($noName ? print "You must supply a name to associate with this account.<br />" : ''); ?>
|
||||||
<div class="panel-body">
|
<?php ($invalidEmail ? print "You must supply a valid email address to associate with this account.<br />" : ''); ?>
|
||||||
<div class="form-group">
|
<?php ($passwordIncorrect || $noCurrent ? print "You did not supply the correct current password for this account.<br />" : ''); ?>
|
||||||
<input type="text" class="form-control" name="login" id="login" placeholder="Login" value="<?php echo $_SESSION['login']; ?>" disabled>
|
<?php ($tooShort ? print "Your password must be at least ".$settings::sec_length." characters long.<br />" : ''); ?>
|
||||||
</div>
|
<?php ($notMatching || $passwordMissing ? print "The password and password confirmation did not match or are missing.<br />" : ''); ?>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<input type="text" class="form-control" name="name" id="name" placeholder="Name" value="<?php echo $account->getName($_SESSION['login']); ?>" required>
|
<?php
|
||||||
</div>
|
}
|
||||||
<div class="form-group">
|
?>
|
||||||
<input type="email" class="form-control" name="email" id="email" placeholder="Email Address" value="<?php echo $account->getEmail($_SESSION['login']); ?>" required>
|
<form id="account-form" method="post" action="account.php">
|
||||||
</div>
|
|
||||||
</div>
|
<div class="panel panel-default">
|
||||||
</div>
|
<div class="panel-heading">Account Settings</div>
|
||||||
|
<div class="panel-body">
|
||||||
<div class="panel panel-default">
|
<div class="form-group">
|
||||||
<div class="panel-heading">Change Password</div>
|
<input type="text" class="form-control" name="login" id="login" placeholder="Login" value="<?php echo $_SESSION['login']; ?>" disabled>
|
||||||
<div class="panel-body">
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="password" class="form-control" name="password" id="password" placeholder="Current Password" required>
|
<input type="text" class="form-control" name="name" id="name" placeholder="Name" value="<?php echo $account->getName($_SESSION['login']); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="password" class="form-control" name="password1" id="password1" placeholder="New Password" required>
|
<input type="email" class="form-control" name="email" id="email" placeholder="Email Address" value="<?php echo $account->getEmail($_SESSION['login']); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<input type="password" class="form-control" name="password2" id="password2" placeholder="Confirm Password" required>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
<div class="panel panel-default">
|
||||||
</div>
|
<div class="panel-heading">Change Password</div>
|
||||||
|
<div class="panel-body">
|
||||||
<input type="submit" class="btn btn-default" value="Submit">
|
<div class="form-group">
|
||||||
</form>
|
<input type="password" class="form-control" name="password" id="password" placeholder="Current Password">
|
||||||
<?php
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
// END HTML BODY //
|
<input type="password" class="form-control" name="password1" id="password1" placeholder="New Password" required>
|
||||||
///////////////////
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
require_once('includes/footer.inc.php');
|
<input type="password" class="form-control" name="password2" id="password2" placeholder="Confirm Password" required>
|
||||||
?>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="submit" class="btn btn-default" value="Submit">
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// END HTML BODY //
|
||||||
|
///////////////////
|
||||||
|
|
||||||
|
require_once('includes/footer.inc.php');
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#password1").prop('disabled', true);
|
||||||
|
$("#password2").prop('disabled', true);
|
||||||
|
|
||||||
|
// Enable/disable password fields if content is contained in the current password textbox.
|
||||||
|
$("#password").keyup(function () {
|
||||||
|
if ($("#password").val().length > 0) {
|
||||||
|
$("#password1").prop('disabled', false);
|
||||||
|
$("#password2").prop('disabled', false);
|
||||||
|
} else {
|
||||||
|
$("#password1").val("");
|
||||||
|
$("#password2").val("");
|
||||||
|
$("#password1").prop('disabled', true);
|
||||||
|
$("#password2").prop('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Form validation.
|
||||||
|
var form = $("#install-form");
|
||||||
|
form.validate().settings.ignore = ":disabled";
|
||||||
|
form.validate({
|
||||||
|
errorPlacement: function errorPlacement(error, element) { element.before(error); },
|
||||||
|
rules: {
|
||||||
|
password1: {
|
||||||
|
minlength: 6,
|
||||||
|
equalTo: "#password2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,53 +1,57 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ADS-B Receiver Administration</title>
|
<title>ADS-B Receiver Administration</title>
|
||||||
<meta http-equiv="cache-control" content="no-cache" />
|
<meta http-equiv="cache-control" content="no-cache" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/admin/assets/css/bootstrap.min.css">
|
<link rel="stylesheet" href="/admin/assets/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="/admin/assets/css/bootstrap-theme.min.css">
|
<link rel="stylesheet" href="/admin/assets/css/bootstrap-theme.min.css">
|
||||||
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
||||||
<link rel="stylesheet" href="/admin/assets/css/jquery.steps.css">
|
<link rel="stylesheet" href="/admin/assets/css/jquery.steps.css">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<link rel="stylesheet" href="/admin/assets/css/admin.css">
|
<link rel="stylesheet" href="/admin/assets/css/admin.css">
|
||||||
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
||||||
<link rel="stylesheet" href="/admin/assets/css/install.css">
|
<link rel="stylesheet" href="/admin/assets/css/install.css">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<script src="/admin/assets/js/jquery-2.2.1.min.js"></script>
|
<script src="/admin/assets/js/jquery-2.2.1.min.js"></script>
|
||||||
<script src="/admin/assets/js/bootstrap.min.js"></script>
|
<script src="/admin/assets/js/bootstrap.min.js"></script>
|
||||||
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
<?php if (basename($_SERVER['PHP_SELF']) == "install.php") { ?>
|
||||||
<script src="/admin/assets/js/jquery.steps.min.js"></script>
|
<script src="/admin/assets/js/jquery.steps.min.js"></script>
|
||||||
<script src="/admin/assets/js/js.cookie-2.1.0.min.js"></script>
|
<script src="/admin/assets/js/js.cookie-2.1.0.min.js"></script>
|
||||||
<script src="/admin/assets/js/jquery.validate.min.js"></script>
|
<script src="/admin/assets/js/jquery.validate.min.js"></script>
|
||||||
<script src="/admin/assets/js/install.js"></script>
|
<script src="/admin/assets/js/install.js"></script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (basename($_SERVER['PHP_SELF']) == "index.php") { ?>
|
<?php if (basename($_SERVER['PHP_SELF']) == "index.php") { ?>
|
||||||
<script src="/admin/assets/js/index.js"></script>
|
<script src="/admin/assets/js/index.js"></script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</head>
|
<?php if (basename($_SERVER['PHP_SELF']) == "account.php") { ?>
|
||||||
<body>
|
<script src="/admin/assets/js/jquery.validate.min.js"></script>
|
||||||
<div id="wrapper">
|
<script src="/admin/assets/js/account.js"></script>
|
||||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
<?php } ?>
|
||||||
<div class="container">
|
</head>
|
||||||
<div class="navbar-header">
|
<body>
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<div id="wrapper">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
<span class="icon-bar"></span>
|
<div class="container">
|
||||||
<span class="icon-bar"></span>
|
<div class="navbar-header">
|
||||||
<span class="icon-bar"></span>
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
</button>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<a class="navbar-brand" href="/admin">ADS-B Receiver Administration</a>
|
<span class="icon-bar"></span>
|
||||||
</div>
|
<span class="icon-bar"></span>
|
||||||
<div class="navbar-collapse collapse">
|
<span class="icon-bar"></span>
|
||||||
<ul class="nav navbar-nav">
|
</button>
|
||||||
<li id="logout-link"><a href="/admin">Settings</a></li>
|
<a class="navbar-brand" href="/admin">ADS-B Receiver Administration</a>
|
||||||
<li id="logout-link"><a href="/admin/blog">Blog</a></li>
|
</div>
|
||||||
<li id="logout-link"><a href="/admin/account.php">Account</a></li>
|
<div class="navbar-collapse collapse">
|
||||||
<li id="logout-link"><a href="/admin/logout.php">Logout</a></li>
|
<ul class="nav navbar-nav">
|
||||||
<li id="logout-link"><a href="/" target="_blank">Portal Home</a></li>
|
<li id="logout-link"><a href="/admin">Settings</a></li>
|
||||||
</ul>
|
<li id="logout-link"><a href="/admin/blog">Blog</a></li>
|
||||||
</div>
|
<li id="logout-link"><a href="/admin/account.php">Account</a></li>
|
||||||
</div>
|
<li id="logout-link"><a href="/admin/logout.php">Logout</a></li>
|
||||||
</nav>
|
<li id="logout-link"><a href="/" target="_blank">Portal Home</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
<div class="container">
|
<div class="container">
|
|
@ -127,6 +127,7 @@
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
function addAdministrator($name, $email, $login, $password) {
|
function addAdministrator($name, $email, $login, $password) {
|
||||||
|
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
|
||||||
$settings = new settings();
|
$settings = new settings();
|
||||||
|
|
||||||
if ($settings::db_driver == "xml") {
|
if ($settings::db_driver == "xml") {
|
||||||
|
@ -218,7 +219,9 @@
|
||||||
|
|
||||||
// Change the name associated to an existing administrator in the file administrators.xml.
|
// Change the name associated to an existing administrator in the file administrators.xml.
|
||||||
function changeName($login, $name) {
|
function changeName($login, $name) {
|
||||||
|
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
|
||||||
$settings = new settings();
|
$settings = new settings();
|
||||||
|
|
||||||
if ($settings::db_driver == "xml") {
|
if ($settings::db_driver == "xml") {
|
||||||
// XML
|
// XML
|
||||||
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
||||||
|
@ -242,7 +245,10 @@
|
||||||
|
|
||||||
// Change the name associated to an existing administrator in the file administrators.xml.
|
// Change the name associated to an existing administrator in the file administrators.xml.
|
||||||
function changeEmail($login, $email) {
|
function changeEmail($login, $email) {
|
||||||
if ($settings::db_driver == "xml") {
|
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
|
||||||
|
$settings = new settings();
|
||||||
|
|
||||||
|
if ($settings::db_driver == 'xml') {
|
||||||
// XML
|
// XML
|
||||||
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
||||||
foreach ($administrators->xpath("administrator[login='".$login."']") as $administrator) {
|
foreach ($administrators->xpath("administrator[login='".$login."']") as $administrator) {
|
||||||
|
@ -265,6 +271,9 @@
|
||||||
|
|
||||||
// Change a password stored for an existing administrator in the file administrators.xml.
|
// Change a password stored for an existing administrator in the file administrators.xml.
|
||||||
function changePassword($login, $password) {
|
function changePassword($login, $password) {
|
||||||
|
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
|
||||||
|
$settings = new settings();
|
||||||
|
|
||||||
if ($settings::db_driver == "xml") {
|
if ($settings::db_driver == "xml") {
|
||||||
// XML
|
// XML
|
||||||
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
$administrators = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."administrators.xml") or die("Error: Cannot create administrators object");
|
||||||
|
|
Ładowanie…
Reference in New Issue