From 4e292284eb02af9dfbb1264800d38787305b3c07 Mon Sep 17 00:00:00 2001 From: xevidos Date: Wed, 18 Jul 2018 17:00:52 -0400 Subject: [PATCH 1/6] Updated filemanager to handle downloading PDfs, opening icons, and fixed favicon. --- components/filemanager/init.js | 142 ++++++++++++++++----------------- favicon.ico | Bin 2 files changed, 71 insertions(+), 71 deletions(-) mode change 100755 => 100644 favicon.ico diff --git a/components/filemanager/init.js b/components/filemanager/init.js index 4b923b2..24cd5b2 100755 --- a/components/filemanager/init.js +++ b/components/filemanager/init.js @@ -4,86 +4,86 @@ * [root]/license.txt for more. This information must remain intact. */ -(function(global, $){ + (function(global, $){ + + var codiad = global.codiad; + + $(window) + .load(function() { + + codiad.filemanager.CodiadnoFiles = [ + //Files + 'exe', + 'pdf', + 'zip', + 'tar', + 'tar.gz', + ] + codiad.filemanager.CodiadnoImages = [ + //Images + 'ico', + 'icon', + 'jpg', + 'jpeg', + 'png', + 'gif', + 'bmp', + ] + codiad.filemanager.CodiadnoAudio = [ + //Music + 'aac', + 'aif', + 'mp3', + 'mp4', + 'wav', + 'ogg', + ] + codiad.filemanager.init(); + }); + - var codiad = global.codiad; - - $(window) - .load(function() { - codiad.filemanager.init(); - }); - - codiad.filemanager = { clipboard: '', - noFiles: [ - //Files - 'exe', - 'zip', - 'tar', - 'tar.gz', - ], - noImages: [ - //Images - 'jpg', - 'jpeg', - 'png', - 'gif', - 'bmp', - ], - noMusic: [ - //Music - 'aac', - 'aif', - 'mp3', - 'mp4', - 'wav', - 'ogg', - ], - - noOpen: [ - //Files - 'exe', - 'zip', - 'tar', - 'tar.gz', - //Images - 'jpg', - 'jpeg', - 'png', - 'gif', - 'bmp', - //Music - 'aac', - 'aif', - 'mp3', - 'mp4', - 'wav', - 'ogg', - ], - noBrowser: [ - //Images - 'jpg', - 'jpeg', - 'png', - 'gif', - 'bmp', - //Music - 'aac', - 'aif', - 'mp3', - 'mp4', - 'wav', - 'ogg', - ], - controller: 'components/filemanager/controller.php', dialog: 'components/filemanager/dialog.php', dialogUpload: 'components/filemanager/dialog_upload.php', init: function() { + + this.noAudio = [ + //Audio + 'aac', + 'aif', + 'mp3', + 'mp4', + 'wav', + 'ogg', + ], + this.noFiles = [ + //Files + 'exe', + 'pdf', + 'zip', + 'tar', + 'tar.gz', + ], + this.noImages = [ + //Images + 'ico', + 'icon', + 'jpg', + 'jpeg', + 'png', + 'gif', + 'bmp', + ], + + + this.noOpen = this.noAudio.concat( this.noFiles, this.noImages ), + this.noBrowser = this.noAudio.concat( this.noImages ), + // Initialize node listener this.nodeListener(); // Load uploader @@ -471,7 +471,7 @@ let type = ""; var ext = this.getExtension(path).toLowerCase(); - if ( this.noMusic.includes(ext) ) { + if ( this.noAudio.includes(ext) ) { type = 'music_preview'; } else if ( this.noImages.includes(ext) ) { diff --git a/favicon.ico b/favicon.ico old mode 100755 new mode 100644 From 190137301206ae9559a0f368ea82b0e6d1ba76d0 Mon Sep 17 00:00:00 2001 From: xevidos Date: Wed, 18 Jul 2018 17:06:28 -0400 Subject: [PATCH 2/6] Updated filemanager to handle downloading PDfs, opening icons, and fixed favicon. --- components/filemanager/init.js | 28 ---------------------------- favicon.ico | Bin 1641 -> 1150 bytes 2 files changed, 28 deletions(-) diff --git a/components/filemanager/init.js b/components/filemanager/init.js index 24cd5b2..c3ec920 100755 --- a/components/filemanager/init.js +++ b/components/filemanager/init.js @@ -10,34 +10,6 @@ $(window) .load(function() { - - codiad.filemanager.CodiadnoFiles = [ - //Files - 'exe', - 'pdf', - 'zip', - 'tar', - 'tar.gz', - ] - codiad.filemanager.CodiadnoImages = [ - //Images - 'ico', - 'icon', - 'jpg', - 'jpeg', - 'png', - 'gif', - 'bmp', - ] - codiad.filemanager.CodiadnoAudio = [ - //Music - 'aac', - 'aif', - 'mp3', - 'mp4', - 'wav', - 'ogg', - ] codiad.filemanager.init(); }); diff --git a/favicon.ico b/favicon.ico index 4747e7c935b576064716cf512d689727d7c43c74..80b1d454fa681ab91aab016755bd470dbb4320c1 100644 GIT binary patch literal 1150 zcmbu8J!=9%5Qg_8g^hUC34Rg5;sRnJq_DQ}KiDXOm-H6mU8994T8gcOU}s_DPw=y_ z(#}3r{(-#NS+j$NByzaNd%N?_JTN!h3Sr2{G=+RWi?=5sEFpv~B`xV(e7OlBb3YdV z@rc&z^=rG`cBMR@a)~uf^HcVOU@!>Vwn69rluoA+3WZe7H+!b~*=&YrG44&R^9sFK5B|ZnukSwaPKgrP*w9yj(8zS@HRN9<5eOd+7Cgs8lK(>%R3~tJP2} z7AdcIn#p7`;re_0bUM|u=KeRE&7XWc9!DaP;QYP$xvq;wqrvs%av8(nkmKLxw_2?@ zpG+okI-TG+4v3|5Hk;-ARj=H?=Xod;3S5&)rO@eg(C_z=$z<5i<#HGd20A`lmi3|M h>USshcs#zy|HF}b_bG?iNAB*0m6wOU#^)l2^aYlZ%pd>& literal 1641 zcmchXziR?f49DL|2N&_C6Z}O52MgjLbZ~a@e{fL*uiYKQyQLkh)`k6c9?K(#AqQpGUB7j9L>xr;3+?I$kD|p)L0eP3cwuycWQ|GD&f1NgFCU!wMOd zq2KRQhNK+N^O7~YW)LQmiH?@tdcW3|rt4_CU=T*5k#@@*X0w_0;ao@$=7c+)4xR3d z(b0CvAPk2??M{1;K8?p?gkG=b;+(1*#DgXD_AONHBctZ8`>;eNEd_oME|<#)l}bg2 zZa2IriV&vLsa6;a2Gp_}M!SEV+yye~#MNq*-nTme!Z1V-*-uZa)zZ;YudY~iBaUN) zZnvxBYqc63an6ukF$m3OQ^&O1ZCblxl>0ph0(?rR`=2L~!ZmZ`UiZ+M(;b*FNwmLj VEpRINw(}QHdPv>c=5o8-{R56!=&1kz From dd638b6dc7b8176c64fea9686eb5e86dca683369 Mon Sep 17 00:00:00 2001 From: xevidos Date: Mon, 23 Jul 2018 22:03:13 -0400 Subject: [PATCH 3/6] Fixed JS error on login screen, added force logout if more than one session is open, fixed favicon, added session path. --- common.php | 12 +++-- components/update/class.update.php | 1 + components/update/dialog.php | 5 ++ components/update/update.php | 0 components/user/class.user.php | 63 ++++++++++++++++++++++- favicon.ico | Bin js/system.js | 9 +++- plugins/Codiad-CodeGit-master/.gitignore | 5 -- 8 files changed, 84 insertions(+), 11 deletions(-) mode change 100644 => 100755 components/update/update.php mode change 100644 => 100755 favicon.ico delete mode 100755 plugins/Codiad-CodeGit-master/.gitignore diff --git a/common.php b/common.php index 3e73c65..bbb2648 100755 --- a/common.php +++ b/common.php @@ -56,6 +56,10 @@ if(!defined('DATA')) { define('DATA', BASE_PATH . '/data'); } + + if(!defined('SESSIONS_PATH')) { + define('SESSIONS_PATH', BASE_PATH . '/data/sessions'); + } if(!defined('THEMES')){ define("THEMES", BASE_PATH . "/themes"); @@ -76,7 +80,7 @@ public static function startSession() { Common::construct(); - + global $cookie_lifetime; if(isset($cookie_lifetime) && $cookie_lifetime != "") { ini_set("session.cookie_lifetime", $cookie_lifetime); @@ -84,7 +88,7 @@ //Set a Session Name session_name(md5(BASE_PATH)); - + session_save_path( SESSIONS_PATH ); session_start(); //Check for external authentification @@ -164,7 +168,9 @@ $key = ""; if(isset($_GET['key'])){ $key = $_GET['key']; } 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"}'); } } diff --git a/components/update/class.update.php b/components/update/class.update.php index 9d2bb57..bf95f6c 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -42,6 +42,7 @@ class Update { $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->protocol = $this->CheckProtocol(); + } ////////////////////////////////////////////////////////////////// diff --git a/components/update/dialog.php b/components/update/dialog.php index 0886d7b..3c370d5 100755 --- a/components/update/dialog.php +++ b/components/update/dialog.php @@ -54,6 +54,11 @@ switch($_GET['action']){
+

+

diff --git a/components/update/update.php b/components/update/update.php old mode 100644 new mode 100755 diff --git a/components/user/class.user.php b/components/user/class.user.php index a5557bb..92a0be3 100755 --- a/components/user/class.user.php +++ b/components/user/class.user.php @@ -50,6 +50,9 @@ class User $users = getJSON('users.php'); foreach ($users as $user) { if ($user['username']==$this->username && $user['password']==$this->password) { + + $this->checkDuplicateSessions(); + $pass = true; $_SESSION['user'] = $this->username; $_SESSION['lang'] = $this->lang; @@ -66,6 +69,64 @@ class User 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 @@ -225,4 +286,4 @@ class User { return preg_replace('#[^A-Za-z0-9'.preg_quote('-_@. ').']#', '', $username); } -} +} \ No newline at end of file diff --git a/favicon.ico b/favicon.ico old mode 100644 new mode 100755 diff --git a/js/system.js b/js/system.js index 5a93779..61e67c4 100755 --- a/js/system.js +++ b/js/system.js @@ -92,8 +92,13 @@ }); // Run resize command to fix render issues - codiad.editor.resize(); - codiad.active.updateTabDropdownVisibility(); + // 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" ) { + + codiad.editor.resize(); + codiad.active.updateTabDropdownVisibility(); + } }); $('#settings').click(function(){ diff --git a/plugins/Codiad-CodeGit-master/.gitignore b/plugins/Codiad-CodeGit-master/.gitignore deleted file mode 100755 index a023e48..0000000 --- a/plugins/Codiad-CodeGit-master/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Tests -tests/ -shell/ - -config.log \ No newline at end of file From 6030f3de74038d8e90f95d0767ec2d383346218f Mon Sep 17 00:00:00 2001 From: xevidos Date: Tue, 24 Jul 2018 08:32:06 -0400 Subject: [PATCH 4/6] Added a fetch to get the latest update script, on update the update file deletes. --- components/update/class.update.php | 18 ++++++++++++++++++ components/update/update.php | 3 +++ 2 files changed, 21 insertions(+) diff --git a/components/update/class.update.php b/components/update/class.update.php index bf95f6c..2eff4a1 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -24,6 +24,7 @@ class Update { public $archive = ""; public $version = ""; public $protocol = ""; + public $update_fiile = ""; ////////////////////////////////////////////////////////////////// // METHODS @@ -41,6 +42,7 @@ class Update { $this->archive = "https://gitlab.telaaedifex.com/xevidos/codiad/-/archive/master/codiad-master.zip"; $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->update_file = "https://gitlab.telaaedifex.com/xevidos/codiad/raw/master/components/update/update.php"; $this->protocol = $this->CheckProtocol(); } @@ -126,6 +128,22 @@ class Update { $nightly = false; $response = $this->getRemoteVersion("check"); + if ( $response["name"] > $current_version ) { + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $this->update_file); + //curl_setopt($curl, CURLOPT_POSTFIELDS, ""); + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13'); + $content = curl_exec($curl); + curl_close($curl); + + unlink( "./update.php" ); + file_put_contents( "./update.php", $content ); + } //echo var_dump( $response ); diff --git a/components/update/update.php b/components/update/update.php index 43e8642..85c5515 100755 --- a/components/update/update.php +++ b/components/update/update.php @@ -305,6 +305,9 @@ class updater { //Trigger update $this->update(); + + //Delete File + unlink( __FILE__ ); } function check_protocol() { From dd9070f85b5c344202187f96d4a45c2761051571 Mon Sep 17 00:00:00 2001 From: xevidos Date: Tue, 24 Jul 2018 08:33:02 -0400 Subject: [PATCH 5/6] Updated version --- components/update/class.update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/update/class.update.php b/components/update/class.update.php index 2eff4a1..1aad299 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -12,7 +12,7 @@ class Update { // CONSTANTS ////////////////////////////////////////////////////////////////// - CONST VERSION = "v.2.8.7"; + CONST VERSION = "v.2.8.9"; ////////////////////////////////////////////////////////////////// // PROPERTIES From e16617d6c2954ceb189e8882f86339463ba3f2f9 Mon Sep 17 00:00:00 2001 From: Isaac Brown Date: Tue, 24 Jul 2018 08:36:39 -0400 Subject: [PATCH 6/6] Revert "Updated version" This reverts commit dd9070f85b5c344202187f96d4a45c2761051571 --- components/update/class.update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/update/class.update.php b/components/update/class.update.php index 1aad299..2eff4a1 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -12,7 +12,7 @@ class Update { // CONSTANTS ////////////////////////////////////////////////////////////////// - CONST VERSION = "v.2.8.9"; + CONST VERSION = "v.2.8.7"; ////////////////////////////////////////////////////////////////// // PROPERTIES