if (! isset($config->guestloginbutton)) {
$config->guestloginbutton = 1;
}
+ if (! isset($config->auth_instructions)) {
+ $config->auth_instructions = "";
+ }
+ if (! isset($config->changepassword)) {
+ $config->changepassword = "";
+ }
+ $user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
+
+ foreach ($user_fields as $user_field) {
+ $user_field = "auth_user_$user_field";
+ if (! isset($config->$user_field)) {
+ $config->$user_field = "";
+ }
+ }
if (empty($focus)) {
$focus = "";
+<?PHP
+ if (!isset($config->auth_dbhost)) {
+ $config->auth_dbhost = "localhost";
+ }
+ if (!isset($config->auth_dbtype)) {
+ $config->auth_dbtype = "mysql";
+ }
+ if (!isset($config->auth_dbname)) {
+ $config->auth_dbname = "";
+ }
+ if (!isset($config->auth_dbuser)) {
+ $config->auth_dbuser = "";
+ }
+ if (!isset($config->auth_dbpass)) {
+ $config->auth_dbpass = "";
+ }
+ if (!isset($config->auth_dbtable)) {
+ $config->auth_dbtable = "";
+ }
+ if (!isset($config->auth_dbfielduser)) {
+ $config->auth_dbfielduser = "";
+ }
+ if (!isset($config->auth_dbfieldpass)) {
+ $config->auth_dbfieldpass = "";
+ }
+ if (!isset($config->auth_dbpasstype)) {
+ $config->auth_dbpasstype = "plaintext";
+ }
+?>
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbhost:</TD>
<TD>
<INPUT name=auth_dbhost TYPE=text SIZE=30 VALUE="<?=$config->auth_dbhost?>">
- <? formerr($err["auth_dbhost"]); ?>
+ <? if (isset($err["auth_dbhost"])) formerr($err["auth_dbhost"]); ?>
</TD>
<TD>
<? print_string("auth_dbhost","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbname:</TD>
<TD>
<INPUT name=auth_dbname TYPE=text SIZE=30 VALUE="<?=$config->auth_dbname?>">
- <? formerr($err["auth_dbname"]); ?>
+ <? if (isset($err["auth_dbname"]))formerr($err["auth_dbname"]); ?>
</TD>
<TD>
<? print_string("auth_dbname","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbuser:</TD>
<TD>
<INPUT name=auth_dbuser TYPE=text SIZE=30 VALUE="<?=$config->auth_dbuser?>">
- <? formerr($err["auth_dbuser"]); ?>
+ <? if (isset($err["auth_dbuser"])) formerr($err["auth_dbuser"]); ?>
</TD>
<TD>
<? print_string("auth_dbuser","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbpass:</TD>
<TD>
<INPUT name="auth_dbpass" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbpass?>">
- <? formerr($err["auth_dbpass"]); ?>
+ <? if (isset($err["auth_dbpass"])) formerr($err["auth_dbpass"]); ?>
</TD>
<TD>
<? print_string("auth_dbpass","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbtable:</TD>
<TD>
<INPUT name="auth_dbtable" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbtable?>">
- <? formerr($err["auth_dbtable"]); ?>
+ <? if (isset($err["auth_dbtable"])) formerr($err["auth_dbtable"]); ?>
</TD>
<TD>
<? print_string("auth_dbtable","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbfielduser:</TD>
<TD>
<INPUT name="auth_dbfielduser" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbfielduser?>">
- <? formerr($err["auth_dbfielduser"]); ?>
+ <? if (isset($err["auth_dbfielduser"])) formerr($err["auth_dbfielduser"]); ?>
</TD>
<TD>
<? print_string("auth_dbfielduser","auth") ?>
<TD ALIGN=RIGHT><P>auth_dbfieldpass:</TD>
<TD>
<INPUT name="auth_dbfieldpass" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbfieldpass?>">
- <? formerr($err["auth_dbfieldpass"]); ?>
+ <? if (isset($err["auth_dbfieldpass"])) formerr($err["auth_dbfieldpass"]); ?>
</TD>
<TD>
<? print_string("auth_dbfieldpass","auth") ?>
</TD>
</TR>
+<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
+ <TD ALIGN=RIGHT><P>auth_dbpasstype:</TD>
+ <TD>
+ <? $passtype["plaintext"] = get_string("plaintext", "auth");
+ $passtype["md5"] = get_string("md5", "auth");
+ choose_from_menu($passtype, "auth_dbpasstype", $config->auth_dbpasstype, "");
+ ?>
+
+ </TD>
+ <TD>
+ <? print_string("auth_dbpasstype","auth") ?>
+ </TD>
+</TR>
+
+
<TR>
<TD ALIGN=RIGHT><P><? print_string("firstname") ?>:</TD>
<TD>
<?PHP // $Id$
// Authentication by looking up an external database table
-// This code is completely untested so far - IT NEEDS TESTERS!
-// Looks like it should work though ...
-
function auth_user_login ($username, $password) {
// Returns true if the username and password work
$authdb = &ADONewConnection();
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
+ switch ($CFG->auth_dbpasstype) { // Re-format password accordingly
+ case "md5":
+ $password = md5($password);
+ break;
+ }
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username'
+<?PHP
+ if (!isset($config->auth_imaphost)) {
+ $config->auth_imaphost = "127.0.0.1";
+ }
+ if (!isset($config->auth_imaptype)) {
+ $config->auth_imaptype = "imap";
+ }
+ if (!isset($config->auth_imapport)) {
+ $config->auth_imapport = "143";
+ }
+?>
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_imaphost:</TD>
<TD>
<INPUT name=auth_imaphost TYPE=text SIZE=30 VALUE="<?=$config->auth_imaphost?>">
- <? formerr($err["ldap_host_url"]); ?>
+ <? if (isset($err["auth_imaphost"])) formerr($err["auth_imaphost"]); ?>
</TD>
<TD>
<? print_string("auth_imaphost","auth") ?>
<TD ALIGN=RIGHT><P>auth_imapport:</TD>
<TD>
<INPUT name=auth_imapport TYPE=text SIZE=6 VALUE="<?=$config->auth_imapport?>">
- <? formerr($err["auth_imapport"]); ?>
+ <? if (isset($err["auth_imapport"])) formerr($err["auth_imapport"]); ?>
</TD>
<TD>
<? print_string("auth_imapport","auth") ?>
+<?PHP
+ if (!isset($config->ldap_host_url)) {
+ $config->ldap_host_url = "";
+ }
+ if (!isset($config->ldap_contexts)) {
+ $config->ldap_contexts = "";
+ }
+ if (!isset($config->ldap_user_attribute)) {
+ $config->ldap_user_attribute = "";
+ }
+ if (!isset($config->ldap_search_sub)) {
+ $config->ldap_search_sub = "";
+ }
+ if (!isset($config->ldap_bind_dn)) {
+ $config->ldap_bind_dn = "";
+ }
+ if (!isset($config->ldap_bind_pw)) {
+ $config->ldap_bind_pw = "";
+ }
+?>
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_host_url:</TD>
<TD>
<INPUT name=ldap_host_url TYPE=text SIZE=30 VALUE="<?=$config->ldap_host_url?>">
- <? formerr($err["ldap_host_url"]); ?>
+ <? if (isset($err["ldap_host_url"])) formerr($err["ldap_host_url"]); ?>
</TD>
<TD>
<? print_string("auth_ldap_host_url","auth") ?>
</TR>
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
- <TD ALIGN=RIGHT><P>ldap_user_context:</TD>
+ <TD ALIGN=RIGHT><P>ldap_contexts:</TD>
<TD>
<INPUT name=ldap_contexts TYPE=text SIZE=30 VALUE="<?=$config->ldap_contexts?>">
- <? formerr($err["ldap_contexts"]); ?>
+ <? if (isset($err["ldap_contexts"])) formerr($err["ldap_contexts"]); ?>
</TD>
<TD>
<? print_string("auth_ldap_contexts","auth") ?>
<TD ALIGN=RIGHT><P>ldap_user_attribute:</TD>
<TD>
<INPUT name=ldap_user_attribute TYPE=text SIZE=30 VALUE="<?=$config->ldap_user_attribute?>">
- <? formerr($err["ldap_user_attribute"]); ?>
+ <? if (isset($err["ldap_user_attribute"])) formerr($err["ldap_user_attribute"]); ?>
</TD>
<TD>
<? print_string("auth_ldap_user_attribute","auth") ?>
<TD ALIGN=RIGHT><P>ldap_search_sub:</TD>
<TD>
<INPUT name=ldap_search_sub TYPE=text SIZE=1 VALUE="<?=$config->ldap_search_sub?>">
- <? formerr($err["ldap_search_sub"]); ?>
+ <? if (isset($err["ldap_search_sub"])) formerr($err["ldap_search_sub"]); ?>
</TD>
<TD>
<? print_string("auth_ldap_search_sub","auth") ?>
<TD ALIGN=RIGHT><P>ldap_bind_dn:</TD>
<TD>
<INPUT name=ldap_bind_dn TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_dn?>">
- <? formerr($err["ldap_bind_dn"]); ?>
+ <? if (isset($err["ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
</TD><TD>
<? print_string("auth_ldap_bind_dn","auth") ?>
</TD>
</TR>
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
- <TD ALIGN=RIGHT><P>ldap_bind_password:</TD>
+ <TD ALIGN=RIGHT><P>ldap_bind_pw:</TD>
<TD>
<INPUT name=ldap_bind_pw TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_pw?>">
- <? formerr($err["ldap_bind_pw"]); ?>
+ <? if (isset($err["ldap_bind_pw"])) formerr($err["ldap_bind_pw"]); ?>
</TD><TD>
<? print_string("auth_ldap_bind_pw","auth") ?>
</TD>
+<?PHP
+ if (!isset($config->auth_nntphost)) {
+ $config->auth_nntphost = "127.0.0.1";
+ }
+ if (!isset($config->auth_nntpport)) {
+ $config->auth_nntpport = "119";
+ }
+?>
+
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_nntphost:</TD>
<TD>
<INPUT name="auth_nntphost" TYPE="text" SIZE=30 VALUE="<?=$config->auth_nntphost?>">
- <? formerr($err["ldap_nntphost"]); ?>
+ <? if (isset($err["auth_nntphost"])) formerr($err["auth_nntphost"]); ?>
</TD>
<TD>
<? print_string("auth_nntphost","auth") ?>
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_nntpport:</TD>
<TD>
- <INPUT name=auth_imapport TYPE=text SIZE=6 VALUE="<?=$config->auth_nntpport?>">
- <? formerr($err["auth_nntpport"]); ?>
+ <INPUT name=auth_nntpport TYPE=text SIZE=6 VALUE="<?=$config->auth_nntpport?>">
+ <? if (isset($err["auth_nntpport"])) formerr($err["auth_nntpport"]); ?>
</TD>
<TD>
<? print_string("auth_nntpport","auth") ?>
+<?PHP
+ if (!isset($config->auth_pop3host)) {
+ $config->auth_pop3host = "127.0.0.1";
+ }
+ if (!isset($config->auth_pop3type)) {
+ $config->auth_pop3type = "pop3";
+ }
+ if (!isset($config->auth_pop3port)) {
+ $config->auth_pop3port = "110";
+ }
+?>
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_pop3host:</TD>
<TD>
<INPUT name=auth_pop3host TYPE=text SIZE=30 VALUE="<?=$config->auth_pop3host?>">
- <? formerr($err["ldap_host_url"]); ?>
+ <? if (isset($err["auth_pop3host"])) formerr($err["auth_pop3host"]); ?>
</TD>
<TD>
<? print_string("auth_pop3host","auth") ?>
}
choose_from_menu($pop3options, "auth_pop3type", $config->auth_pop3type, "");
?>
- <? formerr($err["auth_pop3type"]); ?>
</TD>
<TD>
<? print_string("auth_pop3type","auth") ?>
<TD ALIGN=RIGHT><P>auth_pop3port:</TD>
<TD>
<INPUT name=auth_pop3port TYPE=text SIZE=6 VALUE="<?=$config->auth_pop3port?>">
- <? formerr($err["auth_pop3port"]); ?>
+ <? if (isset($err["auth_pop3port"])) formerr($err["auth_pop3port"]); ?>
</TD>
<TD>
<? print_string("auth_pop3port","auth") ?>
$string['auth_dbhost'] = "The computer hosting the database server.";
$string['auth_dbname'] = "Name of the database itself";
$string['auth_dbpass'] = "Password matching the above username";
+$string['auth_dbpasstype'] = "Specify the format that the password field is using. MD5 encryption is useful for connecting to other common web applications like PostNuke";
$string['auth_dbtable'] = "Name of the table in the database";
$string['auth_dbtitle'] = "Use an external database";
$string['auth_dbtype'] = "The database type (See the <A HREF=../lib/adodb/readme.htm#drivers>ADOdb documentation</A> for details)";
$string['changepasswordhelp'] = "Here you can specify a location at which your users can recover or change their username/password if they've forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.";
$string['chooseauthmethod'] = "Choose an authentication method: ";
$string['guestloginbutton'] = "Guest login button";
+$string['md5'] = "MD5 encryption";
+$string['plaintext'] = "Plain text";
$string['showguestlogin'] = "You can hide or show the guest login button on the login page.";
?>