From acb333ee2e7afc7eeb04e9966a574fb15591e757 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 29 Jan 2011 04:32:55 +0000 Subject: [PATCH] Even more fixes for broken first installation attempt (sorry all) --- inc/extensions/ext-bonus.php | 13 +++++++--- inc/extensions/ext-nickname.php | 4 +-- inc/extensions/ext-register.php | 4 +-- inc/extensions/ext-task.php | 4 +-- inc/extensions/ext-user.php | 2 -- inc/functions.php | 16 ++++++------ inc/modules/admin.php | 30 +++++++++++++++------- inc/monthly/monthly_beg.php | 2 +- inc/wrapper-functions.php | 2 +- templates/de/html/admin/admin_reg_form.tpl | 1 + 10 files changed, 45 insertions(+), 33 deletions(-) diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index c588e54c9e..cf900d1c47 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version of this extension -setThisExtensionVersion('0.9.3'); +setThisExtensionVersion('0.9.4'); // Version history array (add more with , '0.1.0' and so on) -setExtensionVersionHistory(array('0.0', '0.1.6', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3')); +setExtensionVersionHistory(array('0.0', '0.1.6', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3', '0.9.4')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) @@ -136,7 +136,6 @@ PRIMARY KEY (`id`) // Use actual month for this update addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `login_bonus` FLOAT(20,3) NOT NULL DEFAULT 0.000"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `turbo_bonus` FLOAT(20,3) NOT NULL DEFAULT 0.000"); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='bonus' AND `ext_has_css`='N' LIMIT 1"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Login-Bonus und Turbo-Klick-Bonus intergriert."); @@ -592,6 +591,14 @@ ORDER BY // Update notes setExtensionUpdateNotes("Typos gefixt."); break; + + case '0.9.4': // SQL queries for v0.9.4 + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `bonus_id` `bonus_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `bonus_id`=NULL WHERE `bonus_id`=0"); + + // Update notes + setExtensionUpdateNotes("Konfliktierende SQL-Befehle aus ext-user verschoben."); + break; } // END - switch break; diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index 52aa5e12d2..fc4c8fac9e 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -77,10 +77,8 @@ switch (getExtensionMode()) { // This update depends on sql_patches update! addExtensionDependency('sql_patches'); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='nickname' AND `ext_has_css`='N' LIMIT 1"); - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("CSS-Datei kann per Adminbereich ein- und ausgeschaltet werden."); + setExtensionUpdateNotes("Veraltetes Update entfernt."); break; case '0.0.3': // SQL queries for v0.0.3 diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index 3d6815ece5..3369e4f220 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -101,10 +101,8 @@ PRIMARY KEY (`id`) // This update depends on sql_patches update! addExtensionDependency('sql_patches'); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='register' AND `ext_has_css`='N' LIMIT 1"); - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden."); + setExtensionUpdateNotes("Veraltetes Update entfernt."); break; case '0.1.3': // SQL queries for v0.1.3 diff --git a/inc/extensions/ext-task.php b/inc/extensions/ext-task.php index f89b57d379..97ba04d72a 100644 --- a/inc/extensions/ext-task.php +++ b/inc/extensions/ext-task.php @@ -78,10 +78,8 @@ switch (getExtensionMode()) { // This update depends on sql_patches update! addExtensionDependency('sql_patches'); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='task' AND `ext_has_css`='N' LIMIT 1"); - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden."); + setExtensionUpdateNotes("Veraltetes Update entfernt."); break; case '0.0.1': // SQL queries for v0.0.1 diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 819fddcbee..e20c788f8d 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -382,7 +382,6 @@ PRIMARY KEY (`id`) addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_del` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `stats_id` `stats_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `bonus_id` `bonus_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `userid` `userid` BIGINT( 22 ) UNSIGNED NULL DEFAULT NULL"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `ref_depth` `ref_depth` TINYINT( 3 ) UNSIGNED NULL DEFAULT NULL"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); @@ -398,7 +397,6 @@ PRIMARY KEY (`id`) addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid` IS NULL OR `cat_id` IS NULL"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_del` WHERE `userid` IS NULL"); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `stats_id`=NULL WHERE `stats_id`=0"); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `bonus_id`=NULL WHERE `bonus_id`=0"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid` IS NULL"); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `ref_depth`=NULL WHERE `ref_depth`=0"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid` IS NULL"); diff --git a/inc/functions.php b/inc/functions.php index f4c11ee73f..aeb0ac419f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -118,12 +118,12 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' $toEmail = getUserData('email'); } else { // Set webmaster - $toEmail = getConfig('WEBMASTER'); + $toEmail = getWebmaster(); } } } elseif ($toEmail == '0') { // Is the webmaster! - $toEmail = getConfig('WEBMASTER'); + $toEmail = getWebmaster(); } //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail}
"); @@ -170,7 +170,7 @@ Message : ' . htmlentities(utf8_decode($message)) . ' return sendRawEmail($toEmail, $subject, $message, $mailHeader); } elseif ($isHtml != 'Y') { // Problem detected while sending a mail, forward it to admin - return sendRawEmail(getConfig('WEBMASTER'), '[PROBLEM:]' . $subject, $message, $mailHeader); + return sendRawEmail(getWebmaster(), '[PROBLEM:]' . $subject, $message, $mailHeader); } // Why did we end up here? This should not happen @@ -219,7 +219,7 @@ function sendRawEmail ($toEmail, $subject, $message, $headers) { $mail->Username = getConfig('SMTP_USER'); $mail->Password = getConfig('SMTP_PASSWORD'); if (empty($headers)) { - $mail->From = getConfig('WEBMASTER'); + $mail->From = getWebmaster(); } else { $mail->From = $headers; } @@ -235,10 +235,10 @@ function sendRawEmail ($toEmail, $subject, $message, $headers) { } $mail->AddAddress($toEmail, ''); - $mail->AddReplyTo(getConfig('WEBMASTER'), getMainTitle()); - $mail->AddCustomHeader('Errors-To:' . getConfig('WEBMASTER')); - $mail->AddCustomHeader('X-Loop:' . getConfig('WEBMASTER')); - $mail->AddCustomHeader('Bounces-To:' . getConfig('WEBMASTER')); + $mail->AddReplyTo(getWebmaster(), getMainTitle()); + $mail->AddCustomHeader('Errors-To:' . getWebmaster()); + $mail->AddCustomHeader('X-Loop:' . getWebmaster()); + $mail->AddCustomHeader('Bounces-To:' . getWebmaster()); $mail->Send(); // Has an error occured? diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 13f64f1146..65ee5460d6 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -67,12 +67,15 @@ if (!isAdminRegistered()) { destroyAdminSession(false); // Do registration - $ret = addAdminAccount(postRequestParameter('login'), $hashedPass, getConfig('WEBMASTER')); + $ret = addAdminAccount(postRequestParameter('login'), $hashedPass, getWebmaster()); // Check if registration wents fine switch ($ret) { case 'done': + // Change ADMIN_REGISTERED entry $done = changeDataInInclude(getCachePath() . 'config-local.php', 'ADMIN-SETUP', "setConfigEntry('ADMIN_REGISTERED', '", "');", 'Y', 0); + + // Was it successfull? if ($done === true) { // Registering is done redirectToUrl('modules.php?module=admin&register=done'); @@ -155,6 +158,7 @@ if (!isAdminRegistered()) { $content['login_message'] = loadTemplate('admin_login_msg', true, $loginMessage); $content['pass1_message'] = loadTemplate('admin_login_msg', true, $pass1Message); $content['pass2_message'] = loadTemplate('admin_login_msg', true, $pass2Message); + $content['error_message'] = loadTemplate('admin_login_msg', true, $errorMessage); } // END - if // Output message in seperate template @@ -211,7 +215,10 @@ if (!isAdminRegistered()) { if (isGetRequestParameterSet('register')) { // Registration of first admin is done - if (getRequestParameter('register') == 'done') loadTemplate('admin_settings_saved', false, '{--ADMIN_REGISTER_DONE--}'); + if (getRequestParameter('register') == 'done') { + // Regisration done! + loadTemplate('admin_settings_saved', false, '{--ADMIN_REGISTER_DONE--}'); + } // END - if } // END - if // Check if the admin has submitted data or not @@ -235,13 +242,17 @@ if (!isAdminRegistered()) { } // END - if // Add data to URL - if (isWhatSet()) $url .= 'what='.getWhat(); - elseif (isActionSet()) $url .= 'action='.getAction(); - elseif (isGetRequestParameterSet('area')) $url .= 'area='.getRequestParameter('area'); + if (isWhatSet()) { + $url .= 'what=' . getWhat(); + } elseif (isActionSet()) { + $url .= 'action=' . getAction(); + } elseif (isGetRequestParameterSet('area')) { + $url .= 'area=' . getRequestParameter('area'); + } - // Load URL - redirectToUrl($url); - break; + // Load URL + redirectToUrl($url); + break; case '404': // Administrator login not found setPostRequestParameter('ok', $ret); @@ -274,7 +285,8 @@ if (!isAdminRegistered()) { if (isFormSent()) { // Set messages to zero - $loginMessage = ''; $passwdMessage = ''; + $loginMessage = ''; + $passwdMessage = ''; // No login entered? if (!isPostRequestParameterSet('login')) $loginMessage = '{--ADMIN_NO_LOGIN--}'; diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 2826065fbe..43f6a24111 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -63,7 +63,7 @@ if ((getBegRanks() > 0) && (!isCssOutputMode())) { // Let's check if there are some points left we can pay... if (isExtensionActive('autopurge')) { // Use last online stamp only when autopurge for inactive members is activated - if ((getApInactiveSince() > 0) && (isBegActiveEnabled()) { + if ((getApInactiveSince() > 0) && (isBegActiveEnabled())) { // Okay, include last online timestamp $whereStatement1 .= " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})"; } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 7df4d8f710..7f85fb8c35 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -2222,7 +2222,7 @@ function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) $FQFN = getPath() . $FQFN; // Call inner function - changeDataInFile($FQFN, $comment, $prefix, $suffix, $DATA, $seek); + return changeDataInFile($FQFN, $comment, $prefix, $suffix, $DATA, $seek); } // Shortens ucfirst(strtolower()) calls diff --git a/templates/de/html/admin/admin_reg_form.tpl b/templates/de/html/admin/admin_reg_form.tpl index ac9e2b78e2..53b37c4f62 100644 --- a/templates/de/html/admin/admin_reg_form.tpl +++ b/templates/de/html/admin/admin_reg_form.tpl @@ -6,6 +6,7 @@ {--CREATE_FIRST_ADMIN_ACCOUNT--} + $content[error_message] {--ADMIN_ACCOUNT_FIRST_CREATION_LOGIN--}: -- 2.39.5