From deb3ad53597a6c28dee45e8e0c9263e2d884cefa Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sun, 13 Jan 2013 14:37:36 +0000 Subject: [PATCH] Logout link added Logout link added to left of version no, next to logo in top right Clicking this triggers the logout function, which directs the browser to the same window location with ?logout QS The settings.php file is run again (via inclusion) and finding the QS var, sets the loggedIn var set to false (as a double measure to the session also being destroyed) and header location boots user back to login screen --- index.php | 2 +- lib/ice-coder.css | 1 + lib/ice-coder.js | 5 +++++ lib/settings.php | 9 ++++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 9d1f963..ab395e9 100644 --- a/index.php +++ b/index.php @@ -98,7 +98,7 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
-
v
+
logout : v
diff --git a/lib/ice-coder.css b/lib/ice-coder.css index 0d354bd..9306f2b 100644 --- a/lib/ice-coder.css +++ b/lib/ice-coder.css @@ -70,6 +70,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .header .plugins img {position: relative; display: inline-block; margin-right: 15px} .header .screenModeIcon {position: absolute; top: 5px; right: 178px; cursor: pointer} .header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbb} +.header .version a {font-size: 10px; color: #bbb; text-decoration: none} .header .logo {position: relative; margin: 5px 10px 0 5px; cursor: pointer} .files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; background-image: url('../images/files-arrow.png'); background-repeat: no-repeat; background-position: 100% 50%; overflow: hidden; z-index: 1; diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 378b608..93886a5 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1479,6 +1479,11 @@ var ICEcoder = { top.ICEcoder.serverMessage('chMod '+perms+' on
'+file.replace(top.iceRoot,"")); }, + // Logout of ICEcoder + logout: function() { + window.location = window.location + "?logout"; + }, + // Show a message message: function(msg) { alert(msg); diff --git a/lib/settings.php b/lib/settings.php index ca6ca34..2cac847 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -11,6 +11,13 @@ error_reporting(-1); // Start a session if we haven't already if(!isset($_SESSION)) {session_start();} +// Logout if that's the action we're taking +if (isset($_GET['logout'])) { + $_SESSION['loggedIn']=false; + session_destroy(); + header("Location: dirname(__FILE__)./?loggedOut"); +} + // Function to handle salted hashing define('SALT_LENGTH',9); function generateHash($plainText,$salt=null) { @@ -262,7 +269,7 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
v
Password" class="accountPassword">

- " class="button"> + " class="button">