Compare commits

..

45 Commits
v1.5 ... v1.6

Author SHA1 Message Date
Matt Pass
a21772f3c2 New screenshot & 2 new features 2013-02-08 14:55:35 +00:00
Matt Pass
cbd930a340 Version 1.6 2013-02-08 14:33:21 +00:00
Matt Pass
9f129c9781 Tidying up recent changes re tabs
tagDragMouseXStart should be tabDragMouseXStart
Ensuring vars are defined at top of function & in usage order
Forgot a var in the foor loop
2013-02-08 14:32:45 +00:00
Matt Pass
18931e94b0 Move 5 x tab functions to tabs section of file 2013-02-08 14:03:19 +00:00
Matt Pass
1520828dff Set tabWidth to begin with
To avoid having a gap after closing all tabs
Also removed thisWidth, moved this value into tabWidth value
2013-02-08 13:56:55 +00:00
Matt Pass
43223d1677 Perform alphanum sort on files not paths
Run new currentArrayFull array inline with currentArray
This provides a full path and the currentArray then becomes a file array
only
nextValueFull provides the value which we find the index of to insert
into alphaArray
2013-02-08 13:44:43 +00:00
Matt Pass
3fb9836fc8 Tab dragging, sortTabs, alphaTabs & dynamic close
closeButtons now take the parent nodes' ID to know what to close, also
image inside has no ID anymore, targetted via
childNodes[0].childNodes[0] from parent tab
var diffX at top of function
Setting both tabSlide and tabDrag classes on start of tab dragging now
Massively improved and finished tabDragStart, tabDragMove & tabDragEnd
functions
New functions - sortTabs and alphaTabs
No need to get cM on redoTabHightlight, and it also sets the close tab
BG color by targeting the child elems, no need to consider or update an
ID on this anymore.
Now asking to close on all tabs
2013-02-08 10:57:49 +00:00
Matt Pass
8cd5a10ea8 Trigger tabDragEnd onmouseup on html tag
This is so you can drag and release in either the editor or files areas
and it will release the tab.
2013-02-08 10:21:48 +00:00
Matt Pass
da1850896b alphaTabs button & this.id on 2 x hardcoded items
New alphaTabs button added next to closeAllTabs
Titles added to both so user knows what these are
The argument on the mousedown and mouseup events now look to the ID of
the item, rather than being hardcoded values. This is so we only have to
change the ID on the tab and the rest falls into line.
No longer doing onmouseup here, this is now handled at the top level
(index.php)
2013-02-08 10:19:18 +00:00
Matt Pass
336ef01dee loadedFile to replace all & chars for textarea
This is so & becomes & ...what you draw out of the textarea
is then &
In turn this allows all HTML entities of this style to work and as we
aren't using PHP's htmlentities(), we don't end with junk chars on
slanted apostrophes, degree symbols etc.
2013-02-08 10:12:35 +00:00
Matt Pass
246bf189b5 tabDrag and alphaTabs classes
New tabDrag class to determin transition of 0s
New alphaTabs class to show next to closeAllTabs button
Move closeAllTabs across to make room for this
2013-02-08 10:09:34 +00:00
Matt Pass
825effadd9 Syntax formatting change only 2013-02-08 10:05:04 +00:00
Matt Pass
51f53855f8 Alpha tabs button added 2013-02-08 10:04:24 +00:00
Matt Pass
65fa29fbb8 Determining which tabs to swap on release
When you release the mouse after dragging now, we're able to decide
which tabs were swapped.
2013-02-04 09:04:34 +00:00
Matt Pass
5bcfa06e19 New refresh FM icon 2013-02-04 09:03:20 +00:00
Matt Pass
b01218958f Tab dragging working with variable widths
Not working to the 150px default, now working to the possibly smaller
tab widths
2013-02-03 17:24:21 +00:00
Matt Pass
7887f0e7a1 Tab sliding and opacity
On start of the drag, all tabs apart from the one we are dragging are
given the additional tabSlide class so they slide in the background.
Better use of swapWith variable and now setting background tabs position
more effectively plus also setting opacity and returning to full opacity
on release of mouse button.
On that event we also add the tabSlide class on our released tab so it
slides into place, set the tab widths/positions again and after 150ms
(after our released tab has finished it's slide transition), reset the
zIndex, classname for everything back to the initial state.
2013-02-03 16:58:12 +00:00
Matt Pass
f522502938 Classes to transition tabs left 0.15s
By default this is 0s, tabs other than the one being dragged is given
the extra tabSlide class so they slide around in the background. The tab
being dragged will also slide into place when the mouse button is
released.
2013-02-03 16:52:30 +00:00
Matt Pass
c7f533cf0a New tab dragging system & del removeSnippet
Previously we were using HTML5 dragging, but this is too freerange, we
want to restrict to a region and x-axis only. Replaced with new system,
doesn't actually do anything yet when you release mouse but UI works.
Deleted the removeSnippet function, no longer used.
2013-02-03 15:19:55 +00:00
Matt Pass
a3107de33e tab & newTab absolute positioning & zindex of 1
So we can control their position easily
2013-02-03 15:13:25 +00:00
Matt Pass
e69a3249e5 Updating to work with new tab dragging
onMouseUp on HTML tag now triggers tabDragEnd
Tabs no longer have 'draggable' attribute, onMouseDown replaces onClick,
which also fires tabDragStart event and onMouseUp also fires tabDragEnd
newTab has an ID so we can control it
2013-02-03 15:11:38 +00:00
mattpass
f3c24f05e0 Merge pull request #152 from aharris88/master
.gitkeep files for empty directories
2013-02-01 14:42:49 -08:00
aharris88
20364bb1d7 Replace placeholder backups/readme.txt with .gitkeep 2013-02-01 15:59:49 -06:00
mattpass
3d1c92dae4 Merge pull request #149 from aharris88/master
Add .gitignore file to ignore backups and error-log
2013-02-01 11:27:41 -08:00
aharris88
4048895c6b Ignore backups and error-log 2013-02-01 12:01:24 -06:00
aharris88
991908bd8d Add elseif onto if statement in lib/settings.php 2013-02-01 11:56:29 -06:00
mattpass
8ff559dbef Merge pull request #147 from aharris88/master
header issue #146
2013-02-01 09:31:34 -08:00
aharris88
d7d483ef9c Fix header issue #146 2013-02-01 11:25:13 -06:00
Matt Pass
b11064e3a8 Autoopen for more than 0 files, transparent close
Only prompt to open if we have 0 files
Close button is transparent if not changed
2013-02-01 16:05:12 +00:00
Matt Pass
409d35b29b Asks if you want to open previous files on boot
Now shows ask message to ask if you'd like to open previous files.
Also shows the no of files and list
2013-02-01 13:44:28 +00:00
Matt Pass
811cf40cd7 Close all tabs sets new arg for setPreviousFiles
closeAllTabs now passes 2nd arg to closeTab, setting true if we've got
more tabs to close, false if not. The dontSetPV arg determins if we
should setPreviousFiles or not. This means we only set this once all
tabs have been closed.
Also fixed issue with setting previousFiles, wasn't setting on 'CLEAR',
ie, no tabs open. Now sets a blank to handle this.
2013-01-31 17:59:44 +00:00
Matt Pass
3aa9d23ac6 wireframe|cc added as a URL plugin 2013-01-31 14:35:44 +00:00
Matt Pass
9c8bb08454 Remove htmlentities() to avoid junk chars
Not needed and just caused junk/rubbish.
2013-01-31 14:05:47 +00:00
Matt Pass
2c28af0dd7 Check if !ctrlKeyDown on deciding on change
An estimated 20% of the time CTRL+key combos would register as a change.
Readded checking on !ctrlKeyDown to fix this.
2013-01-24 07:54:25 +00:00
Matt Pass
cc6bd40b15 Var name fix, should be $renamed 2013-01-24 07:36:11 +00:00
Matt Pass
5221ba0959 Shows server message to indicate file upload
Users aren't always aware if a file upload has happened OK, this server
message helps put the point across.
2013-01-23 19:48:56 +00:00
Matt Pass
61f132327d Type boosting on function, removed fallback
Removed 'f ' as a type booster, now being more specific by requiring the
user type 'function'. This is consistent with if and for. It also won't
work as the autocomplete script will want to trigger instead and display
items starting with 'f'.
Removed showing the snippet display as a fallback.
2013-01-23 19:39:59 +00:00
Matt Pass
826730e88b Code completion added for JS via simple hint
Simple hint .css, .js and the javascript hinter added
No need to have Ctrl-Up or Down to do nothing, handled in icecoder.js
Ctrl-Space triggers the autocomplete command
This is setup as a function which runs if the cursor is in a JS block
2013-01-23 19:37:51 +00:00
Matt Pass
5cdb08c35f Using CodeMirror 3.01 now 2013-01-23 19:35:17 +00:00
Matt Pass
9806d3705a Snippet display no longer fallback
If you now hit CTRL+space and you're not expanding function, if or for,
it will fallthrough the CodeMirror addon of code completion rather than
show this snippet info screen.
2013-01-23 19:34:57 +00:00
Matt Pass
55e6e66df6 Update CodeMirror 3 to 3.01, incl code hinting
Also includes simple-hint.js, javascript-hint.js and simple-hint.css
2013-01-23 19:33:40 +00:00
Matt Pass
0d38b23a60 Fixed tab filename display & rename title
Simplified background on .tab class, also set it to relative positioning
and removed text having a RTL direction and being right aligned. Then
set the .closeTab class to also be absolutely positioned and 7px from
the right edge. Now the text is left aligned and close tab link right
aligned!
Renaming open tabs also now updates title
Fixed 2 x titles to have slashes at start now we aren't using RTL
direction
2013-01-22 20:26:08 +00:00
Matt Pass
07fd0ab6bf Fixes to rename processes
renameFile didn't have i var set, so I have set this to be what is
expected so we can now rename open files again.
shortURL was having it's slashes replaced with pipes in a few areas but
not all which meant it wasn't changing the onmouseover argument. Now
doing this on setting the var now which means a fix and less code.
Also forgot to alter the title attribute, now changing that on rename
too.
2013-01-22 20:01:54 +00:00
Matt Pass
6036b0635d Error catching on rename function
Test if the rename has taken place and only if it has, call
updateFileManagerList etc. If it hasn't set the renamed var to false. If
renamed var is false, show the improved error message (gives note on
permissions).
2013-01-22 19:58:21 +00:00
Matt Pass
74f678076a Don't update openFiles array on upload
Calling updateFileManagerList now includes a 6th argument and if a true
value is passed, then it's indicating an uploaded file and shouldn't set
the openFiles array value.
2013-01-22 18:49:48 +00:00
37 changed files with 913 additions and 809 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
error-log.txt
backups/*.zip

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com> Copyright (C) 2013 by Marijn Haverbeke <marijnh@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -0,0 +1,16 @@
.CodeMirror-completions {
position: absolute;
z-index: 10;
overflow: hidden;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
}
.CodeMirror-completions select {
background: #fafafa;
outline: none;
border: none;
padding: 0;
margin: 0;
font-family: monospace;
}

File diff suppressed because one or more lines are too long

View File

@@ -39,14 +39,14 @@
/* CURSOR */ /* CURSOR */
.CodeMirror pre.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black; border-left: 1px solid black;
} }
/* Shown when moving in bi-directional text */ /* Shown when moving in bi-directional text */
.CodeMirror pre.CodeMirror-secondarycursor { .CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver; border-left: 1px solid silver;
} }
.cm-keymap-fat-cursor pre.CodeMirror-cursor { .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto; width: auto;
border: 0; border: 0;
background: transparent; background: transparent;
@@ -54,11 +54,11 @@
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
} }
/* Kludge to turn off filter in ie9+, which also accepts rgba */ /* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) { .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
} }
/* Can style cursor different in overwrite (non-insert) mode */ /* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} .CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
/* DEFAULT THEME */ /* DEFAULT THEME */
@@ -196,6 +196,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-linewidget { .CodeMirror-linewidget {
position: relative; position: relative;
z-index: 2; z-index: 2;
overflow: auto;
} }
.CodeMirror-wrap .CodeMirror-scroll { .CodeMirror-wrap .CodeMirror-scroll {
@@ -210,20 +211,20 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
} }
.CodeMirror-measure pre { position: static; } .CodeMirror-measure pre { position: static; }
.CodeMirror pre.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
position: absolute; position: absolute;
visibility: hidden; visibility: hidden;
border-right: none; border-right: none;
width: 0; width: 0;
} }
.CodeMirror-focused pre.CodeMirror-cursor { .CodeMirror-focused div.CodeMirror-cursor {
visibility: visible; visibility: visible;
} }
.CodeMirror-selected { background: #d9d9d9; } .CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching { .cm-searching {
background: #ffa; background: #ffa;
background: rgba(255, 255, 0, .4); background: rgba(255, 255, 0, .4);
} }
@@ -233,7 +234,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
@media print { @media print {
/* Hide the cursor when printing */ /* Hide the cursor when printing */
.CodeMirror pre.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
visibility: hidden; visibility: hidden;
} }
} }

View File

@@ -3,7 +3,7 @@
Early version of the web based IDE which allows for creation of websites in the web browser. Uses the brilliant CodeMirror for code highlighting & editing, with a slick IDE wrapped around it to make the whole thing work. Early version of the web based IDE which allows for creation of websites in the web browser. Uses the brilliant CodeMirror for code highlighting & editing, with a slick IDE wrapped around it to make the whole thing work.
<img src="http://icecoder.net/images/icecoder-v1pt4-web-ide.jpg" alt="ICEcoder web IDE"> <img src="http://icecoder.net/images/icecoder-v1pt6-web-ide.jpg" alt="ICEcoder web IDE">
###Features you'd expect ###Features you'd expect
* Context aware code highlighting * Context aware code highlighting
@@ -41,6 +41,8 @@ Early version of the web based IDE which allows for creation of websites in the
* Shell terminal * Shell terminal
* JS Hint validation as you type * JS Hint validation as you type
* Emmet snippet typing booster * Emmet snippet typing booster
* JavaScript code hinting
* Alphanumeric tab sorting
###Installation ###Installation

0
backups/.gitkeep Normal file
View File

View File

@@ -1 +0,0 @@
Zip It! backups are stored in this folder

View File

@@ -1,228 +1,233 @@
<?php include("lib/settings.php");?> <?php include("lib/settings.php");?>
<!DOCTYPE html> <!DOCTYPE html>
<html style="margin: 0" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'editor');top.ICEcoder.canResizeFilesW()}"> <html style="margin: 0" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; top.ICEcoder.tabDragEnd()" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'editor');top.ICEcoder.canResizeFilesW()}">
<head> <head>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> editor</title> <title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css"> <link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
<!-- <link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/hint/simple-hint.css">
codemirror-compressed.js <!--
incls: codemirror.js codemirror-compressed.js
modes: clike, coffeescript, css, javascript, less, php, ruby & xml incls: codemirror.js
utils: foldcode, searchcursor, match-highlighter modes: clike, coffeescript, css, javascript, less, php, ruby & xml
//--> utils: foldcode, searchcursor, match-highlighter, simple-hint, javascript-hint
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script> //-->
<?php <script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) { <?php
echo '<script src="plugins/emmet/emmet.min.js"></script>'; if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
};?> echo '<script src="plugins/emmet/emmet.min.js"></script>';
<link rel="stylesheet" href="<?php };?>
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';}; <link rel="stylesheet" href="<?php
$activeLineBG = $ICEcoder["theme"]=="eclipse" || $ICEcoder["theme"]=="elegant" || $ICEcoder["theme"]=="neat" ? "#ccc" : "#000"; if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';};
?>"> $activeLineBG = $ICEcoder["theme"]=="eclipse" || $ICEcoder["theme"]=="elegant" || $ICEcoder["theme"]=="neat" ? "#ccc" : "#000";
<style type="text/css"> ?>">
.CodeMirror {position: absolute; top: 0px; width: 100%; font-size: 13px; z-index: 1} <style type="text/css">
.CodeMirror-scroll {} // was: height: auto; overflow: visible .CodeMirror {position: absolute; top: 0px; width: 100%; font-size: 13px; z-index: 1}
/* Make sure this next one remains the 3rd item, updated with JS */ .CodeMirror-scroll {} // was: height: auto; overflow: visible
.cm-s-activeLine {background: <?php echo $activeLineBG;?> !important} /* Make sure this next one remains the 3rd item, updated with JS */
span.CodeMirror-matchhighlight {background: #555} .cm-s-activeLine {background: <?php echo $activeLineBG;?> !important}
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000; background: #555; !important} span.CodeMirror-matchhighlight {background: #555}
/* Make sure this next one remains the 6th item, updated with JS */ .CodeMirror-focused span.CodeMirror-matchhighlight {color: #000; background: #555; !important}
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";} /* Make sure this next one remains the 6th item, updated with JS */
.lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px} .cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";}
.lint-error-icon {background-color: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px} .lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px}
.snippetFrame {border: 1px; width: 100%} .lint-error-icon {background-color: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px}
</style> .snippetFrame {border: 1px; width: 100%}
</head> </style>
</head>
<body onLoad="top.ICEcoder.updateFileFolderCount()" style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<body onLoad="top.ICEcoder.updateFileFolderCount()" style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<div style="margin: 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
<div style="float: left; margin-right: 50px"> <div style="margin: 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
<h2 style="color: rgba(0,198,255,0.7)">server</h2> <div style="float: left; margin-right: 50px">
<span style="color:#888">Server name, OS & IP:</span><br> <h2 style="color: rgba(0,198,255,0.7)">server</h2>
<?php echo $_SERVER['SERVER_NAME']." &nbsp;&nbsp ".$_SERVER['SERVER_SOFTWARE']." &nbsp;&nbsp ".$_SERVER['SERVER_ADDR'];?><br><br> <span style="color:#888">Server name, OS & IP:</span><br>
<span style="color:#888">Root:</span><br> <?php echo $_SERVER['SERVER_NAME']." &nbsp;&nbsp ".$_SERVER['SERVER_SOFTWARE']." &nbsp;&nbsp ".$_SERVER['SERVER_ADDR'];?><br><br>
<?php echo $docRoot;?><br><br> <span style="color:#888">Root:</span><br>
<span style="color:#888">ICEcoder root:</span><br> <?php echo $docRoot;?><br><br>
<?php echo $docRoot.$ICEcoder['root'];?><br><br> <span style="color:#888">ICEcoder root:</span><br>
<span style="color:#888">PHP version:</span><br> <?php echo $docRoot.$ICEcoder['root'];?><br><br>
<?php echo phpversion();?><br><br> <span style="color:#888">PHP version:</span><br>
<span style="color:#888">Date & time:</span><br> <?php echo phpversion();?><br><br>
<span id="serverDT"></span><br><br><br> <span style="color:#888">Date & time:</span><br>
</div> <span id="serverDT"></span><br><br><br>
</div>
<div style="float: left">
<h2 style="color: rgba(0,198,255,0.7)">files</h2> <div style="float: left">
<span style="color:#888">Last 10 files opened:</span><br> <h2 style="color: rgba(0,198,255,0.7)">files</h2>
<?php <span style="color:#888">Last 10 files opened:</span><br>
$last10FilesArray = explode(",",$ICEcoder["last10Files"]); <?php
for ($i=0;$i<count($last10FilesArray);$i++) { $last10FilesArray = explode(",",$ICEcoder["last10Files"]);
if ($ICEcoder["last10Files"]=="") { for ($i=0;$i<count($last10FilesArray);$i++) {
echo '[none]<br><br>'; if ($ICEcoder["last10Files"]=="") {
} else { echo '[none]<br><br>';
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">'; } else {
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i])); echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
echo '</a><br>'.PHP_EOL; echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;}; echo '</a><br>'.PHP_EOL;
} if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;};
} }
;?> }
<span style="color:#888">File & folder count:</span><br> ;?>
<div id="fileFolderCounts"></div><br><br><br> <span style="color:#888">File & folder count:</span><br>
</div> <div id="fileFolderCounts"></div><br><br><br>
</div>
<div style="clear: both">
<h2 style="color: rgba(0,198,255,0.7)">your device</h2> <div style="clear: both">
<span style="color:#888">Browser:</span><br> <h2 style="color: rgba(0,198,255,0.7)">your device</h2>
<?php echo $_SERVER['HTTP_USER_AGENT'];?><br><br> <span style="color:#888">Browser:</span><br>
<span style="color:#888">Your IP:</span><br> <?php echo $_SERVER['HTTP_USER_AGENT'];?><br><br>
<?php echo $_SERVER['REMOTE_ADDR'];?> <span style="color:#888">Your IP:</span><br>
</div> <?php echo $_SERVER['REMOTE_ADDR'];?>
<script> </div>
var nDT=<?php echo time()*1000;?>; <script>
setInterval(function(){ var nDT=<?php echo time()*1000;?>;
var s=(new Date(nDT+=1e3)+'').split(' '), setInterval(function(){
d=s[2]*1, var s=(new Date(nDT+=1e3)+'').split(' '),
t=s[4].split(':'), d=s[2]*1,
p=t[0]>11?'pm':'am', t=s[4].split(':'),
e=d%20==1|d>30?'st':d%20==2?'nd':d%20==3?'rd':'th'; p=t[0]>11?'pm':'am',
t[0]=--t[0]%12+1; e=d%20==1|d>30?'st':d%20==2?'nd':d%20==3?'rd':'th';
if (document.getElementById('serverDT')) { t[0]=--t[0]%12+1;
document.getElementById('serverDT').innerHTML=[s[0],d+e,s[1],s[3],t.join(':')+p].join(' '); if (document.getElementById('serverDT')) {
} document.getElementById('serverDT').innerHTML=[s[0],d+e,s[1],s[3],t.join(':')+p].join(' ');
},1000); }
</script> },1000);
</div> </script>
</div>
<script>
CodeMirror.keyMap.ICEcoder = { <script>
"Tab": function(cm) {CodeMirror.commands[top.ICEcoder.tabsIndent ? "defaultTab" : "insertTab"](cm);}, CodeMirror.keyMap.ICEcoder = {
"Shift-Tab": "indentLess", "Tab": function(cm) {CodeMirror.commands[top.ICEcoder.tabsIndent ? "defaultTab" : "insertTab"](cm);},
"Ctrl-Up": function() {}, "Shift-Tab": "indentLess",
"Ctrl-Down": function() {}, "Ctrl-Space": "autocomplete",
fallthrough: ["default"] fallthrough: ["default"]
}; };
CodeMirror.commands.autocomplete = function(cm) {
function createNewCMInstance(num) { if (top.ICEcoder.caretLocType=="JavaScript") {
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]; CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
top.ICEcoder['cM'+num+'waiting'] = ""; }
top.ICEcoder['cM'+num+'widgets'] = []; }
window['cM'+num] = CodeMirror(document.body, { function createNewCMInstance(num) {
mode: "application/x-httpd-php", var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
lineNumbers: true, top.ICEcoder['cM'+num+'waiting'] = "";
lineWrapping: top.ICEcoder.lineWrapping, top.ICEcoder['cM'+num+'widgets'] = [];
indentUnit: top.ICEcoder.tabWidth,
tabSize: top.ICEcoder.tabWidth, window['cM'+num] = CodeMirror(document.body, {
indentWithTabs: true, mode: "application/x-httpd-php",
electricChars: false, lineNumbers: true,
keyMap: "ICEcoder", lineWrapping: top.ICEcoder.lineWrapping,
onKeyEvent: function(thisCM, e) { indentUnit: top.ICEcoder.tabWidth,
top.ICEcoder.redoChangedContent(e); tabSize: top.ICEcoder.tabWidth,
top.ICEcoder.findReplace('find',true,false); indentWithTabs: true,
top.ICEcoder.getCaretPosition(); electricChars: false,
top.ICEcoder.updateCharDisplay(); keyMap: "ICEcoder",
tok = thisCM.getTokenAt(thisCM.getCursor()); onKeyEvent: function(thisCM, e) {
if (tok.string!=">") {lastString=tok.string}; top.ICEcoder.redoChangedContent(e);
if (e.type=="keyup"&&e.keyCode=="16"&&lastKeyCode=="190") { top.ICEcoder.findReplace('find',true,false);
canDoEndTag=true; top.ICEcoder.getCaretPosition();
if (top.ICEcoder.tagString!="script" && top.ICEcoder.tagNestExceptions.indexOf(top.ICEcoder.tagString)>-1) { top.ICEcoder.updateCharDisplay();
canDoEndTag=false; tok = thisCM.getTokenAt(thisCM.getCursor());
} if (tok.string!=">") {lastString=tok.string};
if ( if (e.type=="keyup"&&e.keyCode=="16"&&lastKeyCode=="190") {
top.ICEcoder.tagString.slice(0,1)=="/"|| canDoEndTag=true;
top.ICEcoder.tagString.slice(0,1)=="?"|| if (top.ICEcoder.tagString!="script" && top.ICEcoder.tagNestExceptions.indexOf(top.ICEcoder.tagString)>-1) {
!top.ICEcoder.codeAssist|| canDoEndTag=false;
fileName && (fileName.indexOf(".js")>0||fileName.indexOf(".css")>0||fileName.indexOf(".less")>0) }
) {canDoEndTag=false} if (
top.ICEcoder.tagString.slice(0,1)=="/"||
contentType = top.ICEcoder.caretLocType; top.ICEcoder.tagString.slice(0,1)=="?"||
if (canDoEndTag && (contentType!="JavaScript"||(contentType=="JavaScript"&&top.ICEcoder.tagString=="script"))) { !top.ICEcoder.codeAssist||
numTabs = top.ICEcoder.htmlTagArray.length; fileName && (fileName.indexOf(".js")>0||fileName.indexOf(".css")>0||fileName.indexOf(".less")>0)
if (top.ICEcoder.htmlTagArray[0]=="html") {numTabs--}; ) {canDoEndTag=false}
tabs = "";
for (i=0;i<numTabs-1;i++) { contentType = top.ICEcoder.caretLocType;
tabs += "\t"; if (canDoEndTag && (contentType!="JavaScript"||(contentType=="JavaScript"&&top.ICEcoder.tagString=="script"))) {
} numTabs = top.ICEcoder.htmlTagArray.length;
endTag = "</" + top.ICEcoder.tagString + ">"; if (top.ICEcoder.htmlTagArray[0]=="html") {numTabs--};
if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"}; tabs = "";
if(top.ICEcoder.tagString=="title"||top.ICEcoder.tagString=="a"||top.ICEcoder.tagString=="li"||top.ICEcoder.tagString=="span"||(top.ICEcoder.tagString.slice(0,1)=="h"&&parseInt(top.ICEcoder.tagString.slice(1,2),10)>=1&&parseInt(top.ICEcoder.tagString.slice(1,2),10)<=7)) { for (i=0;i<numTabs-1;i++) {
thisCM.replaceSelection(endTag); tabs += "\t";
thisCM.setCursor(thisCM.getCursor().line,thisCM.getCursor().ch-top.ICEcoder.tagString.length-3); }
} else if(top.ICEcoder.tagString=="html"||top.ICEcoder.tagString=="head") { endTag = "</" + top.ICEcoder.tagString + ">";
thisCM.replaceSelection("\n\n"+endTag); if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"};
thisCM.setCursor(thisCM.getCursor().line-1,numTabs); if(top.ICEcoder.tagString=="title"||top.ICEcoder.tagString=="a"||top.ICEcoder.tagString=="li"||top.ICEcoder.tagString=="span"||(top.ICEcoder.tagString.slice(0,1)=="h"&&parseInt(top.ICEcoder.tagString.slice(1,2),10)>=1&&parseInt(top.ICEcoder.tagString.slice(1,2),10)<=7)) {
} else { thisCM.replaceSelection(endTag);
thisCM.replaceSelection("\n"+tabs+"\t\n"+tabs+endTag); thisCM.setCursor(thisCM.getCursor().line,thisCM.getCursor().ch-top.ICEcoder.tagString.length-3);
thisCM.setCursor(thisCM.getCursor().line-1,numTabs); } else if(top.ICEcoder.tagString=="html"||top.ICEcoder.tagString=="head") {
} thisCM.replaceSelection("\n\n"+endTag);
} thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
}; } else {
lastKeyCode = e.keyCode; thisCM.replaceSelection("\n"+tabs+"\t\n"+tabs+endTag);
} thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
}); }
}
window['cM'+num].on("cursorActivity", function(thisCM) { };
top.ICEcoder.getCaretPosition(); lastKeyCode = e.keyCode;
top.ICEcoder.updateCharDisplay(); }
window['cM'+num].removeLineClass(top.ICEcoder['cMActiveLine'+num], "background"); });
if(!window['cM'+num].somethingSelected()) {
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine"); window['cM'+num].on("cursorActivity", function(thisCM) {
} top.ICEcoder.getCaretPosition();
thisCM.matchHighlight("CodeMirror-matchhighlight"); top.ICEcoder.updateCharDisplay();
top.ICEcoder.cssColorPreview(); window['cM'+num].removeLineClass(top.ICEcoder['cMActiveLine'+num], "background");
} if(!window['cM'+num].somethingSelected()) {
); top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine");
}
window['cM'+num].on("change", function(thisCM, changeObj) { thisCM.matchHighlight("CodeMirror-matchhighlight");
// If we're not loading the file, it's a change, so update tab top.ICEcoder.cssColorPreview();
if (!top.ICEcoder.loadingFile) { }
top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 1; );
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
} window['cM'+num].on("change", function(thisCM, changeObj) {
top.ICEcoder.getCaretPosition(); // If we're not loading the file, it's a change, so update tab
top.ICEcoder.dontUpdateNest = false; if (!top.ICEcoder.loadingFile) {
top.ICEcoder.updateCharDisplay(); top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 1;
top.ICEcoder.updateNestingIndicator(); top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
if (top.ICEcoder.findMode) { }
top.ICEcoder.results.splice(top.ICEcoder.findResult,1); top.ICEcoder.getCaretPosition();
top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results"; top.ICEcoder.dontUpdateNest = false;
top.ICEcoder.findMode = false; top.ICEcoder.updateCharDisplay();
} top.ICEcoder.updateNestingIndicator();
if (top.ICEcoder.codeAssist) { if (top.ICEcoder.findMode) {
clearTimeout(window['cM'+num+'waiting']); top.ICEcoder.results.splice(top.ICEcoder.findResult,1);
window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100); top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results";
} top.ICEcoder.findMode = false;
} }
); if (top.ICEcoder.codeAssist) {
clearTimeout(window['cM'+num+'waiting']);
window['cM'+num].on("scroll", function(thisCM) { window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100);
top.ICEcoder.mouseDown=false; }
} }
); );
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) { window['cM'+num].on("scroll", function(thisCM) {
["JavaScript","CoffeeScript","PHP","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1 top.ICEcoder.mouseDown=false;
? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line); }
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1))); );
setTimeout(function() {
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", null); window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
},1000); ["JavaScript","CoffeeScript","PHP","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
} ? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line);
); window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1)));
setTimeout(function() {
// Now create the active line for this CodeMirror object window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", null);
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); },1000);
}; }
);
// var top.ICEcoder.foldStyle = '<span style="position: absolute; display: inline-block; width: 13px; height: 13px; left: 0; background-color: #b00; color: #fff; text-align: center; cursor: pointer"><span style="position: relative; left: -1px">+</span></span> %N%';
var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder); // Now create the active line for this CodeMirror object
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder); top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine");
</script> };
</body> // var top.ICEcoder.foldStyle = '<span style="position: absolute; display: inline-block; width: 13px; height: 13px; left: 0; background-color: #b00; color: #fff; text-align: center; cursor: pointer"><span style="position: relative; left: -1px">+</span></span> %N%';
var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder);
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);
</script>
</body>
</html> </html>

View File

@@ -1,7 +1,7 @@
<?php include("lib/settings.php");?> <?php include("lib/settings.php");?>
<!DOCTYPE html> <!DOCTYPE html>
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()"> <html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; top.ICEcoder.tabDragEnd()" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()">
<head> <head>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title> <title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title>
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
images/nav-alpha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

View File

@@ -1,4 +1,3 @@
<!DOCTYPE html>
<?php include("lib/settings.php"); <?php include("lib/settings.php");
// Check IP permissions // Check IP permissions
@@ -16,8 +15,8 @@ if ($ICEcoder["checkUpdates"]) {
} }
} }
?> ?>
<!DOCTYPE html>
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'top');top.ICEcoder.canResizeFilesW()}"> <html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false;top.ICEcoder.tabDragEnd()" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'top');top.ICEcoder.canResizeFilesW()}">
<head> <head>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?></title> <title>ICEcoder v <?php echo $ICEcoder["versionNo"];?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -130,12 +129,13 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<div id="editor" class="editor"> <div id="editor" class="editor">
<div id="tabsBar" class="tabsBar" onContextMenu="return false"> <div id="tabsBar" class="tabsBar" onContextMenu="return false">
<a nohref onClick="top.ICEcoder.closeAllTabs()"><img src="images/nav-close.gif" class="closeAllTabs"></a> <a nohref onClick="top.ICEcoder.closeAllTabs()"><img src="images/nav-close.gif" class="closeAllTabs" title="Close all tabs"></a>
<a nohref onClick="top.ICEcoder.alphaTabs()"><img src="images/nav-alpha.png" class="alphaTabs" title="Alphabetize tabs"></a>
<?php <?php
for ($i=1;$i<=100;$i++) { for ($i=1;$i<=100;$i++) {
echo '<div id="tab'.$i.'" class="tab" draggable="true" onClick="ICEcoder.canSwitchTabs ? ICEcoder.switchTab('.$i.') : ICEcoder.canSwitchTabs=true; thisColor=\'#000\'" onMouseOver="thisColor=this.style.color;this.style.color=\'#000\'" onMouseOut="this.style.color=thisColor"></div>'; echo '<div id="tab'.$i.'" class="tab" onMouseDown="ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3),10)) : ICEcoder.canSwitchTabs=true; thisColor=\'#000\'; ICEcoder.tabDragStart(parseInt(this.id.slice(3),10))" onMouseOver="thisColor=this.style.color;this.style.color=\'#000\'" onMouseOut="this.style.color=thisColor"></div>';
} }
?><div class="newTab" onClick="ICEcoder.newTab()"><img src="images/nav-new.png"></div> ?><div class="newTab" onClick="ICEcoder.newTab()" id="newTab"><img src="images/nav-new.png"></div>
</div> </div>
<div id="findBar" class="findBar" onContextMenu="return false"> <div id="findBar" class="findBar" onContextMenu="return false">
<form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false"> <form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false">

View File

@@ -1,31 +1,32 @@
<?php <?php
$ICEcoder = array( $ICEcoder = array(
"root" => "", "root" => "",
"tabsIndent" => true, "tabsIndent" => true,
"checkUpdates" => true, "checkUpdates" => true,
"openLastFiles" => true, "openLastFiles" => true,
"findFilesExclude" => array("_coder","ICEcoder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip"), "findFilesExclude" => array("_coder","ICEcoder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip"),
"codeAssist" => true, "codeAssist" => true,
"visibleTabs" => false, "visibleTabs" => false,
"lockedNav" => true, "lockedNav" => true,
"accountPassword" => "", "accountPassword" => "",
"bannedFiles" => array("_coder","ICEcoder"), "bannedFiles" => array("_coder","ICEcoder"),
"bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"), "bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"),
"allowedIPs" => array("*"), "allowedIPs" => array("*"),
"plugins" => array( "plugins" => array(
array("Terminal","plugins/terminal/icon.gif","margin-top: 3px","plugins/terminal","_blank",""), array("Terminal","plugins/terminal/icon.gif","margin-top: 3px","plugins/terminal","_blank",""),
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""), array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
array("JS Hint","plugins/jshint/icon.png","margin-top: 3px","http://www.jshint.com","_blank",""), array("JS Hint","plugins/jshint/icon.png","margin-top: 3px","http://www.jshint.com","_blank",""),
array("Emmet","plugins/emmet/icon.png","margin-top: 3px","http://docs.emmet.io","_blank",""), array("Emmet","plugins/emmet/icon.png","margin-top: 3px","http://docs.emmet.io","_blank",""),
array("ICErepo","plugins/ice-repo/icon.png","margin-top: 3px","plugins/ice-repo","_blank",""), array("ICErepo","plugins/ice-repo/icon.png","margin-top: 3px","plugins/ice-repo","_blank",""),
array("Dochub","plugins/dochub/icon.png","margin-top: 3px","http://dochub.io","_blank",""), array("Dochub","plugins/dochub/icon.png","margin-top: 3px","http://dochub.io","_blank",""),
array("JS Regex","plugins/jsregex/icon.png","margin-top: 3px","http://jsregex.herokuapp.com","_blank",""), array("JS Regex","plugins/jsregex/icon.png","margin-top: 3px","http://jsregex.herokuapp.com","_blank",""),
array("Zip It!","plugins/zip-it/icon.png","margin-top: 3px; margin-left: 3px","plugins/zip-it/?zip=|&exclude=*.doc*.gif*.jpg*.jpeg*.pdf*.png*.swf*.xml*.zip","fileControl:<b>Zipping Files</b>","30") array("wireframe|cc","plugins/wireframecc/icon.png","margin-top: 3px","http://wireframe.cc","_blank",""),
), array("Zip It!","plugins/zip-it/icon.png","margin-top: 3px; margin-left: 3px","plugins/zip-it/?zip=|&exclude=*.doc*.gif*.jpg*.jpeg*.pdf*.png*.swf*.xml*.zip","fileControl:<b>Zipping Files</b>","30")
"theme" => "default", ),
"lineWrapping" => true, "theme" => "default",
"tabWidth" => 4, "lineWrapping" => true,
"previousFiles" => "", "tabWidth" => 4,
"last10Files" => "" "previousFiles" => "",
); "last10Files" => ""
);
?> ?>

View File

@@ -1,368 +1,375 @@
<?php include("settings.php");?> <?php include("settings.php");?>
<?php <?php
// Get the save type if any // Get the save type if any
$saveType = ""; $saveType = "";
if (isset($_GET['saveType'])) {$saveType = strClean($_GET['saveType']);}; if (isset($_GET['saveType'])) {$saveType = strClean($_GET['saveType']);};
// Establish the filename/new filename // Establish the filename/new filename
$file = str_replace("|","/",strClean( $file = str_replace("|","/",strClean(
isset($_POST['newFileName']) && $_POST['newFileName']!="" isset($_POST['newFileName']) && $_POST['newFileName']!=""
? $_POST['newFileName'] ? $_POST['newFileName']
: $_GET['file'] : $_GET['file']
)); ));
// Make $file a full path and establish the $fileLoc and $fileName // Make $file a full path and establish the $fileLoc and $fileName
if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);}; if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/")); $fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
$fileName = basename($file); $fileName = basename($file);
// If we're due to open a file... // If we're due to open a file...
if ($_GET['action']=="load") { if ($_GET['action']=="load") {
echo '<script>action="load";</script>'; echo '<script>action="load";</script>';
if (file_exists($file)) { if (file_exists($file)) {
// Determine what to do based on mime type // Determine what to do based on mime type
$finfo = finfo_open(FILEINFO_MIME_TYPE); $finfo = finfo_open(FILEINFO_MIME_TYPE);
if (strpos(finfo_file($finfo, $file),"text")===0) { if (strpos(finfo_file($finfo, $file),"text")===0) {
echo '<script>fileType="text";'; echo '<script>fileType="text";';
echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";';
echo '</script>'; echo '</script>';
$loadedFile = file_get_contents($file); $loadedFile = file_get_contents($file);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>'; echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&amp;",$loadedFile)).'</textarea>';
} else if (strpos(finfo_file($finfo, $file),"image")===0) { } else if (strpos(finfo_file($finfo, $file),"image")===0) {
echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>'; echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>';
} else { } else {
echo '<script>fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');</script>'; echo '<script>fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');</script>';
}; };
} else { } else {
echo '<script>fileType="nothing"; top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</script>'; echo '<script>fileType="nothing"; top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</script>';
} }
finfo_close($finfo); finfo_close($finfo);
}; };
// If we're due to add a new folder... // If we're due to add a new folder...
if ($_GET['action']=="newFolder") { if ($_GET['action']=="newFolder") {
if (!$demoMode && is_writable($docRoot.$fileLoc)) { if (!$demoMode && is_writable($docRoot.$fileLoc)) {
mkdir($file, 0705); mkdir($file, 0705);
// Reload file manager // Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
} else { } else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot create folder at\\n".$fileLoc."')</script>"; echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot create folder at\\n".$fileLoc."')</script>";
} }
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
} }
// If we're due to paste a new file... // If we're due to paste a new file...
if ($_GET['action']=="paste") { if ($_GET['action']=="paste") {
$source = $file; $source = $file;
$dest = str_replace("//","/",$docRoot.strClean(str_replace("|","/",$_GET['location']))."/".basename($source)); $dest = str_replace("//","/",$docRoot.strClean(str_replace("|","/",$_GET['location']))."/".basename($source));
if (!$demoMode && is_writable(dirname($dest))) { if (!$demoMode && is_writable(dirname($dest))) {
if (is_dir($source)) { if (is_dir($source)) {
if (!is_dir($dest)) { if (!is_dir($dest)) {
mkdir($dest, 0705); mkdir($dest, 0705);
} }
foreach ($iterator = new RecursiveIteratorIterator( foreach ($iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST) as $item RecursiveIteratorIterator::SELF_FIRST) as $item
) { ) {
if ($item->isDir()) { if ($item->isDir()) {
mkdir($dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), 0705); mkdir($dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), 0705);
} else { } else {
copy($item, $dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName()); copy($item, $dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
} }
} }
} else { } else {
if (!file_exists($dest)) { if (!file_exists($dest)) {
copy($source, $dest); copy($source, $dest);
} else { } else {
for ($i=2; $i<1000000000; $i++) { for ($i=2; $i<1000000000; $i++) {
if (!file_exists($dest." (".$i.")")) { if (!file_exists($dest." (".$i.")")) {
$dest = $dest." (".$i.")"; $dest = $dest." (".$i.")";
copy($source, $dest); copy($source, $dest);
$i=1000000000; $i=1000000000;
} }
} }
} }
} }
// Reload file manager // Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.strClean(str_replace("|","/",$_GET['location'])).'\',\''.basename($dest).'\');action="pasteFile";</script>'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.strClean(str_replace("|","/",$_GET['location'])).'\',\''.basename($dest).'\');action="pasteFile";</script>';
} else { } else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy \\n".str_replace($docRoot,"",$source)."\\n into \\n".str_replace($docRoot,"",$dest)."')</script>"; echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy \\n".str_replace($docRoot,"",$source)."\\n into \\n".str_replace($docRoot,"",$dest)."')</script>";
} }
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
} }
// If we're due to upload files... // If we're due to upload files...
if ($_GET['action']=="upload") { if ($_GET['action']=="upload") {
if (!$demoMode) { if (!$demoMode) {
class fileUploader { class fileUploader {
public function __construct($uploads) { public function __construct($uploads) {
global $docRoot; global $docRoot;
$uploadDir=$docRoot.$iceRoot.str_replace("..","",str_replace("|","/",strClean($_POST['folder'])."/")); $uploadDir=$docRoot.$iceRoot.str_replace("..","",str_replace("|","/",strClean($_POST['folder'])."/"));
foreach($uploads as $current) { foreach($uploads as $current) {
$this->uploadFile=$uploadDir.$current->name; $this->uploadFile=$uploadDir.$current->name;
$fileName = $current->name; $fileName = $current->name;
if ($this->upload($current,$this->uploadFile)) { if ($this->upload($current,$this->uploadFile)) {
echo '<script>action="upload"; top.ICEcoder.updateFileManagerList(\'add\',top.ICEcoder.rightClickedFile.replace(/\|/g,\'/\'),\''.$fileName.'\');</script>'; echo '<script>action="upload"; top.ICEcoder.updateFileManagerList(\'add\',top.ICEcoder.rightClickedFile.replace(/\|/g,\'/\'),\''.$fileName.'\',false,false,true); top.ICEcoder.serverMessage("Uploaded file(s) OK");setTimeout(function(){top.ICEcoder.serverMessage();},2000);</script>';
} else { } else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload \\n".$fileName."\\n into \\n'+top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))</script>"; echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload \\n".$fileName."\\n into \\n'+top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))</script>";
} }
} }
} }
public function upload($current,$uploadFile){ public function upload($current,$uploadFile){
if(move_uploaded_file($current->tmp_name,$uploadFile)){ if(move_uploaded_file($current->tmp_name,$uploadFile)){
return true; return true;
} }
} }
} }
function getDetails($fileArr) { function getDetails($fileArr) {
foreach($fileArr['name'] as $keyee => $info) { foreach($fileArr['name'] as $keyee => $info) {
$uploads[$keyee]->name=$fileArr['name'][$keyee]; $uploads[$keyee]->name=$fileArr['name'][$keyee];
$uploads[$keyee]->type=$fileArr['type'][$keyee]; $uploads[$keyee]->type=$fileArr['type'][$keyee];
$uploads[$keyee]->tmp_name=$fileArr['tmp_name'][$keyee]; $uploads[$keyee]->tmp_name=$fileArr['tmp_name'][$keyee];
$uploads[$keyee]->error=$fileArr['error'][$keyee]; $uploads[$keyee]->error=$fileArr['error'][$keyee];
} }
return $uploads; return $uploads;
} }
if($_FILES['filesInput']){ if($_FILES['filesInput']){
$uploads = getDetails($_FILES['filesInput']); $uploads = getDetails($_FILES['filesInput']);
$fileUploader=new fileUploader($uploads); $fileUploader=new fileUploader($uploads);
} }
} else { } else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload whilst in demo mode');</script>"; echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload whilst in demo mode');</script>";
} }
echo "<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.hideFileMenu();top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));</script>"; echo "<script>top.ICEcoder.hideFileMenu();top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));</script>";
} }
// If we're due to rename a file/folder... // If we're due to rename a file/folder...
if ($_GET['action']=="rename") { if ($_GET['action']=="rename") {
if (!$demoMode && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) { if (!$demoMode && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName); if(rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName)) {
// Reload file manager // Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');';
echo 'action="rename";</script>'; echo 'action="rename";</script>';
} else { $renamed=true;
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."');</script>"; } else {
} $renamed=false;
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; }
} } else {
$renamed=false;
// If we're due to replace text in a file... }
if ($_GET['action']=="replaceText") { if (!$renamed) {
if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) { echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."\\n\\nMaybe public write permissions needed on this or parent folder?');</script>";
$file = str_replace("|","/",strClean($_GET['fileRef'])); }
$loadedFile = file_get_contents($file); echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile); }
$fh = fopen($file, 'w') or die("Sorry, cannot save");
fwrite($fh, $newContent); // If we're due to replace text in a file...
fclose($fh); if ($_GET['action']=="replaceText") {
echo '<script>action="replaceText";</script>'; if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
} else { $file = str_replace("|","/",strClean($_GET['fileRef']));
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot replace text in\\n".strClean($_GET['fileRef'])."');</script>"; $loadedFile = file_get_contents($file);
} $newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; $fh = fopen($file, 'w') or die("Sorry, cannot save");
} fwrite($fh, $newContent);
fclose($fh);
// If we're due to change permissions on a file/folder... echo '<script>action="replaceText";</script>';
if ($_GET['action']=="perms") { } else {
if (!$demoMode && is_writable($file)) { echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot replace text in\\n".strClean($_GET['fileRef'])."');</script>";
chmod($file,octdec(numClean($_GET['perms']))); }
// Reload file manager echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; }
echo 'action="perms";</script>';
} else { // If we're due to change permissions on a file/folder...
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($file)."');</script>"; if ($_GET['action']=="perms") {
} if (!$demoMode && is_writable($file)) {
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; chmod($file,octdec(numClean($_GET['perms'])));
} // Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
// If we're due to delete a file... echo 'action="perms";</script>';
if ($_GET['action']=="delete") { } else {
$filesArray = explode(";",$file); // May contain more than one file here echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($file)."');</script>";
for ($i=0;$i<=count($filesArray)-1;$i++) { }
$fullPath = str_replace($docRoot,"",$filesArray[$i]); echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
$fullPath = str_replace($iceRoot,"",$fullPath); }
$fullPath = $docRoot.$iceRoot.$fullPath;
if (!$demoMode && is_writable($fullPath)) { // If we're due to delete a file...
is_dir($fullPath) if ($_GET['action']=="delete") {
? rrmdir($fullPath) $filesArray = explode(";",$file); // May contain more than one file here
: unlink($fullPath); for ($i=0;$i<=count($filesArray)-1;$i++) {
$fileName = basename($fullPath); $fullPath = str_replace($docRoot,"",$filesArray[$i]);
$fileLoc = dirname(str_replace($docRoot,"",$fullPath)); $fullPath = str_replace($iceRoot,"",$fullPath);
// Reload file manager $fullPath = $docRoot.$iceRoot.$fullPath;
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; if (!$demoMode && is_writable($fullPath)) {
echo 'action="delete";</script>'; is_dir($fullPath)
} else { ? rrmdir($fullPath)
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".str_replace($docRoot,"",$fullPath)."');</script>"; : unlink($fullPath);
} $fileName = basename($fullPath);
echo '<script>action="nothing";</script>'; $fileLoc = dirname(str_replace($docRoot,"",$fullPath));
} // Reload file manager
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
} echo 'action="delete";</script>';
} else {
// The function to recursively remove folders & files echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".str_replace($docRoot,"",$fullPath)."');</script>";
function rrmdir($dir) { }
if (is_dir($dir)) { echo '<script>action="nothing";</script>';
$objects = scandir($dir); }
foreach ($objects as $object) { echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
if ($object != "." && $object != "..") { }
filetype($dir."/".$object) == "dir"
? rrmdir($dir."/".$object) // The function to recursively remove folders & files
: unlink($dir."/".$object); function rrmdir($dir) {
} if (is_dir($dir)) {
} $objects = scandir($dir);
reset($objects); foreach ($objects as $object) {
rmdir($dir); if ($object != "." && $object != "..") {
} filetype($dir."/".$object) == "dir"
} ? rrmdir($dir."/".$object)
: unlink($dir."/".$object);
if ($_GET['action']=="save") { }
echo '<script>action="save";</script>'; }
// on the form posting via a reload, save the file reset($objects);
if (isset($_POST['contents'])) { rmdir($dir);
if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="")) { }
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) { }
$fh = fopen($file, 'w') or die("Sorry, cannot save");
fwrite($fh, $_POST['contents']); if ($_GET['action']=="save") {
fclose($fh); echo '<script>action="save";</script>';
clearstatcache(); // on the form posting via a reload, save the file
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>'; if (isset($_POST['contents'])) {
// Reload file manager & rename tab if it was a new file if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="")) {
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');'; $fh = fopen($file, 'w') or die("Sorry, cannot save");
echo 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>'; fwrite($fh, $_POST['contents']);
} fclose($fh);
// Reload stickytab window clearstatcache();
echo '<script>if (top.ICEcoder.stickyTab.location) {top.ICEcoder.stickyTab.location.reload()};action="doneSave";</script>'; echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>';
} else { // Reload file manager & rename tab if it was a new file
$loadedFile = file_get_contents($file); if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');';
echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>'; echo 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>';
?> }
<script> // Reload stickytab window
var refreshFile = top.ICEcoder.ask('Sorry, this file has changed, cannot save\n<?php echo $file;?>\n\nReload this file and copy your version to a new document?'); echo '<script>if (top.ICEcoder.stickyTab.location) {top.ICEcoder.stickyTab.location.reload()};action="doneSave";</script>';
if (refreshFile) { } else {
var cM = top.ICEcoder.getcMInstance(); $loadedFile = file_get_contents($file);
var thisTab = top.ICEcoder.selectedTab; echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
document.getElementById('userVersionFile').value = cM.getValue(); echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>';
// Revert back to original ?>
cM.setValue(document.getElementById('loadedFile').value); <script>
top.ICEcoder.changedContent[thisTab-1] = 0; var refreshFile = top.ICEcoder.ask('Sorry, this file has changed, cannot save\n<?php echo $file;?>\n\nReload this file and copy your version to a new document?');
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($file); ?>"; if (refreshFile) {
cM.clearHistory(); var cM = top.ICEcoder.getcMInstance();
// Now for the new file var thisTab = top.ICEcoder.selectedTab;
top.ICEcoder.newTab(); document.getElementById('userVersionFile').value = cM.getValue();
cM = top.ICEcoder.getcMInstance(); // Revert back to original
cM.setValue(document.getElementById('userVersionFile').value); cM.setValue(document.getElementById('loadedFile').value);
cM.clearHistory(); top.ICEcoder.changedContent[thisTab-1] = 0;
// Finally, switch back to original tab top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($file); ?>";
top.ICEcoder.switchTab(thisTab); cM.clearHistory();
} // Now for the new file
action='nothing'; top.ICEcoder.newTab();
</script> cM = top.ICEcoder.getcMInstance();
<?php cM.setValue(document.getElementById('userVersionFile').value);
} cM.clearHistory();
} else { // Finally, switch back to original tab
echo "<script>action='nothing';top.ICEcoder.message('Sorry, cannot write\\n".$file."')</script>"; top.ICEcoder.switchTab(thisTab);
} }
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>'; action='nothing';
} </script>
}; <?php
?> }
<script> } else {
if (action=="load") { echo "<script>action='nothing';top.ICEcoder.message('Sorry, cannot write\\n".$file."')</script>";
if (fileType=="text") { }
setTimeout(function() { echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
if (!top.ICEcoder.content.contentWindow.createNewCMInstance) { }
console.log('There was tech hiccup, likely something wasn\'t quite ready. So ICEcoder reloaded it\'s file control again.'); };
window.location.reload(); ?>
<?php <script>
if (file_exists($file)) { if (action=="load") {
?> if (fileType=="text") {
} else { setTimeout(function() {
top.ICEcoder.loadingFile = true; if (!top.ICEcoder.content.contentWindow.createNewCMInstance) {
// Reset the various states back to their initial setting console.log('There was tech hiccup, likely something wasn\'t quite ready. So ICEcoder reloaded it\'s file control again.');
selectedTab = top.ICEcoder.openFiles.length; // The tab that's currently selected window.location.reload();
<?php
// Finally, store all data, show tabs etc if (file_exists($file)) {
top.ICEcoder.createNewTab(); ?>
top.ICEcoder.cMInstances.push(top.ICEcoder.nextcMInstance); } else {
top.ICEcoder.setLayout(); top.ICEcoder.loadingFile = true;
top.ICEcoder.content.contentWindow.createNewCMInstance(top.ICEcoder.nextcMInstance); // Reset the various states back to their initial setting
selectedTab = top.ICEcoder.openFiles.length; // The tab that's currently selected
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on _coder's load)
top.ICEcoder.switchMode(); // Finally, store all data, show tabs etc
cM = top.ICEcoder.getcMInstance(); top.ICEcoder.createNewTab();
cM.setValue(document.getElementById('loadedFile').value); top.ICEcoder.cMInstances.push(top.ICEcoder.nextcMInstance);
top.document.getElementById('content').style.visibility='visible'; top.ICEcoder.setLayout();
top.ICEcoder.switchTab(top.ICEcoder.selectedTab); top.ICEcoder.content.contentWindow.createNewCMInstance(top.ICEcoder.nextcMInstance);
cM.focus();
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on _coder's load)
// Then clean it up, set the text cursor, update the display and get the character data top.ICEcoder.switchMode();
top.ICEcoder.contentCleanUp(); cM = top.ICEcoder.getcMInstance();
top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].removeLineClass(top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab], "background"); cM.setValue(document.getElementById('loadedFile').value);
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine"); top.document.getElementById('content').style.visibility='visible';
top.ICEcoder.nextcMInstance++; top.ICEcoder.switchTab(top.ICEcoder.selectedTab);
top.ICEcoder.openFileMDTs.push('<?php echo filemtime($file); ?>'); cM.focus();
top.ICEcoder.loadingFile = false;
<?php // Then clean it up, set the text cursor, update the display and get the character data
;}; top.ICEcoder.contentCleanUp();
?> top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].removeLineClass(top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab], "background");
} top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine");
},4); top.ICEcoder.nextcMInstance++;
} top.ICEcoder.openFileMDTs.push('<?php echo filemtime($file); ?>');
top.ICEcoder.loadingFile = false;
if (fileType=="image") { <?php
top.document.getElementById('blackMask').style.visibility = "visible"; ;};
top.document.getElementById('mediaContainer').innerHTML = "<img src=\"<?php echo $fileLoc."/".$fileName;?>\" class=\"whiteGlow\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url('images/checkerboard.png')\" onClick=\"return false\"><br><span class=\"whiteGlow\" style=\"border: solid 10px #fff; color: #000; background-color: #fff\" onClick=\"return false\"><?php echo $fileLoc."/".$fileName;?></span>"; ?>
} }
},4);
top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); }
}
</script> if (fileType=="image") {
top.document.getElementById('blackMask').style.visibility = "visible";
<form name="saveFile" action="file-control.php?action=save&file=<?php if (isset($file)) {echo $file;}; if (isset($_GET['fileMDT']) && $_GET['fileMDT']!="undefined") {echo "&fileMDT=".numClean($_GET['fileMDT']);};?>" method="POST"> top.document.getElementById('mediaContainer').innerHTML = "<img src=\"<?php echo $fileLoc."/".$fileName;?>\" class=\"whiteGlow\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url('images/checkerboard.png')\" onClick=\"return false\"><br><span class=\"whiteGlow\" style=\"border: solid 10px #fff; color: #000; background-color: #fff\" onClick=\"return false\"><?php echo $fileLoc."/".$fileName;?></span>";
<textarea name="contents"></textarea> }
<input type="hidden" name="newFileName" value="">
</form> top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);
}
<script> </script>
if (action=="save") {
<?php <form name="saveFile" action="file-control.php?action=save&file=<?php if (isset($file)) {echo $file;}; if (isset($_GET['fileMDT']) && $_GET['fileMDT']!="undefined") {echo "&fileMDT=".numClean($_GET['fileMDT']);};?>" method="POST">
if (strpos($file,"[NEW]")>0||$saveType=="saveAs") { <textarea name="contents"></textarea>
if (strpos($fileName,"[NEW]")>0) {echo "fileLoc = '".$fileLoc."';";} else {echo "fileLoc = '';";}; <input type="hidden" name="newFileName" value="">
?> </form>
newFileName = top.ICEcoder.getInput(fileLoc != ""
? 'Enter filename to save at '+fileLoc <script>
: 'Enter filename (including path, prefixed with /)' if (action=="save") {
,''); <?php
if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName} if (strpos($file,"[NEW]")>0||$saveType=="saveAs") {
if (newFileName) { if (strpos($fileName,"[NEW]")>0) {echo "fileLoc = '".$fileLoc."';";} else {echo "fileLoc = '';";};
newFileName = fileLoc == "" ? newFileName : fileLoc + "/" + fileName; ?>
} newFileName = top.ICEcoder.getInput(fileLoc != ""
if (newFileName && top.document.getElementById('filesFrame').contentWindow.document.getElementById(newFileName.replace(/\//g,"|"))) { ? 'Enter filename to save at '+fileLoc
overwriteOK = top.ICEcoder.ask('That file exists already, overwrite?'); : 'Enter filename (including path, prefixed with /)'
} ,'');
document.saveFile.newFileName.value = '<?php echo $docRoot; ?>' + newFileName; if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
<?php ;};?> if (newFileName) {
if ("undefined" == typeof newFileName || (newFileName && "undefined" == typeof overwriteOK) || ("undefined" != typeof overwriteOK && overwriteOK)) { newFileName = fileLoc == "" ? newFileName : fileLoc + "/" + fileName;
top.ICEcoder.serverMessage('<b>Saving</b><br>'+ <?php echo strpos($file,"[NEW]")>0 ? "newFileName" : "'$file'"; ?>); }
document.saveFile.contents.value = top.document.getElementById('saveTemp1').value; if (newFileName && top.document.getElementById('filesFrame').contentWindow.document.getElementById(newFileName.replace(/\//g,"|"))) {
document.saveFile.submit(); overwriteOK = top.ICEcoder.ask('That file exists already, overwrite?');
} else { }
top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); document.saveFile.newFileName.value = '<?php echo $docRoot; ?>' + newFileName;
action=="nothing"; <?php ;};?>
} if ("undefined" == typeof newFileName || (newFileName && "undefined" == typeof overwriteOK) || ("undefined" != typeof overwriteOK && overwriteOK)) {
} top.ICEcoder.serverMessage('<b>Saving</b><br>'+ <?php echo strpos($file,"[NEW]")>0 ? "newFileName" : "'$file'"; ?>);
</script> document.saveFile.contents.value = top.document.getElementById('saveTemp1').value;
document.saveFile.submit();
<script> } else {
if (action=="doneSave") { top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);
top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 0; action=="nothing";
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab); }
} }
</script>
<script>
if (action=="doneSave") {
top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 0;
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
}
</script> </script>

View File

@@ -100,15 +100,24 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.editor {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px} .editor {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px}
.editor .tabsBar {display: inline-block; height: 22px; width: 2400px; margin-top: 40px; padding-left: 41px; background: #ddd} .editor .tabsBar {display: inline-block; height: 22px; width: 2400px; margin-top: 40px; padding-left: 41px; background: #ddd}
.tabsBar .tab {display: none; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 5px 8px 2px 8px; font-size: 10px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; color: #fff; direction: rtl; text-align: right; white-space: nowrap; overflow: hidden; cursor: pointer; .tabsBar .tab {position: absolute; display: none; background: url('../images/nav-bg.jpg') repeat-x 0 0; padding: 5px 8px 2px 8px; font-size: 10px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1}
-webkit-transition: all 0.15s; .tabsBar .tabSlide {
-moz-transition: all 0.15s; -webkit-transition: left 0.15s ease-in-out;
transition: all 0.15s; -moz-transition: left 0.15s ease-in-out;
transition: left 0.15s ease-in-out;
}
.tabsBar .tabDrag {
-webkit-transition: left 0s ease-in-out;
-moz-transition: left 0s ease-in-out;
transition: left 0s ease-in-out;
} }
.tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 1px 0 0 5px; border-radius: 6px; cursor: pointer} .tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 1px 0 0 5px; border-radius: 6px; cursor: pointer}
.tabsBar .closeAllTabs {position: absolute; margin: 6px 0 0 -25px; background: #bbb} .tabsBar .tab .closeTab {position: absolute; right: 7px}
.tabsBar .alphaTabs {position: absolute; margin: 6px 0 0 -17px; background: #bbb; border-radius: 6px; cursor: pointer}
.tabsBar .alphaTabs:hover {background: #000}
.tabsBar .closeAllTabs {position: absolute; margin: 6px 0 0 -33px; background: #bbb}
.tabsBar .closeAllTabs:hover {background: #000} .tabsBar .closeAllTabs:hover {background: #000}
.tabsBar .newTab {display: inline-block; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 6px 5px 5px 5px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; cursor: pointer;} .tabsBar .newTab {position: absolute; display: inline-block; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 6px 5px 5px 5px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; cursor: pointer; z-index: 1}
.editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #141414} .editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #141414}
.findBar .findReplace {position: absolute; z-index: 1} .findBar .findReplace {position: absolute; z-index: 1}
.findReplace select {position: relative; font-size: 10px; margin: 8px 2px 0 2px; top: -2px;} .findReplace select {position: relative; font-size: 10px; margin: 8px 2px 0 2px; top: -2px;}

View File

@@ -26,10 +26,11 @@ var ICEcoder = {
snippetLine: false, // Line no of snippet, if shown snippetLine: false, // Line no of snippet, if shown
mouseDown: false, // If the mouse is down or not mouseDown: false, // If the mouse is down or not
draggingFilesW: false, // If we're dragging the file manager width or not draggingFilesW: false, // If we're dragging the file manager width or not
draggingTab: false, // If we're dragging a tab
tabLeftPos: [], // Left position of tabs inside content area
serverQueueItems: [], // Array of URLs to call in order serverQueueItems: [], // Array of URLs to call in order
stickyTab: false, // Target variable for the sticky tab window stickyTab: false, // Target variable for the sticky tab window
pluginIntervalRefs: [], // Array of plugin interval refs pluginIntervalRefs: [], // Array of plugin interval refs
dragSrcEl: null, // Tab element being dragged
ready: false, // Indicates if ICEcoder is ready for action ready: false, // Indicates if ICEcoder is ready for action
// Don't consider these tags as part of nesting as they're singles, JS, PHP or Ruby code blocks // Don't consider these tags as part of nesting as they're singles, JS, PHP or Ruby code blocks
@@ -56,15 +57,6 @@ var ICEcoder = {
top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask')); top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));
if (top.ICEcoder.openLastFiles) {top.ICEcoder.autoOpenFiles()}; if (top.ICEcoder.openLastFiles) {top.ICEcoder.autoOpenFiles()};
// Add drag based events to our tabs
var tabs = document.querySelectorAll('.tab');
[].forEach.call(tabs, function(tab) {
// not used: dragenter, dragleave
tab.addEventListener('dragstart', ICEcoder.handleDragStart, false);
tab.addEventListener('dragover', ICEcoder.handleDragOver, false);
tab.addEventListener('drop', ICEcoder.handleDrop, false);
tab.addEventListener('dragend', ICEcoder.handleDragEnd, false);
});
setInterval(ICEcoder.updateNestingIndicator,30); setInterval(ICEcoder.updateNestingIndicator,30);
// Setup fullscreen detection and change icon // Setup fullscreen detection and change icon
@@ -554,7 +546,7 @@ var ICEcoder = {
// Prompt a rename dialog on demand // Prompt a rename dialog on demand
renameFile: function(oldName,newName) { renameFile: function(oldName,newName) {
var shortURL, fileName; var shortURL, fileName, i;
if (!oldName) { if (!oldName) {
shortURL = top.ICEcoder.rightClickedFile.replace(/\|/g,"/"); shortURL = top.ICEcoder.rightClickedFile.replace(/\|/g,"/");
@@ -566,12 +558,14 @@ var ICEcoder = {
newName = top.ICEcoder.getInput('Please enter the new name for',shortURL); newName = top.ICEcoder.getInput('Please enter the new name for',shortURL);
} }
if (newName) { if (newName) {
if(top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/"))>-1) { i = top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/"));
if(i>-1) {
// rename array item and the tab // rename array item and the tab
top.ICEcoder.openFiles[i] = newName; top.ICEcoder.openFiles[i] = newName;
closeTabLink = '<a nohref onClick="top.ICEcoder.files.contentWindow.closeTab('+(i+1)+')"><img src="images/nav-close.gif" id="closeTabButton'+(i+1)+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>'; closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
fileName = top.ICEcoder.openFiles[i]; fileName = top.ICEcoder.openFiles[i];
top.document.getElementById('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); top.document.getElementById('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+(i+1)).title = newName;
} }
top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/")); top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/"));
top.ICEcoder.serverMessage('<b>Renaming to</b><br>'+newName); top.ICEcoder.serverMessage('<b>Renaming to</b><br>'+newName);
@@ -652,7 +646,7 @@ var ICEcoder = {
}, },
// Update the file manager tree list on demand // Update the file manager tree list on demand
updateFileManagerList: function(action,location,file,perms,oldName) { updateFileManagerList: function(action,location,file,perms,oldName,uploaded) {
var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, newUL, newLI, elemType, nameLI, shortURL, newMouseOver; var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, newUL, newLI, elemType, nameLI, shortURL, newMouseOver;
// Adding files // Adding files
@@ -714,7 +708,7 @@ var ICEcoder = {
} }
} }
// If we added a new file, we've saved it under a new filename, so set that // If we added a new file, we've saved it under a new filename, so set that
if (actionElemType=="file") { if (actionElemType=="file" && !uploaded) {
top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=location+file; top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=location+file;
} }
} }
@@ -722,15 +716,16 @@ var ICEcoder = {
// Renaming files // Renaming files
if (action=="rename") { if (action=="rename") {
// Get short URL of our right clicked file and get target elem based on this // Get short URL of our right clicked file and get target elem based on this
shortURL = oldName; shortURL = oldName.replace(/\//g,"|");
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")); targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL);
// Set the name to be as per our new file/folder name // Set the name to be as per our new file/folder name
targetElem.innerHTML = file; targetElem.innerHTML = file;
// Finally, update the ID of the target & set a new mouseover function for the parent too // Finally, update the ID of the target & set a new mouseover function for the parent too
targetElem.id = location.replace(/\//g,"|") + "|" + file; targetElem.id = location.replace(/\//g,"|") + "|" + file;
newMouseOver = targetElem.parentNode.onmouseover.toString().replace(shortURL.substring(shortURL.lastIndexOf("|")+1),file).split('\''); newMouseOver = targetElem.parentNode.onmouseover.toString().replace(shortURL.substring(shortURL.lastIndexOf("|")+1),file).split('\'');
eval("targetElem.parentNode.onmouseover = function() { top.ICEcoder.overFileFolder('"+newMouseOver[1]+"','"+newMouseOver[3]+"');}"); eval("targetElem.parentNode.onmouseover = function() { top.ICEcoder.overFileFolder('"+newMouseOver[1]+"','"+newMouseOver[3]+"');}");
targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); eval("targetElem.parentNode.title = newMouseOver[3];");
targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL+"_perms");
targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms";
} }
@@ -1060,7 +1055,7 @@ var ICEcoder = {
// Exclude a few keys... // Exclude a few keys...
// Escape (27), Caps Lock (20), Shift, CTRL, Alt, Pause/Break (16-19), Left, Up, Right, Down (37-40), Num Lock, Scroll Lock (144-145), // Escape (27), Caps Lock (20), Shift, CTRL, Alt, Pause/Break (16-19), Left, Up, Right, Down (37-40), Num Lock, Scroll Lock (144-145),
// Insert, Delete (45,46), Page Up, Page Down, End, Home (33-36), Left Win Key, Right Win Key (91-92), F1-F12 (112-123) // Insert, Delete (45,46), Page Up, Page Down, End, Home (33-36), Left Win Key, Right Win Key (91-92), F1-F12 (112-123)
if (key!=27 && key!=20 && (key<16||key>19) && (key<37||key>40) && (key!=144||key!=145) && (key!=45||key!=46) && (key<33||key>36) && (key!=91||key!=92) && (key<112||key>123)) { if (!top.ICEcoder.ctrlKeyDown && key!=27 && key!=20 && (key<16||key>19) && (key<37||key>40) && (key!=144||key!=145) && (key!=45||key!=46) && (key<33||key>36) && (key!=91||key!=92) && (key<112||key>123)) {
ICEcoder.changedContent[ICEcoder.selectedTab-1] = cM.historySize().undo > 0 ? 1 : 0; ICEcoder.changedContent[ICEcoder.selectedTab-1] = cM.historySize().undo > 0 ? 1 : 0;
ICEcoder.redoTabHighlight(ICEcoder.selectedTab); ICEcoder.redoTabHighlight(ICEcoder.selectedTab);
} }
@@ -1099,13 +1094,21 @@ var ICEcoder = {
// Test if we need to show a drag cursor or not // Test if we need to show a drag cursor or not
dragCursorTest: function() { dragCursorTest: function() {
var winH, cursorName; var winH, cursorName, diffX;
diffX = top.ICEcoder.mouseX - top.ICEcoder.diffStartX;
if (top.ICEcoder.draggingTab!==false && top.ICEcoder.diffStartX && (diffX <= -10 || diffX >= 10)) {
if (top.ICEcoder.mouseX > parseInt(top.ICEcoder.files.style.width,10)) {
top.ICEcoder.tabDragMouseX = top.ICEcoder.mouseX - parseInt(top.ICEcoder.files.style.width,10) - top.ICEcoder.tabDragMouseXStart;
top.ICEcoder.tabDragMove();
}
}
if (top.ICEcoder.ready) { if (top.ICEcoder.ready) {
winH = window.innerWidth ? window.innerHeight : document.body.clientHeight; winH = window.innerWidth ? window.innerHeight : document.body.clientHeight;
if (!top.ICEcoder.mouseDown) {top.ICEcoder.draggingFilesW = false}; if (!top.ICEcoder.mouseDown) {top.ICEcoder.draggingFilesW = false};
cursorName = ((top.ICEcoder.mouseX > top.ICEcoder.filesW-7 && top.ICEcoder.mouseX < top.ICEcoder.filesW+7 && top.ICEcoder.mouseY > 40 && top.ICEcoder.mouseY < (winH-30)) || top.ICEcoder.draggingFilesW) cursorName = (!ICEcoder.draggingTab && ((top.ICEcoder.mouseX > top.ICEcoder.filesW-7 && top.ICEcoder.mouseX < top.ICEcoder.filesW+7 && top.ICEcoder.mouseY > 40 && top.ICEcoder.mouseY < (winH-30)) || top.ICEcoder.draggingFilesW))
? "w-resize" ? "w-resize"
: "auto"; : "auto";
if (top.ICEcoder.content.contentWindow.document && top.ICEcoder.filesFrame.contentWindow) { if (top.ICEcoder.content.contentWindow.document && top.ICEcoder.filesFrame.contentWindow) {
@@ -1321,10 +1324,12 @@ var ICEcoder = {
// Opens the last files we had open // Opens the last files we had open
autoOpenFiles: function() { autoOpenFiles: function() {
for (var i=0;i<top.ICEcoder.previousFiles.length;i++) { if (top.ICEcoder.previousFiles.length>0 && top.ICEcoder.ask('Open previous files?\n\n'+top.ICEcoder.previousFiles.length+' files:\n'+top.ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(top.docRoot+top.iceRoot,'gi'),""))) {
top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[i].replace('|','/'); for (var i=0;i<top.ICEcoder.previousFiles.length;i++) {
top.ICEcoder.thisFileFolderType='file'; top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[i].replace('|','/');
top.ICEcoder.openFile(); top.ICEcoder.thisFileFolderType='file';
top.ICEcoder.openFile();
}
} }
}, },
@@ -1446,51 +1451,6 @@ var ICEcoder = {
top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href="plugins/zip-it/index.php?zip="+tgt; top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href="plugins/zip-it/index.php?zip="+tgt;
}, },
// Tab dragging start
handleDragStart: function(e) {
this.style.opacity = '0.2';
ICEcoder.dragSrcEl = this;
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', this.innerHTML);
},
// Tab dragging over tabs
handleDragOver: function(e) {
if (e.preventDefault) {e.preventDefault()}
e.dataTransfer.dropEffect = 'move';
return false;
},
// Tab dropping on target
handleDrop: function(e) {
if (e.stopPropagation) {e.stopPropagation()}
if (ICEcoder.dragSrcEl != this) {
ICEcoder.dragSrcEl.innerHTML = this.innerHTML.split(" ")[0] + ICEcoder.dragSrcEl.innerHTML.substr(ICEcoder.dragSrcEl.innerHTML.indexOf(" "));
this.innerHTML = e.dataTransfer.getData('text/html').split(" ")[0] + this.innerHTML.substr(this.innerHTML.indexOf(" "));
var dragID = ICEcoder.dragSrcEl.id.substr(3)*1;
var dropID = this.id.substr(3)*1;
if(dragID==top.ICEcoder.selectedTab) {
var a; // array value
var b = dragID-1;
var c = dropID-1;
// Swap values for switched tabs in these arrays
a = [ICEcoder.changedContent, ICEcoder.openFiles, ICEcoder.openFileMDTs, ICEcoder.cMInstances];
for (var i=0;i<a.length;i++) {
a[i][b]=[a[i][c],a[i][c]=a[i][b]][0];
}
top.ICEcoder.switchTab(dropID);
}
}
return false;
},
// Tab drag ending
handleDragEnd: function(e) {
this.style.opacity = '1';
},
// Change permissions on a file/folder // Change permissions on a file/folder
chmod: function(file,perms) { chmod: function(file,perms) {
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
@@ -1591,11 +1551,11 @@ var ICEcoder = {
top.ICEcoder.openFiles.push(top.ICEcoder.shortURL); top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);
// Setup a new tab // Setup a new tab
closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab('+(top.ICEcoder.openFiles.length)+')"><img src="images/nav-close.gif" id="closeTabButton'+(top.ICEcoder.openFiles.length)+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>'; closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block"; top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block";
fileName = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1]; fileName = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).title = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"") + "/"; top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).title = "/" + top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");
// Set the widths // Set the widths
top.ICEcoder.setTabWidths(); top.ICEcoder.setTabWidths();
@@ -1634,21 +1594,20 @@ var ICEcoder = {
top.ICEcoder.openFiles[tabNum-1] = newName; top.ICEcoder.openFiles[tabNum-1] = newName;
// Setup a new tab // Setup a new tab
closeTabLink = '<a nohref onClick="parent.ICEcoder.closeTab('+tabNum+')"><img src="images/nav-close.gif" id="closeTabButton'+tabNum+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>'; closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
fileName = top.ICEcoder.openFiles[tabNum-1]; fileName = top.ICEcoder.openFiles[tabNum-1];
top.document.getElementById('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); top.document.getElementById('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+tabNum).title = top.ICEcoder.openFiles[tabNum-1].replace(/\//,"") + "/"; top.document.getElementById('tab'+tabNum).title = "/" + top.ICEcoder.openFiles[tabNum-1].replace(/\//,"");
}, },
// Reset all tabs to be without a highlight and then highlight the selected // Reset all tabs to be without a highlight and then highlight the selected
redoTabHighlight: function(selectedTab) { redoTabHighlight: function(selectedTab) {
var cM, bgVPos, tColor, fileLink; var bgVPos, tColor, fileLink;
cM = ICEcoder.getcMInstance();
for(var i=1;i<=ICEcoder.changedContent.length;i++) { for(var i=1;i<=ICEcoder.changedContent.length;i++) {
if (document.getElementById('closeTabButton'+i)) { if (document.getElementById('tab'+i).childNodes[0]) {
document.getElementById('closeTabButton'+i).style.backgroundColor = ICEcoder.changedContent[i-1]==1 document.getElementById('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.changedContent[i-1]==1
? "#b00" : "rgba(255,255,255,0.3)"; ? "#b00" : "transparent";
} }
tColor = i==selectedTab ? "#000" : "#fff"; tColor = i==selectedTab ? "#000" : "#fff";
if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") { if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") {
@@ -1663,7 +1622,7 @@ var ICEcoder = {
}, },
// Close the tab upon request // Close the tab upon request
closeTab: function(closeTabNum) { closeTab: function(closeTabNum, dontSetPV) {
var cM, okToRemove, closeFileName; var cM, okToRemove, closeFileName;
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
okToRemove = true; okToRemove = true;
@@ -1681,9 +1640,6 @@ var ICEcoder = {
top.document.getElementById('tab'+i).title = top.document.getElementById('tab'+(i+1)).title; top.document.getElementById('tab'+i).title = top.document.getElementById('tab'+(i+1)).title;
ICEcoder.openFiles[i-1] = ICEcoder.openFiles[i]; ICEcoder.openFiles[i-1] = ICEcoder.openFiles[i];
ICEcoder.openFileMDTs[i-1] = ICEcoder.openFileMDTs[i]; ICEcoder.openFileMDTs[i-1] = ICEcoder.openFileMDTs[i];
// reduce the tab reference number on the closeTab link by 1
top.document.getElementById('tab'+i).innerHTML = top.document.getElementById('tab'+i).innerHTML.replace(("closeTab("+(i+1)+")"),"closeTab("+i+")").replace(("closeTabButton"+(i+1)),"closeTabButton"+i);
} }
// hide the instance we're closing by setting the hide class and removing from the array // hide the instance we're closing by setting the hide class and removing from the array
ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[closeTabNum-1]].getWrapperElement().style.display = "none"; ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[closeTabNum-1]].getWrapperElement().style.display = "none";
@@ -1715,7 +1671,9 @@ var ICEcoder = {
// Remove any highlighting from the file manager // Remove any highlighting from the file manager
top.ICEcoder.selectDeselectFile('deselect',top.ICEcoder.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|"))); top.ICEcoder.selectDeselectFile('deselect',top.ICEcoder.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|")));
top.ICEcoder.setPreviousFiles(); if (!dontSetPV) {
top.ICEcoder.setPreviousFiles();
}
} }
// Lastly, stop it from trying to also switch tab // Lastly, stop it from trying to also switch tab
top.ICEcoder.canSwitchTabs=false; top.ICEcoder.canSwitchTabs=false;
@@ -1725,23 +1683,171 @@ var ICEcoder = {
// Close all tabs // Close all tabs
closeAllTabs: function() { closeAllTabs: function() {
for (var i=top.ICEcoder.cMInstances.length; i>0; i--) { if (ICEcoder.ask("Close all tabs?")) {
top.ICEcoder.closeTab(i); for (var i=top.ICEcoder.cMInstances.length; i>0; i--) {
top.ICEcoder.closeTab(i, i>1? true:false);
}
} }
}, },
// Set the tabs width // Set the tabs width
setTabWidths: function() { setTabWidths: function() {
var availWidth, tabWidth, thisWidth; var availWidth, avgWidth, tabWidth, lastLeft, lastWidth;
availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin
avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18; avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18;
tabWidth = -18; // Incl 18px offset
lastLeft = 41;
lastWidth = 0;
top.ICEcoder.tabLeftPos = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) { for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
thisWidth = parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10); tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150;
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? thisWidth : 150; lastLeft = i==0 ? 41 : parseInt(top.document.getElementById('tab'+(i)).style.left,10);
lastWidth = i==0 ? 0 : parseInt(top.document.getElementById('tab'+(i)).style.width,10)+18;
top.document.getElementById('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px";
top.document.getElementById('tab'+(i+1)).style.width = tabWidth + "px"; top.document.getElementById('tab'+(i+1)).style.width = tabWidth + "px";
top.ICEcoder.tabLeftPos.push(lastLeft+lastWidth);
} }
top.document.getElementById('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px";
},
// Tab dragging start
tabDragStart: function(tab) {
top.ICEcoder.draggingTab = tab;
top.ICEcoder.diffStartX = top.ICEcoder.mouseX;
top.ICEcoder.tabDragMouseXStart = (top.ICEcoder.mouseX - (parseInt(top.ICEcoder.files.style.width,10)+41+18)) % 150;
top.document.getElementById('tab'+tab).style.zIndex = 2;
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
top.document.getElementById('tab'+i).className = i!==tab
? "tab tabSlide"
: "tab tabDrag";
}
},
// Tab dragging
tabDragMove: function() {
var lastTabWidth, thisLeft, dragTabNo, tabWidth;
lastTabWidth = parseInt(top.document.getElementById('tab'+top.ICEcoder.openFiles.length).style.width,10)+18;
top.ICEcoder.thisLeft = thisLeft = top.ICEcoder.tabDragMouseX >= 41
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth) : 41;
top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
top.ICEcoder.dragTabNo = dragTabNo = top.ICEcoder.draggingTab;
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
top.document.getElementById('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
tabWidth = top.ICEcoder.tabLeftPos[i] ? top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1] : tabWidth;
if (i!=top.ICEcoder.draggingTab) {
if (i < top.ICEcoder.draggingTab) {
top.document.getElementById('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]+tabWidth
: top.ICEcoder.tabLeftPos[i-1];
} else {
top.document.getElementById('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]-tabWidth
: top.ICEcoder.tabLeftPos[i-1];
}
}
}
},
// Tab dragging end
tabDragEnd: function() {
var swapWith, tempArray;
top.ICEcoder.setTabWidths();
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
if (top.ICEcoder.thisLeft >= top.ICEcoder.tabLeftPos[i-1]) {
swapWith = top.ICEcoder.thisLeft == top.ICEcoder.tabLeftPos[0] ? 1 : top.ICEcoder.dragTabNo > i ? i+1 : i;
}
top.document.getElementById('tab'+i).className = "tab";
top.document.getElementById('tab'+i).style.opacity = 1;
if (i!=top.ICEcoder.dragTabNo) {
top.document.getElementById('tab'+i).style.zIndex = 1;
} else {
setTimeout(function() {
top.document.getElementById('tab'+i).style.zIndex = 1;
},150);
}
}
if (top.ICEcoder.thisLeft && top.ICEcoder.thisLeft!==false) {
tempArray = [];
for (var i=1;i<=top.ICEcoder.openFiles.length;i++) {
tempArray.push(i);
}
tempArray.splice(top.ICEcoder.dragTabNo-1,1);
tempArray.splice(swapWith-1,0,top.ICEcoder.dragTabNo);
ICEcoder.sortTabs(tempArray);
}
top.ICEcoder.setTabWidths();
top.ICEcoder.draggingTab = false;
top.ICEcoder.thisLeft = false;
},
// Sort tabs into new order
sortTabs: function(newOrder) {
var a, b, changedContent = [], openFiles = [], openFileMDTs = [], cMInstances = [], selectedTabWillBe;
a = [ICEcoder.changedContent, ICEcoder.openFiles, ICEcoder.openFileMDTs, ICEcoder.cMInstances];
b = [changedContent, openFiles, openFileMDTs, cMInstances];
for (var i=0;i<a.length;i++) {
for (var j=0;j<a[i].length;j++) {
b[i].push(a[i][newOrder[j]-1]);
}
a[i] = b[i];
}
for (var i=0;i<newOrder.length;i++) {
document.getElementById('tab'+newOrder[i]).id = "tab" + (i+1) + ".temp";
if (top.ICEcoder.selectedTab == newOrder[i]) {
selectedTabWillBe = (i+1);
}
}
for (var i=0;i<newOrder.length;i++) {
document.getElementById('tab'+(i+1)+'.temp').id = "tab"+(i+1);
}
if (top.document.getElementById('tab'+selectedTabWillBe)) {
top.document.getElementById('tab'+selectedTabWillBe).className = "tab tabSlide";
}
ICEcoder.changedContent = a[0];
ICEcoder.openFiles = a[1];
ICEcoder.openFileMDTs = a[2];
ICEcoder.cMInstances = a[3];
top.ICEcoder.setTabWidths();
top.ICEcoder.switchTab(selectedTabWillBe);
},
// Alphabetize tabs
alphaTabs: function() {
var currentArray, currentArrayFull, alphaArray, nextValue, nextPos;
currentArray = [];
currentArrayFull = [];
alphaArray = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1));
currentArrayFull.push(top.ICEcoder.openFiles[i]);
top.document.getElementById('tab'+(i+1)).className = "tab tabSlide";
}
while (currentArray.length>0) {
nextValue = currentArray[0];
nextValueFull = currentArrayFull[0];
nextPos = 0;
for (var i=0;i<currentArray.length;i++) {
if (currentArray[i] < nextValue) {
nextValue = currentArray[i];
nextValueFull = top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(currentArrayFull[i])];
nextPos = i;
}
}
alphaArray.push((top.ICEcoder.openFiles.indexOf(nextValueFull)+1));
currentArray.splice(nextPos,1);
currentArrayFull.splice(nextPos,1);
}
top.ICEcoder.sortTabs(alphaArray);
}, },
// ============== // ==============
@@ -1887,19 +1993,12 @@ var ICEcoder = {
lineNo = cM.getCursor().line; lineNo = cM.getCursor().line;
whiteSpace = cM.getLine(lineNo).length - cM.getLine(lineNo).replace(/^\s\s*/, '').length; whiteSpace = cM.getLine(lineNo).length - cM.getLine(lineNo).replace(/^\s\s*/, '').length;
content = cM.getLine(lineNo).slice(whiteSpace); content = cM.getLine(lineNo).slice(whiteSpace);
if (content.slice(0,2)=="f ") { if (content.slice(0,8)=="function") {
top.ICEcoder.doSnippet('f ','function VAR() {\nINDENT\tCURSOR\nINDENT}'); top.ICEcoder.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}');
} else if (content.slice(0,2)=="if") { } else if (content.slice(0,2)=="if") {
top.ICEcoder.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); top.ICEcoder.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}');
} else if (content.slice(0,3)=="for") { } else if (content.slice(0,3)=="for") {
top.ICEcoder.doSnippet('for','for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}'); top.ICEcoder.doSnippet('for','for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}');
} else {
cM.operation(function(){
var msg = document.createElement("iframe");
msg.src = "lib/snippet-display.php";
msg.className = "snippetFrame";
top.ICEcoder.snippetLine = cM.addLineWidget(cM.getCursor().line, msg, {coverGutter: false, noHScroll: true});
});
} }
}, },
@@ -1934,16 +2033,5 @@ var ICEcoder = {
cM.focus(); cM.focus();
top.ICEcoder.removeSnippet(); top.ICEcoder.removeSnippet();
} }
},
// Remove snippet panel
removeSnippet: function() {
var cM;
cM = ICEcoder.getcMInstance();
if (top.ICEcoder.snippetLine!==false) {
cM.removeLineWidget(top.ICEcoder.snippetLine);
}
top.ICEcoder.snippetLine = false;
} }
}; };

View File

@@ -45,8 +45,8 @@ include($settingsFile);
// Add ICEcoder settings to beginning of $ICEcoder array // Add ICEcoder settings to beginning of $ICEcoder array
$ICEcoder = array( $ICEcoder = array(
"versionNo" => "1.5", "versionNo" => "1.6",
"codeMirrorDir" => "CodeMirror-3.0", "codeMirrorDir" => "CodeMirror-3.01",
"demoMode" => false "demoMode" => false
)+$ICEcoder; )+$ICEcoder;
@@ -147,15 +147,20 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
// Replace our previousFiles var with the the current // Replace our previousFiles var with the the current
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20; $repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart; $repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
if (!$demoMode && $_GET['saveFiles']!="CLEAR") { if (!$demoMode) {
$saveFiles=strClean($_GET['saveFiles']); if ($_GET['saveFiles']!="CLEAR") {
$saveFilesArray = explode(",",$saveFiles); $saveFiles=strClean($_GET['saveFiles']);
$saveFiles=""; $saveFilesArray = explode(",",$saveFiles);
for ($i=0;$i<count($saveFilesArray);$i++) { $saveFiles="";
$saveFilesArray[$i] = str_replace("/","|",$docRoot).$saveFilesArray[$i]; for ($i=0;$i<count($saveFilesArray);$i++) {
$saveFiles .= $saveFilesArray[$i].","; $saveFilesArray[$i] = str_replace("/","|",$docRoot).$saveFilesArray[$i];
$saveFiles .= $saveFilesArray[$i].",";
}
$saveFiles = rtrim($saveFiles,",");
} else {
$saveFilesArray = array();
$saveFiles = "";
} }
$saveFiles = rtrim($saveFiles,",");
$settingsContents = substr($settingsContents,0,$repPosStart).$saveFiles.substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents)); $settingsContents = substr($settingsContents,0,$repPosStart).$saveFiles.substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
// Now update the config file // Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/".$settingsFile." and press refresh"); $fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/".$settingsFile." and press refresh");
@@ -227,8 +232,10 @@ if ($_SESSION['loggedIn']) {
$onLoadExtras .= ";top.ICEcoder.content.style.visibility='visible'"; $onLoadExtras .= ";top.ICEcoder.content.style.visibility='visible'";
} }
if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_SERVER['SCRIPT_NAME'],"lib/settings.php")) {
header('Location: lib/settings.php');
// If we're due to show the settings screen // If we're due to show the settings screen
if (!$_SESSION['loggedIn']) { } elseif (!$_SESSION['loggedIn']) {
// If the password hasn't been set and we're setting it // If the password hasn't been set and we're setting it
if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) { if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) {
$password = generateHash(strClean($_POST['accountPassword'])); $password = generateHash(strClean($_POST['accountPassword']));
@@ -280,8 +287,4 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
</html> </html>
<?php <?php
} }
if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_SERVER['SCRIPT_NAME'],"lib/settings.php")) {
header('Location: lib/settings.php');
}
?> ?>

View File

@@ -1,30 +0,0 @@
<?php include("lib/settings.php");?>
<!DOCTYPE html>
<html style="margin: 0">
<head>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> snippet display</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<style type="text/css">
body {font-family: arial; font-size: 10px; background: #ccc}
</style>
</head>
<body style="margin: 5px">
<table border="0" cellpadding="0" cellspacing="0" width="500">
<tr valign="top"><td style="padding-bottom: 5px; font-size: 11px"><b>abbreviation plus CTRL+space</td><td style="font-size: 11px"><b>produces</b></td></tr>
<tr valign="top"><td>f name</td><td style="padding-bottom: 5px">function name() {...}</td></tr>
<tr valign="top"><td>if</td><td style="padding-bottom: 5px">if () {...}</td></tr>
<tr valign="top"><td>for</td><td style="padding-bottom: 5px">for (var i=0; i<; i++) {...}</td></tr>
</table>
<br><br>
Tip: If you have Emmet installed, also try tab key after your abbreviation
</script>
<span onClick="top.ICEcoder.removeSnippet()" style="position: absolute; top: 5px; right: 5px; height: 11px; background: #444; margin: 1px 0 0 5px; border-radius: 6px; cursor: pointer"><img src="../images/nav-close.gif"></span>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB