LDAPAccountManager/lam/templates/config/mainlogin.php

188 lines
5.7 KiB
PHP
Raw Normal View History

2006-04-16 12:49:12 +00:00
<?php
/*
$Id$
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
2014-02-20 17:14:22 +00:00
Copyright (C) 2003 - 2014 Roland Gruber
2006-04-16 12:49:12 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Login page to change the main preferences.
*
* @package configuration
* @author Roland Gruber
*/
/** Access to config functions */
include_once('../../lib/config.inc');
/** Used to print status messages */
include_once('../../lib/status.inc');
// start session
2009-07-08 18:03:28 +00:00
if (strtolower(session_module_name()) == 'files') {
2010-02-06 11:50:26 +00:00
session_save_path(dirname(__FILE__) . '/../../sess');
2009-07-08 18:03:28 +00:00
}
2010-02-06 11:50:26 +00:00
session_start();
session_regenerate_id(true);
2006-04-16 12:49:12 +00:00
setlanguage();
// remove settings from session
if (isset($_SESSION["mainconf_password"])) unset($_SESSION["mainconf_password"]);
if (isset($_SESSION['cfgMain'])) {
unset($_SESSION['cfgMain']);
}
$cfgMain = new LAMCfgMain();
2006-04-16 12:49:12 +00:00
// check if user entered a password
if (isset($_POST['passwd'])) {
2007-11-07 21:02:13 +00:00
if (isset($_POST['passwd']) && ($cfgMain->checkPassword($_POST['passwd']))) {
2006-04-16 12:49:12 +00:00
$_SESSION["mainconf_password"] = $_POST['passwd'];
metaRefresh("mainmanage.php");
exit();
}
else {
$message = _("The password is invalid! Please try again.");
}
}
echo $_SESSION['header'];
?>
<title>
<?php
echo _("Login");
?>
</title>
2010-08-31 18:05:17 +00:00
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../../style';
$cssDir = dir($cssDirName);
2012-11-02 17:45:35 +00:00
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
2010-08-31 18:05:17 +00:00
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
}
?>
2008-01-01 13:06:51 +00:00
<link rel="shortcut icon" type="image/x-icon" href="../../graphics/favicon.ico">
2006-04-16 12:49:12 +00:00
</head>
<body>
<?php
// set focus on password field
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo "<!--\n";
echo "window.onload = function() {\n";
echo "loginField = document.getElementsByName('passwd')[0];\n";
echo "loginField.focus();\n";
echo "}\n";
echo "//-->\n";
echo "</script>\n";
2010-01-01 17:39:38 +00:00
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/../lib';
$jsDir = dir($jsDirName);
2010-08-28 12:27:06 +00:00
$jsFiles = array();
2010-01-01 17:39:38 +00:00
while ($jsEntry = $jsDir->read()) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
2010-08-28 12:27:06 +00:00
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
2010-01-01 17:39:38 +00:00
echo "<script type=\"text/javascript\" src=\"../lib/" . $jsEntry . "\"></script>\n";
}
2006-04-16 12:49:12 +00:00
?>
2010-08-31 18:05:17 +00:00
<table border=0 width="100%" class="lamHeader ui-corner-all">
2010-07-30 16:08:20 +00:00
<tr>
<td align="left" height="30">
<a class="lamHeader" href="http://www.ldap-account-manager.org/" target="new_window">&nbsp;<img src="../../graphics/logo32.png" width=24 height=24 class="align-middle" alt="LDAP Account Manager">&nbsp;&nbsp;LDAP Account Manager</a>
</td>
<td align="right" height=20>
<a href="../login.php"><IMG alt="configuration" src="../../graphics/undo.png">&nbsp;<?php echo _("Back to login") ?></a>
</td>
</tr>
</table>
<br>
<?php
// check if config file is writable
if (!$cfgMain->isWritable()) {
StatusMessage('WARN', 'The config file is not writable.', 'Your changes cannot be saved until you make the file writable for the webserver user.');
}
?>
<br>
2006-04-16 12:49:12 +00:00
<!-- form to change main options -->
2014-02-20 17:14:22 +00:00
<form action="mainlogin.php" method="post" autocomplete="off">
2013-01-15 18:58:33 +00:00
<table align="center">
<tr><td>
2013-01-12 16:33:42 +00:00
<table align="center" border="2" rules="none" bgcolor="white" class="ui-corner-all" style="padding: 20px;">
<tr><td>
<?php
$spacer = new htmlSpacer('20px', '20px');
$table = new htmlTable();
$caption = new htmlOutputText(_("Please enter the master password to change the general preferences:"));
$table->addElement($caption, true);
$table->addElement($spacer, true);
// print message if login was incorrect or no config profiles are present
if (isset($message)) { // $message is set by confmain.php (requires conflogin.php then)
$messageField = new htmlStatusMessage('ERROR', $message);
$table->addElement($messageField, true);
$table->addElement($spacer, true);
}
// password field
$gap = new htmlSpacer('1px', null);
$passwordGroup = new htmlGroup();
$passwordGroup->alignment = htmlElement::ALIGN_CENTER;
$passwordGroup->addElement(new htmlOutputText(_('Master password')));
$passwordGroup->addElement($gap);
$passwordField = new htmlInputField('passwd');
$passwordField->setFieldSize(15);
$passwordField->setIsPassword(true);
$passwordGroup->addElement($passwordField);
$passwordGroup->addElement($gap);
$passwordGroup->addElement(new htmlButton('submit', _("Ok")));
$passwordGroup->addElement($gap);
$passwordGroup->addElement(new htmlHelpLink('236'));
$table->addElement($passwordGroup, true);
$tabindex = 1;
parseHtml(null, $table, array(), false, $tabindex, 'user');
?>
</td></tr>
2006-04-16 12:49:12 +00:00
</table>
2013-01-15 18:58:33 +00:00
</td></tr>
<tr><td align="left">
<br><a href="../login.php"> <?php echo _("Back to login"); ?> </a>
</td></tr>
</table>
2006-04-16 12:49:12 +00:00
</form>
2010-07-30 16:08:20 +00:00
<p><br><br></p>
2006-04-16 12:49:12 +00:00
</body>
</html>