Bug correction
Corrected some bugs in User class, related to email management. Added a sendmail function (usage to be done) and small bug fixes in install and settings.
This commit is contained in:
parent
95d84c1a55
commit
82a469404c
@ -88,15 +88,15 @@ class User extends Storage {
|
||||
|
||||
public function setNotifications($notifications) {
|
||||
switch($notifications) {
|
||||
case 1:
|
||||
case 1: // Nothing
|
||||
$this->notifications = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 2: // Global paybacks only
|
||||
$this->notifications = 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 3: // Everything concerning you
|
||||
$this->notifications = 3;
|
||||
break;
|
||||
|
||||
|
@ -79,3 +79,21 @@
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
// Sendmail function by Bronco
|
||||
function sendmail($to, $subject = '[Bouffe@Ulm]', $msg, $from = null, $format = 'text/plain') {
|
||||
$r = "\r\n";
|
||||
$header = '';
|
||||
$msg = wordwrap ($msg, 70, $r);
|
||||
if ($format != 'text/plain') {
|
||||
$msg = htmlspecialchars ($msg);
|
||||
}
|
||||
if (!empty ($from)) {
|
||||
$header .= 'From: '.$from.$r;
|
||||
}
|
||||
$header =
|
||||
'Content-Type: text/plain; charset="utf-8"'.$r.
|
||||
'Content-Transfer-Encoding: 8bit'.$r.$header;
|
||||
|
||||
return mail ($to, $subject, $msg, $header);
|
||||
}
|
||||
|
24
index.php
24
index.php
@ -402,29 +402,29 @@
|
||||
|
||||
foreach($config as $line_number=>$line) {
|
||||
if(strpos(trim($line), "MYSQL_HOST") !== false)
|
||||
$config[$line_number] = "\tdefine('MYSQL_HOST', '".$_POST['mysql_host']."');";
|
||||
$config[$line_number] = "\tdefine('MYSQL_HOST', '".$_POST['mysql_host']."');\n";
|
||||
elseif(strpos(trim($line), "MYSQL_LOGIN") !== false)
|
||||
$config[$line_number] = "\tdefine('MYSQL_LOGIN', '".$_POST['mysql_login']."');";
|
||||
$config[$line_number] = "\tdefine('MYSQL_LOGIN', '".$_POST['mysql_login']."');\n";
|
||||
elseif(strpos(trim($line), "MYSQL_PASSWORD") !== false && !empty($_POST['mysql_password']))
|
||||
$config[$line_number] = "\tdefine('MYSQL_PASSWORD', '".$_POST['mysql_password']."');";
|
||||
$config[$line_number] = "\tdefine('MYSQL_PASSWORD', '".$_POST['mysql_password']."');\n";
|
||||
elseif(strpos(trim($line), "MYSQL_DB") !== false)
|
||||
$config[$line_number] = "\tdefine('MYSQL_DB', '".$_POST['mysql_db']."');";
|
||||
$config[$line_number] = "\tdefine('MYSQL_DB', '".$_POST['mysql_db']."');\n";
|
||||
elseif(strpos(trim($line), "MYSQL_PREFIX") !== false && !empty($_POST['mysql_prefix']))
|
||||
$config[$line_number] = "\tdefine('MYSQL_PREFIX', '".$_POST['mysql_prefix']."');";
|
||||
$config[$line_number] = "\tdefine('MYSQL_PREFIX', '".$_POST['mysql_prefix']."');\n";
|
||||
elseif(strpos(trim($line), "INSTANCE_TITLE") !== false)
|
||||
$config[$line_number] = "\tdefine('INSTANCE_TITLE', '".$_POST['instance_title']."');";
|
||||
$config[$line_number] = "\tdefine('INSTANCE_TITLE', '".$_POST['instance_title']."');\n";
|
||||
elseif(strpos(trim($line), "BASE_URL") !== false)
|
||||
$config[$line_number] = "\tdefine('BASE_URL', '".$_POST['base_url']."');";
|
||||
$config[$line_number] = "\tdefine('BASE_URL', '".$_POST['base_url']."');\n";
|
||||
elseif(strpos(trim($line), "CURRENCY") !== false)
|
||||
$config[$line_number] = "\tdefine('CURRENCY', '".$_POST['currency']."');";
|
||||
$config[$line_number] = "\tdefine('CURRENCY', '".$_POST['currency']."');\n";
|
||||
elseif(strpos(trim($line), "EMAIL_WEBMASTER") !== false)
|
||||
$config[$line_number] = "\tdefine('EMAIL_WEBMASTER', '".$_POST['email_webmaster']."');";
|
||||
$config[$line_number] = "\tdefine('EMAIL_WEBMASTER', '".$_POST['email_webmaster']."');\n";
|
||||
elseif(strpos(trim($line), "TEMPLATE_DIR") !== false)
|
||||
$config[$line_number] = "\tdefine('TEMPLATE_DIR', 'tpl/".$_POST['template']."/');";
|
||||
$config[$line_number] = "\tdefine('TEMPLATE_DIR', 'tpl/".$_POST['template']."/');\n";
|
||||
elseif(strpos(trim($line), "LANG") !== false)
|
||||
$config[$line_number] = "\tdefine('LANG', '".substr($_POST['template'], -2)."');";
|
||||
$config[$line_number] = "\tdefine('LANG', '".substr($_POST['template'], -2)."');\n";
|
||||
elseif(strpos(trim($line), 'date_default_timezone_set') !== false)
|
||||
$config[$line_number] = "\tdate_default_timezone_set('".$_POST['timezone']."');";
|
||||
$config[$line_number] = "\tdate_default_timezone_set('".$_POST['timezone']."');\n";
|
||||
}
|
||||
|
||||
if(file_put_contents("data/config.php", $config)) {
|
||||
|
@ -90,13 +90,15 @@
|
||||
$admin->setDisplayName($_POST['admin_display_name']);
|
||||
$admin->setPassword($admin->encrypt($_POST['admin_password']));
|
||||
$admin->setAdmin(true);
|
||||
$admin->setEmail($_POST['email_webmaster']);
|
||||
$admin->setNotifications(3);
|
||||
$admin->newJsonToken();
|
||||
$admin->save();
|
||||
|
||||
header('location: index.php');
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
$erreur = 'An error occurred when inserting user in the database.<br/> Error message : '.$e->getMessage().'.';
|
||||
$error = 'An error occurred when inserting user in the database.<br/> Error message : '.$e->getMessage().'.';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user