mirror of
https://github.com/xevidos/codiad.git
synced 2025-01-03 11:42:12 +01:00
Fixed JS error on login screen, added force logout if more than one session is open, fixed favicon, added session path.
This commit is contained in:
parent
1901373012
commit
dd638b6dc7
8 changed files with 84 additions and 11 deletions
12
common.php
12
common.php
|
@ -56,6 +56,10 @@
|
||||||
if(!defined('DATA')) {
|
if(!defined('DATA')) {
|
||||||
define('DATA', BASE_PATH . '/data');
|
define('DATA', BASE_PATH . '/data');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!defined('SESSIONS_PATH')) {
|
||||||
|
define('SESSIONS_PATH', BASE_PATH . '/data/sessions');
|
||||||
|
}
|
||||||
|
|
||||||
if(!defined('THEMES')){
|
if(!defined('THEMES')){
|
||||||
define("THEMES", BASE_PATH . "/themes");
|
define("THEMES", BASE_PATH . "/themes");
|
||||||
|
@ -76,7 +80,7 @@
|
||||||
|
|
||||||
public static function startSession() {
|
public static function startSession() {
|
||||||
Common::construct();
|
Common::construct();
|
||||||
|
|
||||||
global $cookie_lifetime;
|
global $cookie_lifetime;
|
||||||
if(isset($cookie_lifetime) && $cookie_lifetime != "") {
|
if(isset($cookie_lifetime) && $cookie_lifetime != "") {
|
||||||
ini_set("session.cookie_lifetime", $cookie_lifetime);
|
ini_set("session.cookie_lifetime", $cookie_lifetime);
|
||||||
|
@ -84,7 +88,7 @@
|
||||||
|
|
||||||
//Set a Session Name
|
//Set a Session Name
|
||||||
session_name(md5(BASE_PATH));
|
session_name(md5(BASE_PATH));
|
||||||
|
session_save_path( SESSIONS_PATH );
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
//Check for external authentification
|
//Check for external authentification
|
||||||
|
@ -164,7 +168,9 @@
|
||||||
$key = "";
|
$key = "";
|
||||||
if(isset($_GET['key'])){ $key = $_GET['key']; }
|
if(isset($_GET['key'])){ $key = $_GET['key']; }
|
||||||
if(!isset($_SESSION['user']) && !in_array($key,$api_keys)){
|
if(!isset($_SESSION['user']) && !in_array($key,$api_keys)){
|
||||||
exit('{"status":"error","message":"Authentication Error"}');
|
|
||||||
|
//exit('{"status":"error","message":"Authentication Error"}');
|
||||||
|
exit('{"status":"error","message":"Authentication Error<script>window.location.href = window.location.protocol + `' . "//" . Common::getConstant('BASE_URL') . '`</script>"}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ class Update {
|
||||||
$this->commits = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/commits/";
|
$this->commits = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/commits/";
|
||||||
$this->tags = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/tags/";
|
$this->tags = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/tags/";
|
||||||
$this->protocol = $this->CheckProtocol();
|
$this->protocol = $this->CheckProtocol();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -54,6 +54,11 @@ switch($_GET['action']){
|
||||||
<br><label><?php i18n("Changes on Codiad"); ?></label>
|
<br><label><?php i18n("Changes on Codiad"); ?></label>
|
||||||
<pre style="overflow: auto; max-height: 200px; max-width: 510px;"><?php echo $vars[0]['data']['message']; ?></pre>
|
<pre style="overflow: auto; max-height: 200px; max-width: 510px;"><?php echo $vars[0]['data']['message']; ?></pre>
|
||||||
<?php
|
<?php
|
||||||
|
} elseif( $vars[0]['data']['remoteversion'] === "" || $vars[0]['data']['remoteversion'] === null ) {
|
||||||
|
|
||||||
|
?>
|
||||||
|
<br><br><b><label><?php echo htmlentities("Error, could not check for updates. Please try again later. If this problem persists, then please contact the web administrator."); ?></label></b>
|
||||||
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<br><br><b><label><?php echo htmlentities("Your current version of Codiad is up to date."); ?></label></b>
|
<br><br><b><label><?php echo htmlentities("Your current version of Codiad is up to date."); ?></label></b>
|
||||||
|
|
0
components/update/update.php
Normal file → Executable file
0
components/update/update.php
Normal file → Executable file
|
@ -50,6 +50,9 @@ class User
|
||||||
$users = getJSON('users.php');
|
$users = getJSON('users.php');
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ($user['username']==$this->username && $user['password']==$this->password) {
|
if ($user['username']==$this->username && $user['password']==$this->password) {
|
||||||
|
|
||||||
|
$this->checkDuplicateSessions();
|
||||||
|
|
||||||
$pass = true;
|
$pass = true;
|
||||||
$_SESSION['user'] = $this->username;
|
$_SESSION['user'] = $this->username;
|
||||||
$_SESSION['lang'] = $this->lang;
|
$_SESSION['lang'] = $this->lang;
|
||||||
|
@ -66,6 +69,64 @@ class User
|
||||||
echo formatJSEND("error", "Incorrect Username or Password");
|
echo formatJSEND("error", "Incorrect Username or Password");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check duplicate sessions
|
||||||
|
*
|
||||||
|
* This function checks to see if the user is currently logged in
|
||||||
|
* on any other machine and if they are then log them off. This
|
||||||
|
* will fix the issue with the new auto save attempting to save both
|
||||||
|
* users at the same time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function checkDuplicateSessions() {
|
||||||
|
|
||||||
|
$all_sessions = array();
|
||||||
|
session_save_path( SESSIONS_PATH );
|
||||||
|
session_start();
|
||||||
|
$sessions = glob( SESSIONS_PATH . "/*" );
|
||||||
|
$this_session = session_id();
|
||||||
|
$username = "xevidos";
|
||||||
|
|
||||||
|
foreach($sessions as $session) {
|
||||||
|
|
||||||
|
//echo var_dump( $session ) . "\n\n";
|
||||||
|
|
||||||
|
if ( strpos( $session, "sess_") == false ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$session = str_replace( "sess_", "", $session );
|
||||||
|
$session = str_replace( SESSIONS_PATH . "/", "", $session );
|
||||||
|
//This skips temp files that aren't sessions
|
||||||
|
if( strpos( $session, "." ) == false ) {
|
||||||
|
|
||||||
|
if ( $session == $this_session ) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
session_save_path( SESSIONS_PATH );
|
||||||
|
session_id( $session );
|
||||||
|
session_start();
|
||||||
|
//echo var_dump( $_SESSION ) . "\n\n";
|
||||||
|
|
||||||
|
if ( ( isset( $_SESSION["user"] ) && $_SESSION["user"] == $username ) || empty( $_SESSION ) ) {
|
||||||
|
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
session_abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
session_id( $this_session );
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Create Account
|
// Create Account
|
||||||
|
@ -225,4 +286,4 @@ class User
|
||||||
{
|
{
|
||||||
return preg_replace('#[^A-Za-z0-9'.preg_quote('-_@. ').']#', '', $username);
|
return preg_replace('#[^A-Za-z0-9'.preg_quote('-_@. ').']#', '', $username);
|
||||||
}
|
}
|
||||||
}
|
}
|
0
favicon.ico
Normal file → Executable file
0
favicon.ico
Normal file → Executable file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -92,8 +92,13 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Run resize command to fix render issues
|
// Run resize command to fix render issues
|
||||||
codiad.editor.resize();
|
// Add a check to see if it is not undefined due to an
|
||||||
codiad.active.updateTabDropdownVisibility();
|
// error being generated on the login page.
|
||||||
|
if ( typeof( codiad.editor.resize() ) !== "undefined" ) {
|
||||||
|
|
||||||
|
codiad.editor.resize();
|
||||||
|
codiad.active.updateTabDropdownVisibility();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#settings').click(function(){
|
$('#settings').click(function(){
|
||||||
|
|
5
plugins/Codiad-CodeGit-master/.gitignore
vendored
5
plugins/Codiad-CodeGit-master/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
||||||
# Tests
|
|
||||||
tests/
|
|
||||||
shell/
|
|
||||||
|
|
||||||
config.log
|
|
Loading…
Reference in a new issue