Commit 3db5f310 authored by Dries's avatar Dries
Browse files

Bugfixes:
---------
* Fixed a few bugs in account.php - saves Natrak some time.
  I only fixed the obvious, very small bugs reported today.

Enhancements:
-------------
* Made the default theme a setting in config.inc.  You can now easily
  change the default theme.  It's a much nicer approach with more
  flexibility.  When working on your theme, you set your theme to be the
  default theme.  In addition, with a small scripting tric in config.inc
  we could automatically set the default theme to the most popular theme
  (according to the user table), or we could periodically cycle (round
  robin) through all themes: say every week a new default theme.  I truly
  think that's better. :-)
* Adjusted config.inc, theme.inc and account.php in order to do so.
* I have some remarks with regards to config.inc, but I think I'll share
  those later in a seperate mail.
parent 44e01f84
......@@ -63,11 +63,11 @@ function validateUser($user) {
### Verify username and e-mail address:
$user[userid] = trim($user[userid]);
if (empty($user[email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[email]))) $rval = "the specified e-mail address is not valid.<BR>";
if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $rval = "the specified username '$uname' is not valid.<BR>";
if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $rval = "the specified username '$new[userid]' is not valid.<BR>";
if (strlen($user[userid]) > 15) $rval = "the specified username is too long: it must be less than 15 characters.";
if (eregi("^((root)|(httpd)|(operator)|(admin)|(administrator)|(news)|(deamon)|(nobody)|(ftp))$", $user[userid])) $rval = "the specified username is reserved.";
### Verify whether username and e-mail address are uniqua:
### Verify whether username and e-mail address are unique:
dbconnect();
if (mysql_num_rows(mysql_query("SELECT userid FROM testusers WHERE LOWER(userid)=LOWER('$user[userid]')")) > 0) $rval = "the specified username is already taken.";
if (mysql_num_rows(mysql_query("SELECT email FROM testusers WHERE LOWER(email)=LOWER('$user[email]')")) > 0) $rval = "the specified e-mail address is already registered.";
......@@ -113,7 +113,7 @@ function makePassword($min_length=6) {
$message = "Your $sitename member account has been created succesfully. To be able to use it you must login using the information below. Please save this mail for further reference.\n\n username: $new[userid]\n e-mail: $newu[email]\n password: $new[passwd]\n\nThis password is generated by a randomizer. It is recommended that you change this password immediately.\n\n$contact_signature";
$subject = "Account details for $sitename";
mail($new[email], $subject, $message, "From: $contact_email\nX-Mailer: PHP/" . phpversion());
print("Your member account has been created and the details necessary to login have been sent to your e-mail account <B>$email</B>. Once you received the account confirmation, hit <A HREF=\"account.php\">this link</A> to login.");
print("Your member account has been created and the details necessary to login have been sent to your e-mail account <B>$new[email]</B>. Once you received the account confirmation, hit <A HREF=\"account.php\">this link</A> to login.");
}
$theme->footer();
}
......@@ -150,6 +150,7 @@ function makePassword($min_length=6) {
$theme->footer();
break;
case "editpage":
include('config.inc');
include('theme.inc');
$theme->header();
print("<FORM ACTION=\"account.php\" METHOD=post>\n");
......@@ -157,10 +158,10 @@ function makePassword($min_length=6) {
include "themes/list.php";
for ($i = 0; $i < count($themelist); $i++) {
if ($themelist[$i] != "") {
$options .= "<OPTION VALUE=\"$themelist[$i]\"". (((!empty($userinfo[theme])) && ($themelist[$i] == "default")) || ($user->theme == $themelist[$i]) ? " SELECTED" : "") .">$themelist[$i]</OPTION>";
$options .= "<OPTION VALUE=\"$themelist[$i]\"". (((!empty($userinfo[theme])) && ($themelist[$i] == $cfg_theme)) || ($user->theme == $themelist[$i]) ? " SELECTED" : "") .">$themelist[$i]</OPTION>";
}
}
if ($userinfo[theme]=="") $userinfo[theme] = "default";
if ($userinfo[theme]=="") $userinfo[theme] = $cfg_theme;
print("<SELECT NAME=\"edit[theme]\">$options</SELECT><BR>\n");
print("<I>Changes the look and feel of the site.</I><P>\n");
print("<B>Maximum number of stories:</B><BR>\n");
......
......@@ -61,6 +61,12 @@
#
$anonymous = "Anonymous Chicken";
#
#
# Default theme:
#
$cfg_theme = "default";
#
# Debug flag:
# Set to '1' if you are using Windows so the engine won't try
......
......@@ -4,7 +4,7 @@
if (isset($user->theme) && file_exists("themes/$user->theme/theme.class")) {
include "themes/$user->theme/theme.class";
}
else include "themes/default/theme.class";
else include "themes/$cfg_theme/theme.class";
$theme = new Theme();
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment