diff --git a/README.html b/README.html deleted file mode 100755 index fa798ad..0000000 --- a/README.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - Read Me - - -

Codaid

-

- This is the Telaaedifex team's custom version of Codiad. Codiad is a web-based IDE framework with a small footprint and minimal requirements.
-
- Codiad was built with simplicity in mind, allowing for fast, interactive development without the massive overhead of some of the larger desktop editors. That being said even users of IDE's such as Eclipse, NetBeans and Aptana are finding Codiad's simplicity to be a huge benefit. While simplicity was key, we didn't skimp on features and have a team of dedicated developers actively adding more.
-
- For more information on the project please check out the check out the Wiki.
-
- Distributed under the MIT-Style License. See LICENSE.txt file for more information.
-
- When you see a - in front of a task that means it is a possibility but we aren't sure we will add it yet.
-
- Task List:
-

-

- - \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 0000000..cca7245 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +Codaid + +This is the Telaaedifex team's custom version of Codiad. Codiad is a web-based IDE framework with a small footprint and minimal requirements. + +Codiad was built with simplicity in mind, allowing for fast, interactive development without the massive overhead of some of the larger desktop editors. That being said even users of IDE's such as Eclipse, NetBeans and Aptana are finding Codiad's simplicity to be a huge benefit. While simplicity was key, we didn't skimp on features and have a team of dedicated developers actively adding more. + +For more information on the project please check out the check out the Wiki. + +Distributed under the MIT-Style License. See LICENSE.txt file for more information. + +Features: + +* 132 Native programming languages supported. +* Auto Complete ( CTRL + Space ) +* Auto Save +* Collaborative Editing +* Multi Cursor +* PHP 7.2 Compatibility +* Self updating +* Split editor mode +* Themes + +When you see a - in front of a task that means it is a possibility but we aren't sure we will add it yet. + +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 mobile compatibility. + +* Clean up Collaborative compatibility +* Clean up update script. + +* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit) \ No newline at end of file diff --git a/common.php b/common.php index 427c8ac..30f5f76 100755 --- a/common.php +++ b/common.php @@ -4,7 +4,10 @@ * 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(); ////////////////////////////////////////////////////////////////// diff --git a/components/autocomplete/init.js b/components/autocomplete/init.js index e010819..1b77d51 100755 --- a/components/autocomplete/init.js +++ b/components/autocomplete/init.js @@ -23,7 +23,7 @@ // Show a popup with word completion suggestions. // ////////////////////////////////////////////////////////////////// - + codiad.autocomplete = { wordRegex: /[^a-zA-Z_0-9\$]+/, @@ -75,7 +75,12 @@ this.show(); // handle click-out autoclosing. - var fn = function () { + var fn = function ( event ) { + let keycodes = [ 9, 10, 13 ] + + /*if( ! keycodes.includes( event.keyCode ) ) { + return; + }*/ _this.hide(); $(window).off('click', fn); }; @@ -236,14 +241,26 @@ }, onDocumentChange: function (e) { - if (e.data.text.search(/^\s+$/) !== -1) { + + if ( e.data === undefined || e.data === null || e.data.text.search(/^\s+$/) !== -1) { this.hide(); return; } var position = null; if (e.data.action === 'insertText') { - position = e.data.range.end; + + if( codiad.autosave.saving === false ) { + position = e.data.range.end; + } else { + var start = new Date().getTime(); + for (var i = 0; i < 1e7; i++) { + if ((new Date().getTime() - start) > 50){ + break; + } + } + position = e.data.range.end; + } } else if (e.data.action === 'removeText') { position = e.data.range.start; } else { @@ -676,4 +693,4 @@ }; -})(this, jQuery); +})(this, jQuery); \ No newline at end of file diff --git a/components/autosave/init.js b/components/autosave/init.js new file mode 100755 index 0000000..5679edf --- /dev/null +++ b/components/autosave/init.js @@ -0,0 +1,112 @@ +/* + * Copyright (c) Codiad, Kent Safranski (codiad.com), and Isaac Brown (telaaedifex.com), distributed + * as-is and without warranty under the MIT License. See + * [root]/license.txt for more. This information must remain intact. + */ + +(function(global, $){ + + // Define core + var codiad = global.codiad, + scripts= document.getElementsByTagName('script'), + path = scripts[scripts.length-1].src.split('?')[0], + curpath = path.split('/').slice(0, -1).join('/')+'/'; + + // Instantiates plugin + $(function() { + + amplify.subscribe('settings.changed', function(){ + //React here on changed settings + location.reload(); + }); + + codiad.auto_save.init(); + }); + + codiad.auto_save = { + + // Allows relative `this.path` linkage + path: curpath, + saving: false, + settings: { + autosave: true, + toggle: true, + }, + + init: function() { + + this.get_settings(); + // Check if the auto save setting is true or false + if( this.settings.autosave === false || this.settings.autosave === "false" ) { + return; + } + + $(window).focus(function() { + + //Turn auto save off if the user leaves the tab. + codiad.auto_save.settings.toggle = false; + console.log( 'Auto save resumed' ); + }); + + $(window).blur(function() { + + //Turn auto save off if the user leaves the tab. + codiad.auto_save.settings.toggle = false; + console.log( 'Auto save paused' ); + }); + + //let editor = document.getElementsByClassName( 'ace_content' )[0]; + let auto_save_trigger = setInterval( this.auto_save, 256 ); + }, + + /** + * + * This is where the core functionality goes, any call, references, + * script-loads, etc... + * + */ + + auto_save: function() { + + if( this.settings.toggle === false ) { + + return; + } + + this.saving = true; + + if ( codiad.active.getPath() === null ) { + + this.saving = false; + return; + } + let tabs = document.getElementsByClassName( "tab-item" ); + let path = codiad.active.getPath(); + let content = codiad.editor.getContent(); + + codiad.active.save; + codiad.filemanager.saveFile(path, content, localStorage.removeItem(path), false); + var session = codiad.active.sessions[path]; + if(typeof session != 'undefined') { + session.untainted = content; + session.serverMTime = session.serverMTime; + if (session.listThumb) session.listThumb.removeClass('changed'); + if (session.tabThumb) session.tabThumb.removeClass('changed'); + } + + this.saving = false; + }, + + get_settings: function() { + + var _this = this; + + $.each(['autosave'], function(idx, key) { + var localValue = localStorage.getItem('codiad.settings.' + key); + if (localValue !== null) { + _this.settings[key] = localValue; + } + }); + } + }; +})(this, jQuery); \ No newline at end of file diff --git a/components/install/process.php b/components/install/process.php index 1b95b78..b8b2ef1 100755 --- a/components/install/process.php +++ b/components/install/process.php @@ -120,7 +120,7 @@ if (!file_exists($users) && !file_exists($projects) && !file_exists($active)) { if ( ! is_dir( $sessions ) ) { - mkdir( $sessions, 755 ); + mkdir( $sessions, 0755 ); } ////////////////////////////////////////////////////////////////// @@ -145,7 +145,7 @@ if (!file_exists($users) && !file_exists($projects) && !file_exists($active)) { $config_data = ' + + + + + + + + diff --git a/components/update/class.update.php b/components/update/class.update.php index b1f18b1..29c4251 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -12,7 +12,7 @@ class Update { // CONSTANTS ////////////////////////////////////////////////////////////////// - CONST VERSION = "v.2.9.1"; + CONST VERSION = "v.2.9.0"; ////////////////////////////////////////////////////////////////// // PROPERTIES diff --git a/components/update/dialog.php b/components/update/dialog.php index b2d37b3..f78237b 100755 --- a/components/update/dialog.php +++ b/components/update/dialog.php @@ -58,9 +58,9 @@ switch($_GET['action']){ ?>

+
+ + diff --git a/components/user/class.user.php b/components/user/class.user.php index b4b53ea..c1b3108 100755 --- a/components/user/class.user.php +++ b/components/user/class.user.php @@ -285,4 +285,4 @@ class User { return preg_replace('#[^A-Za-z0-9'.preg_quote('-_@. ').']#', '', $username); } -} \ No newline at end of file +} diff --git a/components/user/dialog.php b/components/user/dialog.php index fb8dc2c..e1fcd48 100755 --- a/components/user/dialog.php +++ b/components/user/dialog.php @@ -5,7 +5,7 @@ * as-is and without warranty under the MIT License. See * [root]/license.txt for more. This information must remain intact. */ - + require_once('../../common.php'); ////////////////////////////////////////////////////////////////// diff --git a/js/jsend.js b/js/jsend.js index 62bb2e1..fcc3cd5 100755 --- a/js/jsend.js +++ b/js/jsend.js @@ -10,6 +10,12 @@ parse: function(d) { // (Data) var obj = $.parseJSON(d); + + if( obj !== undefined && obj !== null ) { + + return; + } + if (obj.debug !== undefined && Array.isArray(obj.debug)) { var debug = obj.debug.join('\nDEBUG: '); if(debug !== '') { diff --git a/js/system.js b/js/system.js index 61e67c4..f552f33 100755 --- a/js/system.js +++ b/js/system.js @@ -94,7 +94,7 @@ // Run resize command to fix render issues // Add a check to see if it is not undefined due to an // error being generated on the login page. - if ( typeof( codiad.editor.resize() ) !== "undefined" ) { + if ( codiad.editor !== undefined && codiad.editor !== null ) { codiad.editor.resize(); codiad.active.updateTabDropdownVisibility();
+ +