Răsfoiți Sursa

Brought back multiple Logins

causefx 8 ani în urmă
părinte
comite
838192664d
10 a modificat fișierele cu 45 adăugiri și 50 ștergeri
  1. 10 10
      error.php
  2. 1 1
      lang/de.ini
  3. 1 1
      lang/en.ini
  4. 1 1
      lang/es.ini
  5. 1 1
      lang/fr.ini
  6. 1 1
      lang/it.ini
  7. 1 1
      lang/nl.ini
  8. 1 1
      lang/pl.ini
  9. 1 0
      settings.php
  10. 27 33
      user.php

+ 10 - 10
error.php

@@ -41,16 +41,16 @@ foreach(loadAppearance() as $key => $value) {
 //error stuff
 $requested = $_SERVER['REQUEST_URI'];
 $codes = array(
-       400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
-       401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
-       403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
-       404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
-       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
-       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
-       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
-       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
-       503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
-       504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
+       400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy','400'),
+       401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy','401'),
+       403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy','403'),
+       404 => array('Not Found', $requested . ' was not found on this server.', 'confused','404'),
+       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused','405'),
+       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy','408'),
+       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused','500'),
+       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused','502'),
+       503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused','503'),
+       504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused','504'),
        999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused', '401'),
 );
 $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";

+ 1 - 1
lang/de.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "Wir benötigen immer Hilfe bei der Übersetzung. Sollten S
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Hintergrund Ladebildschirm"
 HOVER_TEXT = "Einblendungs-Text"
-COOKIE_PASSWORD = "Cookie-Passwort"
+COOKIE_PASSWORD = "Cookie-Passwort - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Konto registrieren"
 ENTER_PASSWORD_TO_REGISTER = "Registrierungspasswort eingeben"
 SUBMIT = "Absenden"

+ 1 - 1
lang/en.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 1 - 1
lang/es.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 1 - 1
lang/fr.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 1 - 1
lang/it.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 1 - 1
lang/nl.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 1 - 1
lang/pl.ini

@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "Zawsze potrzebujemy pomocy z tłumaczeniami.  Jeżeli znas
 UPGRADE = "Ulepsz"
 LOADING_COLOR = "Tło ładowania"
 HOVER_TEXT = "Tekst przy najechaniu kursorem"
-COOKIE_PASSWORD = "Hasło ciasteczek"
+COOKIE_PASSWORD = "Hasło ciasteczek - used for Multiple Logins and Cookie Authorization"
 CREATE_USER = "Stwórz konto"
 ENTER_PASSWORD_TO_REGISTER = "Wpisz hasło by zarejestrować"
 SUBMIT = "Prześlij"

+ 1 - 0
settings.php

@@ -617,6 +617,7 @@ echo buildSettings(
 							'buttonType' => 'dark',
 							'buttonDrop' => '
 							<ul class="dropdown-menu">
+								<li class="dropdown-header">Choose a Theme Below</li>
 								<li id="open-themes" box="themes-box" onclick"" data-toggle="tooltip" data-placement="top" title="" data-original-title="Custom Themes Created by The Community"><a onclick="" href="#">Themes</a></li>
 								<li id="layerCakeDefault" data-toggle="tooltip" data-placement="top" title="" data-original-title="A 7 color theme based on Organizr"><a onclick="layerCake(\'Basic\',\'layerCake\');$(\'#customCSS_id\').attr(\'data-changed\', \'true\');" href="#">LAYER#CAKE Basic</a></li>
 								<li id="layerCakeCustom" data-toggle="tooltip" data-placement="top" title="" data-original-title="A 32 color theme based on Organizr"><a onclick="layerCake(\'Advanced\',\'layerCake\');$(\'#customCSS_id\').attr(\'data-changed\', \'true\');" href="#">LAYER#CAKE Advanced</a></li>

+ 27 - 33
user.php

@@ -450,40 +450,34 @@
 			if($this->is_user_active($username)===false) { return false; }
 			// logged in, but do the tokens match?
 			$token = $this->get_user_token($username);
-            if(isset($_COOKIE["Organizr"])){
-                if($_COOKIE["Organizr"] == $token){
-					// active, using the correct token -> authenticated
-					setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
-					return true;
-                }else{
-                    $this->error("cookie token mismatch for $username");
-                    unset($_COOKIE['Organizr']);
-                    setcookie('Organizr', '', time() - 3600, '/', DOMAIN);
-                    setcookie('Organizr', '', time() - 3600, '/');
-                    unset($_COOKIE['OrganizrU']);
-                    setcookie('OrganizrU', '', time() - 3600, '/', DOMAIN);
-                    setcookie('OrganizrU', '', time() - 3600, '/');
-                    unset($_COOKIE['cookiePassword']);
-                    setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
-                    setcookie("cookiePassword", '', time() - 3600, '/');
-					unset($_COOKIE['Auth']);
-		            setcookie("Auth", '', time() - 3600, '/', DOMAIN);
-		            setcookie("Auth", '', time() - 3600, '/');
-					unset($_COOKIE['mpt']);
-		            setcookie("mpt", '', time() - 3600, '/', DOMAIN);
-		            setcookie("mpt", '', time() - 3600, '/');
-                    return false;
-                }
-            }else{
-                if($token != $_SESSION["token"]) {
-                    $this->error("token mismatch for $username");
-                    return false;
-                }else{
-					// active, using the correct token -> authenticated
-	                 setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
-	                 return true;
+			//Check Token with Session
+			if($token == $_SESSION["token"]) { return true; }
+            if(MULTIPLELOGIN == "true"){
+                if(isset($_COOKIE["Organizr"]) && isset($_COOKIE["OrganizrU"]) && isset($_COOKIE["cookiePassword"])){
+                    if($_COOKIE["cookiePassword"] == COOKIEPASSWORD && strlen($_COOKIE["Organizr"]) == 32){
+                        return true;
+                    }else{
+                        $this->error("cookie token mismatch for $username");
+                        unset($_COOKIE['Organizr']);
+                        setcookie('Organizr', '', time() - 3600, '/', DOMAIN);
+                        setcookie('Organizr', '', time() - 3600, '/');
+                        unset($_COOKIE['OrganizrU']);
+                        setcookie('OrganizrU', '', time() - 3600, '/', DOMAIN);
+                        setcookie('OrganizrU', '', time() - 3600, '/');
+                        unset($_COOKIE['cookiePassword']);
+                        setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
+                        setcookie("cookiePassword", '', time() - 3600, '/');
+						unset($_COOKIE['Auth']);
+			            setcookie("Auth", '', time() - 3600, '/', DOMAIN);
+			            setcookie("Auth", '', time() - 3600, '/');
+						unset($_COOKIE['mpt']);
+			            setcookie("mpt", '', time() - 3600, '/', DOMAIN);
+			            setcookie("mpt", '', time() - 3600, '/');
+                        return false;
+                    }
 				}
-            }
+			}
+			return false;
 		}
 		/**
 		 * Unicode friendly(ish) version of strtolower