Compare commits

..

125 Commits

Author SHA1 Message Date
Matt Pass
8dfad0aa5d v2.0 beta 2013-02-27 08:12:33 +00:00
Matt Pass
b07f2e9633 Tag wrappers & config template features added 2013-02-27 08:12:20 +00:00
Matt Pass
6ecc435b85 Boot users if not logged in 2013-02-26 17:35:09 +00:00
Matt Pass
a0a70495f0 Always set the scanDir to $docRoot.$iceRoot 2013-02-26 16:57:17 +00:00
Matt Pass
29981dfd52 rename get-tree to get-branch 2013-02-26 16:48:56 +00:00
Matt Pass
86735ac3b7 Upgrade to CodeMirror 3.1 2013-02-26 16:45:14 +00:00
Matt Pass
e5a1a10101 Help screen wider, not as tall
Due to adding extra shortcuts to Help screen, it needs to be bigger to
accomodate this info
2013-02-26 16:30:56 +00:00
Matt Pass
f362a83cfa Add 8 tag wrapper shortcuts & 2 column format
8 new tag wrapper shortcuts added and moving from 1 column to 2 because
of this extra info
2013-02-26 16:30:08 +00:00
Matt Pass
df902fb08e Pull classes out of .help class
We have 2 div containers now, so just define key, plus and shortcut in
isolation
2013-02-26 16:28:51 +00:00
Matt Pass
29de36f348 Removing branch & branchReload, this now default
No need to work with the treeType of branch or branchReload, as
reloading branches are now the default and only tree type
2013-02-26 13:15:09 +00:00
Matt Pass
92e7603aa5 Don't look to nextSibling & open/close fix
No need to set node to nextSibling again, only once is needed
If condition is now else if and calling the get-tree.php script
subsequent times and only if we're opening
This means we fix the open/close dir problem and also reload the dir
each time we open
2013-02-26 13:14:06 +00:00
Matt Pass
e3431f201c Setting treeType is no longer an option
Branch loading is now the default and only way to view a tree
2013-02-26 13:10:18 +00:00
Matt Pass
5c7a6bbf8f No longer creating full trees
Evolved to a branch loading system only, none of this needed anymore
2013-02-26 13:09:36 +00:00
Matt Pass
d6a82d1962 Change of latest version URL, not JSON encoded
Now calling /latest-version which is a tidier URL and also passing user
version no to this
This URL now tracks usage via Google Analytics, so I can begin to get an
idea of which version nos users are on, geo data, overall usage etc
No longer using json_encode as it's not JSON encoded, instead splitting
on line breaks and grabbing first array value as the version no
2013-02-25 16:39:46 +00:00
Matt Pass
a7a5ada4d9 openCloseDir changes onClick & gets dir branch
Change onclick event by setting 2nd param to false so it doesn't reload
Broke setting of node.nextSibling down into 2 new items, may revise this
If we're due to load, pass that through to get-tree.php in the
fileControl iFrame to begin the process
2013-02-24 17:19:51 +00:00
Matt Pass
6ff50cb42d 4 x vars moved to get-tree.php
Need to make use of these for branch injection too
2013-02-24 17:17:00 +00:00
Matt Pass
7ffc89f41b Now working with branch loading!
Only include settings file if we don't have ICEcoder settings available
Need 4 x vars for fileCounts etc available here
Contain tree within DIV which we can get the innerHTML of later for
branch injection
Need .$location when determining if a dir or not and also as part of the
path
If it's a folder and we have a treeType of branch or branchReload, add
true as the 2nd param, false otherwise
If we have a location, we're branch injecting, so get the target DOM
elem, create a new UL, set the style of it, remove whatever UL may be
there before, take the DIV innerHTML with the UL and /UL tags chopped
off, make it the innerHTML of our UL and finally inject into the DOM at
the right position.
2013-02-24 17:15:19 +00:00
Matt Pass
8c1131442b Keep root level out of get-tree.php
This is so we can call get-tree.php and just get the UL list at a dir
location
2013-02-24 14:09:16 +00:00
Matt Pass
c49acc9084 Get a specific dir if treeType is a branch type
Boot user out if not logged in
If the treeType is branch or branchReload, scan the dir at the specific
location, sort into dir and files arrays, nat case sort them and merge.
This is then finalArray and can be used to create the UL list
2013-02-24 13:53:53 +00:00
Matt Pass
f03cfcb0e3 Only create full tree if treeType is 'full'
No need to do any of this if not, so wrapped in an if condition to
exclude otherwise
2013-02-24 13:43:04 +00:00
Matt Pass
460d7c5aea treeType added as a setting
root setting text input a bit smaller to allow for this new dropdown
treeType dropdown added with 3 options for full, branch & branchReload
2013-02-24 13:41:06 +00:00
Matt Pass
50fd681420 treeType setting now updated, with quotes 2013-02-24 13:39:37 +00:00
Matt Pass
70c8ca3a55 Move treeType setting
Move nearer root setting, makes logical sense to be near each other,
plus we only update settings down to tabWidth from settings screen,
would be out of this updated section otherwise.
2013-02-24 13:37:37 +00:00
Matt Pass
1234f789a4 Move display of UL list into include file
This is so we can use for other purposes shortly, such as different
treeTypes
2013-02-24 11:20:07 +00:00
Matt Pass
25fd009be3 Focus on editor in 4ms
Wasn't focusing after switch, this solves the issue
2013-02-24 11:07:02 +00:00
Matt Pass
9ffab47f83 fileManager() gone, new openCloseDir() function
The fileManager function was only being called once onLoad of files.php
This was really only adding onClick events and setting classNames and
style.displays, no need to do this really with JS, merged into files.php
as it's creating the tree
openCloseDir function now available to deal with open & close of dirs
This is less code, less JS to run on boot and paves the way towards
multiple treeTypes
2013-02-20 18:09:00 +00:00
Matt Pass
38c46f3d5c Merge onClick events & removing fileManager()
Remove triggering fileManager() onLoad, this is the only place it's used
Set the class, style and onClick events to replicate what that function
was doing
2013-02-20 18:05:48 +00:00
Matt Pass
3a0c33c5cf treeType setting added 2013-02-20 18:03:07 +00:00
Matt Pass
5d6b057361 Replace URL special chars when folder sorting
When sorting folders into order, special chars such as $, -, _ etc were
causing sorting issues while other chars such as _ worked OK. This is
all due to the char's ref in relation to a-z, 0-9 and A-Z chars in the
char table. By replacing these URL special chars (defined in RFC 1738
specification) with a \ (the only char not allowed in a file/folder
name), we are levelling these chars out, so we can safely focus on
alphanum sorting only.
2013-02-20 09:34:29 +00:00
Matt Pass
8fcbdc8ea0 Reinstate files.php only
Stupid line breaks
2013-02-20 09:32:19 +00:00
Matt Pass
a774f9052d Tag wrap on a tag cursor pos & other Esc = cancel
Need to set cursor position to start line, not end
Accidentally removed cancel shortcut
2013-02-18 09:58:27 +00:00
Matt Pass
2d79b5a988 Reset fileInput and only act if we have file
Reset fileInput back to an empty value after upload (success or fail)
Only if value isn't empty action the upload
2013-02-17 18:04:32 +00:00
Matt Pass
86ae5e14b4 Remove the child on delete
Instead of just hiding. So we can delete an item and create a new one of
the name name at that dir location without issues.
2013-02-17 17:47:06 +00:00
Matt Pass
8153d4a139 Spelling fix - Folders 2013-02-17 17:32:28 +00:00
Matt Pass
3e80d86628 Change install info to 757 on backups & lib dirs 2013-02-17 17:26:59 +00:00
Matt Pass
a097330772 Duplicates config template file on boot
If the config file doesn't exist, create a new one by copying the
template file
2013-02-17 17:26:25 +00:00
Matt Pass
5545743bd8 config-sample.php is now config-template.php 2013-02-17 16:53:22 +00:00
mattpass
ccd212f839 Merge pull request #156 from aharris88/master
Ignore config.php
2013-02-17 08:30:54 -08:00
Matt Pass
5697625a7d Line breaks and indents for DIV tag wrapping
If the user is wrapping the selected with a DIV tag, add line breaks
were needed and indentation as appropriate.
2013-02-17 16:26:10 +00:00
aharris88
3d54005332 Rename config.php to config-sample.php and ignore config.php 2013-02-15 11:56:15 -06:00
Matt Pass
a5894dfae8 Alt key down flag & tag wrapper
New variable flag for altKeyDown just like ctrlKeyDown
Restructured key tracking system into more modular chunks
If CTRL+Alt+key, check if we need to trigger tagWrapper function.
Currently have 8 common tags setup (for div, span, p, a, b, i, strong,
em)
tagWrapper function receives any tag and wraps selected text with that
tag
If it's an a tag tho, it adds a href="" to the start and sets cursor
between quotes
2013-02-15 10:28:17 +00:00
Matt Pass
b3aa6e37b9 Arrow pointing to logo, dataMessage DIV
When in demoMode, there is an arrow now pointing to the logo as a quick
guide to using ICEcoder. Will likely be only used by the ICEcoder
website.
dataMessage DIV available to display on demand and insert content into
Slight adjust to subsequent data/info content.
2013-02-12 20:01:12 +00:00
Matt Pass
e4e7661a3d Now passing dataMessage instead of alert
No longer showing alert message, was a bit annoying. This is a better
solution, shows how out of date you are and also provides a link to the
ICEcoder website to get an update.
2013-02-12 19:58:45 +00:00
Matt Pass
9fe38ad649 Taller help screen and dataMessage function
Help screen is now taller to accomodate 4 new FM actions
dataMessage function available to display DIV and then add message into
it on demand
2013-02-12 19:57:40 +00:00
Matt Pass
a8a03a831a Info on 4 x file manager actions
Provide info on left click, double click, CTRL + click and right click
2013-02-12 19:56:13 +00:00
Matt Pass
0df4db9286 Big arrow added 2013-02-12 19:55:03 +00:00
Matt Pass
e4599e3076 Hide paste option until we have copied something
Changes display from none to block when we copy a file/folder ref.
2013-02-11 17:12:59 +00:00
Matt Pass
1a0d8933dc Adjust style values
Now we have an extra stylesheet, this should be [3] not [2]
The class ref for the tabs class is actually [5] not [4]
2013-02-11 17:08:21 +00:00
Matt Pass
00af30281c Fix bad comment tag, revise matchhilight styles
The comment after .CodeMirror-scroll should be inside /* */
Merge matchhighlight and the focused version, add pseudo styles to
override main selected style. May look at changing this in future.
As we removed a class, the tab class is no longer the 6th, but now 5th
class
2013-02-11 17:07:19 +00:00
Matt Pass
8c85b3098d Inform user if there is no file/folder to copy 2013-02-09 17:18:23 +00:00
Matt Pass
000607f8e0 Considering empty folder should be opposite arg
Should be if the childNodes.length < 3, was doing the opposite. Oops!
2013-02-09 15:43:47 +00:00
Matt Pass
82e3698dd2 Change of operator to consider empty files
Was giving false positives on false, !==false is what we require here
2013-02-09 15:42:20 +00:00
Matt Pass
0dd9535a5b Allow opening of empty files
Allow 'empty' to appear in the MIME type, so we can accept things such
as application/x-empty, which indicates an empty file. Wouldn't open
them previously.
2013-02-09 15:07:45 +00:00
Matt Pass
088b3f60ea tagNestExceptions array removed
No longer used (was only used by the ropey close tag system, now
removed)
2013-02-09 14:50:02 +00:00
Matt Pass
c118159121 Selected text forced to be white on blue 2013-02-09 14:49:10 +00:00
Matt Pass
5fad745220 Remove old close tag system, tweak highlights
Old and quite ropey close tag system removed in favour of the
CodeMirrror closetag addon
2 x classes to define highlighted text now forced to be white on blue
everywhere
2013-02-09 14:48:41 +00:00
Matt Pass
02b41bfbdc Matchhilight & autoCloseTags updates
CSS class changed needed for matchhilight and removed color setting
snippetFrame now unused, removed
2 new options set to autoCloseTags and highlightSelectionMatches
No longer setting thisCM.matchHighlight anymore
Set a if 1==2 condition on the previous (and quite ropey) code that did
autoclosing to stop it happening, will remove next.
2013-02-09 14:03:52 +00:00
Matt Pass
82ab3faca3 Upgrade CodeMirror to 3.02 2013-02-09 13:27:13 +00:00
Matt Pass
df74757e83 Quick test only 2013-02-08 17:02:10 +00:00
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 &amp; becomes &amp;amp; ...what you draw out of the textarea
is then &amp;
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
Matt Pass
ef157d71f2 Version 1.5 2013-01-18 17:19:47 +00:00
Matt Pass
0b718e0fbf Styling of a elems for manual link 2013-01-18 17:09:42 +00:00
Matt Pass
809af86c16 Link to manual from Help screen
Passes through version number to be used by function in the URL that
shows the manual
2013-01-18 17:08:26 +00:00
Matt Pass
449e8e2c4a Function to show the ICEcoder manual
Shows the manual in the mediaContainer popup, also passing through the
version number so in the future we can show relevant info.
2013-01-18 17:07:09 +00:00
Matt Pass
01c8a10463 DOCTYPE must be set before anything else
By setting doctype before settings.php, the script elements etc are
loaded after defining the doctype to be html5. This issue only affects
IE9 and not Chrome or Firefox.
2013-01-18 12:59:41 +00:00
Matt Pass
27da7ed0fe Close all tabs function added
Close button added to left of tabs as close all button. Simple styling
added to match tabs. closeAllTabs function added to close all tabs from
last back to first.
2013-01-18 12:13:09 +00:00
Matt Pass
685116c555 Can now pass mode argument to switchMode()
Allows you to set a mode to use via the API
2013-01-18 11:50:16 +00:00
Matt Pass
0c4741c793 Disallow traversing to parent dir 2013-01-15 11:54:12 +00:00
Matt Pass
4da7024f91 Upload files function added
This function will get uploaded file details for each file uploaded and
when uploaded, move the file to the user selected folder. Also shows
error message if there is an issue. Either way, when finished it will
clear the selectedFiles, file menu and hide the loading mask to return
user to normal view.
2013-01-15 11:47:31 +00:00
Matt Pass
b49a2cc52d 2 new functions to select & submit uploaded files
Select function sets uploadedDir hidden form field and clicks the file
input button for user. Submit function is automatically triggered when
files value changes, which then shows the loading screen and submits the
form. preventDefault is also needed here.
2013-01-15 11:45:06 +00:00
Matt Pass
c0fe50cd2f Upload files option added
Clicking on new 'Upload File(s)' option triggers a function to click the
file input button. onChange of this value, the submit function is called
to post the form
2013-01-15 11:43:24 +00:00
Matt Pass
497efaabf0 Fixing multiple & path issies in delete function
Establish a fullPath to begin with and use that
Only show relative path in message re not being able to delete
2013-01-13 16:10:19 +00:00
Matt Pass
2ee777739f Paste same name files with postfixed next nos
$dest now has double slashes replaced with singles
Now also considers if a file exists before copying
If it does, next available number up to 1 billion postfixed to end of
filename
Copy with that new filename, next number postfixed
Slight adjust to filename shown in file manager to match
2013-01-13 15:13:34 +00:00
Matt Pass
deb3ad5359 Logout link added
Logout link added to left of version no, next to logo in top right
Clicking this triggers the logout function, which directs the browser to
the same window location with ?logout QS
The settings.php file is run again (via inclusion) and finding the QS
var, sets the loggedIn var set to false (as a double measure to the
session also being destroyed) and header location boots user back to
login screen
2013-01-13 14:37:36 +00:00
Matt Pass
3f1801ef2b Postfix comparison to check path
Establish a stringExtra value of a slash or nothing depending on wether
we are considering the root level or not
When comparing the folder against the selectedFile array value, postfix
both with a slash (could be any char though). This is to eliminate path
mismatches.
2013-01-13 13:46:59 +00:00
Matt Pass
ca8e92e443 Establish cM and consider in if statement
Avoids errors on content = cM.getValue line
2013-01-13 13:09:46 +00:00
Matt Pass
c514e4a1ad Replace pipes with slahes before opening URL 2013-01-13 12:53:59 +00:00
Matt Pass
ec28de40c9 Checkerboard BG behind image popups
Show checkerboard image behind image popups so you can see transparent
areas on images. Needed black BG as a fallback too.
2013-01-13 12:47:48 +00:00
Matt Pass
14053fbfdd Fixed banned & selected finding issues
Remove old echo test message
Added new $foundInSelFile var
Both this and bFile are false to begin with
Testing on not false of bannedFile in strpos
If we find our matching item is one of our selected files, set
$foundInSelFile to true
Only if we don't have a banned file and either we have no selected
files, or we do have some and have a match, push to array etc
PHP_EOL's to make source easier to read
2012-12-30 19:24:17 +00:00
Matt Pass
464030808c No need to preload the snippet display
Doesn't help with repainting issue
2012-12-30 19:20:43 +00:00
Matt Pass
d2377bff34 Close button for snippet-display 2012-12-30 19:20:09 +00:00
45 changed files with 1883 additions and 1631 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
error-log.txt
backups/*.zip
lib/config.php

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 */
@@ -148,6 +148,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-gutters { .CodeMirror-gutters {
position: absolute; left: 0; top: 0; position: absolute; left: 0; top: 0;
height: 100%; height: 100%;
padding-bottom: 30px;
z-index: 3; z-index: 3;
} }
.CodeMirror-gutter { .CodeMirror-gutter {
@@ -196,6 +197,11 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-linewidget { .CodeMirror-linewidget {
position: relative; position: relative;
z-index: 2; z-index: 2;
overflow: auto;
}
.CodeMirror-widget {
display: inline-block;
} }
.CodeMirror-wrap .CodeMirror-scroll { .CodeMirror-wrap .CodeMirror-scroll {
@@ -210,20 +216,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 +239,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,10 @@ 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
* Tag wrappers
* Config template
###Installation ###Installation
@@ -53,7 +57,7 @@ $ git clone git@github:mattpass/ICEcoder
####Step 2: Upload the files (Linux or Windows hosting OK) ####Step 2: Upload the files (Linux or Windows hosting OK)
``` ```
Upload to a new sub-dir URL such as yourdomain.com/_coder Upload to a new sub-dir URL such as yourdomain.com/_coder
Set public write permissions on the backups folder and lib/config.php file Set public write permissions (757 recommended) on the 'backups' and 'lib' folders
``` ```
####Step 3: Start coding ####Step 3: Start coding

0
backups/.gitkeep Normal file
View File

View File

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

View File

@@ -1,17 +1,18 @@
<?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 codemirror-compressed.js
incls: codemirror.js incls: codemirror.js
modes: clike, coffeescript, css, javascript, less, php, ruby & xml modes: clike, coffeescript, css, javascript, less, php, ruby & xml
utils: foldcode, searchcursor, match-highlighter utils: foldcode, searchcursor, match-highlighter, simple-hint, javascript-hint, closetag
//--> //-->
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script> <script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
<?php <?php
@@ -24,22 +25,26 @@ $activeLineBG = $ICEcoder["theme"]=="eclipse" || $ICEcoder["theme"]=="elegant" |
?>"> ?>">
<style type="text/css"> <style type="text/css">
.CodeMirror {position: absolute; top: 0px; width: 100%; font-size: 13px; z-index: 1} .CodeMirror {position: absolute; top: 0px; width: 100%; font-size: 13px; z-index: 1}
.CodeMirror-scroll {} // was: height: auto; overflow: visible .CodeMirror-scroll {} /* was: height: auto; overflow: visible */
/* Make sure this next one remains the 3rd item, updated with JS */ /* Make sure this next one remains the 3rd item, updated with JS */
.cm-s-activeLine {background: <?php echo $activeLineBG;?> !important} .cm-s-activeLine {background: <?php echo $activeLineBG;?> !important}
span.CodeMirror-matchhighlight {background: #555} .cm-matchhighlight, .CodeMirror-focused .cm-matchhighlight {color: #fff !important; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); background-position: bottom; background-repeat: repeat-x}
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000; background: #555; !important} /* Make sure this next one remains the 5th item, updated with JS */
/* Make sure this next one remains the 6th item, updated with JS */
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";} .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 {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px} .lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px}
.lint-error-icon {background-color: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px} .lint-error-icon {background-color: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px}
.snippetFrame {border: 1px; width: 100%}
</style> </style>
</head> </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"> <?php if ($ICEcoder['demoMode']) {?>
<div style="position: absolute; display: inline-block; width: 99px; height: 50px; top: 0; right: 30px; background: url('images/big-arrow.gif') 0 -10px no-repeat; text-align: center; font-family: arial; font-size: 10px; padding-top: 60px"><b>Click logo<br>for help &amp;<br>usage info</b></div>
<?php ;}; ?>
<div style="display: none; margin: 32px 43px 0 43px; padding: 10px; width: 500px; font-family: arial; font-size: 10px; color: #ddd; background: #333" id="dataMessage"></div>
<div style="margin: 20px 43px 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
<div style="float: left; margin-right: 50px"> <div style="float: left; margin-right: 50px">
<h2 style="color: rgba(0,198,255,0.7)">server</h2> <h2 style="color: rgba(0,198,255,0.7)">server</h2>
<span style="color:#888">Server name, OS & IP:</span><br> <span style="color:#888">Server name, OS & IP:</span><br>
@@ -101,10 +106,14 @@ span.CodeMirror-matchhighlight {background: #555}
CodeMirror.keyMap.ICEcoder = { CodeMirror.keyMap.ICEcoder = {
"Tab": function(cm) {CodeMirror.commands[top.ICEcoder.tabsIndent ? "defaultTab" : "insertTab"](cm);}, "Tab": function(cm) {CodeMirror.commands[top.ICEcoder.tabsIndent ? "defaultTab" : "insertTab"](cm);},
"Shift-Tab": "indentLess", "Shift-Tab": "indentLess",
"Ctrl-Up": function() {}, "Ctrl-Space": "autocomplete",
"Ctrl-Down": function() {},
fallthrough: ["default"] fallthrough: ["default"]
}; };
CodeMirror.commands.autocomplete = function(cm) {
if (top.ICEcoder.caretLocType=="JavaScript") {
CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
}
}
function createNewCMInstance(num) { function createNewCMInstance(num) {
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]; var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
@@ -119,6 +128,8 @@ function createNewCMInstance(num) {
tabSize: top.ICEcoder.tabWidth, tabSize: top.ICEcoder.tabWidth,
indentWithTabs: true, indentWithTabs: true,
electricChars: false, electricChars: false,
autoCloseTags: true,
highlightSelectionMatches: true,
keyMap: "ICEcoder", keyMap: "ICEcoder",
onKeyEvent: function(thisCM, e) { onKeyEvent: function(thisCM, e) {
top.ICEcoder.redoChangedContent(e); top.ICEcoder.redoChangedContent(e);
@@ -126,42 +137,6 @@ function createNewCMInstance(num) {
top.ICEcoder.getCaretPosition(); top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay(); top.ICEcoder.updateCharDisplay();
tok = thisCM.getTokenAt(thisCM.getCursor()); tok = thisCM.getTokenAt(thisCM.getCursor());
if (tok.string!=">") {lastString=tok.string};
if (e.type=="keyup"&&e.keyCode=="16"&&lastKeyCode=="190") {
canDoEndTag=true;
if (top.ICEcoder.tagString!="script" && top.ICEcoder.tagNestExceptions.indexOf(top.ICEcoder.tagString)>-1) {
canDoEndTag=false;
}
if (
top.ICEcoder.tagString.slice(0,1)=="/"||
top.ICEcoder.tagString.slice(0,1)=="?"||
!top.ICEcoder.codeAssist||
fileName && (fileName.indexOf(".js")>0||fileName.indexOf(".css")>0||fileName.indexOf(".less")>0)
) {canDoEndTag=false}
contentType = top.ICEcoder.caretLocType;
if (canDoEndTag && (contentType!="JavaScript"||(contentType=="JavaScript"&&top.ICEcoder.tagString=="script"))) {
numTabs = top.ICEcoder.htmlTagArray.length;
if (top.ICEcoder.htmlTagArray[0]=="html") {numTabs--};
tabs = "";
for (i=0;i<numTabs-1;i++) {
tabs += "\t";
}
endTag = "</" + top.ICEcoder.tagString + ">";
if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"};
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)) {
thisCM.replaceSelection(endTag);
thisCM.setCursor(thisCM.getCursor().line,thisCM.getCursor().ch-top.ICEcoder.tagString.length-3);
} else if(top.ICEcoder.tagString=="html"||top.ICEcoder.tagString=="head") {
thisCM.replaceSelection("\n\n"+endTag);
thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
} else {
thisCM.replaceSelection("\n"+tabs+"\t\n"+tabs+endTag);
thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
}
}
};
lastKeyCode = e.keyCode;
} }
}); });
@@ -172,7 +147,6 @@ function createNewCMInstance(num) {
if(!window['cM'+num].somethingSelected()) { if(!window['cM'+num].somethingSelected()) {
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine"); top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine");
} }
thisCM.matchHighlight("CodeMirror-matchhighlight");
top.ICEcoder.cssColorPreview(); top.ICEcoder.cssColorPreview();
} }
); );
@@ -223,8 +197,6 @@ function createNewCMInstance(num) {
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder); var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);
</script> </script>
<iframe name="snippetLoader" src="snippets/snippet-display.php" style="display: none"></iframe>
</body> </body>
</html> </html>

209
files.php
View File

@@ -1,157 +1,54 @@
<?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">
<link rel="stylesheet" type="text/css" href="lib/files.css"> <link rel="stylesheet" type="text/css" href="lib/files.css">
<script src="lib/ice-coder.js" type="text/javascript"></script> <script src="lib/ice-coder.js" type="text/javascript"></script>
</head> </head>
<body onLoad="top.ICEcoder.fileManager()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);"> <body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div> <div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
<?php <?php
// Function to sort given values alphabetically $fileAtts = "";
function alphasort($a, $b) { if ($serverType=="Linux") {
return strcasecmp($a->getPathname(), $b->getPathname()); $chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3);
} $fileAtts = '<span style="color: #888; font-size: 8px" id="|_perms">'.$chmodInfo.'</span>';
}
// Class to put forward the values for sorting ?>
class SortingIterator implements IteratorAggregate { <ul class="fileManager">
private $iterator = null; <li class="pft-directory dirOpen">
public function __construct(Traversable $iterator, $callback) { <a nohref title="/" onMouseOver="top.ICEcoder.overFileFolder('folder','/')" onMouseOut="top.ICEcoder.overFileFolder('folder','')" onClick="top.ICEcoder.openCloseDir(this)" style="position: relative; left:-22px">
$array = iterator_to_array($iterator); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
usort($array, $callback); <span id="|">/
$this->iterator = new ArrayIterator($array); <?php echo $iceRoot == "" ? "[ROOT]" : trim($iceRoot,"/");?>
} </span>
public function getIterator() { <?php echo $fileAtts;?>
return $this->iterator; </a>
} </li>
} <?php
include("lib/get-branch.php");
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator { ?>
function getChildren() { </ul>
try {
if (!isset($GLOBALS['ICEcoder']['bannedPaths']) || <?php
!in_array($this->key(), $GLOBALS['ICEcoder']['bannedPaths'])) { // Output the JS vars
return parent::getChildren(); echo "<script>\n";
} else { echo "top.ICEcoder.dirCount=";
return new RecursiveArrayIterator(array()); echo $dirCount ? $dirCount : "0";
} echo ";\ntop.ICEcoder.fileCount=";
} catch(UnexpectedValueException $e) { echo $fileCount ? $fileCount : "0";
return new RecursiveArrayIterator(array()); echo ";\ntop.ICEcoder.fileBytes=";
} echo $fileBytes ? $fileBytes : "0";
} echo ";\n</script>";
} ?>
// Get a full list of dirs & files and begin sorting using above class & function <iframe name="fileControl" style="display: none"></iframe>
$objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort');
</body>
// With that done, create arrays for out final ordered list and a temp container of files
$finalArray = $tempArray = array();
// To start, push folders from object into finalArray, files into tempArray
foreach ($objectList as $objectRef) {
$fileFolderName = substr($objectRef->getPathname(), strlen($docRoot.$iceRoot));
$canAdd = true;
for ($i=0;$i<count($_SESSION['bannedFiles']);$i++) {
if(strpos($fileFolderName,$_SESSION['bannedFiles'][$i])!==false) {$canAdd = false;}
}
if ($objectRef->getFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) {
$fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName)
? array_push($finalArray,$fileFolderName)
: array_push($tempArray,$fileFolderName);
}
}
// Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs
for ($i=0;$i<count($tempArray);$i++) {
if (count(explode("/",$tempArray[$i]))==2) {
array_push($finalArray,$tempArray[$i]);
array_splice($tempArray,$i,1);
$i--;
}
}
// Lastly we push remaining files into the right subdirs in finalArray
for ($i=0;$i<count($tempArray);$i++) {
$insertAt = array_search(dirname($tempArray[$i]),$finalArray)+1;
for ($j=$insertAt;$j<count($finalArray);$j++) {
if ( strcasecmp(dirname($finalArray[$j]), dirname($tempArray[$i]))==0 &&
strcasecmp(basename($finalArray[$j]), basename($tempArray[$i]))<0 ||
(strpos(dirname($finalArray[$j]),dirname($tempArray[$i]))===0 && substr($finalArray[$j],strlen(dirname($tempArray[$i])),1)=="/")) {
$insertAt++;
}
}
array_splice($finalArray, $insertAt, 0, $tempArray[$i]);
}
// Finally, we have our ordered list, so display in a UL
$fileAtts = "";
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="|_perms">'.$chmodInfo.'</span>';
}
?>
<ul class="fileManager">
<li class="pft-directory">
<a nohref title="/" onMouseOver="top.ICEcoder.overFileFolder('folder','/')" onMouseOut="top.ICEcoder.overFileFolder('folder','')" style="position: relative; left:-22px">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span id="|">/
<?php echo $iceRoot == "" ? "[ROOT]" : trim($iceRoot,"/");?>
</span>
<?php echo $fileAtts;?>
</a>
</li>
<?php
$lastPath="";
$fileCount=0;
$fileBytes=0;
$dirCount=0;
for ($i=0;$i<count($finalArray);$i++) {
$fileFolderName = str_replace("\\","/",$finalArray[$i]);
$type = is_dir($docRoot.$iceRoot.$fileFolderName) ? "folder" : "file";
$type=="folder" ? $dirCount++ : $fileCount++;
if ($type=="file") {
$fileBytes+=filesize($docRoot.$iceRoot.$fileFolderName);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
}
$thisDepth = count(explode("/",$fileFolderName));
$lastDepth = count(explode("/",$lastPath));
if ($thisDepth > $lastDepth) {echo "<ul>\n";}
if ($thisDepth < $lastDepth) {
for ($j=$lastDepth;$j>$thisDepth;$j--) {
echo "</ul>\n";
}
}
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'.$chmodInfo.'</span>';
}
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ".$fileAtts."</a>\n";
if ($i<count($finalArray)) {echo "</li>\n";}
$lastPath = $fileFolderName;
}
echo "</ul>\n</ul>\n";
// Output the JS vars
echo "<script>\n";
echo "top.ICEcoder.dirCount=";
echo $dirCount ? $dirCount : "0";
echo ";\ntop.ICEcoder.fileCount=";
echo $fileCount ? $fileCount : "0";
echo ";\ntop.ICEcoder.fileBytes=";
echo $fileBytes ? $fileBytes : "0";
echo ";\n</script>";
?>
<iframe name="fileControl" style="display: none"></iframe>
</body>
</html> </html>

BIN
images/big-arrow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
images/checkerboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

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

372
index.php
View File

@@ -1,182 +1,192 @@
<?php include("lib/settings.php"); <?php include("lib/settings.php");
// Check IP permissions // Check IP permissions
if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*", $_SESSION['allowedIPs'])) { if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*", $_SESSION['allowedIPs'])) {
header('Location: /'); header('Location: /');
}; };
$updateMsg = ''; $updateMsg = '';
// Check for updates // Check for updates
if ($ICEcoder["checkUpdates"]) { if ($ICEcoder["checkUpdates"]) {
$icv = json_encode(file_get_contents("http://icecoder.net/latest-version.txt")); $icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]));
$icv = rtrim(ltrim($icv,'"'),'"\\n'); $icv = $icv[0];
if ($ICEcoder["versionNo"]<$icv) { $icv = rtrim(ltrim($icv,'"'),'"\\n');
$updateMsg = ';top.ICEcoder.message(\'ICEcoder '.$icv.' now released\n\nPlease upgrade\')'; if ($ICEcoder["versionNo"]<$icv) {
} $updateMsg = ";top.ICEcoder.dataMessage('<b>UPDATE INFO:</b> ICEcoder v ".$icv." now available. (Your version is v ".$ICEcoder["versionNo"]."). Get it free from <a href=\\'http://icecoder.net\\' target=\\'_blank\\' style=\\'color:#ddd\\'>icecoder.net</a>');";
} }
?> }
<!DOCTYPE html> ?>
<!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">
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="lib/ice-coder.css"> <link rel="stylesheet" type="text/css" href="lib/ice-coder.css">
<link rel="icon" type="image/png" href="favicon.png"> <link rel="icon" type="image/png" href="favicon.png">
<script> <script>
iceRoot = "<?php echo $ICEcoder["root"]; ?>"; iceRoot = "<?php echo $ICEcoder['root']; ?>";
window.onbeforeunload = function() { window.onbeforeunload = function() {
if (top.ICEcoder.changedContent.indexOf(1)>-1) { if (top.ICEcoder.changedContent.indexOf(1)>-1) {
return "You have some unsaved changes."; return "You have some unsaved changes.";
} }
} }
</script> </script>
<script language="JavaScript" src="lib/ice-coder.js"></script> <script language="JavaScript" src="lib/ice-coder.js"></script>
<?php <?php
if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) { if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
echo '<script src="plugins/jshint/jshint.js"></script>'; echo '<script src="plugins/jshint/jshint.js"></script>';
} }
?> ?>
</head> </head>
<body onLoad="<?php <body onLoad="<?php
echo 'top.ICEcoder.previousFiles = ['; echo 'top.ICEcoder.previousFiles = [';
if ($ICEcoder["previousFiles"]!="") { if ($ICEcoder["previousFiles"]!="") {
$openFilesArray = explode(",",$ICEcoder["previousFiles"]); $openFilesArray = explode(",",$ICEcoder["previousFiles"]);
echo "'".implode("','",$openFilesArray)."'"; echo "'".implode("','",$openFilesArray)."'";
} }
echo "];top.ICEcoder.theme = '"; echo "];top.ICEcoder.theme = '";
echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"]; echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];
echo "'"; echo "'";
echo ';top.ICEcoder.tabsIndent = '; echo ';top.ICEcoder.tabsIndent = ';
echo $ICEcoder["tabsIndent"] ? 'true' : 'false'; echo $ICEcoder["tabsIndent"] ? 'true' : 'false';
echo ';top.ICEcoder.openLastFiles = '; echo ';top.ICEcoder.openLastFiles = ';
echo $ICEcoder["openLastFiles"] ? 'true' : 'false'; echo $ICEcoder["openLastFiles"] ? 'true' : 'false';
echo ';top.ICEcoder.lineWrapping = '; echo ';top.ICEcoder.lineWrapping = ';
echo $ICEcoder["lineWrapping"] ? 'true' : 'false'; echo $ICEcoder["lineWrapping"] ? 'true' : 'false';
echo ';top.ICEcoder.tabWidth = '; echo ';top.ICEcoder.tabWidth = ';
echo $ICEcoder["tabWidth"]; echo $ICEcoder["tabWidth"];
?>;ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);"> ?>;ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)" onContextMenu="return false"> <div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)" onContextMenu="return false">
<div class="popupVCenter"> <div class="popupVCenter">
<div class="popup" id="mediaContainer"></div> <div class="popup" id="mediaContainer"></div>
</div> </div>
</div> </div>
<div id="loadingMask" class="blackMask" style="visibility: visible" onContextMenu="return false"> <div id="loadingMask" class="blackMask" style="visibility: visible" onContextMenu="return false">
<span class="progressBar" id="progressBar" style="-webkit-animation:fullexpand 10s ease-out; -moz-animation:fullexpand 10s ease-out"></span> <span class="progressBar" id="progressBar" style="-webkit-animation:fullexpand 10s ease-out; -moz-animation:fullexpand 10s ease-out"></span>
<div class="popupVCenter"> <div class="popupVCenter">
<div class="popup"> <div class="popup">
<div class="circleOutside"></div> <div class="circleOutside"></div>
<div class="circleInside"></div> <div class="circleInside"></div>
&nbsp;&nbsp;&nbsp;working... &nbsp;&nbsp;&nbsp;working...
</div> </div>
</div> </div>
</div> </div>
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');this.style.display='none'" onContextMenu="return false"> <div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');this.style.display='none'" onContextMenu="return false">
<span id="folderMenuItems"> <span id="folderMenuItems">
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="ICEcoder.showFileMenu()">New File</a> <a href="javascript:top.ICEcoder.newFile()" onMouseOver="ICEcoder.showFileMenu()">New File</a>
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="ICEcoder.showFileMenu()">New Folder</a> <a href="javascript:top.ICEcoder.newFolder()" onMouseOver="ICEcoder.showFileMenu()">New Folder</a>
<a href="javascript:top.ICEcoder.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Paste</a> <a href="javascript:top.ICEcoder.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()" id="fmMenuPasteOption" style="display: none">Paste</a>
</span> <a href="javascript:top.ICEcoder.uploadFilesSelect(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Upload File(s)</a>
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Delete</a> <div style="display: none">
<span id="singleFileMenuItems"> <form enctype="multipart/form-data" id="uploadFilesForm" action="lib/file-control.php?action=upload&file=/uploaded" method="POST" target="fileControl">
<a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</a> <input type="hidden" name="folder" id="uploadDir" value="/">
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Rename</a> <input type="file" name="filesInput[]" id="fileInput" onchange="top.ICEcoder.uploadFilesSubmit(this)" multiple>
<a href="javascript:window.open(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">View Webpage</a> <input type="submit" value="Upload File">
</span> </form>
<a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Zip It!</a> </div>
<a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Properties</a> </span>
</div> <a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Delete</a>
<span id="singleFileMenuItems">
<div id="header" class="header" onContextMenu="return false"> <a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</a>
<div class="plugins" id="pluginsContainer"> <a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Rename</a>
<?php echo $pluginsDisplay; ?> <a href="javascript:window.open(top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()">View Webpage</a>
</div> </span>
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()"> <a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Zip It!</a>
<img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()"> <a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Properties</a>
</div> </div>
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';"> <div id="header" class="header" onContextMenu="return false">
<div class="account" id="account"> <div class="plugins" id="pluginsContainer">
<div class="accountOptions"> <?php echo $pluginsDisplay; ?>
<div title="Save" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div> </div>
<div title="Open" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div> <div class="version"><a href="javascript:top:ICEcoder.logout()">logout</a> : v <?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
<div title="New File" onClick="ICEcoder.fMIcon('newFile')" id="fMNewFile" class="newFile"></div> <img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
<div title="New Folder" onClick="ICEcoder.fMIcon('newFolder')" id="fMNewFolder" class="newFolder"></div> </div>
<div title="Delete" onClick="ICEcoder.fMIcon('delete')" id="fMDelete" class="delete"></div>
<div title="Rename" onClick="ICEcoder.fMIcon('rename')" id="fMRename" class="rename"></div> <div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';">
<div title="View" onClick="ICEcoder.fMIcon('view')" id="fMView" class="view"></div> <div class="account" id="account">
<div class="accountOptions">
<div title="Lock" onClick="ICEcoder.lockUnlockNav()" id="fmLock" class="lock"></div> <div title="Save" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div>
</div> <div title="Open" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div>
</div> <div title="New File" onClick="ICEcoder.fMIcon('newFile')" id="fMNewFile" class="newFile"></div>
<iframe id="filesFrame" class="frame" name="ff" src="files.php" style="opacity: 0" onLoad="this.style.opacity='1';this.contentWindow.onscroll=function(){top.ICEcoder.mouseDown=false}"></iframe> <div title="New Folder" onClick="ICEcoder.fMIcon('newFolder')" id="fMNewFolder" class="newFolder"></div>
<div class="serverMessage" id="serverMessage"></div> <div title="Delete" onClick="ICEcoder.fMIcon('delete')" id="fMDelete" class="delete"></div>
</div> <div title="Rename" onClick="ICEcoder.fMIcon('rename')" id="fMRename" class="rename"></div>
<div title="View" onClick="ICEcoder.fMIcon('view')" id="fMView" class="view"></div>
<div id="editor" class="editor">
<div id="tabsBar" class="tabsBar" onContextMenu="return false"> <div title="Lock" onClick="ICEcoder.lockUnlockNav()" id="fmLock" class="lock"></div>
<?php </div>
for ($i=1;$i<=100;$i++) { </div>
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>'; <iframe id="filesFrame" class="frame" name="ff" src="files.php" style="opacity: 0" onLoad="this.style.opacity='1';this.contentWindow.onscroll=function(){top.ICEcoder.mouseDown=false}"></iframe>
} <div class="serverMessage" id="serverMessage"></div>
?><div class="newTab" onClick="ICEcoder.newTab()"><img src="images/nav-new.png"></div> </div>
</div>
<div id="findBar" class="findBar" onContextMenu="return false"> <div id="editor" class="editor">
<form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false"> <div id="tabsBar" class="tabsBar" onContextMenu="return false">
<div class="findReplace"> <a nohref onClick="top.ICEcoder.closeAllTabs()"><img src="images/nav-close.gif" class="closeAllTabs" title="Close all tabs"></a>
<div class="findText">Find</div> <a nohref onClick="top.ICEcoder.alphaTabs()"><img src="images/nav-alpha.png" class="alphaTabs" title="Alphabetize tabs"></a>
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true,false)"> <?php
for ($i=1;$i<=100;$i++) {
<select name="connector" onChange="ICEcoder.findReplaceOptions()"> 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>';
<option>in</option> }
<option>and</option> ?><div class="newTab" onClick="ICEcoder.newTab()" id="newTab"><img src="images/nav-new.png"></div>
</select> </div>
<div class="replaceText" id="rText" style="display: none"> <div id="findBar" class="findBar" onContextMenu="return false">
<select name="replaceAction" class="replaceAction"> <form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false">
<option>replace</option> <div class="findReplace">
<option>replace all</option> <div class="findText">Find</div>
</select> <input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true,false)">
with
</div> <select name="connector" onChange="ICEcoder.findReplaceOptions()">
<input type="text" name="replace" value="" id="replace" class="textbox replace" style="display: none"> <option>in</option>
<div class="targetText" id="rTarget" style="display: none">in</div> <option>and</option>
<select name="target" onChange="ICEcoder.updateResultsDisplay(this.value=='this document' ? 'show' : 'hide')"> </select>
<option>this document</option> <div class="replaceText" id="rText" style="display: none">
<option>open documents</option> <select name="replaceAction" class="replaceAction">
<option>all files</option> <option>replace</option>
<option>all filenames</option> <option>replace all</option>
</select> </select>
<input type="submit" name="submit" value="&gt;&gt;" class="submit"> with
<div class="results" id="results"></div> </div>
</div> <input type="text" name="replace" value="" id="replace" class="textbox replace" style="display: none">
</form> <div class="targetText" id="rTarget" style="display: none">in</div>
<form onSubmit="return ICEcoder.goToLine()"> <select name="target" onChange="ICEcoder.updateResultsDisplay(this.value=='this document' ? 'show' : 'hide')">
<div class="codeAssist"><input type="checkbox" name="codeAssist" id="codeAssist" checked onClick="top.ICEcoder.codeAssistToggle()">Code Assist</div> <option>this document</option>
<div class="goLine">Go to Line<input type="text" name="goToLine" value="" id="goToLineNo" class="textbox goToLine"> <option>open documents</option>
</form> <option>all files</option>
</div> <option>all filenames</option>
<iframe name="contentFrame" id="content" src="editor.php" class="code"></iframe> </select>
</div> <input type="submit" name="submit" value="&gt;&gt;" class="submit">
<div class="results" id="results"></div>
<div class="footer" id="footer" onContextMenu="return false"> </div>
<div class="nesting" id="nestValid">Nesting OK</div> </form>
<div class="nestLoc">cursor nest location</div> <form onSubmit="return ICEcoder.goToLine()">
<div class="nestDisplay" id="nestDisplay"></div> <div class="codeAssist"><input type="checkbox" name="codeAssist" id="codeAssist" checked onClick="top.ICEcoder.codeAssistToggle()">Code Assist</div>
<div class="charDisplay" id="charDisplay"><span id="char"></span></div> <div class="goLine">Go to Line<input type="text" name="goToLine" value="" id="goToLineNo" class="textbox goToLine">
</div> </form>
</div>
<script> <iframe name="contentFrame" id="content" src="editor.php" class="code"></iframe>
ICEcoder.initAliases(); </div>
ICEcoder.setLayout('dontSetEditor');
</script> <div class="footer" id="footer" onContextMenu="return false">
<div class="nesting" id="nestValid">Nesting OK</div>
</body> <div class="nestLoc">cursor nest location</div>
<div class="nestDisplay" id="nestDisplay"></div>
<div class="charDisplay" id="charDisplay"><span id="char"></span></div>
</div>
<script>
ICEcoder.initAliases();
ICEcoder.setLayout('dontSetEditor');
</script>
</body>
</html> </html>

View File

@@ -20,6 +20,7 @@ $ICEcoder = array(
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("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") 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", "theme" => "default",

View File

@@ -34,7 +34,7 @@
.cm-s-icecoder span.cm-link {color: #ff0} .cm-s-icecoder span.cm-link {color: #ff0}
.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important} .cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important}
.cm-s-icecoder .CodeMirror-selected {background: #037 !important} .cm-s-icecoder .CodeMirror-selected {color: #fff !important; background: #037 !important}
.cm-s-icecoder .CodeMirror-gutters {background: #333; width: 41px; text-align: right; border-right: 1px solid #ccc} .cm-s-icecoder .CodeMirror-gutters {background: #333; width: 41px; text-align: right; border-right: 1px solid #ccc}
.cm-s-icecoder .CodeMirror-linenumber {color: #999; cursor: default} .cm-s-icecoder .CodeMirror-linenumber {color: #999; cursor: default}
.cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important} .cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important}

View File

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

87
lib/get-branch.php Normal file
View File

@@ -0,0 +1,87 @@
<?php
if (!isset($ICEcoder['root'])) {
include("settings.php");
}
if (!$_SESSION['loggedIn']) {
header("Location: ../");
}
$lastPath="";
$fileCount=0;
$fileBytes=0;
$dirCount=0;
?>
<div id="branch">
<?php
// If we're just getting a branch, get that and set as the finalArray
$scanDir = $docRoot.$iceRoot;
$location = "";
if (isset($_GET['location'])) {
$location = str_replace("|","/",$_GET['location']);
}
$dirArray = $filesArray = $finalArray = array();
$finalArray = scanDir($scanDir.$location);
foreach($finalArray as $entry) {
$canAdd = true;
for ($i=0;$i<count($_SESSION['bannedFiles']);$i++) {
if(strpos($entry,$_SESSION['bannedFiles'][$i])!==false) {$canAdd = false;}
}
if ($entry != "." && $entry != ".." && $canAdd) {
is_dir($docRoot.$iceRoot.$location."/".$entry)
? array_push($dirArray,$location."/".$entry)
: array_push($filesArray,$location."/".$entry);
}
}
natcasesort($dirArray);
natcasesort($filesArray);
$finalArray = array_merge($dirArray,$filesArray);
for ($i=0;$i<count($finalArray);$i++) {
$fileFolderName = str_replace("\\","/",$finalArray[$i]);
$type = is_dir($docRoot.$iceRoot.$fileFolderName) ? "folder" : "file";
$type=="folder" ? $dirCount++ : $fileCount++;
if ($type=="file") {
$fileBytes+=filesize($docRoot.$iceRoot.$fileFolderName);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
}
$thisDepth = count(explode("/",$fileFolderName));
$lastDepth = count(explode("/",$lastPath));
$ulDisplay = $i==0 ? ' style="display: block"' : ' style="display: none"';
if ($thisDepth > $lastDepth) {echo "<ul".$ulDisplay.">\n";}
if ($thisDepth < $lastDepth) {
for ($j=$lastDepth;$j>$thisDepth;$j--) {
echo "</ul>\n";
}
}
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'.$chmodInfo.'</span>';
}
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
$loadParam = $type == "folder" ? "true" : "false";
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" onClick=\"top.ICEcoder.openCloseDir(this,$loadParam)\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ".$fileAtts."</a>\n";
if ($i<count($finalArray)) {echo "</li>\n";}
$lastPath = $fileFolderName;
}
?>
</div>
<?php
if (isset($_GET['location'])) {
?>
<script>
targetElem = top.ICEcoder.filesFrame.contentWindow.document.getElementById('<?php echo $_GET['location'];?>');
newUL = document.createElement("ul");
newUL.style = "display: block";
locNest = targetElem.parentNode.parentNode;
if(locNest.nextSibling.tagName=="UL") {
x = locNest.nextSibling;
x.parentNode.removeChild(x);
}
newUL.innerHTML = document.getElementById('branch').innerHTML.slice(29).slice(0,-6);
locNest.parentNode.insertBefore(newUL,locNest.nextSibling);
</script>
<?php
;};
?>

View File

@@ -24,8 +24,9 @@ body {overflow: hidden;
} }
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
a {color: #fff; text-decoration: none}
.help {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} .help {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px}
.help .key {display: inline-block; width: 175px; text-align: right; margin-right: 5px; float: left} .key {display: inline-block; width: 175px; text-align: right; margin-right: 5px; float: left}
.help .key .plus {color: #888} .key .plus {color: #888}
.help .shortcut {display: inline-block; width: 175px; color: #888; margin-left: 5px; float: left} .shortcut {display: inline-block; width: 175px; color: #888; margin-left: 5px; float: left}

View File

@@ -1,45 +1,63 @@
<?php include("settings.php");?> <?php include("settings.php");?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> help</title> <title>ICEcoder <?php echo $ICEcoder["versionNo"];?> help</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" type="text/css" href="help.css"> <link rel="stylesheet" type="text/css" href="help.css">
</head> </head>
<body class="help"> <body class="help">
<h1 id="title">help</h1> <h1 id="title">help</h1>
<h2>In file manager</h2> <a href="javascript:top.ICEcoder.showManual(<?php echo $ICEcoder["versionNo"];?>)" style="position: absolute; top: 26px; right: 20px"><div style="padding: 10px; background: #2187e7; color: #fff; font-size: 18px">ICEcoder manual</div></a>
<span class="key">Delete</span> <span class="shortcut">Delete file</span><br><br>
<div style="display: inline-block; width: 365px; margin-right: 20px">
<h2>Within document</h2> <h2>Within file manager</h2>
<span class="key">CTRL <span class="plus">+</span> &uarr;</span> <span class="shortcut">Move line up</span><br> <span class="key">Left click</span> <span class="shortcut">Select file / folder</span><br>
<span class="key">CTRL <span class="plus">+</span> &darr;</span> <span class="shortcut">Move line down</span><br> <span class="key">Double click</span> <span class="shortcut">Open file</span><br>
<span class="key">CTRL <span class="plus">+</span> I</span> <span class="shortcut">Search selected text</span><br> <span class="key">CTRL <span class="plus">+</span> click</span> <span class="shortcut">Multiple select</span><br>
<span class="key">Esc</span> <span class="shortcut">Comment / uncomment text</span><br> <span class="key">Right click</span> <span class="shortcut">Options for selected</span><br>
<span class="key">Tab</span> <span class="shortcut">Insert tab / indent selected text</span><br><br> <span class="key">Delete</span> <span class="shortcut">Delete selected</span><br><br><br>
<h2>Anywhere</h2> <h2>Within document</h2>
<span class="key">CTRL <span class="plus">+</span> &rarr;</span> <span class="shortcut">Next tab</span><br> <span class="key">CTRL <span class="plus">+</span> &uarr;</span> <span class="shortcut">Move line up</span><br>
<span class="key">CTRL <span class="plus">+</span> &larr;</span> <span class="shortcut">Previous tab</span><br> <span class="key">CTRL <span class="plus">+</span> &darr;</span> <span class="shortcut">Move line down</span><br>
<span class="key">CTRL <span class="plus">+</span> +</span> <span class="shortcut">New tab</span><br> <span class="key">CTRL <span class="plus">+</span> I</span> <span class="shortcut">Search selected text</span><br>
<span class="key">CTRL <span class="plus">+</span> -</span> <span class="shortcut">Close current tab</span><br> <span class="key">Esc</span> <span class="shortcut">Comment / uncomment text</span><br>
<span class="key">CTRL <span class="plus">+</span> F</span> <span class="shortcut">Find</span><br> <span class="key">Tab</span> <span class="shortcut">Insert tab / indent selected text</span><br>
<span class="key">CTRL <span class="plus">+</span> G</span> <span class="shortcut">Go to line</span><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> d</span> <span class="shortcut">Wrap selected in &lt;div&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> S</span> <span class="shortcut">Save</span><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> s</span> <span class="shortcut">Wrap selected in &lt;span&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Shift <span class="plus">+</span> S</span> <span class="shortcut">Save as...</span><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> p</span> <span class="shortcut">Wrap selected in &lt;p&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Enter</span> <span class="shortcut">View webpage</span><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> a</span> <span class="shortcut">Wrap selected in &lt;a&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> S <span class="plus">+</span> Enter</span> <span class="shortcut">Save & create sticky tab</span><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> b</span> <span class="shortcut">Wrap selected in &lt;b&gt;</span><br>
<span class="key">Esc</span> <span class="shortcut">Cancel tasks</span><br><br> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> i</span> <span class="shortcut">Wrap selected in &lt;i&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> g</span> <span class="shortcut">Wrap selected in &lt;strong&gt;</span><br>
<h2>Logo</h2> <span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> e</span> <span class="shortcut">Wrap selected in &lt;em&gt;</span><br>
<span class="key">Left click</span> <span class="shortcut">Help</span><br> </div>
<span class="key">Right click</span> <span class="shortcut">Settings</span><br>
<div style="display: inline-block; width: 365px">
</body> <h2>Anywhere</h2>
<span class="key">CTRL <span class="plus">+</span> &rarr;</span> <span class="shortcut">Next tab</span><br>
<span class="key">CTRL <span class="plus">+</span> &larr;</span> <span class="shortcut">Previous tab</span><br>
<span class="key">CTRL <span class="plus">+</span> +</span> <span class="shortcut">New tab</span><br>
<span class="key">CTRL <span class="plus">+</span> -</span> <span class="shortcut">Close current tab</span><br>
<span class="key">CTRL <span class="plus">+</span> F</span> <span class="shortcut">Find</span><br>
<span class="key">CTRL <span class="plus">+</span> G</span> <span class="shortcut">Go to line</span><br>
<span class="key">CTRL <span class="plus">+</span> S</span> <span class="shortcut">Save</span><br>
<span class="key">CTRL <span class="plus">+</span> Shift <span class="plus">+</span> S</span> <span class="shortcut">Save as...</span><br>
<span class="key">CTRL <span class="plus">+</span> Enter</span> <span class="shortcut">View webpage</span><br>
<span class="key">CTRL <span class="plus">+</span> S <span class="plus">+</span> Enter</span> <span class="shortcut">Save & create sticky tab</span><br>
<span class="key">Esc</span> <span class="shortcut">Cancel tasks</span><br><br><br>
<h2>On logo</b><h2>
<span class="key">Left click</span> <span class="shortcut">Help</span><br>
<span class="key">Right click</span> <span class="shortcut">Settings</span><br>
</div>
</body>
</html> </html>

View File

@@ -1,146 +1,158 @@
/* First, reset everything to a standard */ /* First, reset everything to a standard */
html, body, div, span, applet, object, iframe, html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code, a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp, del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, small, strike, strong, sub, sup, tt, var,
b, u, i, center, b, u, i, center,
dl, dt, dd, ol, ul, li, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td { table, caption, tbody, tfoot, thead, tr, th, td {
font-family: arial, verdana, helvetica, sans-serif; font-family: arial, verdana, helvetica, sans-serif;
border: 0; border: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
outline: 0; outline: 0;
font-size: 12px; font-size: 12px;
vertical-align: top; vertical-align: top;
} }
body {overflow: hidden; body {overflow: hidden;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
user-select: none; user-select: none;
background-color: #222; background-color: #222;
} }
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
h2 {font-size: 18px; font-weight: normal; color: #fff} h2 {font-size: 18px; font-weight: normal; color: #fff}
.blackMask {position: fixed; display: table; width: 100%; height: 100%; top: 0; left: 0; visibility: hidden; background-color: rgba(0,0,0,0.8); text-align: center; z-index: 100} .blackMask {position: fixed; display: table; width: 100%; height: 100%; top: 0; left: 0; visibility: hidden; background-color: rgba(0,0,0,0.8); text-align: center; z-index: 100}
.blackMask .popupVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center} .blackMask .popupVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center}
.popupVCenter .popup {#position: relative; #top: -50%; text-align: center; color: #fff; font-size: 10px} .popupVCenter .popup {#position: relative; #top: -50%; text-align: center; color: #fff; font-size: 10px}
.whiteGlow {box-shadow: 0 0 8px 2px rgba(255,255,255,0.6)} .whiteGlow {box-shadow: 0 0 8px 2px rgba(255,255,255,0.6)}
.circleOutside {background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 35px #2187e7; .circleOutside {background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 35px #2187e7;
width:50px; height:50px; margin:0 auto; -moz-animation:spin .5s infinite linear; -webkit-animation:spin .5s infinite linear; width:50px; height:50px; margin:0 auto; -moz-animation:spin .5s infinite linear; -webkit-animation:spin .5s infinite linear;
} }
.circleInside {background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 15px #2187e7; .circleInside {background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 15px #2187e7;
width:30px; height:30px; margin:0 auto; position:relative; top:-50px; -moz-animation:spinoff .5s infinite linear; -webkit-animation:spinoff .5s infinite linear; width:30px; height:30px; margin:0 auto; position:relative; top:-50px; -moz-animation:spinoff .5s infinite linear; -webkit-animation:spinoff .5s infinite linear;
} }
@-moz-keyframes spin { @-moz-keyframes spin {
0% {-moz-transform:rotate(0deg)} 0% {-moz-transform:rotate(0deg)}
100% {-moz-transform:rotate(360deg)} 100% {-moz-transform:rotate(360deg)}
} }
@-moz-keyframes spinoff { @-moz-keyframes spinoff {
0% {-moz-transform:rotate(0deg)} 0% {-moz-transform:rotate(0deg)}
100% {-moz-transform:rotate(-360deg)} 100% {-moz-transform:rotate(-360deg)}
} }
@-webkit-keyframes spin { @-webkit-keyframes spin {
0% {-webkit-transform:rotate(0deg)} 0% {-webkit-transform:rotate(0deg)}
100% {-webkit-transform:rotate(360deg)} 100% {-webkit-transform:rotate(360deg)}
} }
@-webkit-keyframes spinoff { @-webkit-keyframes spinoff {
0% {-webkit-transform:rotate(0deg)} 0% {-webkit-transform:rotate(0deg)}
100% {-webkit-transform:rotate(-360deg)} 100% {-webkit-transform:rotate(-360deg)}
} }
.progressBar {position:absolute; top: 0; left: 0; width:100%; height:1px; margin:2px 0; background:#2187e7; box-shadow:0 0 10px 1px rgba(0,198,255,0.7)} .progressBar {position:absolute; top: 0; left: 0; width:100%; height:1px; margin:2px 0; background:#2187e7; box-shadow:0 0 10px 1px rgba(0,198,255,0.7)}
@-moz-keyframes fullexpand { @-moz-keyframes fullexpand {
0% {width:0} 0% {width:0}
100%{width:100%} 100%{width:100%}
} }
@-webkit-keyframes fullexpand { @-webkit-keyframes fullexpand {
0% {width:0} 0% {width:0}
100%{width:100%} 100%{width:100%}
} }
.header {position: absolute; display: inline-block; top: 0; left: 0; width: 100%; height: 40px; background-color: #fff; text-align: right; z-index: 2} .header {position: absolute; display: inline-block; top: 0; left: 0; width: 100%; height: 40px; background-color: #fff; text-align: right; z-index: 2}
.header .plugins {position: absolute; display: inline-block; left: 15px; top: 3px} .header .plugins {position: absolute; display: inline-block; left: 15px; top: 3px}
.header .plugins img {position: relative; display: inline-block; margin-right: 15px} .header .plugins img {position: relative; display: inline-block; margin-right: 15px}
.header .screenModeIcon {position: absolute; top: 5px; right: 178px; cursor: pointer} .header .screenModeIcon {position: absolute; top: 5px; right: 178px; cursor: pointer}
.header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbb} .header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbb}
.header .logo {position: relative; margin: 5px 10px 0 5px; cursor: pointer} .header .version a {font-size: 10px; color: #bbb; text-decoration: none}
.header .logo {position: relative; margin: 5px 10px 0 5px; cursor: pointer}
.files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; background-image: url('../images/files-arrow.png'); background-repeat: no-repeat; background-position: 100% 50%; overflow: hidden; z-index: 1;
box-shadow: 0 50px 10px 4px rgba(0,0,0,0.4); .files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; background-image: url('../images/files-arrow.png'); background-repeat: no-repeat; background-position: 100% 50%; overflow: hidden; z-index: 1;
} box-shadow: 0 50px 10px 4px rgba(0,0,0,0.4);
.files .account {display: inline-block; height: 50px; width: 250px; margin-top: 40px; background-color: #888} }
.files .accountOptions {position: relative; height: 32px; width: 100%; margin-left: 15px; margin-top: 8px} .files .account {display: inline-block; height: 50px; width: 250px; margin-top: 40px; background-color: #888}
.files .accountOptions div {display: inline-block; background: url('../images/file-manager-icons.png') 0 0 no-repeat; cursor: pointer} .files .accountOptions {position: relative; height: 32px; width: 100%; margin-left: 15px; margin-top: 8px}
.files .accountOptions .save {width: 30px; height: 32px; opacity: 0.3} .files .accountOptions div {display: inline-block; background: url('../images/file-manager-icons.png') 0 0 no-repeat; cursor: pointer}
.files .accountOptions .open {width: 25px; height: 32px; background-position: -32px -3px; margin: 3px 0 0 7px; opacity: 0.3} .files .accountOptions .save {width: 30px; height: 32px; opacity: 0.3}
.files .accountOptions .newFile {width: 15px; height: 16px; background-position: -64px 0; margin: 8px 0 0 10px; opacity: 0.3} .files .accountOptions .open {width: 25px; height: 32px; background-position: -32px -3px; margin: 3px 0 0 7px; opacity: 0.3}
.files .accountOptions .newFolder {width: 20px; height: 16px; background-position: -80px 0; margin: 8px 0 0 5px; opacity: 0.3} .files .accountOptions .newFile {width: 15px; height: 16px; background-position: -64px 0; margin: 8px 0 0 10px; opacity: 0.3}
.files .accountOptions .delete {width: 16px; height: 16px; background-position: -100px 0; margin: 8px 0 0 5px; opacity: 0.3} .files .accountOptions .newFolder {width: 20px; height: 16px; background-position: -80px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files .accountOptions .rename {width: 16px; height: 16px; background-position: -116px 0; margin: 8px 0 0 5px; opacity: 0.3} .files .accountOptions .delete {width: 16px; height: 16px; background-position: -100px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files .accountOptions .view {width: 16px; height: 16px; background-position: -132px 0; margin: 8px 0 0 5px; opacity: 0.3} .files .accountOptions .rename {width: 16px; height: 16px; background-position: -116px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files .accountOptions .lock {position: relative; margin-left: 208px; margin-top: -27px; width: 12px; height: 16px; background-position: -64px -16px; z-index: 1} .files .accountOptions .view {width: 16px; height: 16px; background-position: -132px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files input:focus, .findReplace input:focus, .findReplace select:focus, .accountPassword:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)} .files .accountOptions .lock {position: relative; margin-left: 208px; margin-top: -27px; width: 12px; height: 16px; background-position: -64px -16px; z-index: 1}
.files .button {position: absolute; border: 0; background: #444; color: #eee; height:20px; margin-top: 16px; margin-left: 5px; font-size: 11px; cursor: pointer} .files input:focus, .findReplace input:focus, .findReplace select:focus, .accountPassword:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)}
.files .button:hover {background-color: #222; color: #eee} .files .button {position: absolute; border: 0; background: #444; color: #eee; height:20px; margin-top: 16px; margin-left: 5px; font-size: 11px; cursor: pointer}
.files .frame {display: inline-block; width: 250px} .files .button:hover {background-color: #222; color: #eee}
.files .serverMessage {position: absolute; display: none; width: 450px; bottom: 0; margin-bottom: 30px; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 7px 12px; opacity: 0; .files .frame {display: inline-block; width: 250px}
-webkit-transition: opacity 0.2s; .files .serverMessage {position: absolute; display: none; width: 450px; bottom: 0; margin-bottom: 30px; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 7px 12px; opacity: 0;
-moz-transition: opacity 0.2s; -webkit-transition: opacity 0.2s;
transition: opacity 0.2s; -moz-transition: opacity 0.2s;
} transition: opacity 0.2s;
.files .serverMessage b {font-size: 10px} }
.files .serverMessage b {font-size: 10px}
.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 {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px}
.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; .editor .tabsBar {display: inline-block; height: 22px; width: 2400px; margin-top: 40px; padding-left: 41px; background: #ddd}
-webkit-transition: all 0.15s; .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}
-moz-transition: all 0.15s; .tabsBar .tabSlide {
transition: all 0.15s; -webkit-transition: left 0.15s ease-in-out;
} -moz-transition: left 0.15s ease-in-out;
.tabsBar .tab .closeTab {margin: 1px 0 0 5px; border-radius: 6px} transition: left 0.15s ease-in-out;
.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;} }
.editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #141414} .tabsBar .tabDrag {
.findBar .findReplace {position: absolute; z-index: 1} -webkit-transition: left 0s ease-in-out;
.findReplace select {position: relative; font-size: 10px; margin: 8px 2px 0 2px; top: -2px;} -moz-transition: left 0s ease-in-out;
.findReplace .findText {display: inline-block; height: 21px; font-size: 10px; margin: 8px 2px 0 2px; margin-left: 43px} transition: left 0s ease-in-out;
.findReplace .find {position: relative; width: 120px; height: 16px; border: 0; top: -3px; font-size: 10px; padding-left: 5px; margin-right: 3px} }
.findReplace .replaceAction {margin: 0 2px 0 0; top: -2px} .tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 1px 0 0 5px; border-radius: 6px; cursor: pointer}
.findReplace .replaceText {height: 21px; font-size: 10px; margin: 8px 2px 0 2px} .tabsBar .tab .closeTab {position: absolute; right: 7px}
.findReplace .replace {position: relative; width: 120px; height: 16px; border: 0; top: -3px; font-size: 10px; padding-left: 5px} .tabsBar .alphaTabs {position: absolute; margin: 6px 0 0 -17px; background: #bbb; border-radius: 6px; cursor: pointer}
.findReplace .targetText {height: 21px; font-size: 10px; margin: 8px 2px 0 2px} .tabsBar .alphaTabs:hover {background: #000}
.findReplace .submit {position: relative; top: -2px; height: 17px; border: 0; background-color: #444; color: #eee; font-size: 10px; margin-left: 2px; cursor: pointer} .tabsBar .closeAllTabs {position: absolute; margin: 6px 0 0 -33px; background: #bbb}
.findReplace .submit:hover {background-color: #2187e7; color: #eee} .tabsBar .closeAllTabs:hover {background: #000}
.findReplace .results {position: relative; display: inline-block; width: 200px; height: 20px; font-size: 10px; margin: 8px 0 0 20px} .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}
.findBar .codeAssist {position: fixed; display: inline-block; width: 100px; right: 74px; top: 70px; height: 21px; font-size: 10px; z-index: 1} .editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #141414}
.findBar .codeAssist input {margin-top: -1px} .findBar .findReplace {position: absolute; z-index: 1}
.findBar .goLine {position: fixed; display: inline-block; width: 100px; right: -10px; top: 70px; height: 21px; font-size: 10px; z-index: 1} .findReplace select {position: relative; font-size: 10px; margin: 8px 2px 0 2px; top: -2px;}
.goLine .goToLine {width: 25px; height: 16px; border: 0; font-size: 10px; margin: -3px 0 0 3px} .findReplace .findText {display: inline-block; height: 21px; font-size: 10px; margin: 8px 2px 0 2px; margin-left: 43px}
.goLine .goToLine:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)} .findReplace .find {position: relative; width: 120px; height: 16px; border: 0; top: -3px; font-size: 10px; padding-left: 5px; margin-right: 3px}
.editor .code {position: relative; display: inline-block; top: 28px; width: 600px; height: 600px; visibility: hidden} .findReplace .replaceAction {margin: 0 2px 0 0; top: -2px}
.findReplace .replaceText {height: 21px; font-size: 10px; margin: 8px 2px 0 2px}
.footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2} .findReplace .replace {position: relative; width: 120px; height: 16px; border: 0; top: -3px; font-size: 10px; padding-left: 5px}
.footer .nesting {display: inline-block; padding: 5px 8px; margin: 4px 0 0 15px; font-weight: bold; font-size: 10px; color: #fff; background-color: #0b0} .findReplace .targetText {height: 21px; font-size: 10px; margin: 8px 2px 0 2px}
.footer .nestLoc {position: absolute; display: inline-block; width: 120px; padding: 5px 0 0 8px; margin-top: 2px; left: 112px; font-weight: bold; font-size: 12px; color: #fff; text-align: right} .findReplace .submit {position: relative; top: -2px; height: 17px; border: 0; background-color: #444; color: #eee; font-size: 10px; margin-left: 2px; cursor: pointer}
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 255px; font-size: 12px; color: #fff; text-align: right} .findReplace .submit:hover {background-color: #2187e7; color: #eee}
.footer .charDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 100%; font-weight: bold; font-size: 12px; color: #fff; text-align: right; width: 200px; text-align: right; margin-left: -220px} .findReplace .results {position: relative; display: inline-block; width: 200px; height: 20px; font-size: 10px; margin: 8px 0 0 20px}
.findBar .codeAssist {position: fixed; display: inline-block; width: 100px; right: 74px; top: 70px; height: 21px; font-size: 10px; z-index: 1}
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)} .findBar .codeAssist input {margin-top: -1px}
.findBar .goLine {position: fixed; display: inline-block; width: 100px; right: -10px; top: 70px; height: 21px; font-size: 10px; z-index: 1}
.fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10} .goLine .goToLine {width: 25px; height: 16px; border: 0; font-size: 10px; margin: -3px 0 0 3px}
.fileMenu a {display: block; padding: 2px 5px; background-color: #333; color: #eee; text-decoration: none} .goLine .goToLine:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)}
.fileMenu a:hover {background-color: #666} .editor .code {position: relative; display: inline-block; top: 28px; width: 600px; height: 600px; visibility: hidden}
.screenContainer {position: absolute; display: table; width: 100%; height: 100%; top: 0; left: 0; text-align: center} .footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2}
.screenContainer .screenVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center} .footer .nesting {display: inline-block; padding: 5px 8px; margin: 4px 0 0 15px; font-weight: bold; font-size: 10px; color: #fff; background-color: #0b0}
.screenVCenter .screenCenter {#position: relative; #top: -50%; text-align: center; display: inline} .footer .nestLoc {position: absolute; display: inline-block; width: 120px; padding: 5px 0 0 8px; margin-top: 2px; left: 112px; font-weight: bold; font-size: 12px; color: #fff; text-align: right}
.screenCenter .version {position: relative; display: block; margin: 5px 0 15px 0; font-size: 10px; color: #bbb} .footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 255px; font-size: 12px; color: #fff; text-align: right}
.screenCenter .accountPassword {border: 0; background-color: #333; color: #fff; height: 20px} .footer .charDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 100%; font-weight: bold; font-size: 12px; color: #fff; text-align: right; width: 200px; text-align: right; margin-left: -220px}
.screenCenter .button {border: 0; background: #444; color: #eee; height: 22px; cursor: pointer}
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
.fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10}
.fileMenu a {display: block; padding: 2px 5px; background-color: #333; color: #eee; text-decoration: none}
.fileMenu a:hover {background-color: #666}
.screenContainer {position: absolute; display: table; width: 100%; height: 100%; top: 0; left: 0; text-align: center}
.screenContainer .screenVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center}
.screenVCenter .screenCenter {#position: relative; #top: -50%; text-align: center; display: inline}
.screenCenter .version {position: relative; display: block; margin: 5px 0 15px 0; font-size: 10px; color: #bbb}
.screenCenter .accountPassword {border: 0; background-color: #333; color: #fff; height: 20px}
.screenCenter .button {border: 0; background: #444; color: #eee; height: 22px; cursor: pointer}
.screenCenter .button:hover {background: #2187e7; color: #eee} .screenCenter .button:hover {background: #2187e7; color: #eee}

View File

@@ -11,6 +11,7 @@ var ICEcoder = {
selectedTab: 0, // The tab that's currently selected selectedTab: 0, // The tab that's currently selected
changedContent: [], // Binary array to indicate which tabs have changed changedContent: [], // Binary array to indicate which tabs have changed
ctrlKeyDown: false, // Indicates if CTRL keydown ctrlKeyDown: false, // Indicates if CTRL keydown
altKeyDown: false, // Indicates if Alt keydown
shiftKeyDown: false, // Indicates if Shift keydown shiftKeyDown: false, // Indicates if Shift keydown
delKeyDown: false, // Indicates if DEL keydown delKeyDown: false, // Indicates if DEL keydown
canSwitchTabs: true, // Stops switching of tabs when trying to close canSwitchTabs: true, // Stops switching of tabs when trying to close
@@ -26,15 +27,13 @@ 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
tagNestExceptions: ["!DOCTYPE","meta","link","img","br","hr","input","script","?php","?","%"],
// Set our aliases // Set our aliases
initAliases: function() { initAliases: function() {
var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplay","charDisplay"]; var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplay","charDisplay"];
@@ -56,15 +55,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
@@ -217,12 +207,14 @@ var ICEcoder = {
}, },
// Switch the CodeMirror mode on demand // Switch the CodeMirror mode on demand
switchMode: function() { switchMode: function(mode) {
var cM, fileName; var cM, fileName;
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1]; fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
if (fileName) { if (mode) {
cM.setOption("mode",mode);
} else if (fileName) {
fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript") fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript")
: fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript") : fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript")
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby") : fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
@@ -356,41 +348,50 @@ var ICEcoder = {
top.ICEcoder.dontSelect = true; top.ICEcoder.dontSelect = true;
}, },
// Wrap our selected text/cursor with tags
tagWrapper: function(tag) {
var cM, tagStart, tagEnd, startLine, endLine;
cM = ICEcoder.getcMInstance();
tagStart = tag;
tagEnd = tag;
if (tag=='div') {
startLine = cM.getCursor('start').line;
endLine = cM.getCursor().line;
cM.operation(function() {
cM.replaceSelection("<div>\n"+cM.getSelection()+"\n</div>");
for (var i=startLine+1; i<=endLine+1; i++) {
cM.indentLine(i);
}
cM.indentLine(endLine+2,'prev');
cM.indentLine(endLine+2,'subtract');
});
} else {
if (tag=='a') {tagStart='a href=""';}
cM.replaceSelection("<"+tagStart+">"+cM.getSelection()+"</"+tagEnd+">");
}
if (tag=='a') {cM.setCursor({line:cM.getCursor('start').line,ch:cM.getCursor('start').ch+9})}
},
// ============== // ==============
// FILES // FILES
// ============== // ==============
// Setup the file manager // Open/close dirs on demand
fileManager: function() { openCloseDir: function(dir,load) {
ICEcoder.filesFrame = top.document.getElementById('filesFrame'); dir.onclick = function() {top.ICEcoder.openCloseDir(this,false)};
if (!ICEcoder.filesFrame.contentWindow.document.getElementsByTagName) {return;}; var node = dir.parentNode;
if (node.nextSibling) {node = node.nextSibling};
var aMenus = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("LI"); if (load) {
for (var i=0; i<aMenus.length; i++) { top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/get-branch.php?location="+dir.childNodes[1].id;
var mclass = aMenus[i].className; } else if (node && node.tagName=="UL") {
if (mclass.indexOf("pft-directory")>-1) { var d = node.style.display=="none";
var submenu=aMenus[i].childNodes; if (d) {
for (var j=0; j<submenu.length; j++) { top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/get-branch.php?location="+dir.childNodes[1].id;
if (submenu[j].tagName=="A") {
submenu[j].onclick = function() {
var node = this.parentNode.nextSibling.nextSibling;
if (node && node.tagName=="UL") {
var d = node.style.display=="none";
node.style.display = d ? "block" : "none";
this.parentNode.className=this.className = d ? "pft-directory dirOpen" : "pft-directory";
}
return false;
}
}
}
} }
node.style.display = d ? "block" : "none";
dir.parentNode.className=dir.className = d ? "pft-directory dirOpen" : "pft-directory";
} }
var ulElems = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("UL");
for (var i=2; i<ulElems.length; i++) {
ulElems[i].style.display = "none";
}
ulElems[0].childNodes[1].className = "pft-directory dirOpen";
ulElems[1].style.display = "block";
return false; return false;
}, },
@@ -552,7 +553,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,"/");
@@ -564,12 +565,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);
@@ -598,13 +601,31 @@ var ICEcoder = {
// Copy a file on demand // Copy a file on demand
copyFile: function(selFile) { copyFile: function(selFile) {
top.ICEcoder.copiedFile = selFile; top.ICEcoder.copiedFile = selFile;
top.document.getElementById('fmMenuPasteOption').style.display = "block";
top.ICEcoder.hideFileMenu(); top.ICEcoder.hideFileMenu();
}, },
// Paste a file on demand // Paste a file on demand
pasteFile: function(location) { pasteFile: function(location) {
top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFile+"&location="+location); if (top.ICEcoder.copiedFile) {
top.ICEcoder.serverMessage('<b>Pasting File</b><br>'+top.ICEcoder.copiedFile.toString().replace(/\|/g,"/").replace(/,/g,"\n")); top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFile+"&location="+location);
top.ICEcoder.serverMessage('<b>Pasting File</b><br>'+top.ICEcoder.copiedFile.toString().replace(/\|/g,"/").replace(/,/g,"\n"));
} else {
top.ICEcoder.message("Nothing to paste, copy a file/folder first!");
}
},
// Upload file(s) - select & submit
uploadFilesSelect: function(location) {
top.document.getElementById('uploadDir').value = location;
top.document.getElementById("fileInput").click();
},
uploadFilesSubmit: function(obj) {
if (top.document.getElementById('fileInput').value!="") {
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
document.getElementById('uploadFilesForm').submit();
event.preventDefault();
}
}, },
// Show menu on right clicking in file manager // Show menu on right clicking in file manager
@@ -633,13 +654,13 @@ var ICEcoder = {
document.getElementById('fileMenu').style.display='inline-block'; document.getElementById('fileMenu').style.display='inline-block';
}, },
// Continue to show the file manager // Hide the file manager
hideFileMenu: function() { hideFileMenu: function() {
document.getElementById('fileMenu').style.display='none'; document.getElementById('fileMenu').style.display='none';
}, },
// 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
@@ -659,7 +680,7 @@ var ICEcoder = {
innerLI = '<a nohref title="'+location+"/"+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+"|"+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+"|"+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+"|"+file+'_perms">'+perms+'</span></a>'; innerLI = '<a nohref title="'+location+"/"+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+"|"+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+"|"+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+"|"+file+'_perms">'+perms+'</span></a>';
// If we don't have at least 3 DOM items in here, it's an empty folder // If we don't have at least 3 DOM items in here, it's an empty folder
if(!locNest.childNodes.length<3) { if(locNest.childNodes.length<3) {
// We now need to begin a new UL list // We now need to begin a new UL list
newUL = document.createElement("ul"); newUL = document.createElement("ul");
locNest = targetElem.parentNode.parentNode; locNest = targetElem.parentNode.parentNode;
@@ -701,7 +722,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;
} }
} }
@@ -709,15 +730,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";
} }
@@ -733,8 +755,8 @@ var ICEcoder = {
// Deleting files // Deleting files
if (action=="delete") { if (action=="delete") {
// Simply get our target and make it dissapear // Simply get our target and make it dissapear
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")+"|"+file); targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")+"|"+file).parentNode.parentNode;
targetElem.parentNode.parentNode.style.display = "none"; targetElem.parentNode.removeChild(targetElem);
} }
}, },
@@ -808,8 +830,8 @@ var ICEcoder = {
results = top.document.getElementById('results'); results = top.document.getElementById('results');
// If we have something to find in currrent document // If we have something to find in currrent document
if (find.length>0 && document.findAndReplace.target.value=="this document") { cM = ICEcoder.getcMInstance();
cM = ICEcoder.getcMInstance(); if (cM && find.length>0 && document.findAndReplace.target.value=="this document") {
content = cM.getValue().toLowerCase(); content = cM.getValue().toLowerCase();
// Find & replace the next instance, or all? // Find & replace the next instance, or all?
@@ -1047,7 +1069,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);
} }
@@ -1086,13 +1108,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) {
@@ -1308,10 +1338,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();
}
} }
}, },
@@ -1325,7 +1357,13 @@ var ICEcoder = {
// Show the help screen // Show the help screen
helpScreen: function() { helpScreen: function() {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/help.php" class="whiteGlow" style="width: 400px; height: 500px"></iframe>'; top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 440px"></iframe>';
top.ICEcoder.showHide('show',top.document.getElementById('blackMask'));
},
// Show the ICEcoder manual, loaded remotely
showManual: function(version) {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="http://icecoder.net/manual?version='+version+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';
top.ICEcoder.showHide('show',top.document.getElementById('blackMask')); top.ICEcoder.showHide('show',top.document.getElementById('blackMask'));
}, },
@@ -1363,9 +1401,9 @@ var ICEcoder = {
top.document.getElementById('fileMenu').style.display='none'; top.document.getElementById('fileMenu').style.display='none';
} }
cMCSS = ICEcoder.content.contentWindow.document.styleSheets[2]; cMCSS = ICEcoder.content.contentWindow.document.styleSheets[3];
strCSS = cMCSS.rules ? 'rules' : 'cssRules'; strCSS = cMCSS.rules ? 'rules' : 'cssRules';
cMCSS[strCSS][4].style['content'] = visibleTabs ? '"\\21e5"' : '" "'; cMCSS[strCSS][5].style['content'] = visibleTabs ? '"\\21e5"' : '" "';
cMCSS[strCSS][2].style.cssText = "background: " + activeLineBG + " !important"; cMCSS[strCSS][2].style.cssText = "background: " + activeLineBG + " !important";
top.ICEcoder.lineWrapping = lineWrapping; top.ICEcoder.lineWrapping = lineWrapping;
@@ -1427,51 +1465,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'));
@@ -1479,6 +1472,11 @@ var ICEcoder = {
top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,"")); top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,""));
}, },
// Logout of ICEcoder
logout: function() {
window.location = window.location + "?logout";
},
// Show a message // Show a message
message: function(msg) { message: function(msg) {
alert(msg); alert(msg);
@@ -1494,6 +1492,15 @@ var ICEcoder = {
return prompt(question,defaultValue); return prompt(question,defaultValue);
}, },
// Show a data screen message
dataMessage: function(message) {
var dM;
dM = top.ICEcoder.content.contentWindow.document.getElementById('dataMessage');
dM.style.display = "block";
dM.innerHTML = message;
},
// ============== // ==============
// TABS // TABS
// ============== // ==============
@@ -1518,7 +1525,7 @@ var ICEcoder = {
cM.getWrapperElement().style.display = "block"; cM.getWrapperElement().style.display = "block";
// Focus on & refresh our selected instance // Focus on & refresh our selected instance
if (!noFocus) {cM.focus();} if (!noFocus) {setTimeout(function() {cM.focus();},4);}
cM.refresh(); cM.refresh();
// Highlight the selected tab // Highlight the selected tab
@@ -1567,11 +1574,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();
@@ -1610,21 +1617,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]") {
@@ -1639,7 +1645,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;
@@ -1657,9 +1663,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";
@@ -1691,7 +1694,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;
@@ -1699,18 +1704,173 @@ var ICEcoder = {
top.ICEcoder.setTabWidths(); top.ICEcoder.setTabWidths();
}, },
// Close all tabs
closeAllTabs: function() {
if (ICEcoder.ask("Close all tabs?")) {
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);
}, },
// ============== // ==============
@@ -1734,102 +1894,127 @@ var ICEcoder = {
top.ICEcoder.ctrlKeyDown = true; top.ICEcoder.ctrlKeyDown = true;
return false; return false;
// Alt key down
} else if(key==18) {
top.ICEcoder.altKeyDown = true;
return false;
// Shift key down // Shift key down
} else if(key==16) { } else if(key==16) {
top.ICEcoder.shiftKeyDown = true; top.ICEcoder.shiftKeyDown = true;
return false; return false;
};
// CTRL+F (Find) // Alt key down?
} else if(key==70 && top.ICEcoder.ctrlKeyDown==true) { if (top.ICEcoder.altKeyDown==true) {
top.document.getElementById('find').focus();
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+G (Go to line) // + CTRL + key (tag wrapper)
} else if(key==71 && top.ICEcoder.ctrlKeyDown==true) { if (ICEcoder.ctrlKeyDown==true && area == "content") {
top.document.getElementById('goToLineNo').focus(); if (key==68) {top.ICEcoder.tagWrapper('div'); return false;}
top.ICEcoder.ctrlKeyDown = false; else if (key==83) {top.ICEcoder.tagWrapper('span'); return false;}
return false; else if (key==80) {top.ICEcoder.tagWrapper('p'); return false;}
else if (key==65) {top.ICEcoder.tagWrapper('a'); return false;}
else if (key==66) {top.ICEcoder.tagWrapper('b'); return false;}
else if (key==73) {top.ICEcoder.tagWrapper('i'); return false;}
else if (key==71) {top.ICEcoder.tagWrapper('strong'); return false;}
else if (key==69) {top.ICEcoder.tagWrapper('em'); return false;}
else {return key;}
} else {return key;}
// CTRL+I (Get info)
} else if(key==73 && top.ICEcoder.ctrlKeyDown==true && area == "content") {
var searchPrefix = "";
if (top.ICEcoder.caretLocType!="Content") {
searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" ";
}
window.open("http://www.google.com/#output=search&q="+searchPrefix+top.ICEcoder.getcMInstance().getSelection());
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+right arrow (Next tab)
} else if(key==39 && top.ICEcoder.ctrlKeyDown==true && area!="content") {
top.ICEcoder.nextTab();
return false;
// CTRL+left arrow (Previous tab)
} else if(key==37 && top.ICEcoder.ctrlKeyDown==true && area!="content") {
top.ICEcoder.previousTab();
return false;
// CTRL+up arrow (Move line up)
} else if(key==38 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.moveLine('up');
return false;
// CTRL+down arrow (Move line down)
} else if(key==40 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.moveLine('down');
return false;
// CTRL+numeric plus (New tab)
} else if(key==107 && top.ICEcoder.ctrlKeyDown==true) {
top.ICEcoder.newTab();
return false;
// CTRL+numeric minus (Close tab)
} else if(key==109 && top.ICEcoder.ctrlKeyDown==true) {
top.ICEcoder.closeTab(top.ICEcoder.selectedTab);
return false;
// CTRL+S (Save), CTRL+Shift+S (Save As)
} else if(key==83 && top.ICEcoder.ctrlKeyDown==true) {
if(top.ICEcoder.shiftKeyDown==true) {
top.ICEcoder.saveFile('saveAs');
top.ICEcoder.shiftKeyDown = false;
} else {
top.ICEcoder.saveFile();
}
top.ICEcoder.stickyTabMaybe = true;
return false;
// CTRL+Enter (Open Webpage)
} else if(key==13 && top.ICEcoder.ctrlKeyDown==true && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") {
if (top.ICEcoder.stickyTabMaybe) {
top.ICEcoder.stickyTab = window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1],"stickyTab");
} else {
window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
}
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+Space (Show snippet)
} else if(key==32 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.addSnippet();
return false;
// ESC in content area (Comment/Uncomment line)
} else if(key==27 && area == "content") {
top.ICEcoder.lineCommentToggle();
return false;
// ESC not in content area (Cancel all actions)
} else if(key==27 && area != "content") {
top.ICEcoder.cancelAllActions();
return false;
// Any other key
} else { } else {
return key;
// CTRL+F (Find)
if(key==70 && top.ICEcoder.ctrlKeyDown==true) {
top.document.getElementById('find').focus();
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+G (Go to line)
} else if(key==71 && top.ICEcoder.ctrlKeyDown==true) {
top.document.getElementById('goToLineNo').focus();
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+I (Get info)
} else if(key==73 && top.ICEcoder.ctrlKeyDown==true && area == "content") {
var searchPrefix = "";
if (top.ICEcoder.caretLocType!="Content") {
searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" ";
}
window.open("http://www.google.com/#output=search&q="+searchPrefix+top.ICEcoder.getcMInstance().getSelection());
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+right arrow (Next tab)
} else if(key==39 && top.ICEcoder.ctrlKeyDown==true && area!="content") {
top.ICEcoder.nextTab();
return false;
// CTRL+left arrow (Previous tab)
} else if(key==37 && top.ICEcoder.ctrlKeyDown==true && area!="content") {
top.ICEcoder.previousTab();
return false;
// CTRL+up arrow (Move line up)
} else if(key==38 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.moveLine('up');
return false;
// CTRL+down arrow (Move line down)
} else if(key==40 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.moveLine('down');
return false;
// CTRL+numeric plus (New tab)
} else if(key==107 && top.ICEcoder.ctrlKeyDown==true) {
top.ICEcoder.newTab();
return false;
// CTRL+numeric minus (Close tab)
} else if(key==109 && top.ICEcoder.ctrlKeyDown==true) {
top.ICEcoder.closeTab(top.ICEcoder.selectedTab);
return false;
// CTRL+S (Save), CTRL+Shift+S (Save As)
} else if(key==83 && top.ICEcoder.ctrlKeyDown==true) {
if(top.ICEcoder.shiftKeyDown==true) {
top.ICEcoder.saveFile('saveAs');
top.ICEcoder.shiftKeyDown = false;
} else {
top.ICEcoder.saveFile();
}
top.ICEcoder.stickyTabMaybe = true;
return false;
// CTRL+Enter (Open Webpage)
} else if(key==13 && top.ICEcoder.ctrlKeyDown==true && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") {
if (top.ICEcoder.stickyTabMaybe) {
top.ICEcoder.stickyTab = window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1],"stickyTab");
} else {
window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
}
top.ICEcoder.ctrlKeyDown = false;
return false;
// CTRL+Space (Show snippet)
} else if(key==32 && top.ICEcoder.ctrlKeyDown==true && area=="content") {
top.ICEcoder.addSnippet();
return false;
// ESC in content area (Comment/Uncomment line)
} else if(key==27 && area == "content") {
top.ICEcoder.lineCommentToggle();
return false;
// ESC not in content area (Cancel all actions)
} else if(key==27 && area != "content") {
top.ICEcoder.cancelAllActions();
return false;
// Any other key
} else {
return key;
}
} }
}, },
@@ -1841,6 +2026,7 @@ var ICEcoder = {
if (key==17) {top.ICEcoder.ctrlKeyDown = false; top.ICEcoder.stickyTabMaybe = false} if (key==17) {top.ICEcoder.ctrlKeyDown = false; top.ICEcoder.stickyTabMaybe = false}
else if (key==16) {top.ICEcoder.shiftKeyDown = false} else if (key==16) {top.ICEcoder.shiftKeyDown = false}
else if (key==18) {top.ICEcoder.altKeyDown = false}
else if (key==46) {top.ICEcoder.delKeyDown = false} else if (key==46) {top.ICEcoder.delKeyDown = false}
}, },
@@ -1856,19 +2042,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});
});
} }
}, },
@@ -1903,16 +2082,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

@@ -1,217 +1,218 @@
<?php include("settings.php");?> <?php include("settings.php");?>
<?php <?php
if(isset($_GET['selectedFiles'])) { if(isset($_GET['selectedFiles'])) {
$selectedFiles=explode(":",strClean($_GET['selectedFiles'])); $selectedFiles=explode(":",strClean($_GET['selectedFiles']));
echo $selectedFiles[0].".....".$selectedFiles[1]; }
} ?>
?> <!DOCTYPE html>
<!DOCTYPE html>
<html>
<html> <head>
<head> <title>ICEcoder <?php echo $ICEcoder["versionNo"];?> multiple results screen</title>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> multiple results screen</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" type="text/css" href="multiple-results.css">
<link rel="stylesheet" type="text/css" href="multiple-results.css"> </head>
</head>
<body class="results" onLoad="top.document.getElementById('loadingMask').style.visibility = 'hidden'">
<body class="results" onLoad="top.document.getElementById('loadingMask').style.visibility = 'hidden'">
<h1 id="title"></h1>
<h1 id="title"></h1> <div class="resultsPane" id="resultsPane">
<div class="resultsPane" id="resultsPane"> <div id="results"></div>
<div id="results"></div> </div>
</div> <?php if (isset($_GET['replace'])) { ?>
<?php if (isset($_GET['replace'])) { ?> <div class="replaceAll" id="replaceAll" onClick="<?php
<div class="replaceAll" id="replaceAll" onClick="<?php if (isset($_GET['target']) && strpos($_GET['target'],"filenames")) {
if (isset($_GET['target']) && strpos($_GET['target'],"filenames")) { echo 'renameAll()';
echo 'renameAll()'; } else if (isset($_GET['target']) && strpos($_GET['target'],"files")) {
} else if (isset($_GET['target']) && strpos($_GET['target'],"files")) { echo 'replaceInFilesAll()';
echo 'replaceInFilesAll()'; } else {
} else { echo 'replaceAll()';
echo 'replaceAll()'; }
} ?>" style="opacity: 0.1"><?php echo isset($_GET['target']) && strpos($_GET['target'],"filenames") ? 'rename all' : 'replace all';?></div>
?>" style="opacity: 0.1"><?php echo isset($_GET['target']) && strpos($_GET['target'],"filenames") ? 'rename all' : 'replace all';?></div> <?php ;}; ?>
<?php ;}; ?>
<script>
<script> <?php if (!isset($_GET['replace'])) { ?>
<?php if (!isset($_GET['replace'])) { ?> document.getElementById('resultsPane').style.height = "380px";
document.getElementById('resultsPane').style.height = "380px"; <?php ;}; ?>
<?php ;}; ?> var resultsDisplay = "";
var resultsDisplay = ""; var foundArray = [];
var foundArray = []; foundInSelected = false;
foundInSelected = false; userTarget = top.document.findAndReplace.target.value;
userTarget = top.document.findAndReplace.target.value; findText = top.findAndReplace.find.value.toLowerCase();
findText = top.findAndReplace.find.value.toLowerCase(); <?php
<?php $findText = str_replace("ICEcoder:","",str_replace("&#39;","\'",$_GET['find']));
$findText = str_replace("ICEcoder:","",str_replace("&#39;","\'",$_GET['find'])); // Find in open docs?
// Find in open docs? if (!isset($_GET['target'])) {
if (!isset($_GET['target'])) { $targetName = "document";
$targetName = "document"; ?>
?> var startTab = top.ICEcoder.selectedTab;
var startTab = top.ICEcoder.selectedTab; var rExp = new RegExp(findText,"gi");
var rExp = new RegExp(findText,"gi"); for (var i=1;i<=top.ICEcoder.openFiles.length;i++) {
for (var i=1;i<=top.ICEcoder.openFiles.length;i++) { top.ICEcoder.switchTab(i);
top.ICEcoder.switchTab(i); var cM = top.ICEcoder.getcMInstance();
var cM = top.ICEcoder.getcMInstance(); var content = cM.getValue();
var content = cM.getValue(); if (content.match(rExp)) {
if (content.match(rExp)) { resultsDisplay += '<a href="javascript:gotoTab('+i+')">'+ top.ICEcoder.openFiles[i-1]+ '</a><br><div id="foundCount'+i+'">Found '+content.match(rExp).length+' times</div>';
resultsDisplay += '<a href="javascript:gotoTab('+i+')">'+ top.ICEcoder.openFiles[i-1]+ '</a><br><div id="foundCount'+i+'">Found '+content.match(rExp).length+' times</div>'; <?php if (isset($_GET['replace'])) { ?>
<?php if (isset($_GET['replace'])) { ?> resultsDisplay += '<div class="replace" id="replace" onClick="replaceSingle('+i+');this.style.display=\'none\'">replace</div>';
resultsDisplay += '<div class="replace" id="replace" onClick="replaceSingle('+i+');this.style.display=\'none\'">replace</div>'; <?php ;}; ?>
<?php ;}; ?> resultsDisplay += '<hr>';
resultsDisplay += '<hr>'; foundArray.push(i);
foundArray.push(i); }
} }
} if (startTab!=top.ICEcoder.selectedTab) {
if (startTab!=top.ICEcoder.selectedTab) { top.ICEcoder.switchTab(startTab);
top.ICEcoder.switchTab(startTab); }
} <?php
<?php // Find in files or filenames
// Find in files or filenames } else {
} else { if (strpos($_GET['target'],"filenames")>0) {
if (strpos($_GET['target'],"filenames")>0) { $targetName = "file/folder";
$targetName = "file/folder"; ?>
?> var spansArray = top.ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span');
var spansArray = top.ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span'); for (var i=0;i<spansArray.length;i++) {
for (var i=0;i<spansArray.length;i++) { foundInSelected = false;
foundInSelected = false; targetURL = spansArray[i].id.replace(/\|/g,"/").toLowerCase();
targetURL = spansArray[i].id.replace(/\|/g,"/").toLowerCase(); if ( targetURL.lastIndexOf(findText.toLowerCase()) > targetURL.lastIndexOf("/")
if ( targetURL.lastIndexOf(findText.toLowerCase()) > targetURL.lastIndexOf("/") && targetURL.indexOf(findText.toLowerCase())>-1 && targetURL.indexOf('_perms')>-1) {
&& targetURL.indexOf(findText.toLowerCase())>-1 && targetURL.indexOf('_perms')>-1) { if (userTarget.indexOf("selected")>-1) {
if (userTarget.indexOf("selected")>-1) { for (var j=0;j<top.ICEcoder.selectedFiles.length;j++) {
for (var j=0;j<top.ICEcoder.selectedFiles.length;j++) { if (
if ( targetURL.replace(/\//g,"|").indexOf(top.ICEcoder.selectedFiles[j].replace(/\//g,"|").replace(/_perms/g,""))==0
targetURL.replace(/\//g,"|").indexOf(top.ICEcoder.selectedFiles[j].replace(/\//g,"|").replace(/_perms/g,""))==0 && (
&& ( targetURL.replace(/\|/g,"/").replace(/_perms/g,"")==top.ICEcoder.selectedFiles[j].replace(/\|/g,"/").replace(/_perms/g,"")
targetURL.replace(/\|/g,"/").replace(/_perms/g,"")==top.ICEcoder.selectedFiles[j].replace(/\|/g,"/").replace(/_perms/g,"") ||
|| (targetURL.replace(/\|/g,"/").split("/").length > top.ICEcoder.selectedFiles[j].replace(/\|/g,"/").split("/").length && targetURL.charAt(top.ICEcoder.selectedFiles[j].length)=="/"))) {
(targetURL.replace(/\|/g,"/").split("/").length > top.ICEcoder.selectedFiles[j].replace(/\|/g,"/").split("/").length && targetURL.charAt(top.ICEcoder.selectedFiles[j].length)=="/"))) { foundInSelected = true;
foundInSelected = true; }
} }
} }
} if (userTarget.indexOf("all")>-1 || (userTarget.indexOf("selected")>-1 && foundInSelected)) {
if (userTarget.indexOf("all")>-1 || (userTarget.indexOf("selected")>-1 && foundInSelected)) { resultsDisplay += '<a href="javascript:top.ICEcoder.openFile(\'<?php echo $docRoot;?>'+targetURL.replace(/\|/g,"/").replace(/_perms/g,"")+'\');top.ICEcoder.showHide(\'hide\',top.document.getElementById(\'blackMask\'))">';
resultsDisplay += '<a href="javascript:top.ICEcoder.openFile(\'<?php echo $docRoot;?>'+targetURL.replace(/\|/g,"/").replace(/_perms/g,"")+'\');top.ICEcoder.showHide(\'hide\',top.document.getElementById(\'blackMask\'))">'; resultsDisplay += targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",strtolower($findText)); ?>/g,"<b>"+findText.toLowerCase()+"</b>");
resultsDisplay += targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",strtolower($findText)); ?>/g,"<b>"+findText.toLowerCase()+"</b>"); resultsDisplay += '</a><br>';
resultsDisplay += '</a><br>'; <?php if (!isset($_GET['replace'])) { ?>
<?php if (!isset($_GET['replace'])) { ?> resultsDisplay += '<div id="foundCount'+i+'">'+spansArray[i].innerHTML+'</div>';
resultsDisplay += '<div id="foundCount'+i+'">'+spansArray[i].innerHTML+'</div>'; <?php ;} else { ?>
<?php ;} else { ?> resultsDisplay += '<div id="foundCount'+i+'">'+spansArray[i].innerHTML+', rename to '+targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",strtolower($findText)); ?>/g,"<b><?php if(isset($_GET['replace'])) {echo strtolower(strClean($_GET['replace']));};?></b>")+'</div>';
resultsDisplay += '<div id="foundCount'+i+'">'+spansArray[i].innerHTML+', rename to '+targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",strtolower($findText)); ?>/g,"<b><?php if(isset($_GET['replace'])) {echo strtolower(strClean($_GET['replace']));};?></b>")+'</div>'; <?php
<?php ;};
;}; if (isset($_GET['replace'])) { ?>
if (isset($_GET['replace'])) { ?> resultsDisplay += '<div class="replace" id="replace" onClick="renameSingle('+i+');this.style.display=\'none\'">rename</div>';
resultsDisplay += '<div class="replace" id="replace" onClick="renameSingle('+i+');this.style.display=\'none\'">rename</div>'; <?php ;}; ?>
<?php ;}; ?> resultsDisplay += '<hr>';
resultsDisplay += '<hr>'; foundArray.push(i);
foundArray.push(i); }
} }
} }
} <?php
<?php } else {
} else { $targetName = "file";
$targetName = "file"; $r = 0;
$r = 0; function phpGrep($q, $path, $base) {
function phpGrep($q, $path, $base) { $fp = opendir($path);
$fp = opendir($path); global $r, $ICEcoder, $serverType, $selectedFiles;
global $r, $ICEcoder, $serverType, $selectedFiles; if (!isset($ret)) {$ret="";};
if (!isset($ret)) {$ret="";}; $slash = $serverType == "Windows" ? "\\" : "/";
$slash = $serverType == "Windows" ? "\\" : "/"; while($f = readdir($fp)) {
while($f = readdir($fp)) { if(preg_match("#^\.+$#", $f)) continue;
if(preg_match("#^\.+$#", $f)) continue; $fullPath = $path.$slash.$f;
$fullPath = $path.$slash.$f; if(is_dir($fullPath)) {
if(is_dir($fullPath)) { $ret .= phpGrep($q, $fullPath, $base);
$ret .= phpGrep($q, $fullPath, $base); } else if(stristr(file_get_contents($fullPath), $q)) {
} else if(stristr(file_get_contents($fullPath), $q)) { $bFile = false;
$bFile = false; $foundInSelFile = false;
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) { for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
if (strpos($f,$ICEcoder['bannedFiles'][$i])>0) {$bFile = true;}; if (strpos($f,$ICEcoder['bannedFiles'][$i])!==false) {$bFile = true;};
} }
$findPath = str_replace($base,"",$fullPath); $findPath = str_replace($base,"",$fullPath);
for ($i=0;$i<count($selectedFiles);$i++) { for ($i=0;$i<count($selectedFiles);$i++) {
if (strpos($findPath,str_replace("|","/",$selectedFiles[$i]))!==0) { $stringExtra = $selectedFiles[$i] != "|" ? "/" : "";
$bFile = true; if (strpos($findPath.$stringExtra,str_replace("|","/",$selectedFiles[$i]).$stringExtra)===0) {
} $foundInSelFile = true;
} }
if (!$bFile) { }
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">"; if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) {
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>"; $ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
if (isset($_GET['replace'])) { $ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>";
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>"; if (isset($_GET['replace'])) {
}; $ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>".PHP_EOL;
$ret .= '<hr>'; };
echo 'foundArray.push("'.$fullPath.'");'; $ret .= '<hr>';
$r++; echo 'foundArray.push("'.$fullPath.'");'.PHP_EOL;
} $r++;
} }
} }
return $ret; }
} return $ret;
}
$results = phpGrep($findText, $docRoot.$iceRoot, $docRoot.$iceRoot);
echo 'resultsDisplay += "'.$results.'";'; $results = phpGrep($findText, $docRoot.$iceRoot, $docRoot.$iceRoot);
?> echo 'resultsDisplay += "'.$results.'";';
<?php ?>
} <?php
} }
?> }
showHide = foundArray.length==0 ? "hide" : "show"; ?>
top.ICEcoder.showHide(showHide,top.document.getElementById('blackMask')); showHide = foundArray.length==0 ? "hide" : "show";
if (foundArray.length==0) {top.ICEcoder.message('No matches found')}; top.ICEcoder.showHide(showHide,top.document.getElementById('blackMask'));
<?php if (isset($_GET['replace'])) { ?> if (foundArray.length==0) {top.ICEcoder.message('No matches found')};
if (foundArray.length!=0) {document.getElementById('replaceAll').style.opacity = 1}; <?php if (isset($_GET['replace'])) { ?>
<?php ;}; ?> if (foundArray.length!=0) {document.getElementById('replaceAll').style.opacity = 1};
plural = foundArray.length >= 2 ? "s" : ""; <?php ;}; ?>
targetName = "<?php echo $targetName;?>"; plural = foundArray.length >= 2 ? "s" : "";
selectedText = foundInSelected ? "selected " : ""; targetName = "<?php echo $targetName;?>";
document.getElementById('title').innerHTML = findText.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+" found in "+foundArray.length+" "+selectedText+targetName+plural; selectedText = foundInSelected ? "selected " : "";
document.getElementById('results').innerHTML = resultsDisplay; document.getElementById('title').innerHTML = findText.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+" found in "+foundArray.length+" "+selectedText+targetName+plural;
document.getElementById('results').innerHTML = resultsDisplay;
var gotoTab = function(tab) {
top.ICEcoder.switchTab(tab); var gotoTab = function(tab) {
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); top.ICEcoder.switchTab(tab);
} top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
}
var replaceSingle = function(tab) {
top.ICEcoder.switchTab(tab); var replaceSingle = function(tab) {
cM = top.ICEcoder.getcMInstance(); top.ICEcoder.switchTab(tab);
content = cM.getValue(); cM = top.ICEcoder.getcMInstance();
cM.setValue(cM.getValue().replace(rExp,top.document.getElementById('replace').value)); content = cM.getValue();
document.getElementById('foundCount'+tab).innerHTML = document.getElementById('foundCount'+tab).innerHTML.replace('Found','Replaced'); cM.setValue(cM.getValue().replace(rExp,top.document.getElementById('replace').value));
} document.getElementById('foundCount'+tab).innerHTML = document.getElementById('foundCount'+tab).innerHTML.replace('Found','Replaced');
}
var replaceAll = function() {
for (var i=0;i<=foundArray.length-1;i++) { var replaceAll = function() {
replaceSingle(foundArray[i]); for (var i=0;i<=foundArray.length-1;i++) {
} replaceSingle(foundArray[i]);
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); }
} top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
}
var replaceInFileSingle = function(fileRef) {
top.ICEcoder.replaceInFile(fileRef,findText,'<?php if(isset($_GET['replace'])) {echo strClean($_GET['replace']);}; ?>'); var replaceInFileSingle = function(fileRef) {
} top.ICEcoder.replaceInFile(fileRef,findText,'<?php if(isset($_GET['replace'])) {echo strClean($_GET['replace']);}; ?>');
}
var replaceInFilesAll = function() {
for (var i=0;i<=foundArray.length-1;i++) { var replaceInFilesAll = function() {
replaceInFileSingle(foundArray[i]); for (var i=0;i<=foundArray.length-1;i++) {
} replaceInFileSingle(foundArray[i]);
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); }
} top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
}
var renameSingle = function(arrayRef) {
fileRef = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,""); var renameSingle = function(arrayRef) {
newName = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,"").replace(find,"<?php if(isset($_GET['replace'])) {echo strClean($_GET['replace']);}; ?>"); fileRef = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,"");
top.ICEcoder.renameFile(fileRef,newName); newName = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,"").replace(find,"<?php if(isset($_GET['replace'])) {echo strClean($_GET['replace']);}; ?>");
} top.ICEcoder.renameFile(fileRef,newName);
}
var renameAll = function() {
for (var i=0;i<=foundArray.length-1;i++) { var renameAll = function() {
renameSingle(foundArray[i]); for (var i=0;i<=foundArray.length-1;i++) {
} renameSingle(foundArray[i]);
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); }
} top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
</script> }
</script>
</body>
</body>
</html> </html>

View File

@@ -1,227 +1,227 @@
<?php include("settings.php");?> <?php include("settings.php");?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> settings screen</title> <title>ICEcoder <?php echo $ICEcoder["versionNo"];?> settings screen</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" type="text/css" href="settings-screen.css"> <link rel="stylesheet" type="text/css" href="settings-screen.css">
<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css"> <link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script> <script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
<style type="text/css"> <style type="text/css">
.CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; font-family: monospace; width: 420px} .CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; font-family: monospace; width: 420px}
.CodeMirror-scroll {height: 240px; overflow: hidden} .CodeMirror-scroll {height: 240px; overflow: hidden}
/* Make sure this next one remains the 3rd item, updated with JS */ /* Make sure this next one remains the 3rd item, updated with JS */
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\21e5';};?>";} .cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\21e5';};?>";}
</style> </style>
<link rel="stylesheet" href="editor.css"> <link rel="stylesheet" href="editor.css">
<?php <?php
$themeArray = array(); $themeArray = array();
$handle = opendir('../'.$ICEcoder["codeMirrorDir"].'/theme/'); $handle = opendir('../'.$ICEcoder["codeMirrorDir"].'/theme/');
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
if ($file !== "." && $file != "..") { if ($file !== "." && $file != "..") {
array_push($themeArray,basename($file,".css")); array_push($themeArray,basename($file,".css"));
} }
} }
sort($themeArray); sort($themeArray);
for ($i=0;$i<count($themeArray);$i++) { for ($i=0;$i<count($themeArray);$i++) {
echo '<link rel="stylesheet" href="../'.$ICEcoder["codeMirrorDir"].'/theme/'.$themeArray[$i].'.css">'.PHP_EOL; echo '<link rel="stylesheet" href="../'.$ICEcoder["codeMirrorDir"].'/theme/'.$themeArray[$i].'.css">'.PHP_EOL;
} }
?> ?>
</head> </head>
<body class="settings"> <body class="settings">
<div class="infoPane"> <div class="infoPane">
<img src="../images/ice-coder.png" class="logo"> <img src="../images/ice-coder.png" class="logo">
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div> <div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<p> <p>
git:<br> git:<br>
<a href="http://github.com/mattpass/ICEcoder" target="_blank">http://github.com/mattpass/ICEcoder</a> <a href="http://github.com/mattpass/ICEcoder" target="_blank">http://github.com/mattpass/ICEcoder</a>
<br><br> <br><br>
codemirror dir:<br> codemirror dir:<br>
<?php echo $ICEcoder["codeMirrorDir"]; ?> <?php echo $ICEcoder["codeMirrorDir"]; ?>
<br><br> <br><br>
codemirror version:<br> codemirror version:<br>
<script> <script>
document.write(CodeMirror.version); document.write(CodeMirror.version);
</script> </script>
<br><br> <br><br>
file manager root:<br> file manager root:<br>
<?php echo $ICEcoder['root'];?> <?php echo $ICEcoder['root'];?>
<br><br><br><br> <br><br><br><br>
<div style="font-size: 10px; line-height: 12px">ICE coder by Matt Pass (<a href="http://www.twitter.com/mattpass" style="font-size: 10px" target="_blank">@mattpass</a>)<br><br> <div style="font-size: 10px; line-height: 12px">ICE coder by Matt Pass (<a href="http://www.twitter.com/mattpass" style="font-size: 10px" target="_blank">@mattpass</a>)<br><br>
Free to use it for your own purposes, commercial or not, just let me know of any cool uses or customisations. :)<br><br> Free to use it for your own purposes, commercial or not, just let me know of any cool uses or customisations. :)<br><br>
No warranty or liability accepted for anything, all responsibility of use is your own.<br><br> No warranty or liability accepted for anything, all responsibility of use is your own.<br><br>
Thanks go to the following people who have inspired me to create this and in the odd case, provided feedback or code:<br> Thanks go to the following people who have inspired me to create this and in the odd case, provided feedback or code:<br>
<?php <?php
$peopleArray = array("marijnjh", "maettig", "wimtibackx", "jakubvrana", "_higg_", "yandle", "davidwalshblog", "kuvos", "mathias", "rem"); $peopleArray = array("marijnjh", "maettig", "wimtibackx", "jakubvrana", "_higg_", "yandle", "davidwalshblog", "kuvos", "mathias", "rem");
for ($i=0;$i<count($peopleArray)-1;$i++) { for ($i=0;$i<count($peopleArray)-1;$i++) {
echo '<a href="http://www.twitter.com/'.$peopleArray[$i].'" style="font-size: 10px" target="_blank">@'.$peopleArray[$i].'</a>'; echo '<a href="http://www.twitter.com/'.$peopleArray[$i].'" style="font-size: 10px" target="_blank">@'.$peopleArray[$i].'</a>';
if ($i<count($peopleArray)-2) { if ($i<count($peopleArray)-2) {
echo ", "; echo ", ";
} }
} }
?> ?>
</div> </div>
</p> </p>
</div> </div>
<form name="settings" action="settings.php" method="POST"> <form name="settings" action="settings.php" method="POST">
<div class="settingsColumn1"> <div class="settingsColumn1">
<h1>settings</h1> <h1>settings</h1>
<h2>functionality</h2> <h2>functionality</h2>
<input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($ICEcoder["tabsIndent"]) {echo ' checked';};?>> tab indents selection<br> <input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($ICEcoder["tabsIndent"]) {echo ' checked';};?>> tab indents selection<br>
<input type="checkbox" onclick="showButton()" name="checkUpdates" value="true"<?php if($ICEcoder["checkUpdates"]) {echo ' checked';};?>> check for updates on load<br> <input type="checkbox" onclick="showButton()" name="checkUpdates" value="true"<?php if($ICEcoder["checkUpdates"]) {echo ' checked';};?>> check for updates on load<br>
<input type="checkbox" onclick="showButton()" name="openLastFiles" value="true"<?php if($ICEcoder["openLastFiles"]) {echo ' checked';};?>> auto open last files on login<br> <input type="checkbox" onclick="showButton()" name="openLastFiles" value="true"<?php if($ICEcoder["openLastFiles"]) {echo ' checked';};?>> auto open last files on login<br>
<br> <br>
when finding in files, exclude:<br> when finding in files, exclude:<br>
<input type="text" onkeydown="showButton()" name="findFilesExclude" value="<?php for($i=0;$i<=count($ICEcoder["findFilesExclude"])-1;$i++) {echo $ICEcoder["findFilesExclude"][$i]; if ($i<count($ICEcoder["findFilesExclude"])-1) {echo ', ';};}; ?>"><br> <input type="text" onkeydown="showButton()" name="findFilesExclude" value="<?php for($i=0;$i<=count($ICEcoder["findFilesExclude"])-1;$i++) {echo $ICEcoder["findFilesExclude"][$i]; if ($i<count($ICEcoder["findFilesExclude"])-1) {echo ', ';};}; ?>"><br>
<br> <br>
<h2>assisting</h2> <h2>assisting</h2>
<input type="checkbox" onclick="showButton()" name="codeAssist" value="true"<?php if($ICEcoder["codeAssist"]) {echo ' checked';};?>> code assist<br> <input type="checkbox" onclick="showButton()" name="codeAssist" value="true"<?php if($ICEcoder["codeAssist"]) {echo ' checked';};?>> code assist<br>
<input type="checkbox" onclick="showButton();showHideTabs()" name="visibleTabs" value="true"<?php if($ICEcoder["visibleTabs"]) {echo ' checked';};?>> visible tabs<br> <input type="checkbox" onclick="showButton();showHideTabs()" name="visibleTabs" value="true"<?php if($ICEcoder["visibleTabs"]) {echo ' checked';};?>> visible tabs<br>
<input type="checkbox" onclick="showButton()" name="lockedNav" value="true"<?php if($ICEcoder["lockedNav"]) {echo ' checked';};?>> locked nav<br> <input type="checkbox" onclick="showButton()" name="lockedNav" value="true"<?php if($ICEcoder["lockedNav"]) {echo ' checked';};?>> locked nav<br>
<br> <br>
<h2>security</h2> <h2>security</h2>
new password <span style="font-size: 10px; color: #888">8 chars</span><br> new password <span style="font-size: 10px; color: #888">8 chars</span><br>
<input type="password" name="accountPassword" onkeydown="showButton()"><br> <input type="password" name="accountPassword" onkeydown="showButton()"><br>
confirm password<br> confirm password<br>
<input type="password" name="confirmPassword" onkeydown="showButton()"><br> <input type="password" name="confirmPassword" onkeydown="showButton()"><br>
<br> <br>
banned files/folders<br> banned files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($ICEcoder["bannedFiles"])-1;$i++) {echo $ICEcoder["bannedFiles"][$i]; if ($i<count($ICEcoder["bannedFiles"])-1) {echo ', ';};}; ?>"><br> <input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($ICEcoder["bannedFiles"])-1;$i++) {echo $ICEcoder["bannedFiles"][$i]; if ($i<count($ICEcoder["bannedFiles"])-1) {echo ', ';};}; ?>"><br>
banned paths<br> banned paths<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedPaths" value="<?php for($i=0;$i<=count($ICEcoder["bannedPaths"])-1;$i++) {echo $ICEcoder["bannedPaths"][$i]; if ($i<count($ICEcoder["bannedPaths"])-1) {echo ', ';};}; ?>"><br> <input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedPaths" value="<?php for($i=0;$i<=count($ICEcoder["bannedPaths"])-1;$i++) {echo $ICEcoder["bannedPaths"][$i]; if ($i<count($ICEcoder["bannedPaths"])-1) {echo ', ';};}; ?>"><br>
<input type="hidden" name="changedFileSettings" value="false"> <input type="hidden" name="changedFileSettings" value="false">
ip addresses<br> ip addresses<br>
<input type="text" onkeydown="showButton()" name="allowedIPs" value="<?php for($i=0;$i<=count($ICEcoder["allowedIPs"])-1;$i++) {echo $ICEcoder["allowedIPs"][$i]; if ($i<count($ICEcoder["allowedIPs"])-1) {echo ', ';};}; ?>"><br> <input type="text" onkeydown="showButton()" name="allowedIPs" value="<?php for($i=0;$i<=count($ICEcoder["allowedIPs"])-1;$i++) {echo $ICEcoder["allowedIPs"][$i]; if ($i<count($ICEcoder["allowedIPs"])-1) {echo ', ';};}; ?>"><br>
</div> </div>
<div class="settingsColumn2"> <div class="settingsColumn2">
<h2>plugins</h2> <h2>plugins</h2>
plugins array <span style="font-size: 10px; color: #888">name, img src, style, url, target, setInterval (mins)</span><br> plugins array <span style="font-size: 10px; color: #888">name, img src, style, url, target, setInterval (mins)</span><br>
<textarea name="plugins" class="plugins" onkeydown="showButton()"><?php <textarea name="plugins" class="plugins" onkeydown="showButton()"><?php
for($i=0;$i<count($ICEcoder["plugins"]);$i++) { for($i=0;$i<count($ICEcoder["plugins"]);$i++) {
echo '"'.implode('",'.PHP_EOL.'"', $ICEcoder["plugins"][$i]).'"'; echo '"'.implode('",'.PHP_EOL.'"', $ICEcoder["plugins"][$i]).'"';
if ($i<count($ICEcoder["plugins"])-1) { if ($i<count($ICEcoder["plugins"])-1) {
echo PHP_EOL."====================".PHP_EOL; echo PHP_EOL."====================".PHP_EOL;
} }
} }
?></textarea> ?></textarea>
<br><br> <br><br>
<h2>style</h2> <h2>style</h2>
theme<br> theme<br>
<select onchange="selectTheme();showButton()" id="select" name="theme"> <select onchange="selectTheme();showButton()" id="select" name="theme">
<option<?php if ($ICEcoder["theme"]=="default") {echo ' selected';}; ?>>default</option> <option<?php if ($ICEcoder["theme"]=="default") {echo ' selected';}; ?>>default</option>
<?php <?php
for ($i=0;$i<count($themeArray);$i++) { for ($i=0;$i<count($themeArray);$i++) {
$optionSelected = $ICEcoder["theme"]==$themeArray[$i] ? ' selected' : ''; $optionSelected = $ICEcoder["theme"]==$themeArray[$i] ? ' selected' : '';
echo '<option'.$optionSelected.'>'.$themeArray[$i].'</option>'.PHP_EOL; echo '<option'.$optionSelected.'>'.$themeArray[$i].'</option>'.PHP_EOL;
} }
?> ?>
</select> </select>
<span style="position: absolute; margin: -15px 0 0 20px"> <span style="position: absolute; margin: -15px 0 0 20px">
line wrapping<br> line wrapping<br>
<select onchange="showButton()" name="lineWrapping"> <select onchange="showButton()" name="lineWrapping">
<option value="true"<?php if($ICEcoder["lineWrapping"]) {echo " selected";};?>>yes</option> <option value="true"<?php if($ICEcoder["lineWrapping"]) {echo " selected";};?>>yes</option>
<option value="false"<?php if(!$ICEcoder["lineWrapping"]) {echo " selected";};?>>no</option> <option value="false"<?php if(!$ICEcoder["lineWrapping"]) {echo " selected";};?>>no</option>
</select> </select>
</span> </span>
<span style="position: absolute; margin: -15px 0 0 120px"> <span style="position: absolute; margin: -15px 0 0 120px">
tab width <span style="font-size: 10px; color: #888">chars</span><br> tab width <span style="font-size: 10px; color: #888">chars</span><br>
<input type="text" name="tabWidth" id="tabWidth" style="width: 30px" onkeydown="showButton()" onkeyup="changeTabWidth()" value="<?php echo $ICEcoder["tabWidth"];?>"> <input type="text" name="tabWidth" id="tabWidth" style="width: 30px" onkeydown="showButton()" onkeyup="changeTabWidth()" value="<?php echo $ICEcoder["tabWidth"];?>">
</span> </span>
<br><br> <br><br>
<textarea id="code" name="code"> <textarea id="code" name="code">
function findSequence(goal) { function findSequence(goal) {
function find(start,history) { function find(start,history) {
if (start==goal) if (start==goal)
return history; return history;
else if (start>goal) else if (start>goal)
return null; return null;
else else
return find(start+5,"("+history+"+5)") || return find(start+5,"("+history+"+5)") ||
find(start*3,"("+history+"*3)"); find(start*3,"("+history+"*3)");
} }
return find(1,"1"); return find(1,"1");
}</textarea> }</textarea>
<br> <br>
<span style="position: absolute; top: 510px"> <span style="position: absolute; top: 510px">
<h2>file manager</h2> <h2>file manager</h2>
root <span style="font-size: 10px; color: #888">slash prefixed</span><br> root <span style="font-size: 10px; color: #888">slash prefixed</span><br>
<input type="text" name="root" style="width: 250px" onkeydown="document.settings.changedFileSettings.value='true';showButton()" value="<?php echo $ICEcoder["root"];?>"> <input type="text" name="root" style="width: 200px" onkeydown="document.settings.changedFileSettings.value='true';showButton()" value="<?php echo $ICEcoder["root"];?>">
</span> </span>
<script> <script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true, lineNumbers: true,
readOnly: "nocursor", readOnly: "nocursor",
indentUnit: top.ICEcoder.tabWidth, indentUnit: top.ICEcoder.tabWidth,
tabSize: top.ICEcoder.tabWidth, tabSize: top.ICEcoder.tabWidth,
mode: "javascript", mode: "javascript",
theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>" theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>"
}); });
var input = document.getElementById("select"); var input = document.getElementById("select");
function selectTheme() { function selectTheme() {
var theme = input.options[input.selectedIndex].innerHTML; var theme = input.options[input.selectedIndex].innerHTML;
if (theme=="default") {theme = "icecoder"}; if (theme=="default") {theme = "icecoder"};
editor.setOption("theme", theme); editor.setOption("theme", theme);
} }
function changeTabWidth() { function changeTabWidth() {
var tabWidth = document.getElementById("tabWidth").value; var tabWidth = document.getElementById("tabWidth").value;
editor.setOption("indentUnit", tabWidth); editor.setOption("indentUnit", tabWidth);
editor.setOption("tabSize", tabWidth); editor.setOption("tabSize", tabWidth);
} }
var showButton = function() { var showButton = function() {
document.getElementById('updateButton').style.opacity = 1; document.getElementById('updateButton').style.opacity = 1;
} }
var showHideTabs = function() { var showHideTabs = function() {
cMCSS = document.styleSheets[2]; cMCSS = document.styleSheets[2];
cMCSS.rules ? strCSS = 'rules' : strCSS = 'cssRules'; cMCSS.rules ? strCSS = 'rules' : strCSS = 'cssRules';
document.settings.visibleTabs.checked ? cMCSS[strCSS][2].style['content'] = '"\\21e5"' : cMCSS[strCSS][2].style['content'] = '" "'; document.settings.visibleTabs.checked ? cMCSS[strCSS][2].style['content'] = '"\\21e5"' : cMCSS[strCSS][2].style['content'] = '" "';
} }
var validatePasswords = function() { var validatePasswords = function() {
if (document.settings.accountPassword.value != 0 && document.settings.accountPassword.value.length<8) { if (document.settings.accountPassword.value != 0 && document.settings.accountPassword.value.length<8) {
top.ICEcoder.message('Please use at least 8 chars in the password'); top.ICEcoder.message('Please use at least 8 chars in the password');
} else { } else {
if (document.settings.accountPassword.value != document.settings.confirmPassword.value) { if (document.settings.accountPassword.value != document.settings.confirmPassword.value) {
top.ICEcoder.message('Sorry, your passwords don\'t match') top.ICEcoder.message('Sorry, your passwords don\'t match')
} else { } else {
document.settings.submit(); document.settings.submit();
} }
} }
} }
</script> </script>
<div class="update" id="updateButton" onClick="validatePasswords()">update</div> <div class="update" id="updateButton" onClick="validatePasswords()">update</div>
</div> </div>
</form> </form>
</body> </body>
</html> </html>

View File

@@ -11,6 +11,13 @@ error_reporting(-1);
// Start a session if we haven't already // Start a session if we haven't already
if(!isset($_SESSION)) {session_start();} if(!isset($_SESSION)) {session_start();}
// Logout if that's the action we're taking
if (isset($_GET['logout'])) {
$_SESSION['loggedIn']=false;
session_destroy();
header("Location: dirname(__FILE__)./?loggedOut");
}
// Function to handle salted hashing // Function to handle salted hashing
define('SALT_LENGTH',9); define('SALT_LENGTH',9);
function generateHash($plainText,$salt=null) { function generateHash($plainText,$salt=null) {
@@ -33,13 +40,19 @@ function numClean($var) {
} }
// Settings are stored in this file // Settings are stored in this file
$settingsTemplate = 'config-template.php';
$settingsFile = 'config.php'; $settingsFile = 'config.php';
if (!file_exists(dirname(__FILE__)."/".$settingsFile)) {
if (!copy(dirname(__FILE__)."/".$settingsTemplate, dirname(__FILE__)."/".$settingsFile)) {
die("Couldn't create $settingsFile. Maybe you need write permissions on the lib folder?");
}
}
include($settingsFile); include($settingsFile);
// Add ICEcoder settings to beginning of $ICEcoder array // Add ICEcoder settings to beginning of $ICEcoder array
$ICEcoder = array( $ICEcoder = array(
"versionNo" => "1.4", "versionNo" => "2.0 beta",
"codeMirrorDir" => "CodeMirror-3.0", "codeMirrorDir" => "CodeMirror-3.1",
"demoMode" => false "demoMode" => false
)+$ICEcoder; )+$ICEcoder;
@@ -140,15 +153,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");
@@ -220,8 +238,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']));
@@ -262,7 +282,7 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div> <div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<form name="settingsUpdate" action="settings.php" method="POST"> <form name="settingsUpdate" action="settings.php" method="POST">
<input type="password" name="<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password" class="accountPassword"><br><br> <input type="password" name="<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password" class="accountPassword"><br><br>
<input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "Set Password" : "Login"; ?>" class="button"> <input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "set password" : "login"; ?>" class="button">
</form> </form>
</div> </div>
</div> </div>
@@ -273,8 +293,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,28 +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>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB