mirror of
https://github.com/xevidos/codiad.git
synced 2024-12-21 21:32:17 +01:00
Fixed dev branch sync
This commit is contained in:
parent
9a78c22f5b
commit
ffbb309ba2
306 changed files with 1217 additions and 52584 deletions
|
@ -610,7 +610,7 @@ class Filemanager extends Common
|
|||
$path = str_replace('\\', '/', $path);
|
||||
|
||||
// allow only valid chars in paths$
|
||||
$path = preg_replace('/[^A-Za-z0-9\-\._\/]/', '', $path);
|
||||
$path = preg_replace('/[^A-Za-z0-9\-\._\/\ ]/', '', $path);
|
||||
// maybe this is not needed anymore
|
||||
// prevent Poison Null Byte injections
|
||||
$path = str_replace(chr(0), '', $path);
|
||||
|
|
|
@ -71,6 +71,21 @@ switch($_GET['action']){
|
|||
<button class="btn-right" onclick="codiad.modal.unload();return false;"><?php i18n("Close"); ?></button>
|
||||
<?php
|
||||
break;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Preview
|
||||
//////////////////////////////////////////////////////////////////
|
||||
case 'music_preview':
|
||||
?>
|
||||
<label><?php i18n("Inline Preview"); ?></label>
|
||||
<div><br><br>
|
||||
<audio controls>
|
||||
<source src="<?php echo(str_replace(BASE_PATH . "/", "", WORKSPACE) . "/" . $_GET['path']); ?>">
|
||||
</audio>
|
||||
<br><br></div>
|
||||
<button class="btn-right" onclick="codiad.modal.unload();return false;"><?php i18n("Close"); ?></button>
|
||||
<?php
|
||||
break;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Overwrite
|
||||
|
|
|
@ -12,14 +12,73 @@
|
|||
.load(function() {
|
||||
codiad.filemanager.init();
|
||||
});
|
||||
|
||||
|
||||
|
||||
codiad.filemanager = {
|
||||
|
||||
clipboard: '',
|
||||
|
||||
noOpen: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'exe', 'zip', 'tar', 'tar.gz'],
|
||||
noBrowser: ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
|
||||
|
||||
|
||||
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',
|
||||
|
@ -386,7 +445,7 @@
|
|||
this.openInModal(path);
|
||||
}
|
||||
} else {
|
||||
codiad.message.error(i18n('Unable to open file in Browser'));
|
||||
codiad.message.error(i18n('Unable to open file in Browser while using absolute path.'));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -408,8 +467,20 @@
|
|||
});
|
||||
},
|
||||
openInModal: function(path) {
|
||||
|
||||
let type = "";
|
||||
var ext = this.getExtension(path).toLowerCase();
|
||||
|
||||
if ( this.noMusic.includes(ext) ) {
|
||||
|
||||
type = 'music_preview';
|
||||
} else if ( this.noImages.includes(ext) ) {
|
||||
|
||||
type = 'preview';
|
||||
}
|
||||
|
||||
codiad.modal.load(250, this.dialog, {
|
||||
action: 'preview',
|
||||
action: type,
|
||||
path: path
|
||||
});
|
||||
},
|
||||
|
|
0
data/cache/Codiad-Archives-master.current
vendored
0
data/cache/Codiad-Archives-master.current
vendored
0
data/cache/Codiad-CodeGit-master.current
vendored
0
data/cache/Codiad-CodeGit-master.current
vendored
0
data/cache/Codiad-ColorPicker-master.current
vendored
0
data/cache/Codiad-ColorPicker-master.current
vendored
0
data/cache/Codiad-DragDrop-master.current
vendored
0
data/cache/Codiad-DragDrop-master.current
vendored
0
data/cache/Codiad-Duplicate-master.current
vendored
0
data/cache/Codiad-Duplicate-master.current
vendored
0
data/cache/Codiad-Macro-master.current
vendored
0
data/cache/Codiad-Macro-master.current
vendored
0
data/cache/Codiad-Permissions-master.current
vendored
0
data/cache/Codiad-Permissions-master.current
vendored
0
data/cache/Codiad-Terminal-master.current
vendored
0
data/cache/Codiad-Terminal-master.current
vendored
0
data/cache/Codiad-Together-master.current
vendored
0
data/cache/Codiad-Together-master.current
vendored
0
data/cache/auto_save.current
vendored
0
data/cache/auto_save.current
vendored
0
data/cache/market.current
vendored
0
data/cache/market.current
vendored
0
data/cache/market.last
vendored
0
data/cache/market.last
vendored
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
i:1531493655;
|
|
@ -1 +0,0 @@
|
|||
|user:xevidos|>521a72d0c807e2f9d68b250337d72b6f>
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1 +0,0 @@
|
|||
s:0:"";
|
|
@ -1,53 +0,0 @@
|
|||
|filename:xevidos|user:%2Fvar%2Fwww%2Fhtml%2Findex.php|>d63bfda1e19a710e4869b47822cbabf1>
|
||||
|filename:test|user:%2Fvar%2Fwww%2Fhtml%2Findex.php|>ec2c158db3453f8ce0e25d234ead42b7>
|
||||
|filename:sabbakilam|user:%2Fvar%2Fwww%2Fhtml%2Fmusic%2FmethodsHELPER.js|>83e043f141603a9150e0718bc09bdac0>
|
||||
|filename:xevidos|user:web2%2Findex.php|>c411bfdc2e7d453914f61c6ac1113793>
|
||||
|filename:sabbakilam|user:web2%2Findex.html|>23843b6cae13d579283d820ae8604f11>
|
||||
|filename:TrevorBeresford|user:web2%2Findex.php|>3c0811e1791db35b940af5330f4ea307>
|
||||
|filename:xevidos|user:web2%2Findex.html|>dcbd2e14b07c72b85ad7b5cd989cfd09>
|
||||
|filename:TrevorBeresford|user:web2%2Findex.html|>6117d79a736608652f0e2b84f18c2ee6>
|
||||
|filename:xevidos|user:web2%2Fjs%2FInitialize.js|>e2693b5a21a0545b9c1d44f2647703d0>
|
||||
|filename:TrevorBeresford|user:web2%2Fjs%2FInitialize.js|>fbf7364839635641f96c195cbdcb7669>
|
||||
|filename:sabbakilam|user:web2%2Fjs%2FInitialize.js|>a25fdf5bb2a3722799c1dd377f337c6a>
|
||||
|filename:xevidos|user:web2%2Fjs%2FQualify.js|>a65fec1802fb6a7362b302cfc0d3dacc>
|
||||
|filename:xevidos|user:web2%2Fcss%2Fstyles.css|>06b4bf234c856dfc262ab9a104e7515d>
|
||||
|filename:TrevorBeresford|user:web2%2Fjs%2FQualify.js|>0502dab6244f6cf47a408682bde2da19>
|
||||
|filename:sabbakilam|user:web2%2FL.js|>357768ee57f499a81982c891d2e8212d>
|
||||
|filename:xevidos|user:web2%2Fjs%2FUpdate.js|>3fa8e3235f78fded26b0a95b3550a30c>
|
||||
|filename:sabbakilam|user:web2%2Fcss%2Fstyles.css|>f3895333c762ec423739ab7db5496006>
|
||||
|filename:xevidos|user:mobile_programming%2Fcss%2Fstyles.css|>ad20d395c6cbf9716cdccffe8776952e>
|
||||
|filename:xevidos|user:mobile_programming%2Findex.html|>df0d7fda7f488203b2a32d3f9f6f8822>
|
||||
|filename:TrevorBeresford|user:mobile_programming%2Findex.html|>142ce5a5e09022f6b27c33c5bab75df2>
|
||||
|filename:sabbakilam|user:mobile_programming%2Fcss%2Fstyles.css|>e1d97e7fc378fc2d6bae15b009dfe6b2>
|
||||
|filename:ithollie|user:mobile_programming%2Fcss%2Fstyles.css|>3bad7b063c15d3531895bc5ad94efae5>
|
||||
|filename:sabbakilam|user:mobile_programming%2Findex.html|>2d9e916777b9f877e8c43fdc5820f3ed>
|
||||
|filename:xevidos|user:mobile_programming%2FL.js|>eaacf5898c2cc7e26f68fe871e166773>
|
||||
|filename:xevidos|user:mobile_programming%2Fjs%2FInitialize.js|>00f67b79a2f9c0defb5cb9e35a1eedc9>
|
||||
|filename:ithollie|user:mobile_programming%2Fjs%2FInitialize.js|>1e7e459cde205d91c481b9015511414b>
|
||||
|filename:TrevorBeresford|user:mobile_programming%2Fjs%2FInitialize.js|>8de74798a6eade7a47588beedfd958f4>
|
||||
|filename:sabbakilam|user:mobile_programming%2Fjs%2FInitialize.js|>77df941f7befd27ec8acf4166d618539>
|
||||
|filename:FrankSmith22|user:mobile_programming%2Fjs%2FInitialize.js|>9cbc99f31b556308807390b4655cabf9>
|
||||
|filename:TrevorBeresford|user:mobile_programming%2Fjs%2FQualify.js|>45f16dcf5deda7c1cfb3ba414bbf37a0>
|
||||
|filename:xevidos|user:mobile_programming%2Fjs%2FQualify.js|>64054ac5cf0355c0c7a54a47a753e918>
|
||||
|filename:sabbakilam|user:mobile_programming%2Fjs%2FUpdate.js|>42b6da74b138c81b431dd486e605d7a1>
|
||||
|filename:xevidos|user:mobile_programming%2Fjs%2FUpdate.js|>a2962a947d6d5fcbc65facb728e37051>
|
||||
|filename:FrankSmith22|user:mobile_programming%2Fjs%2FUpdate.js|>e811c035b4fd6345836647c699408f91>
|
||||
|filename:sabbakilam|user:mobile_programming%2Fjs%2FQualify.js|>10cd3ff020218b98a70ae382ac763cba>
|
||||
|filename:xevidos|user:dev%2Fteacher.php|>58b9c53d2f43d2a924386e0fc7f1a364>
|
||||
|filename:xevidos|user:dev%2Fstudents%2Fpages.php|>feb6db58347bafc0959a719eb8787268>
|
||||
|filename:xevidos|user:dev%2Fincludes%2Fheader.php|>869e192baaf4f39d39c181279dffa05f>
|
||||
|filename:xevidos|user:html%2Fweb2%2Fcomponents%2Factive%2Fclass.active.php|>97e1bfaa42d9fd93e5a8996f400585bd>
|
||||
|filename:xevidos|user:html%2Fmobile_programming%2Fcomponents%2Factive%2Fclass.active.php|>19d575f3f3ce8f2aa9001aa4833228a1>
|
||||
|filename:xevidos|user:html%2Fweb2%2Fplugins%2Fauto_save%2Finit.js|>39d5e786f59a5b05c3d7e4296ea42a76>
|
||||
|filename:xevidos|user:html%2Fcode%2Fplugins%2Fauto_save%2Finit.js|>a07ab47d2665186a3e41f4f730ec7683>
|
||||
|filename:xevidos|user:html%2Fdev%2Findex.php|>a2c548e3c41867b8373761249047ecb0>
|
||||
|filename:xevidos|user:html%2Fcode%2Fcomponents%2Ffilemanager%2Finit.js|>40f6a41afa74ace596bc5735f4133b27>
|
||||
|filename:xevidos|user:html%2Fmobile_programming%2Fplugins%2FCodiad-CodeGit-master%2Finit.js|>48f9526f719a68de0bfb94ccd4284528>
|
||||
|filename:xevidos|user:html%2Fmobile_programming%2Fcomponents%2Factive%2Finit.js|>46e202c38d2c8a4216b81c0007276f38>
|
||||
|filename:xevidos|user:html%2Fmobile_programming%2Fcomponents%2Ffilemanager%2Finit.js|>c8a4d866e1e889520d0e31839e0854e3>
|
||||
|filename:xevidos|user:html%2Findex.php|>6cddbc005f97f76483eaf7397644de3b>
|
||||
|filename:xevidos|user:html%2Fcode%2Fconfig.php|>72670089ea1a80f64d41b30ab5abb317>
|
||||
|filename:xevidos|user:html%2Fcode%2Fdata%2Fcollaborative%2Ftext%2Fec501c81f6d7f8903809691ef846031d|>3cee2d164d3de51fe4c83d4954105eb5>
|
||||
|filename:xevidos|user:html%2Fcode%2Fdata%2Fversion.php|>5e6656bf1b6fd77c4f86ab277cc0988b>
|
||||
|filename:xevidos|user:html%2Fcode%2Fcomponents%2Fupdate%2Fclass.update.php|>5a6ea387fe176a5ee685311d1368bdbf>
|
||||
|filename:html%2Fcode%2Fcomponents%2Fupdate%2Fdialog.php|user:xevidos|>0231def7a6a1608f8242d5dfeee17fec>
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:20;s:6:"column";i:3;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:20;s:6:"column";i:24;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:27;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:27;s:6:"column";i:0;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:9;s:6:"column";i:20;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:9;s:6:"column";i:20;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:29;s:6:"column";i:29;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:29;s:6:"column";i:33;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:5;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:5;s:6:"column";i:0;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:5;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:5;s:6:"column";i:0;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:16;s:6:"column";i:1;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:16;s:6:"column";i:1;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:27;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:27;s:6:"column";i:0;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:14;s:6:"column";i:1;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:14;s:6:"column";i:1;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:36;s:6:"column";i:11;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:36;s:6:"column";i:11;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:7;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:7;s:6:"column";i:0;}}
|
|
@ -1 +0,0 @@
|
|||
O:8:"stdClass":2:{s:5:"start";O:8:"stdClass":2:{s:3:"row";i:19;s:6:"column";i:0;}s:3:"end";O:8:"stdClass":2:{s:3:"row";i:19;s:6:"column";i:0;}}
|
|
@ -1,12 +0,0 @@
|
|||
|filename:%2Fvar%2Fwww%2Fhtml%2Findex.php|user:test|>a0debe38b2118dc397cfe4898ab46b9e>
|
||||
|filename:mobile_programming%2Findex.html|user:FrankSmith22|>51640228b7c95ec21668deae8e14fd37>
|
||||
|filename:mobile_programming%2Fcss%2Fstyles.css|user:FrankSmith22|>f46fc66fdb891a570f1a03add3c166cc>
|
||||
|filename:mobile_programming%2Fcss%2Fstyles.css|user:ithollie|>ddd0681a0e90f0480910b3fb7719dde7>
|
||||
|filename:mobile_programming%2Findex.html|user:ithollie|>6e2f31eef830626055498ba7ba41f3dc>
|
||||
|filename:mobile_programming%2Fjs%2FQualify.js|user:ithollie|>cc91755cde6ab90a7f2aada55994f97b>
|
||||
|filename:mobile_programming%2Fjs%2FInitialize.js|user:FrankSmith22|>e6ca864b939a36765d43aa4ae3e8503e>
|
||||
|filename:mobile_programming%2Fjs%2FInitialize.js|user:ithollie|>22f1d2494993531e6b1a016a8d8b6438>
|
||||
|filename:mobile_programming%2Fjs%2FQualify.js|user:FrankSmith22|>2741708a0ee997fc889e4770f0a3b8ea>
|
||||
|filename:mobile_programming%2Fjs%2FUpdate.js|user:FrankSmith22|>92e0d8216f938e9f6450634e2ac0d0da>
|
||||
|filename:mobile_programming%2Fjs%2FUpdate.js|user:ithollie|>8ca94770f4850fd864af830a177c90aa>
|
||||
|filename:mobile_programming%2Fcss%2Fstyles.css|user:TrevorBeresford|>eceb4e0876fe71ea018f446d0d34eca1>
|
|
@ -1,66 +0,0 @@
|
|||
s:3098:"<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) Codiad & daeks (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
require_once('../../common.php');
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Verify Session or Key
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
checkSession();
|
||||
|
||||
switch($_GET['action']){
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Update
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
case 'check':
|
||||
|
||||
if(!checkAccess()){
|
||||
?>
|
||||
<label><?php i18n("Restricted"); ?></label>
|
||||
<pre><?php i18n("You can not check for updates"); ?></pre>
|
||||
<button onclick="codiad.modal.unload();return false;"><?php i18n("Close"); ?></button>
|
||||
<?php } else {
|
||||
require_once('class.update.php');
|
||||
$update = new Update();
|
||||
$vars = json_decode($update->Check(), true);
|
||||
?>
|
||||
<form>
|
||||
<input type="hidden" name="archive" value="<?php echo $vars[0]['data']['archive']; ?>">
|
||||
<input type="hidden" name="remoteversion" value="<?php echo $vars[0]['data']['remoteversion']; ?>">
|
||||
<label><?php i18n("Update Check"); ?></label>
|
||||
<br><table>
|
||||
<tr><td width="40%"><?php i18n("Your Version"); ?></td><td><?php echo $vars[0]['data']['currentversion']; ?></td></tr>
|
||||
<tr><td width="40%"><?php i18n("Latest Version"); ?></td><td><?php echo $vars[0]['data']['remoteversion']; ?></td></tr>
|
||||
</table>
|
||||
<?php if($vars[0]['data']['currentversion'] != $vars[0]['data']['remoteversion']) { ?>
|
||||
<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>
|
||||
<?php } else { ?>
|
||||
<br><br><b><label><?php i18n("Congratulation, your system is up to date."); ?></label></b>
|
||||
<?php if($vars[0]['data']['name'] != '') { ?>
|
||||
<em><?php i18n("Last update was done by "); ?><?php echo $vars[0]['data']['name']; ?>.</em>
|
||||
<?php } } ?>
|
||||
<?php if($vars[0]['data']['nightly']) { ?>
|
||||
<br><em class="note"><?php i18n("Note: Your installation is a nightly build. Codiad might be unstable."); ?></em><br>
|
||||
<?php } ?>
|
||||
<br><?php
|
||||
if($vars[0]['data']['currentversion'] != $vars[0]['data']['remoteversion']) {
|
||||
echo '<button class="btn-left" onclick="codiad.update.download();return false;">'.get_i18n("Download Codiad").'</button> ';
|
||||
}
|
||||
?><button class="btn-right" onclick="codiad.modal.unload();return false;"><?php i18n("Cancel"); ?></button>
|
||||
<form>
|
||||
<?php }
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
";
|
File diff suppressed because it is too large
Load diff
|
@ -1,577 +0,0 @@
|
|||
s:22352:"/**
|
||||
Author: Abbas Abdulmalik
|
||||
Created: ~ May, 2017
|
||||
Revised: June 9, 2018
|
||||
Original Filename: L.js
|
||||
Purpose: a small (but growing) personal re-usable js library for a simple MVC architecture
|
||||
Notes: Now qualifyFunction helper doesn't return true for empty arrays (no vacuous truth)
|
||||
|
||||
Added UploadFiles:
|
||||
uploadFiles takes a callback -- progressReporter-- as it FIRST argument (parameter)
|
||||
to allow for an optional fourth parameter of an upload path for the server.
|
||||
progressReporter will be passed three arguments when called:
|
||||
1.) the amount of bytes uploaded so far
|
||||
2.) the total size of the file in bytes
|
||||
3.) the index of the file in the "array" of files being uploaded
|
||||
|
||||
Added sortByExtension that alphabetizes an array of strings 'in place' by filename extension
|
||||
Added arrayStringMatch that matches a collection of string arrays to a search string.
|
||||
later (6-9-2018) included an option for a "maximum array index" to eliminate
|
||||
searching irrelevant fields at the end of the array, such as image name and primary key.
|
||||
Added loopCall as a 'better' version of setInterval
|
||||
Removed L.attributes. It's a reserved word: an object belonging to DOM elements
|
||||
Now it uses L.attribs
|
||||
Added L.loopCall.stop() so that user can easily stop L.loopCall
|
||||
Added L.symDiff for comparing arrays to determine their symmetric difference = conjunctive union =
|
||||
exclusive-or
|
||||
Restored an updated version of uploadFiles that signals the final file has uploaded
|
||||
Added secToMinSec
|
||||
Added runQualifiedFunctions that mirrors runQualifiedMethods using different parameters,
|
||||
namely: functionQualifiers, model, view, controller
|
||||
Added attachNewElement(tagname, id, view). Create new element, gives it an id and
|
||||
attaches it to object provided:
|
||||
L.attachNewElement(`div`, `picHolder`, view)
|
||||
Added createListMixer and scrammbleThis, which depends on createListMixer
|
||||
Added sortArrayOfStringArrays, with option of using a "link token" of choice as the 3rd argument
|
||||
Added an optional argument for arrayStringMatch for a maximum array index
|
||||
to eliminate searching irrelevant fields at the end of the array,
|
||||
such as image name and primary key
|
||||
*/
|
||||
|
||||
var L = {}
|
||||
L.styles = function(styleString){
|
||||
const colonPosition = styleString.indexOf(':')
|
||||
const property = styleString.slice(0, colonPosition)
|
||||
const value = styleString.slice(colonPosition + 1)
|
||||
this.style[property] = value
|
||||
|
||||
return this.styles
|
||||
}
|
||||
|
||||
L.attribs = function(attributeString){
|
||||
const assignmentPosition = attributeString.indexOf('=')
|
||||
const attribute = attributeString.slice(0, assignmentPosition)
|
||||
const value = attributeString.slice(assignmentPosition + 1)
|
||||
this.setAttribute(attribute, value)
|
||||
|
||||
return this.attribs
|
||||
}
|
||||
|
||||
L.attachAllElementsById = function(here){
|
||||
let allElements = document.getElementsByTagName('*')
|
||||
let array = []
|
||||
array.forEach.call(allElements, function(element) {
|
||||
if(element.id){
|
||||
here[element.id] = element
|
||||
element.styles = L.styles.bind(element) // attach L's styles() method here
|
||||
element.attribs = L.attribs.bind(element) // attach L's attribs() method here
|
||||
}
|
||||
})
|
||||
}
|
||||
///////////////| START of L.attachNewElement |/////////////
|
||||
/**
|
||||
L.attachNewElement(string tagname, string id, object view) ...
|
||||
... creates a new element of type "tagname" given as the first argument,
|
||||
and gives it the id "id" given as the second argument.
|
||||
The third argument is the view object where this new reference will be attached.
|
||||
The element can then be referenced as view.id.
|
||||
*/
|
||||
L.attachNewElement = function(tagname, id, view){
|
||||
if(arguments.length !== 3){
|
||||
console.log(`Error: requires 3 arguments: tagname, id, view`)
|
||||
return
|
||||
}
|
||||
try{
|
||||
if(typeof tagname === `string`){
|
||||
var newElement = document.createElement(tagname)
|
||||
}
|
||||
else{
|
||||
console.log(`Error: tagname needs to be a string`)
|
||||
return
|
||||
}
|
||||
if(typeof id === `string`){
|
||||
newElement.id = id
|
||||
}
|
||||
else{
|
||||
console.log(`Error: id needs to be a string`)
|
||||
return
|
||||
}
|
||||
if(view.toString() === `[object Object]`){
|
||||
view[newElement.id] = newElement
|
||||
newElement.styles = L.styles.bind(newElement) // attach L's styles() method here
|
||||
newElement.attribs = L.attribs.bind(newElement) // attach L's attribs() method here
|
||||
return newElement
|
||||
}
|
||||
else{
|
||||
console.log(`Error: view needs to be an object`)
|
||||
return
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
console.log(`Error in L.attachNewElement: ${e}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
///////////////| END of L.attachNewElement |/////////////
|
||||
|
||||
L.noPinchZoom = function(){
|
||||
window.ontouchstart = function(eventObject){
|
||||
if(eventObject.touches && eventObject.touches.length > 1){
|
||||
eventObject.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
L.runQualifiedMethods = function(functionQualifiers, object, runNextUpdate){
|
||||
Object
|
||||
.keys(functionQualifiers)
|
||||
.filter(qualifyFunction)
|
||||
.forEach(runFunction)
|
||||
if(typeof runNextUpdate === 'function'){runNextUpdate()}
|
||||
|
||||
//-----| helpers |-----//
|
||||
function qualifyFunction(functionName){
|
||||
const isQualified = functionQualifiers[functionName].every( qualifier => qualifier) &&
|
||||
!!functionQualifiers[functionName].length
|
||||
return isQualified
|
||||
}
|
||||
function runFunction(functionName){
|
||||
if(typeof object[functionName] === 'function'){
|
||||
object[functionName]()
|
||||
}
|
||||
|
||||
/**
|
||||
If the prefix of this function's name is 'set' (for updating the MODEL),
|
||||
and there is a similarly named function with a prefix of 'show' (for updating the VIEW),
|
||||
then run the 'show' version as well.
|
||||
*/
|
||||
let prefix = functionName.slice(0,3)
|
||||
let newFunctionName = 'show' + functionName.slice(3)
|
||||
|
||||
if(prefix === 'set' && typeof object[newFunctionName] === 'function'){
|
||||
object[newFunctionName]()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
L.runQualifiedFunctions = function(functionQualifiers, model, view, controller){
|
||||
Object
|
||||
.keys(functionQualifiers)
|
||||
.filter(qualifyFunction)
|
||||
.forEach(runFunction)
|
||||
//-----| helpers |-----//
|
||||
function qualifyFunction(functionName){
|
||||
const isQualified = functionQualifiers[functionName].every( qualifier => qualifier) &&
|
||||
!!functionQualifiers[functionName].length
|
||||
return isQualified
|
||||
}
|
||||
function runFunction(functionName){
|
||||
if(typeof controller[functionName] === 'function'){
|
||||
controller[functionName](model)
|
||||
}
|
||||
/**
|
||||
If the prefix of this function's name is 'set' (for updating the MODEL),
|
||||
and there is a similarly named function with a prefix of 'show' (for updating the VIEW),
|
||||
then run the 'show' version as well.
|
||||
*/
|
||||
let prefix = functionName.slice(0,3)
|
||||
let newFunctionName = 'show' + functionName.slice(3)
|
||||
if(prefix === 'set' && typeof controller[newFunctionName] === 'function'){
|
||||
controller[newFunctionName](view)
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
Use a php script that reads contents of file from $_POST['contents'] that was convert by client
|
||||
as DataURL, and expects filename and uploadPath from: $_POST['filename'] and $_POST['uploadPath']
|
||||
with trailing slash (/) provided by client (though script could check for this).
|
||||
*/
|
||||
L.uploadFiles = function(progressReporter, fileElement, phpScriptName, uploadPath='../uploads/'){
|
||||
let doneCounter = 0
|
||||
let fileCount = fileElement.files.length
|
||||
const array = [] // make a real array to borrow it's forEach method
|
||||
array.forEach.call(fileElement.files, (file, index) => {
|
||||
const postman = new XMLHttpRequest() // make a file deliverer for each file
|
||||
const uploadObject = postman.upload // This object keeps track of upload progress
|
||||
const envelope = new FormData() // make a holder for the file's name and content
|
||||
envelope.stuff = envelope.append // give 'append' the nickname 'stuff'
|
||||
const reader = new FileReader() // make a file reader (the raw file element is useless)
|
||||
|
||||
reader.readAsDataURL(file) // process the file's contents
|
||||
reader.onload = function(){ // when done ...
|
||||
const contents = reader.result // collect the result, and ...
|
||||
envelope.stuff('contents', contents) // place it in the envelope along with ...
|
||||
envelope.stuff('filename', file.name) // its filename ...
|
||||
envelope.stuff('uploadPath', uploadPath) // and its upload path on the server
|
||||
|
||||
postman.open(`POST`, phpScriptName)// open up a POST to the server's php script
|
||||
postman.send(envelope) // send the file
|
||||
|
||||
//check when file loads and when there is an error
|
||||
postman.onload = eventObject => {
|
||||
postman.status !== 200 ? showMessage() : checkLastFileDone()
|
||||
//-----| helper |------//
|
||||
function showMessage(){
|
||||
const message = `Trouble with file: ${postman.status}`
|
||||
console.log(message)
|
||||
alert(message)
|
||||
}
|
||||
function checkLastFileDone(){
|
||||
doneCounter++
|
||||
if(typeof progressReporter === 'function'){
|
||||
if(doneCounter === fileCount){
|
||||
progressReporter(1, 1, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
postman.onerror = eventObject => {
|
||||
const message = `Trouble connecting to server`
|
||||
console.log(message)
|
||||
alert(message)
|
||||
}
|
||||
|
||||
//invoke the callback for each upload progress report
|
||||
uploadObject.onprogress = function(progressObject){
|
||||
if(typeof progressReporter === 'function'){
|
||||
progressReporter(progressObject.loaded, progressObject.total, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//---------------------------------------------------------//
|
||||
/**
|
||||
Given an array of strings (array), sorts the array 'in place' by filename EXTENSION,
|
||||
and returns a copy of the array as well. Since it mutates the array, it is decidedly not
|
||||
functionistic (but it functions).
|
||||
*/
|
||||
L.sortByExtension = function (array) {
|
||||
const type = {}.toString.call(array, null);
|
||||
if (type !== '[object Array]') {
|
||||
return array;
|
||||
}
|
||||
if (array.length === 0 || array.some(member => typeof member !== 'string')) {
|
||||
return array;
|
||||
}
|
||||
//-------------------------------------//
|
||||
let extension = ``;
|
||||
let nudeWord = ``;
|
||||
array.forEach((m, i, a) => {
|
||||
if (m.lastIndexOf(`.`) !== -1) {
|
||||
//get the extension
|
||||
extension = m.slice(m.lastIndexOf(`.`) + 1);
|
||||
nudeWord = m.slice(0, m.lastIndexOf(`.`));
|
||||
a[i] = `${extension}.${nudeWord}`;
|
||||
}
|
||||
});
|
||||
|
||||
array.sort();
|
||||
|
||||
array.forEach((m, i, a) => {
|
||||
if (m.indexOf(`.`) !== -1){
|
||||
//get prefix (formerly the extension)
|
||||
extension = m.slice(0, m.indexOf(`.`))
|
||||
nudeWord = m.slice(m.indexOf(`.`) + 1)
|
||||
a[i] = `${nudeWord}.${extension}`
|
||||
}
|
||||
});
|
||||
|
||||
const newArray = []
|
||||
array.forEach( m => newArray.push(m))
|
||||
|
||||
return newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
From an array of string arrays, return a possibly smaller array
|
||||
of only those string arrays whose member strings contain the given subString
|
||||
regardless of case.
|
||||
1. For arrayOfStringArrays, use the filter method (a function property of an array)
|
||||
that expects a function argument that operates on each array member
|
||||
2. Let's call the function argument 'match'
|
||||
3. 'match' should test each member array for a match of the substring as follows:
|
||||
a.) join the members strings together into a bigString that is lowerCased
|
||||
b.) lowerCase the subString
|
||||
c.) use indexOf to match substring to the bigString
|
||||
d.) return true for a match, otherwise return false
|
||||
4. the filter creates a new array after doing this.
|
||||
5. final step: return the new array that the filter produced
|
||||
*/
|
||||
L.arrayStringMatch = function(subString, arrayOfStringArrays, maxIndex){
|
||||
//============================================================//
|
||||
return arrayOfStringArrays.filter(match)
|
||||
//-------| Helper function 'match' |---------//
|
||||
function match(memberArray){
|
||||
//on 6-9-2018, added option of maximum index to eliminate searching through irrelevant fields
|
||||
let bigString = ''
|
||||
if(maxIndex && typeof maxIndex === "number" && maxIndex > 0){
|
||||
bigString = memberArray
|
||||
.filter((m,i) => i <= maxIndex)
|
||||
.join(` `)
|
||||
.toLowerCase()
|
||||
}
|
||||
else{
|
||||
bigString = memberArray.join(` `).toLowerCase()
|
||||
}
|
||||
const substringToMatch = subString.toLowerCase()
|
||||
return bigString.indexOf(substringToMatch) !== -1
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------//
|
||||
|
||||
/**
|
||||
L.loopCall can be used to replace setInterval, which has been somewhat discredited.
|
||||
See this blog post:
|
||||
https://dev.to/akanksha_9560/why-not-to-use-setinterval--2na9
|
||||
|
||||
L.loopCall uses setTimeout recursively, which is a technique
|
||||
reportedly more reliabale than setInterval.
|
||||
|
||||
L.loopCall repeatedly calls (invokes) the callback function provided as its first argument.
|
||||
The first call is immediate, but subsequent calls are delayed by the milliseconds
|
||||
provided as the second argument. All additional arguments are optional
|
||||
to be used by the callback if required.
|
||||
|
||||
If needed, you can delay the initial call as well,
|
||||
by having loopCall invoked by setTimeout using the same delay:
|
||||
|
||||
setTimeout(L.loopCall, delay, callback, delay, arg1, arg2 ...)
|
||||
|
||||
or the more readable, but more risky ...
|
||||
|
||||
setTimeout("L.loopCall(callback, delay, arg1, arg2 ...)", delay)
|
||||
//Doug Crockford would not be pleased
|
||||
|
||||
To stop the loop, the callback function can test some external state condition,
|
||||
(or test its own arguments, if they are passed by reference):
|
||||
|
||||
if(externalStateCondition){
|
||||
L.loopCall.stop()
|
||||
}
|
||||
*/
|
||||
L.loopCall = function (callback, delay, ...args){
|
||||
L.loopCall.stopLoop = setTimeout(L.loopCall, delay, callback, delay, ...args)
|
||||
callback(...args)
|
||||
}
|
||||
|
||||
L.loopCall.stop = () => {
|
||||
clearTimeout(L.loopCall.stopLoop)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns an array that is the "mathematical or logical" symmetric difference among or between
|
||||
any number of arrays provided as arguments (usually two). If the order of members is ignored
|
||||
(as is done for mathematical sets), the result acts as the the exclusive-or (XOR), also know as
|
||||
the disjunctive union. For the trivial cases of comparing one or two arrays, the result is
|
||||
not surprising: for one array, the result is itself: L.symDiff(A, []) => A ⊕ [] = A.
|
||||
For two arrays, the result is an array that has only members which are not shared in common:
|
||||
L.symDiff(A, B) => A ⊕ B .
|
||||
When comparing more than two arrays, the result may ne surprising. The proper result can be verified
|
||||
by comparing only two at a time: L.symDiff(A, B, C) => A ⊕ B ⊕ C = (A ⊕ B) ⊕ C
|
||||
*/
|
||||
L.symDiff = function symDiff(arrayA, arrayB){ // dummy paramters NOT referenced in body of the function
|
||||
var partialSymDiff = [],
|
||||
argsArray = arguments
|
||||
;
|
||||
//============THE CRUX=================
|
||||
return findSymDiff(partialSymDiff,0);
|
||||
//============UNDER THE HOOD===========
|
||||
function findSymDiff(partialSymDiff,index){
|
||||
if (argsArray[index] === undefined){
|
||||
return partialSymDiff;
|
||||
}
|
||||
else{
|
||||
partialSymDiff = sd(partialSymDiff, argsArray[index] );
|
||||
return findSymDiff( partialSymDiff, index + 1 );
|
||||
}
|
||||
}
|
||||
//=====================================
|
||||
function sd(arrayI, arrayJ){
|
||||
var diff = [],
|
||||
blackList = [],
|
||||
i = 0,
|
||||
j = 0,
|
||||
maxI = arrayI.length,
|
||||
maxJ = arrayJ.length
|
||||
;
|
||||
//-------------------------------------------------
|
||||
//1.) Combine the arrays into a third array.
|
||||
//2.) Find the matched elements and place them into a blacklist array.
|
||||
//3.) Pull blacklisted elements from the combined array.
|
||||
//4.) return the "reduced" combined array.
|
||||
//---------------------------------------------------
|
||||
// 1.) Combine the arrays into a third array.
|
||||
diff = arrayI.concat(arrayJ);
|
||||
//---------------------------------------------------
|
||||
// 2.) Find the matched elements and place them into a blacklist array.
|
||||
for ( i=0; i < maxI; i++ ){
|
||||
for( j=0; j< maxJ; j++ ){
|
||||
if(arrayI[i] === arrayJ[j]){
|
||||
blackList.push(arrayI[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
// 3.) Pull blacklisted elements from the combined array.
|
||||
diff = diff.filter( (element) => blackList.indexOf(element) === -1 )
|
||||
//----------------------------------------------------
|
||||
// 4.) return the "reduced" combined array.
|
||||
return killDupes(diff);
|
||||
}
|
||||
//========================================================
|
||||
function killDupes(array){
|
||||
var kept = []; // Record of the "keepers"
|
||||
return array.filter(function(element){
|
||||
if ( kept.indexOf(element) === -1 ){ //if not already retained ...
|
||||
kept.push(element); // Record it as retained now, and...
|
||||
return true; // allow this element to be kept (true)
|
||||
}
|
||||
else{
|
||||
return false; // otherwise, don't keep it (already kept)
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pass in a numerical seconds: it returns a string in the format
|
||||
* mm : ss, like ...
|
||||
* 35 : 37 in minutes and seconds
|
||||
*/
|
||||
L.secToMinSec = (seconds) =>{
|
||||
var min = Math.floor(seconds / 60);
|
||||
var sec = Math.floor(seconds % 60);
|
||||
if(isNaN(min)){min = 0}
|
||||
if(isNaN(sec)){sec = 0}
|
||||
var zeroMin = ((min < 10) ? ("0" + min) : ("" + min));
|
||||
var zeroSec = ((sec < 10) ? ("0" + sec) : ("" + sec));
|
||||
var minSec = zeroMin + ":" + zeroSec;
|
||||
return minSec;
|
||||
};
|
||||
//====| END of secToMinSec |====//
|
||||
|
||||
///////////////////| START of CreateListMixer |//////////////////////
|
||||
/**
|
||||
* CreateListMixer: a factory that creates and returns a function that
|
||||
* returns a random item from the collection (array or object) provided.
|
||||
* Notes: Example-> var list = ["a", "short", "list"];//three (3) items to test
|
||||
* var getRandomItem = CreateListMixer();
|
||||
* getRandomItem(list);//returns first of randomized list
|
||||
* getRandomItem();//returns next item
|
||||
* getRandomItem();//returns next item (last of three)
|
||||
* getRandomItem();//new first item from re-randomized list
|
||||
*
|
||||
* // a new list;
|
||||
* var list2 = { record1: "string", record2: "anotherString", ...};
|
||||
* getRandomItem(list2);//returns first of new randomized list2
|
||||
* getRandomItem();//etc.
|
||||
* It returns a property name for objects or an array member for arrays;
|
||||
* It returns 'false' if argument of function is not an object
|
||||
* or an array (fails typeof arg === 'object')
|
||||
*
|
||||
*/
|
||||
L.CreateListMixer = function(){
|
||||
var list=[],
|
||||
randList= [],
|
||||
listLength= 0,
|
||||
itemReturned= null,
|
||||
itemReturnedIndex= -1
|
||||
;
|
||||
return function(){
|
||||
if(arguments[0]){
|
||||
if(typeof arguments[0] === 'object'){
|
||||
list = arguments[0];
|
||||
if({}.toString.call(arguments[0]) === '[object Object]'){
|
||||
list = Object.keys(list);
|
||||
}
|
||||
randList = randomize(list);
|
||||
listLength = list.length;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//----| no args activity: return next random item |----
|
||||
if(itemReturnedIndex >= listLength-1){
|
||||
do{
|
||||
randList = randomize(list);
|
||||
itemReturnedIndex = -1;
|
||||
}
|
||||
while(randList[itemReturnedIndex +1] === itemReturned);
|
||||
}
|
||||
itemReturnedIndex++;
|
||||
itemReturned = randList[itemReturnedIndex];
|
||||
return itemReturned;
|
||||
//-----helpers-----
|
||||
function randomize(x){
|
||||
var mixedIndexes = [];
|
||||
var randomList = [];
|
||||
randomizeIndexes();
|
||||
return randomList;
|
||||
//----sub helper----
|
||||
function randomizeIndexes(){
|
||||
// random numbers for mixedIndexes
|
||||
while(mixedIndexes.length !== x.length){
|
||||
var match = false;
|
||||
var possibleIndex = (x.length)*Math.random();
|
||||
possibleIndex = Math.floor(possibleIndex);
|
||||
mixedIndexes.forEach(function(m){
|
||||
if(m === possibleIndex){
|
||||
match = true;
|
||||
}
|
||||
});
|
||||
if(!match){
|
||||
mixedIndexes.push(possibleIndex);
|
||||
}
|
||||
}
|
||||
for(var i = 0; i < x.length; i++){
|
||||
var newIndex = mixedIndexes[i];
|
||||
randomList.push(list[newIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};//===| END returned function |======
|
||||
}//===| END enclosing factory function======
|
||||
///////////////////| END of CreateListMixer |//////////////////////
|
||||
|
||||
///////////////////| START of scrammbleThis |//////////////////////
|
||||
/**
|
||||
scrammbleThis: (depends on createListMixer, above)
|
||||
It returns an array of randomly arranged items of the collection provided.
|
||||
The argument must be an array, an object, or a string.
|
||||
If the argument is an object, a random array of its property names is returned.
|
||||
If the argument is a string, a random array of its characters is returned.
|
||||
If the argument is an array, a random array of its members is returned.
|
||||
*/
|
||||
L.scrammbleThis = function(collection){
|
||||
if ( !(typeof collection === 'object' || typeof collection === 'string') ){return collection}
|
||||
var mix = L.CreateListMixer();
|
||||
var list = (Object.prototype.toString.call(collection) === '[object Array]')
|
||||
? collection
|
||||
: (typeof collection === 'string')
|
||||
? collection.split('')
|
||||
: (typeof collection === 'object')
|
||||
? Object.keys(collection)
|
||||
: null
|
||||
return list.map((m,i,a)=> (i === 0) ? mix(a) : mix())
|
||||
}
|
||||
///////////////////| END of scrammbleThis |//////////////////////
|
||||
|
||||
/**
|
||||
Given an array of string arrays, this function returns an alphabetized version
|
||||
*/
|
||||
L.sortArrayOfStringArrays = function(arrayOfStringArrays, linkToken='```'){
|
||||
//use a unique token (default = triple back-ticks ```) to join the strings of each array of strings
|
||||
const arrayOfStrings = arrayOfStringArrays.map(stringArray => stringArray.join(linkToken))
|
||||
|
||||
//case-insensitive sort this array of strings, mutating it in place:
|
||||
//https://stackoverflow.com/questions/8996963/how-to-perform-case-insensitive-sorting-in-javascript
|
||||
arrayOfStrings.sort( (a,b) => a.toLowerCase().localeCompare(b.toLowerCase()) )
|
||||
|
||||
//return a new array of string arrays after splitting the strings on the unique token
|
||||
return arrayOfStrings.map( string => string.split(linkToken))
|
||||
}
|
||||
";
|
|
@ -1,55 +0,0 @@
|
|||
s:1656:"<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// CONFIG
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// PATH TO CODIAD
|
||||
define("BASE_PATH", "/var/www/html/mobile_programming");
|
||||
|
||||
// BASE URL TO CODIAD (without trailing slash)
|
||||
define("BASE_URL", "aaserver.abbas411.com/mobile_programming");
|
||||
|
||||
// THEME : default, modern or clear (look at /themes)
|
||||
define("THEME", "default");
|
||||
|
||||
// ABSOLUTE PATH
|
||||
define("WHITEPATHS", BASE_PATH . ",/home");
|
||||
|
||||
// SESSIONS (e.g. 7200)
|
||||
$cookie_lifetime = "0";
|
||||
|
||||
// TIMEZONE
|
||||
date_default_timezone_set("America/New_York");
|
||||
|
||||
// External Authentification
|
||||
//define("AUTH_PATH", "/path/to/customauth.php");
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// ** DO NOT EDIT CONFIG BELOW **
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// PATHS
|
||||
define("COMPONENTS", BASE_PATH . "/components");
|
||||
define("PLUGINS", BASE_PATH . "/plugins");
|
||||
define("THEMES", BASE_PATH . "/themes");
|
||||
define("DATA", BASE_PATH . "/data");
|
||||
define("WORKSPACE", BASE_PATH . "/workspace");
|
||||
|
||||
// URLS
|
||||
define("WSURL", BASE_URL . "/workspace");
|
||||
|
||||
// Marketplace
|
||||
//define("MARKETURL", "http://market.codiad.com/json");
|
||||
|
||||
// Update Check
|
||||
//define("UPDATEURL", "http://update.codiad.com/?v={VER}&o={OS}&p={PHP}&w={WEB}&a={ACT}");
|
||||
//define("ARCHIVEURL", "https://github.com/Codiad/Codiad/archive/master.zip");
|
||||
//define("COMMITURL", "https://api.github.com/repos/Codiad/Codiad/commits");
|
||||
";
|
|
@ -1,773 +0,0 @@
|
|||
s:34893:"/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
(function(global, $){
|
||||
|
||||
var codiad = global.codiad;
|
||||
|
||||
$(window)
|
||||
.load(function() {
|
||||
codiad.filemanager.init();
|
||||
});
|
||||
|
||||
codiad.filemanager = {
|
||||
|
||||
clipboard: '',
|
||||
|
||||
noOpen: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'exe', 'zip', 'tar', 'tar.gz'],
|
||||
noBrowser: ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
|
||||
|
||||
controller: 'components/filemanager/controller.php',
|
||||
dialog: 'components/filemanager/dialog.php',
|
||||
dialogUpload: 'components/filemanager/dialog_upload.php',
|
||||
|
||||
init: function() {
|
||||
// Initialize node listener
|
||||
this.nodeListener();
|
||||
// Load uploader
|
||||
$.loadScript("components/filemanager/upload_scripts/jquery.ui.widget.js", true);
|
||||
$.loadScript("components/filemanager/upload_scripts/jquery.iframe-transport.js", true);
|
||||
$.loadScript("components/filemanager/upload_scripts/jquery.fileupload.js", true);
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Listen for dbclick events on nodes
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
nodeListener: function() {
|
||||
var _this = this;
|
||||
|
||||
$('#file-manager').on('selectstart', false);
|
||||
|
||||
$('#file-manager span')
|
||||
.live('click', function() { // Open or Expand
|
||||
if ($(this).parent().children("a").attr('data-type') == 'directory') {
|
||||
_this.index($(this).parent().children("a")
|
||||
.attr('data-path'));
|
||||
} else {
|
||||
_this.openFile($(this).parent().children("a")
|
||||
.attr('data-path'));
|
||||
}
|
||||
if (!$(this).hasClass('none')) {
|
||||
if ($(this).hasClass('plus')) {
|
||||
$(this).removeClass('plus')
|
||||
$(this).addClass('minus');
|
||||
} else {
|
||||
$(this).removeClass('minus')
|
||||
$(this).addClass('plus');
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#file-manager a')
|
||||
.live('dblclick', function() { // Open or Expand
|
||||
if (!codiad.editor.settings.fileManagerTrigger) {
|
||||
if ($(this)
|
||||
.hasClass('directory')) {
|
||||
_this.index($(this)
|
||||
.attr('data-path'));
|
||||
} else {
|
||||
_this.openFile($(this)
|
||||
.attr('data-path'));
|
||||
}
|
||||
if (!$(this).parent().children("span").hasClass('none')) {
|
||||
if ($(this).parent().children("span").hasClass('plus')) {
|
||||
$(this).parent().children("span").removeClass('plus')
|
||||
$(this).parent().children("span").addClass('minus');
|
||||
} else {
|
||||
$(this).parent().children("span").removeClass('minus')
|
||||
$(this).parent().children("span").addClass('plus');
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.live('click', function() { // Open or Expand
|
||||
if (codiad.editor.settings.fileManagerTrigger) {
|
||||
if ($(this)
|
||||
.hasClass('directory')) {
|
||||
_this.index($(this)
|
||||
.attr('data-path'));
|
||||
} else {
|
||||
_this.openFile($(this)
|
||||
.attr('data-path'));
|
||||
}
|
||||
if (!$(this).parent().children("span").hasClass('none')) {
|
||||
if ($(this).parent().children("span").hasClass('plus')) {
|
||||
$(this).parent().children("span").removeClass('plus')
|
||||
$(this).parent().children("span").addClass('minus');
|
||||
} else {
|
||||
$(this).parent().children("span").removeClass('minus')
|
||||
$(this).parent().children("span").addClass('plus');
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.live("contextmenu", function(e) { // Context Menu
|
||||
e.preventDefault();
|
||||
_this.contextMenuShow(e, $(this)
|
||||
.attr('data-path'), $(this)
|
||||
.attr('data-type'), $(this)
|
||||
.html());
|
||||
$(this)
|
||||
.addClass('context-menu-active');
|
||||
});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Context Menu
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
contextMenuShow: function(e, path, type, name) {
|
||||
var _this = this;
|
||||
|
||||
// Selective options
|
||||
switch (type) {
|
||||
case 'directory':
|
||||
$('#context-menu .directory-only, #context-menu .non-root')
|
||||
.show();
|
||||
$('#context-menu .file-only, #context-menu .root-only')
|
||||
.hide();
|
||||
break;
|
||||
case 'file':
|
||||
$('#context-menu .directory-only, #context-menu .root-only')
|
||||
.hide();
|
||||
$('#context-menu .file-only,#context-menu .non-root')
|
||||
.show();
|
||||
break;
|
||||
case 'root':
|
||||
$('#context-menu .directory-only, #context-menu .root-only')
|
||||
.show();
|
||||
$('#context-menu .non-root, #context-menu .file-only')
|
||||
.hide();
|
||||
break;
|
||||
}
|
||||
if(codiad.project.isAbsPath($('#file-manager a[data-type="root"]').attr('data-path'))) {
|
||||
$('#context-menu .no-external').hide();
|
||||
} else {
|
||||
$('#context-menu .no-external').show();
|
||||
}
|
||||
// Show menu
|
||||
var top = e.pageY;
|
||||
if (top > $(window).height() - $('#context-menu').height()) {
|
||||
top -= $('#context-menu').height();
|
||||
}
|
||||
if (top < 10) {
|
||||
top = 10;
|
||||
}
|
||||
var max = $(window).height() - top - 10;
|
||||
|
||||
$('#context-menu')
|
||||
.css({
|
||||
'top': top + 'px',
|
||||
'left': e.pageX + 'px',
|
||||
'max-height': max + 'px'
|
||||
})
|
||||
.fadeIn(200)
|
||||
.attr('data-path', path)
|
||||
.attr('data-type', type)
|
||||
.attr('data-name', name);
|
||||
// Show faded 'paste' if nothing in clipboard
|
||||
if (this.clipboard === '') {
|
||||
$('#context-menu a[content="Paste"]')
|
||||
.addClass('disabled');
|
||||
} else {
|
||||
$('#context-menu a[data-action="paste"]')
|
||||
.removeClass('disabled');
|
||||
}
|
||||
// Hide menu
|
||||
$('#file-manager, #editor-region')
|
||||
.on('mouseover', function() {
|
||||
_this.contextMenuHide();
|
||||
});
|
||||
/* Notify listeners. */
|
||||
amplify.publish('context-menu.onShow', {e: e, path: path, type: type});
|
||||
// Hide on click
|
||||
$('#context-menu a')
|
||||
.click(function() {
|
||||
_this.contextMenuHide();
|
||||
});
|
||||
},
|
||||
|
||||
contextMenuHide: function() {
|
||||
$('#context-menu')
|
||||
.fadeOut(200);
|
||||
$('#file-manager a')
|
||||
.removeClass('context-menu-active');
|
||||
/* Notify listeners. */
|
||||
amplify.publish('context-menu.onHide');
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Return the node name (sans path)
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
getShortName: function(path) {
|
||||
return path.split('/')
|
||||
.pop();
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Return extension
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
getExtension: function(path) {
|
||||
return path.split('.')
|
||||
.pop();
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Return type
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
getType: function(path) {
|
||||
return $('#file-manager a[data-path="' + path + '"]')
|
||||
.attr('data-type');
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Create node in file tree
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
createObject: function(parent, path, type) {
|
||||
// NODE FORMAT: <li><a class="{type} {ext-file_extension}" data-type="{type}" data-path="{path}">{short_name}</a></li>
|
||||
var parentNode = $('#file-manager a[data-path="' + parent + '"]');
|
||||
if (!$('#file-manager a[data-path="' + path + '"]')
|
||||
.length) { // Doesn't already exist
|
||||
if (parentNode.hasClass('open') && parentNode.hasClass('directory')) { // Only append node if parent is open (and a directory)
|
||||
var shortName = this.getShortName(path);
|
||||
if (type == 'directory') {
|
||||
var appendage = '<li><span class="none"></span><a class="directory" data-type="directory" data-path="' + path + '">' + shortName + '</a></li>';
|
||||
} else {
|
||||
var appendage = '<li><span class="none"></span><a class="file ext-' +
|
||||
this.getExtension(shortName) +
|
||||
'" data-type="file" data-path="' +
|
||||
path + '">' + shortName + '</a></li>';
|
||||
}
|
||||
if (parentNode.siblings('ul')
|
||||
.length) { // UL exists, other children to play with
|
||||
parentNode.siblings('ul')
|
||||
.append(appendage);
|
||||
} else {
|
||||
$('<ul>' + appendage + '</ul>')
|
||||
.insertAfter(parentNode);
|
||||
}
|
||||
} else {
|
||||
parentNode.parent().children('span').removeClass('none');
|
||||
parentNode.parent().children('span').addClass('plus');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Loop out all files and folders in directory path
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
indexFiles: [],
|
||||
|
||||
index: function(path, rescan) {
|
||||
var _this = this;
|
||||
if (rescan === undefined) {
|
||||
rescan = false;
|
||||
}
|
||||
node = $('#file-manager a[data-path="' + path + '"]');
|
||||
if (node.hasClass('open') && !rescan) {
|
||||
node.parent('li')
|
||||
.children('ul')
|
||||
.slideUp(300, function() {
|
||||
$(this)
|
||||
.remove();
|
||||
node.removeClass('open');
|
||||
});
|
||||
} else {
|
||||
node.addClass('loading');
|
||||
$.get(this.controller + '?action=index&path=' + encodeURIComponent(path), function(data) {
|
||||
node.addClass('open');
|
||||
var objectsResponse = codiad.jsend.parse(data);
|
||||
if (objectsResponse != 'error') {
|
||||
/* Notify listener */
|
||||
_this.indexFiles = objectsResponse.index;
|
||||
amplify.publish("filemanager.onIndex", {path: path, files: _this.indexFiles});
|
||||
var files = _this.indexFiles;
|
||||
if (files.length > 0) {
|
||||
if (node.parent().children('span').hasClass('plus')) {
|
||||
node.parent().children('span').removeClass('plus').addClass('minus');
|
||||
}
|
||||
var display = 'display:none;';
|
||||
if (rescan) {
|
||||
display = '';
|
||||
}
|
||||
var appendage = '<ul style="' + display + '">';
|
||||
$.each(files, function(index) {
|
||||
var ext = '';
|
||||
var name = files[index].name.replace(path, '');
|
||||
var nodeClass = 'none';
|
||||
name = name.split('/')
|
||||
.join(' ');
|
||||
if (files[index].type == 'file') {
|
||||
var ext = ' ext-' + name.split('.')
|
||||
.pop();
|
||||
}
|
||||
if(files[index].type == 'directory' && files[index].size > 0) {
|
||||
nodeClass = 'plus';
|
||||
}
|
||||
appendage += '<li><span class="' + nodeClass + '"></span><a class="' + files[index].type + ext + '" data-type="' + files[index].type + '" data-path="' + files[index].name + '">' + name + '</a></li>';
|
||||
});
|
||||
appendage += '</ul>';
|
||||
if (rescan) {
|
||||
node.parent('li')
|
||||
.children('ul')
|
||||
.remove();
|
||||
}
|
||||
$(appendage)
|
||||
.insertAfter(node);
|
||||
if (!rescan) {
|
||||
node.siblings('ul')
|
||||
.slideDown(300);
|
||||
}
|
||||
}
|
||||
}
|
||||
node.removeClass('loading');
|
||||
if (rescan && _this.rescanChildren.length > _this.rescanCounter) {
|
||||
_this.rescan(_this.rescanChildren[_this.rescanCounter++]);
|
||||
} else {
|
||||
_this.rescanChildren = [];
|
||||
_this.rescanCounter = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
rescanChildren: [],
|
||||
|
||||
rescanCounter: 0,
|
||||
|
||||
rescan: function(path) {
|
||||
var _this = this;
|
||||
if (this.rescanCounter === 0) {
|
||||
// Create array of open directories
|
||||
node = $('#file-manager a[data-path="' + path + '"]');
|
||||
node.parent()
|
||||
.find('a.open')
|
||||
.each(function() {
|
||||
_this.rescanChildren.push($(this)
|
||||
.attr('data-path'));
|
||||
});
|
||||
}
|
||||
|
||||
this.index(path, true);
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Open File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
openFile: function(path, focus) {
|
||||
if (focus === undefined) {
|
||||
focus = true;
|
||||
}
|
||||
var node = $('#file-manager a[data-path="' + path + '"]');
|
||||
var ext = this.getExtension(path);
|
||||
if ($.inArray(ext.toLowerCase(), this.noOpen) < 0) {
|
||||
node.addClass('loading');
|
||||
$.get(this.controller + '?action=open&path=' + encodeURIComponent(path), function(data) {
|
||||
var openResponse = codiad.jsend.parse(data);
|
||||
if (openResponse != 'error') {
|
||||
node.removeClass('loading');
|
||||
codiad.active.open(path, openResponse.content, openResponse.mtime, false, focus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if(!codiad.project.isAbsPath(path)) {
|
||||
if ($.inArray(ext.toLowerCase(), this.noBrowser) < 0) {
|
||||
this.download(path);
|
||||
} else {
|
||||
this.openInModal(path);
|
||||
}
|
||||
} else {
|
||||
codiad.message.error(i18n('Unable to open file in Browser'));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Open in browser
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
openInBrowser: function(path) {
|
||||
$.ajax({
|
||||
url: this.controller + '?action=open_in_browser&path=' + encodeURIComponent(path),
|
||||
success: function(data) {
|
||||
var openIBResponse = codiad.jsend.parse(data);
|
||||
if (openIBResponse != 'error') {
|
||||
window.open(openIBResponse.url, '_newtab');
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
openInModal: function(path) {
|
||||
codiad.modal.load(250, this.dialog, {
|
||||
action: 'preview',
|
||||
path: path
|
||||
});
|
||||
},
|
||||
saveModifications: function(path, data, callbacks, save=true){
|
||||
callbacks = callbacks || {};
|
||||
var _this = this, action, data;
|
||||
var notifySaveErr = function() {
|
||||
codiad.message.error(i18n('File could not be saved'));
|
||||
if (typeof callbacks.error === 'function') {
|
||||
var context = callbacks.context || _this;
|
||||
callbacks.error.apply(context, [data]);
|
||||
}
|
||||
}
|
||||
$.post(this.controller + '?action=modify&path=' + encodeURIComponent(path), data, function(resp){
|
||||
resp = $.parseJSON(resp);
|
||||
if (resp.status == 'success') {
|
||||
if ( save === true ) {
|
||||
codiad.message.success(i18n('File saved'));
|
||||
}
|
||||
if (typeof callbacks.success === 'function'){
|
||||
var context = callbacks.context || _this;
|
||||
callbacks.success.call(context, resp.data.mtime);
|
||||
}
|
||||
} else {
|
||||
if (resp.message == 'Client is out of sync'){
|
||||
var reload = confirm(
|
||||
"Server has a more updated copy of the file. Would "+
|
||||
"you like to refresh the contents ? Pressing no will "+
|
||||
"cause your changes to override the server's copy upon "+
|
||||
"next save."
|
||||
);
|
||||
if (reload) {
|
||||
codiad.active.close(path);
|
||||
codiad.active.removeDraft(path);
|
||||
_this.openFile(path);
|
||||
} else {
|
||||
var session = codiad.editor.getActive().getSession();
|
||||
session.serverMTime = null;
|
||||
session.untainted = null;
|
||||
}
|
||||
} else codiad.message.error(i18n('File could not be saved'));
|
||||
if (typeof callbacks.error === 'function') {
|
||||
var context = callbacks.context || _this;
|
||||
callbacks.error.apply(context, [resp.data]);
|
||||
}
|
||||
}
|
||||
}).error(notifySaveErr);
|
||||
},
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Save file
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
saveFile: function(path, content, callbacks, save=true) {
|
||||
this.saveModifications(path, {content: content}, callbacks, save);
|
||||
},
|
||||
|
||||
savePatch: function(path, patch, mtime, callbacks) {
|
||||
if (patch.length > 0)
|
||||
this.saveModifications(path, {patch: patch, mtime: mtime}, callbacks);
|
||||
else if (typeof callbacks.success === 'function'){
|
||||
var context = callbacks.context || this;
|
||||
callbacks.success.call(context, mtime);
|
||||
}
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Create Object
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
createNode: function(path, type) {
|
||||
codiad.modal.load(250, this.dialog, {
|
||||
action: 'create',
|
||||
type: type,
|
||||
path: path
|
||||
});
|
||||
$('#modal-content form')
|
||||
.live('submit', function(e) {
|
||||
e.preventDefault();
|
||||
var shortName = $('#modal-content form input[name="object_name"]')
|
||||
.val();
|
||||
var path = $('#modal-content form input[name="path"]')
|
||||
.val();
|
||||
var type = $('#modal-content form input[name="type"]')
|
||||
.val();
|
||||
var createPath = path + '/' + shortName;
|
||||
$.get(codiad.filemanager.controller + '?action=create&path=' + encodeURIComponent(createPath) + '&type=' + type, function(data) {
|
||||
var createResponse = codiad.jsend.parse(data);
|
||||
if (createResponse != 'error') {
|
||||
codiad.message.success(type.charAt(0)
|
||||
.toUpperCase() + type.slice(1) + ' Created');
|
||||
codiad.modal.unload();
|
||||
// Add new element to filemanager screen
|
||||
codiad.filemanager.createObject(path, createPath, type);
|
||||
if(type == 'file') {
|
||||
codiad.filemanager.openFile(createPath, true);
|
||||
}
|
||||
/* Notify listeners. */
|
||||
amplify.publish('filemanager.onCreate', {createPath: createPath, path: path, shortName: shortName, type: type});
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Copy to Clipboard
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
copyNode: function(path) {
|
||||
this.clipboard = path;
|
||||
codiad.message.success(i18n('Copied to Clipboard'));
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Paste
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
pasteNode: function(path) {
|
||||
var _this = this;
|
||||
if (this.clipboard == '') {
|
||||
codiad.message.error(i18n('Nothing in Your Clipboard'));
|
||||
} else if (path == this.clipboard) {
|
||||
codiad.message.error(i18n('Cannot Paste Directory Into Itself'));
|
||||
} else {
|
||||
var shortName = _this.getShortName(_this.clipboard);
|
||||
if ($('#file-manager a[data-path="' + path + '/' + shortName + '"]')
|
||||
.length) { // Confirm overwrite?
|
||||
codiad.modal.load(400, this.dialog, {
|
||||
action: 'overwrite',
|
||||
path: path + '/' + shortName
|
||||
});
|
||||
$('#modal-content form')
|
||||
.live('submit', function(e) {
|
||||
e.preventDefault();
|
||||
var duplicate = false;
|
||||
if($('#modal-content form select[name="or_action"]').val()==1){
|
||||
duplicate=true; console.log('Dup!');
|
||||
}
|
||||
_this.processPasteNode(path,duplicate);
|
||||
});
|
||||
} else { // No conflicts; proceed...
|
||||
_this.processPasteNode(path,false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
processPasteNode: function(path,duplicate) {
|
||||
var _this = this;
|
||||
var shortName = this.getShortName(this.clipboard);
|
||||
var type = this.getType(this.clipboard);
|
||||
if(duplicate){
|
||||
shortName = "copy_of_"+shortName;
|
||||
}
|
||||
$.get(this.controller + '?action=duplicate&path=' +
|
||||
encodeURIComponent(this.clipboard) + '&destination=' +
|
||||
encodeURIComponent(path + '/' + shortName), function(data) {
|
||||
var pasteResponse = codiad.jsend.parse(data);
|
||||
if (pasteResponse != 'error') {
|
||||
_this.createObject(path, path + '/' + shortName, type);
|
||||
codiad.modal.unload();
|
||||
/* Notify listeners. */
|
||||
amplify.publish('filemanager.onPaste', {path: path, shortName: shortName, duplicate: duplicate});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Rename
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
renameNode: function(path) {
|
||||
var shortName = this.getShortName(path);
|
||||
var type = this.getType(path);
|
||||
var _this = this;
|
||||
codiad.modal.load(250, this.dialog, { action: 'rename', path: path, short_name: shortName, type: type});
|
||||
$('#modal-content form')
|
||||
.live('submit', function(e) {
|
||||
e.preventDefault();
|
||||
var newName = $('#modal-content form input[name="object_name"]')
|
||||
.val();
|
||||
// Build new path
|
||||
var arr = path.split('/');
|
||||
var temp = new Array();
|
||||
for (i = 0; i < arr.length - 1; i++) {
|
||||
temp.push(arr[i])
|
||||
}
|
||||
var newPath = temp.join('/') + '/' + newName;
|
||||
$.get(_this.controller, { action: 'modify', path: path, new_name: newName} , function(data) {
|
||||
var renameResponse = codiad.jsend.parse(data);
|
||||
if (renameResponse != 'error') {
|
||||
codiad.message.success(type.charAt(0)
|
||||
.toUpperCase() + type.slice(1) + ' Renamed');
|
||||
var node = $('#file-manager a[data-path="' + path + '"]');
|
||||
// Change pathing and name for node
|
||||
node.attr('data-path', newPath)
|
||||
.html(newName);
|
||||
if (type == 'file') { // Change icons for file
|
||||
curExtClass = 'ext-' + _this.getExtension(path);
|
||||
newExtClass = 'ext-' + _this.getExtension(newPath);
|
||||
$('#file-manager a[data-path="' + newPath + '"]')
|
||||
.removeClass(curExtClass)
|
||||
.addClass(newExtClass);
|
||||
} else { // Change pathing on any sub-files/directories
|
||||
_this.repathSubs(path, newPath);
|
||||
}
|
||||
// Change any active files
|
||||
codiad.active.rename(path, newPath);
|
||||
codiad.modal.unload();
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
repathSubs: function(oldPath, newPath) {
|
||||
$('#file-manager a[data-path="' + newPath + '"]')
|
||||
.siblings('ul')
|
||||
.find('a')
|
||||
.each(function() {
|
||||
// Hit the children, hit 'em hard
|
||||
var curPath = $(this)
|
||||
.attr('data-path');
|
||||
var revisedPath = curPath.replace(oldPath, newPath);
|
||||
$(this)
|
||||
.attr('data-path', revisedPath);
|
||||
});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Delete
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
deleteNode: function(path) {
|
||||
var _this = this;
|
||||
codiad.modal.load(400, this.dialog, {
|
||||
action: 'delete',
|
||||
path: path
|
||||
});
|
||||
$('#modal-content form')
|
||||
.live('submit', function(e) {
|
||||
e.preventDefault();
|
||||
$.get(_this.controller + '?action=delete&path=' + encodeURIComponent(path), function(data) {
|
||||
var deleteResponse = codiad.jsend.parse(data);
|
||||
if (deleteResponse != 'error') {
|
||||
var node = $('#file-manager a[data-path="' + path + '"]');
|
||||
node.parent('li')
|
||||
.remove();
|
||||
// Close any active files
|
||||
$('#active-files a')
|
||||
.each(function() {
|
||||
var curPath = $(this)
|
||||
.attr('data-path');
|
||||
if (curPath.indexOf(path) == 0) {
|
||||
codiad.active.remove(curPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
codiad.modal.unload();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Search
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
search: function(path) {
|
||||
codiad.modal.load(500, this.dialog,{
|
||||
action: 'search',
|
||||
path: path
|
||||
});
|
||||
codiad.modal.load_process.done( function() {
|
||||
var lastSearched = JSON.parse(localStorage.getItem("lastSearched"));
|
||||
if(lastSearched) {
|
||||
$('#modal-content form input[name="search_string"]').val(lastSearched.searchText);
|
||||
$('#modal-content form input[name="search_file_type"]').val(lastSearched.fileExtension);
|
||||
$('#modal-content form select[name="search_type"]').val(lastSearched.searchType);
|
||||
if(lastSearched.searchResults != '') {
|
||||
$('#filemanager-search-results').slideDown().html(lastSearched.searchResults);
|
||||
}
|
||||
}
|
||||
});
|
||||
codiad.modal.hideOverlay();
|
||||
var _this = this;
|
||||
$('#modal-content form')
|
||||
.live('submit', function(e) {
|
||||
$('#filemanager-search-processing')
|
||||
.show();
|
||||
e.preventDefault();
|
||||
searchString = $('#modal-content form input[name="search_string"]')
|
||||
.val();
|
||||
fileExtensions=$('#modal-content form input[name="search_file_type"]')
|
||||
.val();
|
||||
searchFileType=$.trim(fileExtensions);
|
||||
if (searchFileType != '') {
|
||||
//season the string to use in find command
|
||||
searchFileType = "\\(" + searchFileType.replace(/\s+/g, "\\|") + "\\)";
|
||||
}
|
||||
searchType = $('#modal-content form select[name="search_type"]')
|
||||
.val();
|
||||
$.post(_this.controller + '?action=search&path=' + encodeURIComponent(path) + '&type=' + searchType, {
|
||||
search_string: searchString,
|
||||
search_file_type: searchFileType
|
||||
}, function(data) {
|
||||
searchResponse = codiad.jsend.parse(data);
|
||||
var results = '';
|
||||
if (searchResponse != 'error') {
|
||||
$.each(searchResponse.index, function(key, val) {
|
||||
// Cleanup file format
|
||||
if(val['file'].substr(-1) == '/') {
|
||||
val['file'] = val['file'].substr(0, str.length - 1);
|
||||
}
|
||||
val['file'] = val['file'].replace('//','/');
|
||||
// Add result
|
||||
results += '<div><a onclick="codiad.filemanager.openFile(\'' + val['result'] + '\');setTimeout( function() { codiad.active.gotoLine(' + val['line'] + '); }, 500);codiad.modal.unload();">Line ' + val['line'] + ': ' + val['file'] + '</a></div>';
|
||||
});
|
||||
$('#filemanager-search-results')
|
||||
.slideDown()
|
||||
.html(results);
|
||||
} else {
|
||||
$('#filemanager-search-results')
|
||||
.slideUp();
|
||||
}
|
||||
_this.saveSearchResults(searchString, searchType, fileExtensions, results);
|
||||
$('#filemanager-search-processing')
|
||||
.hide();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// saveSearchResults
|
||||
/////////////////////////////////////////////////////////////////
|
||||
saveSearchResults: function(searchText, searchType, fileExtensions, searchResults) {
|
||||
var lastSearched = {
|
||||
searchText: searchText,
|
||||
searchType: searchType,
|
||||
fileExtension: fileExtensions,
|
||||
searchResults: searchResults
|
||||
};
|
||||
localStorage.setItem("lastSearched", JSON.stringify(lastSearched));
|
||||
},
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Upload
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
uploadToNode: function(path) {
|
||||
codiad.modal.load(500, this.dialogUpload, {path: path});
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Download
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
download: function(path) {
|
||||
var type = this.getType(path);
|
||||
$('#download')
|
||||
.attr('src', 'components/filemanager/download.php?path=' + encodeURIComponent(path) + '&type=' + type);
|
||||
}
|
||||
};
|
||||
|
||||
})(this, jQuery);
|
||||
";
|
|
@ -1,26 +0,0 @@
|
|||
s:445:"/*
|
||||
|
||||
Created: 2018-07-09
|
||||
Revised: N/A
|
||||
Purpose: A template for vanilla js with one library.
|
||||
|
||||
*/
|
||||
/*global L*/
|
||||
/*global m*/
|
||||
/*global v*/
|
||||
/*global c*/
|
||||
|
||||
c.designateFunction = function(eventObject) {
|
||||
c.updateMetaEvents(eventObject)
|
||||
let functionQualifiers = {
|
||||
setToggleFirstButton: [m.source === v.firstButton, m.released],
|
||||
/*
|
||||
setXXY: [],
|
||||
setXXZ: [],
|
||||
setXYX: [],
|
||||
setXYY: [],
|
||||
*/
|
||||
}
|
||||
L.runQualifiedFunctions(functionQualifiers, m, v, c)
|
||||
}
|
||||
";
|
|
@ -1,73 +0,0 @@
|
|||
s:1458:"/*
|
||||
|
||||
Created: 2018-07-10
|
||||
Modified: N/A
|
||||
Purpose: To pollute the global scope then initialize our plugin.
|
||||
|
||||
*/
|
||||
/* global L
|
||||
* global m
|
||||
* global v
|
||||
* global c
|
||||
*/
|
||||
const m = {}
|
||||
const v = {}
|
||||
const c = {}
|
||||
|
||||
/////////////////////////////
|
||||
c.initialize = function(eventObject) {
|
||||
c.initializeModel(eventObject)
|
||||
|
||||
L.attachAllElementsById(v)
|
||||
|
||||
let eventTypes = [
|
||||
`change`,
|
||||
`click`,
|
||||
`dblclick`,
|
||||
`input`,
|
||||
`keydown`,
|
||||
`keyup`,
|
||||
`load`,
|
||||
`mousedown`,
|
||||
`mousemove`,
|
||||
`mouseout`,
|
||||
`mouseover`,
|
||||
`mouseup`,
|
||||
`offline`,
|
||||
`online`,
|
||||
`orientationchange`,
|
||||
`resize`,
|
||||
`touchend`,
|
||||
`touchmove`,
|
||||
`touchstart`,
|
||||
]
|
||||
|
||||
//Clever way: for each member of the eventTypes array, have the window listen for the event
|
||||
eventTypes.forEach((event)=>{window.addEventListener(event, c.designateFunction)})
|
||||
|
||||
/*
|
||||
|
||||
let eventType;
|
||||
for(eventType of eventTypes){
|
||||
window.addEventListener(eventType, c.designateFunction)
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
/////////////////////////////
|
||||
c.initializeModel = function(eventObject){
|
||||
m.eventObject = eventObject //the event object itself
|
||||
m.source = eventObject.target //where the event took place
|
||||
m.type = eventObject.type //what the event was
|
||||
m.id = eventObject.target.id //the id of the element where the event occurred
|
||||
|
||||
//Shortcuts to combine similar mobile and computer events
|
||||
m.pressed = m.type === `mousedown` || m.type === `touchstart`
|
||||
m.released = m.type === `mouseup` || m.type === `touchend`
|
||||
|
||||
//et cetera ....
|
||||
|
||||
}
|
||||
|
||||
";
|
|
@ -1,30 +0,0 @@
|
|||
s:855:"<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require_once( "./includes/head.php" );
|
||||
require_once( "./includes/header.php" );
|
||||
|
||||
?>
|
||||
<section class="content">
|
||||
<p>This page will eventually be password protected with a better interface.</p>
|
||||
<p>Pages</p>
|
||||
<ul>
|
||||
<li><a href=""></a></li>
|
||||
<li><a href="./info.php">PHP Module Information</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Info</p>
|
||||
<ul>
|
||||
<li>Connect to server admin interface <a href="https://66.251.14.121:10000" target="_blank">https://66.251.14.121:10000</a></li>
|
||||
<li>Connect to website admin interface <a href="https://66.251.14.121/admin" target="_blank">https://66.251.14.121/admin</a></li>
|
||||
|
||||
<li>Connect to ssh through ssh user@66.251.14.121</li>
|
||||
</ul>
|
||||
vncserver -UserPasswdVerifier UnixAuth
|
||||
</section>
|
||||
<?php
|
||||
|
||||
require_once( "./includes/footer.php" );
|
||||
|
||||
?>";
|
|
@ -1,26 +0,0 @@
|
|||
s:445:"/*
|
||||
|
||||
Created: 2018-07-09
|
||||
Revised: N/A
|
||||
Purpose: A template for vanilla js with one library.
|
||||
|
||||
*/
|
||||
/*global L*/
|
||||
/*global m*/
|
||||
/*global v*/
|
||||
/*global c*/
|
||||
|
||||
c.designateFunction = function(eventObject) {
|
||||
c.updateMetaEvents(eventObject)
|
||||
let functionQualifiers = {
|
||||
setToggleFirstButton: [m.source === v.firstButton, m.released],
|
||||
/*
|
||||
setXXY: [],
|
||||
setXXZ: [],
|
||||
setXYX: [],
|
||||
setXYY: [],
|
||||
*/
|
||||
}
|
||||
L.runQualifiedFunctions(functionQualifiers, m, v, c)
|
||||
}
|
||||
";
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue