From b3bf2638670ff78aa53573bcf5c05ed3fcfc7e2a Mon Sep 17 00:00:00 2001 From: quix0r Date: Thu, 5 Nov 2009 15:57:18 +0000 Subject: [PATCH] Entities in JavaScript => failed, fixed... login fixed by removing status=GUEST --- .gitattributes | 2 + inc/databases.php | 1 + inc/filters.php | 7 ++- inc/functions.php | 10 ++-- inc/js/js-cookies_disabled.php | 50 ++++++++++++++++++++ inc/language/de.php | 3 +- inc/language/doubler_de.php | 3 +- inc/modules/chk_login.php | 1 + inc/modules/guest/what-login.php | 2 +- inc/mysql-manager.php | 4 +- inc/session-functions.php | 12 ++--- inc/wrapper-functions.php | 2 +- templates/de/html/doubler/doubler_index.tpl | 2 +- templates/de/html/js/js_cookies_disabled.tpl | 5 ++ templates/de/html/login_failed_js.tpl | 11 +---- templates/de/html/member/member_login_js.tpl | 4 +- 16 files changed, 88 insertions(+), 31 deletions(-) create mode 100644 inc/js/js-cookies_disabled.php create mode 100644 templates/de/html/js/js_cookies_disabled.tpl diff --git a/.gitattributes b/.gitattributes index d43918ba66..5aa328f36f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -195,6 +195,7 @@ inc/install-functions.php -text inc/install-inc.php -text inc/js/.htaccess -text inc/js/js- -text +inc/js/js-cookies_disabled.php -text inc/js/js-jquery.php -text inc/js/js-order_send.php -text inc/js/js-surfbar_member_book.php -text @@ -1400,6 +1401,7 @@ templates/de/html/install/install_page3.tpl -text templates/de/html/install/install_page5.tpl -text templates/de/html/install/install_welcome.tpl -text templates/de/html/js/.htaccess -text +templates/de/html/js/js_cookies_disabled.tpl -text templates/de/html/js/js_jquery.tpl -text templates/de/html/js/js_order_send.tpl -text templates/de/html/js/js_surfbar_member_book.tpl -text diff --git a/inc/databases.php b/inc/databases.php index f68d2eec89..cb358adf61 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -77,6 +77,7 @@ addCode('LOGIN_FAILED' , 0x020); addCode('BEG_SAME_AS_OWN' , 0x021); addCode('UNHANDLED_STATUS' , 0x022); addCode('MODULE_MEM_ONLY' , 0x023); +addCode('ID_GUEST' , 0x024); // Server-URL (DO NOT CHANGE THIS OR YOU CANNOT CHECK FOR UPDATES/EXTENSIONS!) setConfigEntry('SERVER_URL', 'http://www.mxchange.org'); diff --git a/inc/filters.php b/inc/filters.php index dbc68d39da..3bcc77e333 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -455,8 +455,11 @@ function FILTER_COMPILE_EXTENSION ($code) { // By default we have no extension installed, so 'false' is assumed $replacer = 'false'; - // Is the extension installed? - if (isExtensionActive($matches[4][$key])) { + // Is the extension installed or code provided? + if ($cmd == 'code') { + // Code asked for + $replacer = getCode($matches[4][$key]); + } elseif (isExtensionActive($matches[4][$key])) { // Construct call-back function name $functionName = 'getExtension' . ucfirst(strtolower($cmd)); diff --git a/inc/functions.php b/inc/functions.php index a285c70519..439827a097 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -331,6 +331,9 @@ function loadTemplate ($template, $return=false, $content=array()) { // Prepare eval() command $eval = '$ret = "' . compileCode(smartAddSlashes($ret)) . '";'; + } elseif (substr($template, 0, 3) == 'js_') { + // JavaScripts don't like entities + $eval = '$ret = decodeEntities("' . compileCode(smartAddSlashes($GLOBALS['tpl_content'])) . '");'; } else { // Prepare eval() command $eval = '$ret = "' . compileCode(smartAddSlashes($GLOBALS['tpl_content'])) . '";'; @@ -2398,12 +2401,12 @@ function generateErrorCodeFromUserStatus ($status='') { $errorCode = getCode('UNKNOWN_STATUS'); // Generate constant name - $constantName = sprintf("ID_%s", $status); + $codeName = sprintf("ID_%s", $status); // Is the constant there? - if (isCodeSet($constantName)) { + if (isCodeSet($codeName)) { // Then get it! - $errorCode = getCode($constantName); + $errorCode = getCode($codeName); } else { // Unknown status logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown error status %s detected.", $status)); @@ -2673,6 +2676,7 @@ function getMessageFromErrorCode ($code) { case getCode('WRONG_ID') : $message = getMessage('LOGIN_WRONG_ID'); break; case getCode('ID_LOCKED') : $message = getMessage('LOGIN_ID_LOCKED'); break; case getCode('ID_UNCONFIRMED') : $message = getMessage('LOGIN_ID_UNCONFIRMED'); break; + case getCode('ID_GUEST') : $message = getMessage('LOGIN_ID_GUEST'); break; case getCode('NO_COOKIES') : $message = getMessage('LOGIN_NO_COOKIES'); break; case getCode('COOKIES_DISABLED') : $message = getMessage('LOGIN_NO_COOKIES'); break; case getCode('BEG_SAME_AS_OWN') : $message = getMessage('BEG_SAME_UID_AS_OWN'); break; diff --git a/inc/js/js-cookies_disabled.php b/inc/js/js-cookies_disabled.php new file mode 100644 index 0000000000..bd6e15aa04 --- /dev/null +++ b/inc/js/js-cookies_disabled.php @@ -0,0 +1,50 @@ + diff --git a/inc/language/de.php b/inc/language/de.php index 4960b03aac..ade431ebb0 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -298,7 +298,8 @@ addMessages(array( 'LOGIN_WRONG_PASS' => "Falsches Passwort eingegben.", 'LOGIN_WRONG_ID' => "Es wurde kein Account unter Ihren eingegebenen Logindaten gefunden.", 'LOGIN_ID_LOCKED' => "Ihr Account wurde gesperrt.", - 'LOGIN_ID_UNCONFIRMED' => "Bitte bestätigen Sie erst Ihre Email-Adresse!
Haben Sie den Bestätigungslink verloren? Links im Menü können Sie ihn erneut anfordern.", + 'LOGIN_ID_UNCONFIRMED' => "Bitte bestätigen Sie erst Ihre Email-Adresse! Haben Sie den Bestätigungslink verloren? Links im Menü unter "Bestätigungslink" können Sie ihn erneut anfordern.", + 'LOGIN_ID_GUEST' => "Es ist etwas beim Anmelden schief gelaufen. Dies sollte nicht vorkommen. status=guest", 'LOGIN_NO_COOKIES' => "Sie haben in Ihrem Browser entweder die Cookies ausgeschaltet, oder die Sicherheitsstufe ist zu hoch eingestellt.", 'GUEST_REG_POINTS_1' => "Für Ihre Anmeldung haben wir Ihnen als Willkommensgutschrift", 'GUEST_REG_POINTS_2' => "{?POINTS?} gutgeschrieben. Sie können bereits jetzt schon Mails an die anderen Mitglieder verschicken - solange Empfänger auch erreichbar sind.", diff --git a/inc/language/doubler_de.php b/inc/language/doubler_de.php index 39fa31e2ed..5fe25e2b89 100644 --- a/inc/language/doubler_de.php +++ b/inc/language/doubler_de.php @@ -79,9 +79,8 @@ addMessages(array( 'ADMIN_DOUBLER_LIST_WAITING_ALL' => "Alle wartenden {?POINTS?}-Auszahlungen", 'ADMIN_DOUBLER_LIST_WAITING_DIRECT' => "Wartende Direkt-Auszahlungen", 'ADMIN_DOUBLER_LIST_WAITING_REF' => "Wartende Referal-Auszahlungen", - 'DOUBLER_TITLE' => "Verdoppler", - 'DOUBLER_ENTER_LOGIN_DATA' => "Geben Sie hier Ihre Zugangsdaten ein:", + 'DOUBLER_ENTER_LOGIN_DATA' => "Geben Sie hier Ihre Zugangsdaten ein", 'DOUBLER_NOTE_FOR_PASSWORD' => "Das Passwort wird nicht gespeichert.", 'DOUBLER_ENTER_POINTS' => "{?POINTS?} zum Verdoppeln", 'DOUBLER_NOW' => "Verdoppeln.", diff --git a/inc/modules/chk_login.php b/inc/modules/chk_login.php index e87de7dbf4..d02817258a 100644 --- a/inc/modules/chk_login.php +++ b/inc/modules/chk_login.php @@ -44,6 +44,7 @@ if (!defined('__SECURITY')) { // Initial message part $message = "{--VALIDATING_LOGIN--}"; +// Is the member id and u_hash set? if (isMemberIdSet() && (isSessionVariableSet('u_hash'))) { // Is 'theme' installed and activated? if (isExtensionActive('theme')) { diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 901f7b8c69..da708d5882 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -63,7 +63,7 @@ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { $userid = getMemberId(); } elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) { // Set userid and crypt password when login data was submitted - if ((isExtensionActive('nickname')) && (isNicknameOrUserid(postRequestElement('id')))) { + if (isNicknameUsed(postRequestElement('id'))) { // Nickname entered $userid = SQL_ESCAPE(postRequestElement('id')); } else { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index a96b22392b..e19b1689b0 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -611,17 +611,15 @@ function isMember () { $ret = true; } else { // Maybe got locked etc. - //* DEBUG: */ print(__LINE__."!!!
"); + logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status')); destroyMemberSession(); } } else { // Cookie data is invalid! - //* DEBUG: */ print(__LINE__."***
"); destroyMemberSession(); } } else { // Cookie data is invalid! - //* DEBUG: */ print(__LINE__."///
"); destroyMemberSession(); } diff --git a/inc/session-functions.php b/inc/session-functions.php index 1c4fc7bbeb..ce329769dc 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -50,25 +50,25 @@ function setSession ($var, $value) { $var = trim(SQL_ESCAPE($var)); $value = trim($value); // Is the session variable set? - if ((''.$value.'' == '') && (isSessionVariableSet($var))) { + if (('' . $value . '' == '') && (isSessionVariableSet($var))) { // Remove the session - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UNSET:".$var.'='.getSession($var)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UNSET:' . $var . '=' . getSession($var)); unset($GLOBALS['_SESSION'][$var]); return session_unregister($var); - } elseif (("".$value."" != '') && (!isSessionVariableSet($var))) { + } elseif (('' . $value . '' != '') && (!isSessionVariableSet($var))) { // Set session - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "SET:".$var.'='.$value); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SET:' . $var . '=' . $value); $GLOBALS['_SESSION'][$var] = $value; return session_register($var); } elseif (!empty($value)) { // Update session - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UPDATE:".$var.'='.$value); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UPDATE:' . $var . '=' . $value); $GLOBALS['_SESSION'][$var] = $value; return true; } // Ignored (but valid) - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "IGNORED:".$var.'='.$value); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'IGNORED:' . $var . '=' . $value); return true; } diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 0bcd4f09b1..0b213f3ec9 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -714,7 +714,7 @@ function initUserData () { if (getCurrentUserId() == '0') debug_report_bug('User id is zero.'); // Init the user - $GLOBALS['user_data'][getCurrentUserId()]['status'] = 'GUEST'; + $GLOBALS['user_data'][getCurrentUserId()] = array(); } // Getter for user data diff --git a/templates/de/html/doubler/doubler_index.tpl b/templates/de/html/doubler/doubler_index.tpl index 7017ad5744..67cc657942 100644 --- a/templates/de/html/doubler/doubler_index.tpl +++ b/templates/de/html/doubler/doubler_index.tpl @@ -24,7 +24,7 @@ - {--DOUBLER_ENTER_LOGIN--}:  + {--DOUBLER_ENTER_LOGIN_DATA--}:  diff --git a/templates/de/html/js/js_cookies_disabled.tpl b/templates/de/html/js/js_cookies_disabled.tpl new file mode 100644 index 0000000000..000eb53114 --- /dev/null +++ b/templates/de/html/js/js_cookies_disabled.tpl @@ -0,0 +1,5 @@ +function Loader() { + document.location.href = '{?URL?}/modules.php?module=index&what=login&code={%code=COOKIES_DISABLED%}'; +} + +window.setTimeout("Loader()", 2000); diff --git a/templates/de/html/login_failed_js.tpl b/templates/de/html/login_failed_js.tpl index f6cc086655..4b21264629 100644 --- a/templates/de/html/login_failed_js.tpl +++ b/templates/de/html/login_failed_js.tpl @@ -1,9 +1,2 @@ - + diff --git a/templates/de/html/member/member_login_js.tpl b/templates/de/html/member/member_login_js.tpl index 3185272eb4..21accec2df 100644 --- a/templates/de/html/member/member_login_js.tpl +++ b/templates/de/html/member/member_login_js.tpl @@ -1,4 +1,4 @@ - + -- 2.39.5