2006-04-16 12:49:12 +00:00
< ? php
/*
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager ( http :// www . ldap - account - manager . org / )
2020-03-13 10:30:11 +00:00
Copyright ( C ) 2003 - 2020 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' );
2016-08-21 09:16:44 +00:00
if ( isLAMProVersion ()) {
2018-12-23 16:52:56 +00:00
include_once ( __DIR__ . " /../../lib/env.inc " );
2016-08-21 09:16:44 +00:00
}
2006-04-16 12:49:12 +00:00
// 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
}
2018-03-10 17:48:11 +00:00
lam_start_session ();
2010-02-06 11:50:26 +00:00
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 " ]);
2013-08-10 12:43:01 +00:00
if ( isset ( $_SESSION [ 'cfgMain' ])) {
unset ( $_SESSION [ 'cfgMain' ]);
}
2009-11-06 19:15:56 +00:00
$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' ];
2017-11-04 10:29:38 +00:00
printHeaderContents ( _ ( " Login " ), '../..' );
2006-04-16 12:49:12 +00:00
?>
</ head >
2016-12-14 19:43:16 +00:00
< body class = " admin " >
2006-04-16 12:49:12 +00:00
< ? php
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 " >
2019-05-12 07:50:23 +00:00
< a class = " lamLogo " href = " http://www.ldap-account-manager.org/ " target = " new_window " >
< ? php echo getLAMVersionText (); ?>
</ a >
2010-07-30 16:08:20 +00:00
</ td >
</ tr >
</ table >
< br >
2009-11-06 19:15:56 +00:00
< ? php
// check if config file is writable
if ( ! $cfgMain -> isWritable ()) {
2020-03-13 10:30:11 +00:00
StatusMessage ( 'WARN' , _ ( 'The config file is not writable.' ), _ ( 'Your changes cannot be saved until you make the file writable for the webserver user.' ));
2009-11-06 19:15:56 +00:00
}
2016-10-24 18:26:39 +00:00
if ( ! empty ( $_GET [ 'invalidLicense' ]) && ( $_GET [ 'invalidLicense' ] == '1' )) {
2016-08-29 17:44:58 +00:00
StatusMessage ( 'WARN' , _ ( 'Invalid licence' ), _ ( 'Please setup your licence data.' ));
2016-08-21 09:16:44 +00:00
}
2016-10-24 18:26:39 +00:00
if ( ! empty ( $_GET [ 'invalidLicense' ]) && ( $_GET [ 'invalidLicense' ] == '2' )) {
StatusMessage ( 'WARN' , _ ( 'Expired licence' ), _ ( 'Please setup your licence data.' ));
}
2009-11-06 19:15:56 +00:00
?>
< 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 >
2015-08-02 19:16:46 +00:00
< table align = " center " border = " 0 " rules = " none " bgcolor = " white " class = " ui-corner-all roundedShadowBox " style = " padding: 20px; " >
2013-01-12 16:33:42 +00:00
< tr >< td >
< ? php
$spacer = new htmlSpacer ( '20px' , '20px' );
2016-12-14 19:43:16 +00:00
$group = new htmlGroup ();
$row = new htmlResponsiveRow ();
$row -> add ( new htmlOutputText ( _ ( " Please enter the master password to change the general preferences: " )), 12 );
$group -> addElement ( $row );
2013-01-12 16:33:42 +00:00
// print message if login was incorrect or no config profiles are present
2016-12-14 19:43:16 +00:00
if ( isset ( $message )) {
$messageField = new htmlStatusMessage ( 'ERROR' , $message );
$row = new htmlResponsiveRow ();
$row -> add ( $messageField , 12 );
$group -> addElement ( $spacer );
$group -> addElement ( $row );
2013-01-12 16:33:42 +00:00
}
2016-12-14 19:43:16 +00:00
$group -> addElement ( $spacer );
// password input
$label = new htmlOutputText ( _ ( 'Master password' ));
2013-01-12 16:33:42 +00:00
$passwordGroup = new htmlGroup ();
$passwordField = new htmlInputField ( 'passwd' );
$passwordField -> setFieldSize ( 15 );
$passwordField -> setIsPassword ( true );
2017-11-24 18:22:11 +00:00
$passwordField -> setCSSClasses ( array ( 'lam-initial-focus' ));
2013-01-12 16:33:42 +00:00
$passwordGroup -> addElement ( $passwordField );
$passwordGroup -> addElement ( new htmlHelpLink ( '236' ));
2016-12-14 19:43:16 +00:00
$passwordDiv = new htmlDiv ( null , $passwordGroup );
$passwordDiv -> setCSSClasses ( array ( 'nowrap' ));
$row = new htmlResponsiveRow ( $label , $passwordDiv );
$group -> addElement ( $row );
// button
$group -> addElement ( $spacer );
$okButton = new htmlButton ( 'submit' , _ ( " Ok " ));
$row = new htmlResponsiveRow ();
$row -> add ( $okButton , 12 );
$row -> setCSSClasses ( array ( '' ));
$group -> addElement ( $row );
2017-03-11 10:38:22 +00:00
2016-12-14 19:43:16 +00:00
$div = new htmlDiv ( null , $group );
$div -> setCSSClasses ( array ( 'centeredTable' ));
2017-03-11 10:38:22 +00:00
2013-01-12 16:33:42 +00:00
$tabindex = 1 ;
2016-12-14 19:43:16 +00:00
parseHtml ( null , $div , array (), false , $tabindex , 'user' );
2013-01-12 16:33:42 +00:00
?>
</ 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 " >
2016-08-27 08:40:05 +00:00
< br >< a href = " ../login.php " >< IMG alt = " configuration " src = " ../../graphics/undo.png " >& nbsp ; < ? php echo _ ( " Back to login " ); ?> </a>
2013-01-15 18:58:33 +00:00
</ td ></ tr >
</ table >
2006-04-16 12:49:12 +00:00
</ form >
2016-08-21 09:16:44 +00:00
< p >< br >< br ></ p >
2006-04-16 12:49:12 +00:00
</ body >
</ html >