Added site renaming, Added sessions folder checks, Updated wiki url, Updated readme

This commit is contained in:
xevidos 2018-07-27 13:59:08 -04:00
parent cf653b5776
commit 7c01c4c809
9 changed files with 81 additions and 15 deletions

View file

@ -27,12 +27,25 @@ Task List:
* Add ability to center bottom of code.
* Add ability to hide cursors when in collaboration mode.
* Add ability to login with LDAP.
* Add ability to rename site.
* Add ability to save users in database.
* -Add ability to see what people are highlighting in collaboration mode.
* Add custom market.
* Add if file could not be saved 5 times close the editor.
* Add mobile compatibility.
* Clean up Collaborative compatibility.
* Clean up update script.
* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit)
* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit)
* Fix site settings identification issue.
Completed:
* Add Auto Save.
* Add Self Updating Script.
* Add Site renaming.
* Fix Auto Complete.
* Fix JS errors already showing.
* Update for PHP 7.2.

View file

@ -4,9 +4,6 @@
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Common::startSession();

View file

@ -17,7 +17,8 @@
amplify.subscribe('settings.changed', function(){
//React here on changed settings
location.reload();
codiad.auto_save.init();
});
codiad.auto_save.init();
@ -27,6 +28,7 @@
// Allows relative `this.path` linkage
auto_save_trigger: null,
invalid_states: [ "", " ", null, undefined ],
path: curpath,
saving: false,
settings: {
@ -39,6 +41,7 @@
this.get_settings();
//console.log( this.settings.autosave );
// Check if the auto save setting is true or false
// Also check to see if the editor is any of the invalid states
if( this.settings.autosave === false || this.settings.autosave === "false" ) {
window.clearInterval( this.auto_save_trigger );
@ -74,7 +77,7 @@
auto_save: function() {
if( this.settings.toggle === false ) {
if( this.settings.toggle === false || this.settings.autosave === false || codiad.auto_save.invalid_states.includes( codiad.editor.getContent() ) ) {
return;
}
@ -86,6 +89,7 @@
this.saving = false;
return;
}
let tabs = document.getElementsByClassName( "tab-item" );
let path = codiad.active.getPath();
let content = codiad.editor.getContent();

View file

@ -120,7 +120,7 @@ if (!file_exists($users) && !file_exists($projects) && !file_exists($active)) {
if ( ! is_dir( $sessions ) ) {
mkdir( $sessions, 0755 );
mkdir( $sessions, 00755 );
}
//////////////////////////////////////////////////////////////////

View file

@ -87,7 +87,7 @@
"title": "Help",
"admin": false,
"icon": "icon-help",
"onclick": "window.open('https://github.com/Codiad/Codiad/wiki');"
"onclick": "window.open('https://gitlab.telaaedifex.com/xevidos/codiad/wikis/home');"
},
{
"title": "Logout",

View file

@ -196,7 +196,7 @@ class updater {
if ( ! is_dir( $sessions ) ) {
mkdir( $sessions, 755 );
mkdir( $sessions, 00755 );
}
/**

View file

@ -44,7 +44,49 @@ class User
public function Authenticate()
{
if ( ! is_dir( SESSIONS_PATH ) ) {
mkdir( SESSIONS_PATH, 00755 );
}
$permissions = array(
"755",
"0755"
);
$server_user = posix_getpwuid( posix_geteuid() );
$sessions_permissions = substr( sprintf( '%o', fileperms( SESSIONS_PATH ) ), -4 );
$sessions_owner = posix_getpwuid( fileowner( SESSIONS_PATH ) );
if ( ! ( $sessions_owner === $server_user ) ) {
try {
chown( SESSIONS_PATH, $server_user );
echo( formatJSEND("error", "Error, incorrect owner of sessions folder. The sessions folder owner has been sucessfully changed. Please log in again." ) );
return;
} catch( Exception $e ) {
echo( formatJSEND("error", "Error, incorrect owner of sessions folder. Expecting: $server_user, Recieved: " . $sessions_owner ) );
return;
}
}
if ( ! in_array( $sessions_permissions, $permissions ) ) {
try {
chmod( SESSIONS_PATH, 00755 );
echo( formatJSEND("error", "Error, incorrect permissions on sessions folder. The sessions folder permissions have been sucessfully changed. Please log in again." ) );
return;
} catch( Exception $e ) {
echo( formatJSEND("error", "Error, incorrect permissions on sessions folder. Expecting: 0755, Recieved: " . $sessions_permissions ) );
return;
}
}
$pass = false;
$this->EncryptPassword();
$users = getJSON('users.php');
@ -74,7 +116,7 @@ class User
}
}
/**S
/**
* Check duplicate sessions
*
* This function checks to see if the user is currently logged in
@ -126,7 +168,7 @@ class User
session_id( SESSION_ID );
session_start();
}
//////////////////////////////////////////////////////////////////
// Create Account
//////////////////////////////////////////////////////////////////

View file

@ -35,7 +35,7 @@ date_default_timezone_set("America/Chicago");
//define("AUTH_PATH", "/path/to/customauth.php");
// Site Name
//define("SITE_NAME", "My Codiad Editor");
define("SITE_NAME", "Codiad");
//////////////////////////////////////////////////////////////////
// ** DO NOT EDIT CONFIG BELOW **

View file

@ -21,13 +21,23 @@ if(isset($_SESSION['theme'])) {
$theme = $_SESSION['theme'];
}
// Get Site name if set
if( defined( "SITE_NAME" ) && ! ( SITE_NAME === "" || SITE_NAME === null ) ) {
$site_name = SITE_NAME;
} else {
$site_name = "Codiad";
}
?>
<!doctype html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php i18n("CODIAD"); ?></title>
<title><?php i18n( $site_name ); ?></title>
<script>console.log( '<?php echo $site_name;?>' )</script>
<?php
// Load System CSS Files
$stylesheets = array("jquery.toastmessage.css","reset.css","fonts.css","screen.css");