Entities in JavaScript => failed, fixed... login fixed by removing status=GUEST
authorRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 15:57:18 +0000 (15:57 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 15:57:18 +0000 (15:57 +0000)
16 files changed:
.gitattributes
inc/databases.php
inc/filters.php
inc/functions.php
inc/js/js-cookies_disabled.php [new file with mode: 0644]
inc/language/de.php
inc/language/doubler_de.php
inc/modules/chk_login.php
inc/modules/guest/what-login.php
inc/mysql-manager.php
inc/session-functions.php
inc/wrapper-functions.php
templates/de/html/doubler/doubler_index.tpl
templates/de/html/js/js_cookies_disabled.tpl [new file with mode: 0644]
templates/de/html/login_failed_js.tpl
templates/de/html/member/member_login_js.tpl

index d43918ba66034d1356429d052cafcdf86a2f00a2..5aa328f36f0c33f29be9b65745be6043571d34a3 100644 (file)
@@ -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
index f68d2eec89f45e372e8a6bab64207a8eac012b23..cb358adf6113206333f7cd39ae82304206ea6785 100644 (file)
@@ -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');
index dbc68d39dad3eaa5f196c3a0b5d6989db2a5bde5..3bcc77e333318a1fac6af9edc39d1ac9a55cdd88 100644 (file)
@@ -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));
 
index a285c70519303109e23f3e9d2f4c6f17d00a3b32..439827a0978e7b24ae29d76998b1204053d81c07 100644 (file)
@@ -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 (file)
index 0000000..bd6e15a
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 11/05/2009 *
+ * ===============                              Last change: 11/05/2009 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : js-cookies_disabled.php                          *
+ * -------------------------------------------------------------------- *
+ * Short description : JavaScript tag for cookies disabled              *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : JavaScript-Tag fuer Cookies-Disabled             *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 1109                                                   $ *
+ * $Date:: 2009-07-31 18:30:33 +0200 (Fri, 31 Jul 2009)               $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: quix0r                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} elseif (!isExtensionActive('sql_patches')) {
+       return;
+}
+
+// Load template
+loadTemplate('js_cookies_disabled');
+
+// [EOF]
+?>
index 4960b03aacbfc2e24af4fbd08693080bb71d2809..ade431ebb08f3c9aab4bd7f2b7deb08b35c47828 100644 (file)
@@ -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&auml;tigen Sie erst Ihre Email-Adresse!<br />Haben Sie den Best&auml;tigungslink verloren? Links im Men&uuml; k&ouml;nnen Sie ihn erneut anfordern.",
+       'LOGIN_ID_UNCONFIRMED' => "Bitte best&auml;tigen Sie erst Ihre Email-Adresse! Haben Sie den Best&auml;tigungslink verloren? Links im Men&uuml; unter &quot;Best&auml;tigungslink&quot; k&ouml;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&uuml;r Ihre Anmeldung haben wir Ihnen als Willkommensgutschrift",
        'GUEST_REG_POINTS_2' => "{?POINTS?} gutgeschrieben. Sie k&ouml;nnen bereits jetzt schon Mails an die anderen Mitglieder verschicken - solange Empf&auml;nger auch erreichbar sind.",
index 39fa31e2ed17d99d742e5130c60abb6cac8eb96e..5fe25e2b89b32e6bff3e0f9c1dd2ebb434892467 100644 (file)
@@ -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.",
index e87de7dbf4912673cb6acfc985f13657caf62eaf..d02817258a48a17521308d0efbab02aa806d2492 100644 (file)
@@ -44,6 +44,7 @@ if (!defined('__SECURITY')) {
 // Initial message part
 $message = "<strong>{--VALIDATING_LOGIN--}</strong>";
 
+// Is the member id and u_hash set?
 if (isMemberIdSet() && (isSessionVariableSet('u_hash'))) {
        // Is 'theme' installed and activated?
        if (isExtensionActive('theme')) {
index 901f7b8c69dfadb4dd53372f62ab0634abd85b58..da708d588231593c4364baff469fa34c8a7df9e0 100644 (file)
@@ -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 {
index a96b22392bb58706bb7de976607f4033388ccad9..e19b1689b05df9b64f6c9fdc057a31576abdfbdc 100644 (file)
@@ -611,17 +611,15 @@ function isMember () {
                                $ret = true;
                        } else {
                                // Maybe got locked etc.
-                               //* DEBUG: */ print(__LINE__."!!!<br />");
+                               logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status'));
                                destroyMemberSession();
                        }
                } else {
                        // Cookie data is invalid!
-                       //* DEBUG: */ print(__LINE__."***<br />");
                        destroyMemberSession();
                }
        } else {
                // Cookie data is invalid!
-               //* DEBUG: */ print(__LINE__."///<br />");
                destroyMemberSession();
        }
 
index 1c4fc7bbeb2c421330196fd407f03e7c71bd046b..ce329769dce456e9cbb588edd375e40fe40398bd 100644 (file)
@@ -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;
 }
 
index 0bcd4f09b13e06a15bacda74b794b3857a516568..0b213f3ec92662b9332c353b6a22b2a416ede46f 100644 (file)
@@ -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
index 7017ad5744f99366dc887e335debf9bd020c4999..67cc657942c0b17a76650bf34950e28eff39a101 100644 (file)
@@ -24,7 +24,7 @@
                        </tr>
                        <tr>
                                <td width="260" align="right" height="25">
-                               {--DOUBLER_ENTER_LOGIN--}:&nbsp;</td>
+                               {--DOUBLER_ENTER_LOGIN_DATA--}:&nbsp;</td>
                                <td width="260"><input type="text" name="userid"
                                        class="guest_normal" size="10" maxlength="255"></td>
                        </tr>
diff --git a/templates/de/html/js/js_cookies_disabled.tpl b/templates/de/html/js/js_cookies_disabled.tpl
new file mode 100644 (file)
index 0000000..000eb53
--- /dev/null
@@ -0,0 +1,5 @@
+function Loader() {
+       document.location.href = '{?URL?}/modules.php?module=index&what=login&code={%code=COOKIES_DISABLED%}';
+}
+
+window.setTimeout("Loader()", 2000);
index f6cc086655068291ec46eeaead1a81b80e80d67b..4b212646299a78f96cfea6338e3fc881f37d2370 100644 (file)
@@ -1,9 +1,2 @@
-<script type="text/javascript">
-<!--
-function Loader() {
-       document.location.href = "{?URL?}/modules.php?module=index&amp;what=login&code={--CODE_COOKIES_DISABLED--}";
-}
-
-window.setTimeout("Loader()", 2000);
-//-->
-</script>
+<script type="text/javascript"
+ src="{?URL?}/js.php?js=cookies_disabled{%version=sql_patches%}"></script>
index 3185272eb4a72058bb1ec99fe287c71933d6832e..21accec2df40091b513553f810f861ba7b0e597b 100644 (file)
@@ -1,4 +1,4 @@
-<SCRIPT type="text/javascript">
+<script type="text/javascript">
 <!--
 function Loader()
 {
@@ -8,4 +8,4 @@ function Loader()
 window.setTimeout("Loader()", 2000);
 
 //-->
-</SCRIPT>
+</script>