Compare commits

...

485 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
Matt Pass
d3f378f6bd Version 1.4 screenshot 2012-12-30 17:27:22 +00:00
Matt Pass
09e1562fbc Version 1.4 2012-12-30 17:15:24 +00:00
Matt Pass
4e14ac6d9b Added JS Regex plugin & rearranged order
Icon also added, made one up
2012-12-30 17:13:19 +00:00
Matt Pass
97882f0c60 Emmet icon updated
Used circular version
2012-12-30 17:12:49 +00:00
Matt Pass
482a5cfb11 Now loads snippet-display.php from lib folder 2012-12-30 17:12:30 +00:00
Matt Pass
f73dee1103 Snippets display moved & now for info
Snippets display file now moved to lib folder
Functionality removed from this file and now just used for info purposes
Tidied up look and provided table of uses, plus note on Emmet's tab key
2012-12-30 17:11:50 +00:00
Matt Pass
9034e1ad45 for added as a abbreviation 2012-12-30 17:06:31 +00:00
Matt Pass
7e35481b62 Typo on img src 2012-12-30 13:52:34 +00:00
Matt Pass
2f87f2adc3 Emmet feature added and new screenshot 2012-12-30 13:50:34 +00:00
Matt Pass
6b345ac041 Load Emmet if available, start keyMap
Load the emmet.min.js file if available
Remove extraKeys and start a new keyMap, as extraKeys was overriding
Emmet
Falls through to default keyMap
2012-12-30 13:33:23 +00:00
Matt Pass
19e18f6a10 Emmet plugin added 2012-12-30 13:30:59 +00:00
Matt Pass
f181cef9e9 No need for space var, lCLen-4 not 3 2012-12-27 17:56:47 +00:00
Matt Pass
dd19c39cf8 Declaring function vars and adjusting var name
Establishing vars at beginning of function to stop them being globals
lineNo2 now lineCount
2012-12-27 14:33:07 +00:00
Matt Pass
5887a9c755 Tabs contain only filename
No longer show path as well
(This is now shown on hover)
2012-12-27 13:37:05 +00:00
Matt Pass
ca35084160 Updates to class names & properties for CM3
Now gutters and linenumber
Also moved width to gutters class, aligned text right and lightened
right border
2012-12-27 13:31:19 +00:00
Matt Pass
644eee0aca Tweaks to tab styling
Box shadow y-pos now 50px to be visible on the tabs bar
Tabs bar BG now slightly lighter
Tabs now #eee on left border instead of #fff
2012-12-27 13:30:02 +00:00
Matt Pass
510a0c1087 Rounded tabs, moved box shadow, tabbar BG
Tabs now have rounded corners at top
Moved the box shadow down by 80px so it's only seen to right of file
manager
tabsBar now has lighter colour BG
2012-12-27 12:32:44 +00:00
Matt Pass
4afbe4c2fc Only add tags to array if not undefined 2012-12-27 11:37:58 +00:00
Matt Pass
6cf36cc99c No longer include a space after comment tag
Remove space after comment tags such as //, /* and #
This is to avoid JS Hint errors and also be less stylised
2012-12-27 11:23:06 +00:00
Matt Pass
b98127e83a Changed URL only
To try and get new screenshot in readme file
2012-12-24 13:52:08 +00:00
Matt Pass
f7f195f083 Extra couple of features added to list 2012-12-24 13:48:29 +00:00
Matt Pass
22e6228a08 Version 1.3 2012-12-24 13:16:00 +00:00
Matt Pass
b757e42c88 JS hint icon altered
Now includes word HINT
2012-12-24 12:53:01 +00:00
Matt Pass
fdf1ef1cb7 Now considering indents and better templates
Indents are now considered when completing the snippet
Replaced the mix of various template elements with uppercase
alternatives (VAR, INDENT & CURSOR)
2012-12-21 08:43:25 +00:00
Matt Pass
4797ff84d8 Quick effort at getting snippet notations working
You can now press CTRL+space to have your shorthand notation completed.
2 options for function and if setup so far.
What I've written is a pretty horrible hacky effort to get this working.
It does work but needs a LOT of refining.
2012-12-20 22:12:27 +00:00
Matt Pass
3937d733f0 QS var cleaning, removing test logs and /
strClean on GET var selectedFiles
Remove 2 x console.logs
Remove commented text
2 x areas need first slash removing and ending with a slash
Need to var thisWidth to avoid global
2012-12-20 17:15:26 +00:00
Matt Pass
0328643c7c Now only loads file if it exists
if file_exists needs now wraps load PHP and JS code to allow escaping
and server message when files don't exist
2012-12-18 09:15:13 +00:00
Matt Pass
80c73523e3 No need to globally replace end colon
There will be only one
2012-12-18 08:49:07 +00:00
Matt Pass
8c5747798d Tabs now have closelink fist as it's RTL and clear first slash and end
with one for same reason
Else if conditions to give better perf
newBlock has a z-index of 1000 to show above code
Show titles on tab hovers
New setTabWidths function to reset tab widths on demand
2012-12-17 09:06:46 +00:00
Matt Pass
bdf6dbd096 Meta noindex, nofollow, set & clear gutter marks
Meta robots of noindex, nofollow to stop it being indexed by search
engines
Set & clear gutter with line no etc, need to look at using this for code
folding
2012-12-17 09:04:21 +00:00
Matt Pass
0eaef469f9 Tabs change color hover 2012-12-17 08:59:59 +00:00
Matt Pass
f2d3615e26 Tabs RTL dir, r-align, nowrap, hidden overflow
This is to allow them to be cropped off to the left side if not big
enough
2012-12-17 08:52:28 +00:00
Matt Pass
24f05a1c03 Meta robots noindex, nofollow
Don't allow ICEcoder installations to be indexed by search engines
Remove a couple of console logs from testing.
2012-12-17 08:50:11 +00:00
Matt Pass
570642d820 Meta robots noindex, no follow & dont selectTheme
Don't want ICEcoder installs showing up on search engine results
Also no need to selectTheme onChange of linewrapping select menu
2012-12-17 08:48:41 +00:00
Matt Pass
fd794f99d2 UTF-8 and meta robots noindex, nofollow
Need UTF-8 settings like other pages and don't want ICEcoder
installation showing up on search engine results
2012-12-17 08:47:41 +00:00
Matt Pass
9a95bae6ba Meta robots noindex, nofollow
To stop ICEcoder showing up on search engine results
2012-12-17 08:46:43 +00:00
Matt Pass
1b04504617 Find in selectedFiles & fix to find in filenames
Get an array of selectedFiles if there is one
Fix by resetting foundInSelected on each loop
targetURL is now lowercase as standard
Only provide results if it's a file
Also only provide results if the beginning of the path matches and
either the targetURL is the same or if it forms the beginning
Set $bFile = true if the file which contains our match doesn't match the
selected file
2012-12-17 08:40:37 +00:00
Matt Pass
2a2cd81149 Pass thru list of selected files on find/replace
If we choose selected files when performing a find/replace, build up a
colon seperated list and tack on as a querysting
2012-12-17 08:29:12 +00:00
Matt Pass
2bb961b7a8 Now only loads & runs if JSHint is available
Script only loads if file is available
Processes in function only run if JSHINT is available
2012-12-13 09:16:13 +00:00
Matt Pass
01b035d7af Clear or set JS Hints based on codeAssist
On toggle of codeAssist and being false, clear all JS Hint widgets in
all tabs
If turned on though, set in current tab
Run updateHints on switching tab (helps complete above step)
2012-12-13 08:56:53 +00:00
Matt Pass
8d0de398fd Only if codeAssist is on run JS Hint 2012-12-13 08:54:21 +00:00
Matt Pass
2ebec54476 Line Wrapping and Banned Paths Options
New options available to set in the settings screen
Also passes through to useNewSettings function for in session changes
A couple of other minor changes to style and layout
2012-12-12 17:56:43 +00:00
Matt Pass
b66d5fe8d3 Slight tweaks to CSS and commented code 2012-12-12 09:23:58 +00:00
Matt Pass
0f989f249f Moving function to the info & display section 2012-12-12 09:23:02 +00:00
Matt Pass
6980bdcf7f No need for 3rd arg here 2012-12-11 18:05:11 +00:00
Matt Pass
975a016974 Added width setting twice 2012-12-11 18:04:57 +00:00
Matt Pass
4be1b45896 Upgrading to CM v3 from v3 RC2
Upgrading to official v3 released now it's been released
2012-12-11 17:35:57 +00:00
Matt Pass
8e10824189 Sent argument and returned objected are different
It now takes a {line, ch} object as second argument, instead of an
integer, and will return a {from: {line, ch}, to: {line, ch}} object.
2012-12-11 11:53:06 +00:00
Matt Pass
1a881b4eaf JS Hint available as icon
Takes user to website for now
2012-12-10 17:57:17 +00:00
Matt Pass
2a9e91dd55 JS Hint Icon styles, vars & clear & set timeout
New styles for icon shown in widget
Var waiting used by setTimeout and and widgets array
Set & clear timeouts on change of editor content
2012-12-10 17:56:45 +00:00
Matt Pass
725ea8999a Load the JS Hint plugin JS file 2012-12-10 17:54:59 +00:00
Matt Pass
3427b736ec New updateHints function for JS Hint
Calls on JS Hint and returns with any errors and shows as a widget under
relevant line
This example code taken from CodeMirror's Widgets example
2012-12-10 17:54:43 +00:00
Matt Pass
1dde9d0198 JS Hint plugin added
Added as a plugin, will make optional in the future as a few hooks in
ICEcoder's code by default
2012-12-10 17:52:48 +00:00
Matt Pass
7577c3552d Folding on tag & braces again now
Folds according to the content/lang type at the cursor.
Nest step is to set the cursor to the clicked line, get the type and set
cursor back again, then we know what we can fold on.
2012-12-04 18:07:36 +00:00
Matt Pass
30de655fb2 CSS alts and moving to new on function
No longer setting BG color or color on CodeMirror class
onCursorActivity, onChange, onScroll and onGutterClick now set outside
of main codeMirror object and appended
Using addLineClass now instead of setLineClass
2012-12-03 19:14:20 +00:00
Matt Pass
09cf5589f5 Use addLineClass and removeLineClass
These are used in place of setLineClass now
2012-12-03 19:11:15 +00:00
Matt Pass
b206f8ab78 Remove caretLocType in nest & add/removeLineClass
Don't end the nestDisplay with the caretLocType, this is shown already
near the line/chr counter
For some reason, the array pos of the visible tabs is 4 not 5
Use new removeLineClass and addLineClass methods instead of setLineClass
2012-12-03 19:10:36 +00:00
Matt Pass
f358cdea5b Upgrading to CodeMirror v3 RC2 2012-12-03 19:04:16 +00:00
Matt Pass
14fe45bda8 Version 1.2 2012-12-01 14:35:49 +00:00
Matt Pass
72ff461b45 Nesting tags now have BG chevrons
Slight adjust to make text in footer look in line
'cursor nest locaton' wording starts with lowercase c
BG gif added which contains start, middle and end chevron graphics
Now showing DIV containing BG for start, middle or end chunks between
next tag names
2012-12-01 14:35:03 +00:00
Matt Pass
96fe7d46ba Scroll selected range into view
On hovering mouse over nest tags, scroll the start of the selected range
into view
2012-11-28 17:26:45 +00:00
Matt Pass
d40cdeb65e Syntax tidy up
Removed commented code, simplify parens & tabbed formatting
2012-11-28 17:04:01 +00:00
mattpass
4130df7bf9 Merge pull request #104 from kucerarichard/master
bannedPaths setting added and ignore Drupal modules as standard
2012-11-28 08:49:43 -08:00
Matt Pass
6e176cdda7 Upgrade to CodeMirror 2.36 2012-11-28 16:47:52 +00:00
Rich Kucera
bdb171dc6d add banned paths 2012-11-28 10:57:57 -05:00
Matt Pass
801471a105 3 new themes added
Ambiance altered to not include background image
(avoids file being 26k, instead 3k)
2012-11-25 16:58:55 +00:00
Matt Pass
f86cb53bd9 Standardise font size to 13px 2012-11-25 16:58:14 +00:00
Matt Pass
435e1b3b4b Now pastes files and folders
Also includes, sub folders & files
2012-11-25 16:22:36 +00:00
Matt Pass
4b17d76144 Extend 10 tabs to 100 tabs
10 tabs can sometimes be too few no one should ideally need more than
100 tabs open so this is a good new level.
Doesn't appear to impact on DOM or JS at all, especially as I don't need
to rework code to move to an unlimited tabs setup instead.
Having a limit also helps save crashing or bogging down the browser.
2012-11-25 14:18:36 +00:00
Matt Pass
d96ebe4282 Password protect based on ICEcoder password 2012-11-21 18:24:57 +00:00
Matt Pass
e5c5e7dc5e Terminal plugin added
Will die if in demoMode or not loggedIn
Code needs revising to enable extra login, set sudo etc if necessary?
2012-11-21 17:50:30 +00:00
Matt Pass
fe593dcb09 demoMode no longer saves opened files list 2012-11-18 11:10:13 +00:00
Matt Pass
b1056a19a3 Restrict demo mode to load only
Cannot only make new folder, paste, rename, replace text in file, change
perms, delete or save if demoMode is false
2012-11-17 18:43:32 +00:00
Matt Pass
048c47f7f3 demoMode setting added
demoMode bool added to ICEcoder array, false by default
If set to true and we have a password, set logginIn to true
$demoMode var equivalent to array var
demoMode must be false to possibly allow saving
2012-11-17 18:41:54 +00:00
Matt Pass
a4bb1605ce v1.1 release 2012-11-12 09:27:04 +00:00
Matt Pass
c4d24c0a4c Pasting a new file
Looks to see if the location is writable and if so, copy our file to
that location
Then adds the new file to the file manager, otherwise, informs you it
couldn't do it
Clears server message eitherway
2012-11-12 09:26:50 +00:00
Matt Pass
99dedb61cb copyFile, pasteFile & hideFileMenu functions
copyFile simply sets a var same as the provided selFile var then hides
menu
pasteFile adds a paste file item to the server queue and shows message
hideFileMenu added as the opposite of showFileMenu function
2012-11-12 09:25:32 +00:00
Matt Pass
702c3d069f New options for copy & paste
Copy can be done on anything, paste can only be done on folders
2012-11-12 09:21:39 +00:00
Matt Pass
8ec8efe967 Fix to only pass tests if matching dir exactly
Stops for instance matching dir/fold on dir/foldersz
2012-10-31 16:00:03 +00:00
Matt Pass
4aa0260399 Extending case insensitive find & replace
Checking if we have a $_GET['target'] before use to avoid PHP notices
findText is converted to lowercase
Global case insensitive searching with regex in open documents
Find/replace in filenames now compares in a case insensitive way
Split the resultsDisplay generation onto 3 lines to make it easier to
read
Fixed issue with showing 'replace with xxx' when you're actually just
finding
2012-10-30 17:50:34 +00:00
Matt Pass
f24aaf1396 Added key exclusion back in
Was causing occasional issues with keypresses. Maybe 10% of the time.
Added this back in until I stop this function being triggered on
anything but changes.
2012-10-30 13:40:14 +00:00
Matt Pass
00ddd056af 1px shift to top of replace input field
To match find input field
2012-10-26 19:08:56 +01:00
Matt Pass
2438fbb13d Tweaks to look of find controls
.find class now slightly taller and has top shifted 1px to look more
like other controls
Removed border from submit button
Now also has a dark grey look and BG turns blue on hover
2012-10-26 19:04:37 +01:00
Matt Pass
20832c3dcc Can now press Enter to submit Find control
Button is now a submit, onClick action moved to form tag as onSubmit
Also returns false to stop actually submitting form data
2012-10-26 19:03:05 +01:00
Matt Pass
725461f04e Make searches case insensitive by default
This is to match finding in files and is typically the default.
Need to extend this logic to find in all documents and also filenames.
Also add case insensitive switch to find/replace control.
2012-10-26 18:36:33 +01:00
Matt Pass
a3edd7bdf9 Upgrade to CodeMirror 2.35 2012-10-26 18:04:47 +01:00
Matt Pass
8d9d330678 Upgrade to CodeMirror 2.35 2012-10-26 17:59:36 +01:00
Matt Pass
d46fa3012b Remove CodeMirror v2.34
Upgrading to v2.35
2012-10-26 17:59:21 +01:00
Matt Pass
75e9f916ec Opening file by mime type now
Detect if it's text based, image based or other and open as appropriate
(text = editor, image = media preview, other = new window)
2012-10-25 12:38:36 +01:00
Matt Pass
f71277008f Check excludeFilesFolders before use
Causes an error otherwise
2012-10-25 11:49:30 +01:00
Matt Pass
184a9d223b Save errors in error-log.txt and set default TZ
You need to set a default timezone for PHP 5.3.0 and onwards. Using
functions such as date without that throws up a warning. However,
getting it from the server causes a warning too. So, I'm getting and
setting it whilst also supressing the warning with @.
2012-10-25 11:48:40 +01:00
Matt Pass
b4c45e33e9 Better clearing of mouseDown, hide serverMessage
mouseDown = false being set now on scoll on iFrame (of File Manager) and
via CM instance for editor, so old method removed
Set serverMessages' display to inline-block when showing, none in 0.2s
when hiding
2012-10-25 11:46:32 +01:00
Matt Pass
eea960bcbd serverMessage transition only applies to opacity
Also removed 2 x display properties from tab class
2012-10-25 11:43:49 +01:00
Matt Pass
609e4397db onScroll of iFrame, set mouseDown to false
This is done on load via an anon function
Avoids the system wanting to resize FM when using FM scrollbar
2012-10-25 11:41:51 +01:00
Matt Pass
b8bfbc5f6a Clear mouseDown flag on scroll of CM
Better solution to what I had previously implemented
2012-10-25 11:40:26 +01:00
Matt Pass
4b274f959e v1.0.0 2012-10-23 20:22:13 +01:00
Matt Pass
e66811a4e2 Removed beta tag 2012-10-23 20:21:39 +01:00
Matt Pass
139bfe775c Don't need key, simplify setting changedContent 2012-10-23 20:00:18 +01:00
Matt Pass
feb26af4bf Now logging errors in the root 2012-10-23 18:28:25 +01:00
Matt Pass
27d75f810a setup vars & check post vars before use
'server_software' also needs to be a string
2012-10-23 18:17:30 +01:00
Matt Pass
bc251d8c2b Var usage tweaks to avoid errors/notices
Check replace exists then use
Global & init vars
ICEroot is actually iceRoot
2012-10-23 18:16:25 +01:00
Matt Pass
bde9010000 init saveType before use, split is now explode 2012-10-23 18:14:34 +01:00
Matt Pass
91314f423f init updateMsg before use 2012-10-23 18:14:09 +01:00
Matt Pass
2bb0a361aa Clear mouseDown state if over scrollbar
Clicking on scrollbar to scroll content set the mouseDown state to true
This wasn't being reset on mouse up and moving mouse pointer towards the
edge of the file manager enabled resizing of width
Now on going beyond editor width (-scrollbar of 20px), sets mouseDown to
false
2012-10-23 15:57:50 +01:00
Matt Pass
5517bf80f9 Fixing close tab issue & changedContent setting
When redoing changedContent values, no longer consider if these keys are
being pressed:
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) <<-- mistake, Page Up, Page Down, End, Home (33-36), Left
Win Key, Right Win Key (91-92), F1-F12 (112-123)
This is because CM's changed event will not be triggered with these keys
and I'm not calling onkeypress anymore
Also, rather than now just setting and ending up being stuck at 1 (ie,
changed), we're now detecting if we have at least 1 undo level, if so
set to 1, otherwise 0
(This means you can make changes and undo back to the start and it
doesn't count as a change)
Because this is being handled on changedContent array, no longer need to
consider undo level size when figuring out close button BG colour
openFileMDTs were not being shuffled along when closing tabs but are now
Fixed issue with string replacing closeTabButtonX() - brackets not
needed
2012-10-23 15:14:36 +01:00
Matt Pass
f141e6f7a7 cMThisVer removed, establishing via CM object now
The version num is now being established from the CM object itself using
the version method
2012-10-23 14:57:26 +01:00
Matt Pass
7220288460 No longer using hardcoded CM version num
This is now being established using .version, which also indicates extra
info
(Such as '+' for post version updates included, 'beta' to signify that,
etc)
2012-10-23 14:55:54 +01:00
Matt Pass
d9f4955736 No longer check if CodeMirror is latest version
This is down to me to update upon new CM versions being released
User wouldn't be interested and upgrading to newer version could cause
complications
It's also another check/dependency to slow things down/interfere
Because of these reasons, I'm dropping this check
2012-10-23 14:54:26 +01:00
Matt Pass
13255bc58b Clearing global vars
theme, tabsIndent, openLastFiles, tabWidth, previousFiles, showFileMenu
& foldStyle all now contained within ICEcoder object
showFileMenu is a function to ensure file manager menu continues to show
The few instances of i now have scope
Initing the var fileName
This is to reduce the number of global vars
The only global vars should now be ICEcoder, docRoot & iceRoot
2012-10-20 23:52:36 +01:00
Matt Pass
2988de5501 v0.9.1 beta 2012-10-20 16:55:42 +01:00
Matt Pass
70a69f1c3b stickyTabWindow now stickyTab
Removed the flag variable stickyTab and stickyTabWindow now becomes this
Saves excess vars
2012-10-20 16:44:55 +01:00
Matt Pass
7cce0bf865 Show screenshot of ICEcoder 2012-10-20 16:15:23 +01:00
Matt Pass
16e3e92c4a Fullscreen icon now changing on event handler
No longer detecting current image src and showing the opposite icon on
click
We're now changing the icon on screen change event handler
2012-10-20 16:14:56 +01:00
Matt Pass
5f1b78ea1d Login screen button now blue on hover 2012-10-20 15:27:19 +01:00
Matt Pass
9f36a8e5f8 Favicon added and using ice-coder.js & .css 2012-10-09 08:22:56 +01:00
Matt Pass
89a2212408 JS src is ice-coder.js now 2012-10-09 08:22:19 +01:00
Matt Pass
9ed344d22d Renamed to ice-coder.css and .js 2012-10-09 08:21:28 +01:00
Matt Pass
642db4c5b9 Renamed to properties.php & css 2012-10-09 07:57:28 +01:00
Matt Pass
2a93778df7 First sort of file into logical sections 2012-10-09 07:49:03 +01:00
Matt Pass
c11500b791 v0.9.0 alpha 2012-10-08 07:49:43 +01:00
Matt Pass
ee0303dc06 Code condensing
pB var setup to avoid repeating long DOM elem refs again
Removed end point from substr, not necessary
Put 3 x themes into an array and test using indexOf instead
Syntax spacing in a couple of areas
2012-10-08 07:37:08 +01:00
Matt Pass
0d55f3bd81 use showHide, fix availability bug & use regex
use showHide function where possible
Check file and fileName are available before using them
Shorten code by setting in vars and reusing
Syntax & comment simplification
Use regex to work out previousFiles (also fixed comma prefix on string)
Slight adjustment to for loop using less chars
2012-10-06 18:06:01 +01:00
Matt Pass
0e377c1aff New regex for efficiency
More specific regex used to ensure efficiency & speed are optimal
Syntax spacing adjusts on couple of other lines
2012-10-06 15:43:23 +01:00
Matt Pass
388bd7cefa Improved regex on CSS values
Looks for hex, rgb/hsl-a or colour name values in their correct format
Need match ? match[0] : '' to handle no match scenarios
2012-10-05 15:41:58 +01:00
Matt Pass
8234b3b063 newTab now innerLI & better cssColorPreview code
newTab isn't a tab at all, it's inner contents of an LI, so now called
innerLI
2nd insertBefore should be inserting newText not newLI again
New code to get CSS values via regex
Now only showing the preview if the caretLocType is CSS
2012-10-04 18:10:18 +01:00
Matt Pass
573a07026d Simplifying and condensing code
No need to return cM in getcMInstance, just return the ternary value
Shortened a few comments for clarity & byte saving
No need to add length as 2nd param on substrs in a couple of places
newTab setup as string to be used in a couple of places
Ternary shortening on elemType
Converted ternary statement back to if else to byte save on 2 ternaries
Reversing bool on codeAssist var by using ! instead
break is shorter & better too, than increasing i's value to escape
2012-10-03 21:13:35 +01:00
Matt Pass
880e04d760 Anon objects & CM's searchCursor used, fixed nest
Now just usage anonymous objects inline instead of creating for single
use
(saves adding extra vars and is less code)
Removed findLen and replaceLen as only findLen was being used twice
Replaced how we find & replace by using CM's searchcursor
Fix to the selection on hover over nest items, doesn't need -1
(This is because I fixed CM's tagRangeFinder to include last line)
2012-10-03 19:39:11 +01:00
Matt Pass
683752762d Fix to 1st line charCount & simplifying endPos.ch
If our result is within the first line, add 1 to it to fix offset
No need to have ternary case for replace all, this is now done with a
regex
2012-10-03 08:03:51 +01:00
Matt Pass
79a78e0a58 Condensing and simplification
Reducing code in many areas by condensing and simplifying
2012-10-02 07:56:05 +01:00
Matt Pass
c33bea997a Lots of ternary & array check shortening
Shorting to ternary statements instead of if else statements in many
places
Checking indexOf on arrays to condense code here too
2012-09-30 17:33:34 +01:00
Matt Pass
a2f8d9bc43 Combo moveLine function & code condensing
moveLine(dir) func added as combo of moveLineUp and moveLineDown funcs
Move initialising vars to start of func
Used indexOf to check array for shortURL instead of for loop in 2 places
Improving/removing a few comments
Condensed code to now check if selectedFiles is empty or contains right
clicked file and also condensed code to use indexOf on array instead of
for loop
Don't need foundFile because of this condensing
Using ICEcoder ref for filesFrame and also showing dropdown higher up
(next to mouse pointer/inline with file/folder name)
2012-09-30 16:24:03 +01:00
Matt Pass
80d717b4dc Condensing code & new deselectAllFiles func
Syntax format improvements on fileManager function
selectFileFolder improvements:
- Removed a load of vars we no longer need & new tgtFile var added
- 2 x areas where we deselect files/folders now done via new function
- tgtFile now avail to avoid duplicate setup
- Other much more efficient and clearer processes setup to achieve same
result
New function added to deselect all files
Ternary shortening on colouring of selected/deselected files & folders
Swapped var order around
2012-09-30 14:55:59 +01:00
Matt Pass
e14a8df6a0 Check typeof parent and swap vars around
Checking state.curState.context can cause issues is state.curState
doesn't exist so just check state.curState instead
Swapped a couple of vars round to match order of usage in func
2012-09-29 17:15:09 +01:00
Matt Pass
4be0067852 htmlTagArray defined in top settings now
updateNestingIndicator now setup on a setInterval every 30 ms
(This is due to timing issues and solves this without being noticable)
Only if we have a context for the given tag build up the array
If so, reset htmlTagArray and build up the array again
This means we stick with the old array if we're in a script or style
block (for example)
Set the tagString to be the last item in the array
If caretLocType is JS, set the tagString to script
(This is because CodeMirror doesn't recognise this as a tag)
updateNestingIndicator now works by:
- checking if we have a cM instance and not in JS, Coffee etc filetypes
- gets token information for the very end of the document
- detects if it's className is an error or not to determin if the
nesting is broken
Fix to detecting the code type we're in as without -1, JavaScript is
ignored as it's array item 0
2012-09-29 17:02:30 +01:00
Matt Pass
30a97ed4db Using indexOf to check nestTagExceptions
No need to use for loop here, instead use indexOf to check tagString is
an array item within nestTagExceptions
2012-09-29 16:47:30 +01:00
Matt Pass
1257ed0174 New ICErepo logo
Lost the standard Octocat logo in favour of this one
2012-09-29 11:43:19 +01:00
Matt Pass
c717dd7bba Revised version to establish htmlTagArray
Uses a method from Marijn Haverbeke to establish an array of nested
tokens
This means chars in the document don't need to be scanned and the array
worked out in a more complex way
It means quite a few lines can be condensed down to just 3
Also means it's far less expensive on the CPU, meaning there is no
sluggishness onCursorActivity on large documents (ie typing etc)
2012-09-28 17:35:42 +01:00
Matt Pass
e0a7893578 Highlight line on moving up/down
No longer setting the cursor ch position on moving line up/down
Instead now highlighting the line that has been moved
This is done via the new function highlightLine
2012-09-28 07:52:33 +01:00
Matt Pass
6df5adf0f1 Deselect file we're closing in the file manager 2012-09-27 18:07:11 +01:00
Matt Pass
7e773e5d0a Go back to hiding code editor till loaded
Shows as a white block until loaded, so go back to having it's
visibility hidden until we're loaded and then show
2012-09-21 14:23:29 +01:00
Matt Pass
c3dbc4187f Remove iceRoot from location & perms file path
Clear iceRoot from the beginning of location (needed for when you set
your own ICEroot), so it doesn't cause DOM ID issues/mismatches
Also remove it from the file path passed through to file-control when
changing perms when you have your own ICEroot and don't show in server
message either
2012-09-21 14:22:14 +01:00
Matt Pass
6c004c3010 Remove ICEroot from path
This is applied in file control and by not removing it we have 2 x dirs
2012-09-21 09:25:58 +01:00
Matt Pass
96054295a0 Condensing code in a few areas
Reworked detecting if it's a JS, CoffeeScript, Ruby, CSS or LESS file by
switching the indexOf around
Also performed indexOf on an array rather than looking at each array
item in a for loop
Ternary shortening of code in a few areas
2012-09-20 18:15:20 +01:00
Matt Pass
640c0e9c4a Input field glow updates
Blue glow on input fields now set to 100% opacity, instead of 70%, was a
bit weak before
Also now showing on go to line input field
2012-09-20 09:41:21 +01:00
Matt Pass
ce04ef36da setLayout on creating new tab
Won't have height set on the editor instance otherwise
2012-09-20 09:29:16 +01:00
Matt Pass
677e90ed6b Condensing PHP code into 1 echo 2012-09-20 09:25:16 +01:00
Matt Pass
c2fcdd6b9f Version 0.8.6 2012-09-20 00:13:48 +01:00
Matt Pass
d89cd59c8b Title tag alts, code condensing & tweaks
Version number now in title tag text
Tidied up some comment text re whats included in
codemirror-compressed.js
No longer relying on PHP to echo HTML as much
Code folding vars renamed to codeFoldTag and codeFoldBrace
A new var also set up to define the style of the + that appears in the
gutter
Also some fixes to the + symbol which was overlapping numbers & wrapping
badly
This var is used by both codeFoldTag and codeFoldBrace to set + styling
Formatting of code in creating CM instances
Pulling thisCM through on onCursorActivity and onKeyEvent
This is so we have an object which we can use instead of much more code,
doing it the easier way
2012-09-20 00:13:08 +01:00
Matt Pass
ae0d933588 Title tag changed & simpler code
Title tag text changed to match other files
Decided to drop setting bannedFiles in the ICEcoder array to match
session based version
Checking against the session based version now
Ternary formatting just for ease of reading
Root list item now created mostly without PHP echos
Just echoing now rather than building up a var to echo
2012-09-19 23:56:49 +01:00
Matt Pass
15a092ce87 Title tag text alt & better textarea text buildup
Tweaked title tag text to match other files
Outputting plugin text using implode, which makes for much less code
2012-09-19 23:51:51 +01:00
Matt Pass
e23fc7d15a Removed trailing spaces & semicolons
Also moved position to front of progressBar
2012-09-19 23:48:11 +01:00
Matt Pass
0c07937d45 ICEcoder added as folder to exclude 2012-09-19 23:46:29 +01:00
Matt Pass
2694a06876 onLoad clear load screen, ternary shortening
Now clears load screen when this is loaded
Ternary statements shortened even further in 3 areas
2012-09-19 23:45:51 +01:00
Matt Pass
66ca709da9 title tag text tweak only 2012-09-19 23:44:35 +01:00
Matt Pass
a01d770044 Condensing JS and PHP syntax format tweaks
Multiple JS lines condensed into fewer, action also placed before
message
Couple of PHP if else statements changed to ternary
2012-09-19 23:44:04 +01:00
Matt Pass
bdfa5b6141 Removed unused classes, condensed others
Removed PDF, SQL, SWF and XML, not supporting these in v1
HTML, Jpeg & Ruby condensed, plus dropped RBX and RHTML
2012-09-19 23:40:53 +01:00
Matt Pass
0d9116b9dc Syntax, format & wording tweaks only 2012-09-19 23:39:15 +01:00
Matt Pass
5c8f11bfe3 Remove trailing semicolons 2012-09-19 23:37:31 +01:00
Matt Pass
a32f04a4e3 Show load screen while waiting for multi results
Set visibility to visible until multiple-results.php has loaded
2012-09-19 23:36:46 +01:00
Matt Pass
133317efdb return false onContextMenu on DOM elems 2012-09-19 23:35:14 +01:00
Matt Pass
58f8834041 Hex code shortening 2012-09-19 23:33:58 +01:00
Matt Pass
71ff5d3058 Refresh message & no need to change visibility
Ended config.php write problem messages with 'and press refresh'
No need to set visibility on load anymore as we can only see if logged
in, so should be visible anyway
Removed tabs from login & set password screen (gives clue it's in an if
condition)
2012-09-19 20:45:22 +01:00
Matt Pass
fb82fcdb20 Not hidden by default
Can always be show as we can only see if logged in
2012-09-19 20:42:37 +01:00
Matt Pass
3837e18af2 No need to decode as it's not URI encoded 2012-09-19 20:41:59 +01:00
Matt Pass
c4a431bd2f Upgrade to CodeMirror 2.34 2012-09-19 17:59:29 +01:00
Matt Pass
9ff868a2d4 Upgrade to CodeMirror 2.34 2012-09-19 17:57:38 +01:00
Matt Pass
7a44e5db9a Removed CodeMirror 2.33
Upgrade to 2.34
2012-09-19 17:57:11 +01:00
Matt Pass
9ec77d62cc newTab needs 5px padding at bottom not 1px 2012-09-19 17:38:11 +01:00
Matt Pass
fd974c7bb7 Removed restrictedFile, DOM ready update & tweak
You cannot get access to ICEcoder unless you have logged in, so
restrictedFiles is not needed anymore
Removed it and all instances of it's usage
Only updating pluginsContainer if it's a DOM elem
Change title tag of login/set password screen conditionally
2012-09-19 17:29:10 +01:00
Matt Pass
ed0bad79ad Merge branch 'temp'
Conflicts:
	lib/settings.php

Fixing stupid Github problems
2012-09-19 09:42:57 +01:00
Matt Pass
021a217f2c Version 0.8.5 2012-09-19 09:15:39 +01:00
Matt Pass
0c2ab575a1 Error with Github here, actual change is line 180
Line 180 checks if pluginsContainer exists and if so, sets the innerHTML
2012-09-19 09:14:49 +01:00
Matt Pass
338ca3bb24 if loggedIn conditions removed
User cannot view this file if not logged in, so not logged in handling
no longer needed
2012-09-19 09:10:08 +01:00
Matt Pass
7c718b5131 accountLogin and login related items removed
accountLogin removed as an aliasArray to create
login param not needed on init function
Remove the if & else condition depending on login, this is not done here
anymore
No need to set login, not there anymore
refreshFileManager no longer needs to take action on logging in, user
would already be logged in
2012-09-19 09:02:14 +01:00
Matt Pass
cbeb595f48 if loggedIn condition removed
You cannot view this file if not logged in, so no need to check again
2012-09-19 08:59:08 +01:00
Matt Pass
293d3aa259 Classes removed for login area 2012-09-19 08:55:19 +01:00
Matt Pass
21d1c1f9ba No longer need login area
Logging in now done on seperate screen not here
2012-09-19 08:54:51 +01:00
Matt Pass
ef6bf6e4df Removing of if condition regarding loggedIn
You can only view this file if logged in now, do no need for if or if
else conditions
2012-09-19 08:44:11 +01:00
Matt Pass
aa6cfcc76e No need for if condition here
Removed if checks and else conditions in a couple of places
2012-09-19 08:42:11 +01:00
Matt Pass
924919fb6f No need for if condition now
You can only see multiple results if logged in, so no need for this if
condition
2012-09-19 08:40:37 +01:00
Matt Pass
15b4793d32 bannedFiles changed
Now just hide _coder and ICEcoder folders to hide ICEcoder itself from
the file manager
Users can now see everything else
2012-09-19 08:38:55 +01:00
Matt Pass
22a1305cb1 Cannot view if not logged in
No need to check for loggedIn anymore, you simply cannout view this page
if not logged in
Removed login param from init() function call
2012-09-19 08:35:43 +01:00
Matt Pass
7c3cc891f3 Remove if condition
No longer showing ICEcoder if we're not logged in, so no need for if
else
2012-09-19 08:33:47 +01:00
Matt Pass
158e03b5fd Reworked, so no login, no access to anything
Big set of changes so that you only see a login screen until you're
logged in
Upon receiving a good login password attempt, also now immeditaley
redirect after setting session var
Rearranged a few chunks of code to logically make more sense
SImplified quite a few things by condensing code
Now shows a login/set password screen
Prior to showing this though, if we're setting a password and once
hasn't been set yet, do that and redirect
If we're not logged in or don't have a password plus not on the settings
file, redirect to that to login or set password
2012-09-18 21:12:15 +01:00
Matt Pass
e2aefab2ae SESSION userLevel now loggedIn
Moving away from the idea of multiple user levels, users will either
have full access or no access
Swapped all userLevel session vars to a loggedIn var, which is a bool
Makes things simpler and paves the way towards the new login screen
(before you see any files, code etc)
2012-09-18 08:53:13 +01:00
Matt Pass
4027ecee5a Use strpos instead of strstr
Instead of just finding our dirname within the finalArray using strstr,
now using strpos and detecting if it's pos 0, which is much more
appropriate & reliable.
Example: Looking for /bob/t1.txt for may potentially return a false
positive for finding '/bob' in '/another/bob1/abc' and files therefore
t1.txt ends up in the wrong folder. This false positive only occurs when
the write order of hard drive storage has stored another/bob1/abc before
/bob and therefore retrieval load order can cause this odd, occasional
issue.
Checking for /bob being the start of our finalArray item through
strpos===0 eliminates this possibility.
2012-09-16 10:25:14 +01:00
Matt Pass
b1ca05fec3 Dynamic scoll height, undo URI encoding, use vars
resultsPane id setup. This then allows us to change the height to fill
more of the popup if we don't have replaceAll button at the bottom.
Establish findText in both PHP and JS (they need different sources for
their values unfortunately)
(JS for encoding simplicity by just using input field value and PHP to
get GET value as it can't pick up the parent input field value)
Use findText in both JS and PHP variations where appropriate
2012-09-14 18:02:45 +01:00
Matt Pass
21ef12f143 URI encoding var with ICEcoder: prefix
Don't need cM anymore
Replace apostrophes with HTML entity value
If we have something that should be URI encoded, encode it but also with
an ICEcoder: prefix, so we know we need to unencode it
2012-09-14 17:48:16 +01:00
Matt Pass
6cf1def982 Don't mess with CSS, instead use API to set size
Instead of detecting & altering stylesheets, run through CM instances
and set the size
Needs to be done via setTimeout to avoid timing issues
2012-09-13 18:16:15 +01:00
Matt Pass
2c1e032f38 Set the recommended default of h:auto & o:visible
Not that this works without a container.
Could investigate wrapping in a 100% high container instead?
2012-09-13 18:13:42 +01:00
Matt Pass
56887c9f1f Better checking of open files before loading
New isOpen function added
This receives a file ref (absolute or relative) and checks a relative,
pipe replaced version against the openFiles array
If it finds a match, the file is already open, it will return the array
position, otherwise return false
The openFile function now uses this array when attempting to open a file
It firstly checks if it's open or not, if it is, it will switch to that
tab, otherwise proceed to open it
autoOpenFiles no longer has to check for this, as it's handled by
openFile function anyway
2012-09-13 09:29:27 +01:00
Matt Pass
8715f79251 Reverting ternary statement
Not sure why the ternary version here isn't working, reverted to an if
else
2012-09-11 09:29:34 +01:00
Matt Pass
d8ff32f888 Version 0.8.4 2012-09-09 17:04:52 +01:00
Matt Pass
d0315891b7 UTF-8, ternary switching & condensing code
Added UTF-8 charset metatag
Ternary switching instead of if else
Condensing 2 if statements into 1
Removed old commented line
2012-09-09 17:03:40 +01:00
Matt Pass
a796dc2376 Condensing & improving code
Simplifying & condensing code in a number of areas
Checking for changed content using indexOf
showFileMenu function to handle continuing to show file menu
(used when moving mouse over options to stop it dissapearing)
Condensing multiple <?php ?> blocks
File manager icons now using classes rather than inline styles
Ternary if condition
2012-09-09 16:45:37 +01:00
Matt Pass
eb4cc629a3 File manager icon classes added
Instead of using inline styles
2012-09-09 16:39:57 +01:00
Matt Pass
280320ef9a Now using ICEcoder iconset & default class
Use ICEcoders default iconset to save 7kb
Adjust all CSS BG positions to match this image now
Add ext-file to handle default (unsupported) filetypes
2012-09-09 16:00:19 +01:00
Matt Pass
328ddeb46d Beautify, define filetypes & use default
Unminify for user readability, can uglify in production use
Add fileTypesArray to define supported filetypes
If we have a file without a supported filetype, use ext-file as default
2012-09-09 15:58:06 +01:00
Matt Pass
13df2cb182 Remove icons
Using ICEcoder iconset now to save bytes
2012-09-09 15:50:44 +01:00
Matt Pass
bf73a03125 Simplify building up previousFiles
Using implode to create CSV within JS array block
Added 'v ' to title tag
2012-09-08 19:50:10 +01:00
Matt Pass
8c98e13984 Version number is now numeric only
Removed 'v ' prefix from version number so it can be evaluated in
conditions easier
Hardcoded 'v ' before all places where the version number is shown
No longer need to ltrim 'v ' from the version number
2012-09-08 19:34:25 +01:00
Matt Pass
c159e9326e Now checks for updates by default 2012-09-08 19:23:43 +01:00
Matt Pass
662bd1188d ltrimming 'v ' on version num, put back in
Needed to leave the ltrimming of 'v ' from the version number, put back
in
2012-09-08 19:23:22 +01:00
Matt Pass
b3e57075de No longer trimming 'v ' & clearer syntax on cmv
The latest version number doesn't have a 'v ' prefix now
Altered the syntax when checking cmv to make it shorter & clearer
2012-09-08 19:08:18 +01:00
Matt Pass
c6a08896f0 Condensing code, UTF-8 and messages on load
Check for IP address or * in array via in_array
Shorten long vars to $icv and $cmv in checking for updates
UTF-8 char set added to head
$updateMsg set if there is a newer version and this triggered onload
2012-09-08 18:50:24 +01:00
Matt Pass
8cfe6b557c Removing spaces from 4 x CSVs before use
Before saving the values, remove spaces from CSV values provided by user
Also covering the same thing in the 4 x session arrays & arrays that are
created
2012-09-08 17:23:58 +01:00
Matt Pass
8ce1da9485 Shortening a few vars and 2 x if conditions 2012-09-08 17:15:17 +01:00
Matt Pass
c44b1689b3 Remove padlock to simplify look
No longer showing padlock next to hidden files, looks cleaner & simpler
2012-09-08 15:09:43 +01:00
Matt Pass
dcf2571437 Show found instance count
Now showing number of times our find string is found in a file
2012-09-08 15:05:30 +01:00
Matt Pass
c9aca08d4e readdir created theme array, fix to for counter
Instead of using a hardcoded array, we are now generating this from CSS
files in the CodeMirror theme folder
Need to count the array length, not 1 less than it (2 places)
2012-09-08 15:04:06 +01:00
Matt Pass
fe8486d456 Switching to use new filetypes
files-arrow.gif now .png
nav-bg-gif now .jpg x 2
2012-09-08 15:00:27 +01:00
Matt Pass
b31dc5fb16 Saved bytes by using a JPG instead of GIF 2012-09-08 14:59:11 +01:00
Matt Pass
160ee475fd Removed, no longer wanted next to files 2012-09-08 14:58:20 +01:00
Matt Pass
dca9e6a88a GIF now a PNG to save bytes, also more subtle
Mid-grey instead of white
2012-09-08 14:57:11 +01:00
Matt Pass
4172f7d157 Don't like this theme, removed 2012-09-08 14:56:06 +01:00
Matt Pass
7a2275b3fb Resaved as web version, smaller 2012-09-08 14:55:18 +01:00
Matt Pass
76ac21a92d info now readme, better & shorter description 2012-09-08 14:54:46 +01:00
Matt Pass
f21012202f Removed file, not needed
Don't need to include this in ICEcoder really
2012-09-08 14:54:08 +01:00
Matt Pass
c0eb4172a2 Version no now at v 0.8.3 2012-09-07 17:31:58 +01:00
Matt Pass
2ed832c729 Param adjust and setting up functions for process
Not refering to a number when calling replaceInFileSingle, instead set
file ref as a string param
replaceInFileSingle simply sends the fileRef and find & replace values
to the new replaceInFile function so it can begin it's process
replaceInFilesAll runs through all files in the foundArray and calls
replaceFileInSingle repeatedly with the fileRef
When it's finished running through all files, it hides the blackMask,
returning to the usual view
2012-09-07 17:31:25 +01:00
Matt Pass
bfbf84ca24 New action process added for replaceText
Upon replaceText being needed, we detect if we have a high enough
userLevel and if it's writable, if not provide an appropriate message to
the user
Otherwise - read, replace and save the new content with the find/replace
combo requested
Clear the server message and item from the queue
2012-09-07 17:25:56 +01:00
Matt Pass
5747825c14 replaceInFile function added
New function added which takes 3 params for fileRef, find & replace
Adds a new job to the server queue with an action of replaceText and the
3 params
Also adds a serverMessage
2012-09-07 17:21:55 +01:00
Matt Pass
67cbc08b60 Don't autoload files that are already open
Check if files are already opened and if so, skip autoloading it
2012-09-07 07:09:16 +01:00
Matt Pass
be0c8088ce Make ICEcoder avail in PHPGrey, check res & ban
Make global ICEcoder var avail to be used in PHPGrep function
If the user isn't logged in, check if the file we're considering showing
is a restricted file and if so set rFile = true
Syntax fixed - swapped strpos params round (needle, haystack)
2012-09-07 07:09:00 +01:00
Matt Pass
c36b7d842d iceRoot & docRoot set if level 10
Available for use if user is logged in
2012-09-07 07:08:42 +01:00
Matt Pass
74534641aa Extra param on webkitRequestFullScreen needed
Text input fields in fullscreen mode wouldn't allow alphanum chars. You
need this extra param to make that work OK.
2012-08-30 18:02:41 +01:00
Matt Pass
f7e1ce7b50 Find in files done, replace in files half done
Now detects if we're finding in filenames, files or otherwise, open docs
Extra else condition to handle finding in files
Uses a Grep like technique to recursively find in files and build up a
string
(Need to get the exclusion of restricted and banned files working)
It then displays the results in the results display DIV once we have a
list build up
File paths are dropped into foundArray
These can then be used by 2 x new functions to replace and replace all
(This final part is to be done)
2012-08-30 08:03:40 +01:00
Matt Pass
dab73a3eb2 zip is now a restricted file
Incase it has contents where you don't want to give public access
2012-08-30 07:59:13 +01:00
Matt Pass
24fe2bb81e serverType defined in settings and in a beter way
Instead of detecting a : in the path, now detect by server software name
This is now being done in settings file so it can be used elsewhere too
2012-08-30 07:58:07 +01:00
Matt Pass
1cd1529e28 Dochub icon and plugin ref added 2012-08-29 10:19:17 +01:00
Matt Pass
72386c94a9 Fix to selecting char range 2012-08-28 07:50:55 +01:00
Matt Pass
262efb40bb CodeMirror 2.33 upgrade and v0.8.2 2012-08-27 16:02:54 +01:00
Matt Pass
85dfe6f5fa CodeMirror 2.33 added
Upgrade from 2.32
2012-08-27 16:02:32 +01:00
Matt Pass
53cee56a9d CodeMirror 2.32 removed
Upgrade to 2.33
2012-08-27 16:02:16 +01:00
Matt Pass
76224c40fe ICErepo plugin added
Not quite finished yet, but an early version added for use
2012-08-27 16:01:58 +01:00
Matt Pass
f12b4914e6 Ambiance theme removed
Couldn't justify 26kb when all other themes are 1-3kb
2012-08-27 16:01:38 +01:00
Matt Pass
989b0a602d Remove font size from theme
Should be set in CodeMirror class if different font-sizes are wanted
2012-08-15 11:35:42 +01:00
Matt Pass
7664f1ea74 Ignore _coder and ICEcoder dirs 2012-08-05 15:36:20 +01:00
Matt Pass
1d3d5fa56b Version number update to v 0.8.1 2012-08-05 15:32:31 +01:00
Matt Pass
f69edba862 Set the activeLineBG colour on theme choice
#ccc for light BG themes, #000 for dark themes
2012-08-05 15:24:08 +01:00
Matt Pass
20bd4d81ec Conditional activeLineBG color
activeLineBG color is #ccc for Eclipse, Elegant and Neat themes #000 for
all others
Set the default text color as #000 so Eclipse, Elegant and Neat themes
display fine
2012-08-05 15:22:50 +01:00
Matt Pass
aeac737c84 Set color #000 as default in CodeMirror class
Means the Eclipse, Elegant and Neat themes display OK
2012-08-05 15:20:07 +01:00
Matt Pass
bea1afc01c 6 new shortcuts added
New shortcuts added for next/previous tab, move line up/down, new tab
and close tab
switchTab function now accepts a noFocus param to stop focusing on the
document
Fix to set the visibility on the content area when starting a new tab,
wasn't showing otherwise
Functions added for nextTab, previousTab, moveLineUp and moveLineDown
(Other 2 functions newTab & closeTab already exist)
helpScreen taller to accomodate the 6 new shortcuts
2012-08-05 14:32:30 +01:00
Matt Pass
8cbc5d79d4 Overriding CTRL+Up & Down 2012-08-05 14:18:49 +01:00
Matt Pass
d51f050d6e 6 new shortcuts added
Shortcut info added for move line up/down, new/previous tab, new tab &
close current tab
Minor text adjustment to heading
2012-08-05 14:18:07 +01:00
Matt Pass
b485e1ce4e Icons moved/renamed and ICErepo plugin added
Adminer & Zip-It! have their icons renamed to icon.png now, URLs to them
have changed.
Also renamed the title for Adminer to this
New plugin icon added for ICErepo as a placeholder
Minor CSS adjustments
2012-08-03 13:06:36 +01:00
Matt Pass
5de12ce651 ICErepo plugin placeholder added
Some basic info and link to ICErepo project on Github
Icon also added for this plugin
2012-08-03 13:04:38 +01:00
Matt Pass
2d455a2fcf Icons for Adminer & Zip-It moved & renamed
Renamed icons to icons.png and placed directly in the relevant plugin
folder
This means they're more isolated and have easier distribution, setup etc
2012-08-03 13:01:20 +01:00
Matt Pass
7b5f5ae5ce Reset progress bar to 0% on reshowing load screen
Move webkit & moz animation CSS declarations to the style attribute on
progressBar span
Give the span an ID and on showing the loadingMask again, clear the
declaration
4ms later start it again so it starts from 0% again
2012-08-02 15:29:53 +01:00
Matt Pass
853981b3b0 Graceful & discreet reload on not being ready
If for some reason the createNewCMInstance function isn't ready &
available, reload the iframe containing file-control.php which works
with the issue by giving more time and leave a note in the console.log.
Also move everything to do with the the loading process into the
successful part of the if condition.
2012-08-02 13:45:02 +01:00
Matt Pass
2449a059f0 Set layout on load and apply everything in 4ms
Redo layout on loading of file to avoid occassional broken layout issues
Wrap all load processes in a 4ms timeout to avoid DOM & JS availability
errors
2012-08-02 10:38:19 +01:00
Matt Pass
d1e2cf4850 Only apply height if we have the stylesheet
Check for cMCSS first before changing CSS height property
2012-08-02 10:36:10 +01:00
Matt Pass
e89a80ea1a Version no update to v0.8.0 2012-08-02 07:48:29 +01:00
Matt Pass
ef44be8240 fileLoc defined by saveType, error catching no /
If we're saving a new file, fileLoc is the file location otherwise it's
empty
Error catching given filenames not beginning with a / by prefixing with
one
2012-08-02 07:43:57 +01:00
Matt Pass
81fc8495b2 openFiles array fixes
renameTab now targets the right array position (tabNum-1)
updateFileManager now adds a / in to the files path ref
2012-08-02 07:40:58 +01:00
Matt Pass
3dc7c62559 Another huge path realignment & many improvements
No need to conditionally define $file on action/contents
$file is now either existing or new filename
Converted to fullpath and fileLoc and fileName established from this
Extension checking on fileName now not full path ($file)
Variable reassignment, fileName now used much more
Path realignments in many areas
Big chunks of code removed, simplified or made singularly available
Better error handling & code optimisation/shortening
2012-08-01 20:28:57 +01:00
Matt Pass
41e99372f7 Adding / for root location and on span 2012-08-01 20:16:30 +01:00
Matt Pass
9ac6ce909d Huge path realignments
Now making $file the common filename (instead of $saveFile)
This is changed to a full path now as we receive a relative path
$fileName and $fileLoc chunks worked out from this
isset catching on newFileName before looking at value
Renaming the tab on saving new file
htmlentities wrapped around loaded file on overwrite collision
Not giving away fullpath info on unwritable files if we're not logged
Conditional getInput dialog prompt
Simplified code in quite a few areas
2012-08-01 07:58:38 +01:00
Matt Pass
9eebbc011e Path relaignment, no href and perms ID updating
Replacing pipes with slashes in oldName
Not setting href on a tag to stop snapping to top
Path references should be location + "/" + file (or pipe)
Also updating perms ID ref
2012-08-01 07:35:41 +01:00
Matt Pass
8c62d3eb28 No longer using href="#"
This is to stop the iframe snapping to the top when clicked on.
2012-08-01 07:07:21 +01:00
Matt Pass
7576511841 Passing relative not absolute path
No longer passing the full path to th chmod function, now just the
relative path
2012-08-01 07:05:56 +01:00
Matt Pass
58423bfd18 CSS on a tags in fileManager now have pointer
As I'm no longer setting "#" on the href tag (was snapping to top of
iframe)
2012-08-01 07:04:58 +01:00
Matt Pass
aae759c901 Path fixes, setting new file openFiles value
On adding a new file, need to also set the openFiles array value to
match the newly given filename
2012-07-30 17:28:27 +01:00
Matt Pass
4fe333e335 Dropped Opera support & removed some prefixes
Dropped all Opera related -o prefixes as I'm not supporting Opera now.
Too few users, too many headaches.
-webkit & -moz box-shadow prefixed versions removed now box-shadow can
be used by itself
2012-07-30 17:21:31 +01:00
Matt Pass
7634f9c6d5 Path tweaks to fix errors & correct perms shown
No need to add add / to end of getInput dialog default
Double // replaced with / in error catching
Correct perms shown on update of file manager; 705 on folders, 644 on
files
if condition block tabbed to right depth, for syntax clarity only
2012-07-30 13:13:35 +01:00
Matt Pass
6dd7c4abeb New folder perms now 705 & replacing //
Newly created folders no have 705 perms and / is r'trimmed from docRoot
(as iceRoot is prefixed with a /)
The short URL used in getInput prompt dialog now has // replaced with /
to error catch
2012-07-30 13:09:01 +01:00
Matt Pass
f1aa201425 Realigned and reworked adding & removing files
Due to new DOM structure and relative paths how we add new files &
folders, including how they're added into empty folders has been
realigned and reworked.
2012-07-30 07:56:06 +01:00
Matt Pass
964449660d Send docRoot relative path var back to function
Was previously passing back the full path to updateFileManagerList. Now
removing the docRoot portion and so now passing back a relative path.
Removed old shortURL starts substr, no longer needed.
2012-07-30 07:53:48 +01:00
Matt Pass
5b3af56bd8 Remove new line after span
To keep DOM structure simple and tie in with JS manipulations
2012-07-30 07:50:47 +01:00
Matt Pass
4c1acb8206 All icons now DIVs not images
About the same amount of code needed but now using a single PNG
spritesheet which gives about a 5k saving over seperate files.
2012-07-29 14:05:23 +01:00
Matt Pass
a9dd713809 minFilesW adjustment & not setting account
minFilesW should be 14px not 15px (could just about see edge of icons)
Not setting account width. Wasn't really necessary and caused icons to
collapse into smaller space when file manager reduced in width.
2012-07-29 14:02:25 +01:00
Matt Pass
d67c25aab5 Ternary shortening & other optimisation
Ternary statements shortened where possible
Account now has it's width set too when setting layout
fmLock now moved into another DIV container, adjust marginLeft value
No need to add last argument to substr as we want up to the end
Few hex codes shortened
2012-07-29 13:51:39 +01:00
Matt Pass
7a0f8c5d98 Spritesheets now used for file manager
Instead of using seperate files, there is now one pNG spritesheet and
these CSS updates to show icons within DIV containers, just as per the
filetype icons in the file manager. Result has been about 5k of bytes
saved.
Lock class removed, now a DIV like the other icons.
2012-07-29 12:58:26 +01:00
Matt Pass
46cd326f09 Using PNG now instead of GIF
Gif file removed, now just a PNG is needed
2012-07-29 12:55:56 +01:00
Matt Pass
08898a7334 Newly named file
Now file-folder-icons.png instead of the previously named
file-manager-icons.png. This is because that filename is now taken by a
new file for the save, open etc icons.
2012-07-29 12:54:35 +01:00
Matt Pass
f2facff418 Refresh icon now using DIV & CSS spritesheet
Also has title now like other files & icons
Files/folders now now use file-folder-icons.png for icons
2012-07-29 12:53:18 +01:00
Matt Pass
ef55c48dd1 File manager icons now in 1 PNG
Individual PNG file icons placed into single PNG,
file-manager-icons.png. Much like how the icons are shown for filetypes,
this uses a stylesheet to show the icon within a DIV container's BG.
Result is a few kilobytes saved and having all icons in 1 file.

Padlock.png kept as a single PNG for now as used against restricted
files/folders. May use the same DIV CSS stylesheet technique in future.
2012-07-29 12:49:24 +01:00
Matt Pass
f9411f0500 Removed BIRME plugin, upgraded Adminer
BIRME (Batch Image Resizing Made Easy) plugin link removed as I never
use this and it's not exactly dev related. Icon removed too.
Adminer upgraded to 3.4.0.
2012-07-29 12:45:22 +01:00
Matt Pass
26e54dc2a2 No longer need .gif version, use .png 2012-07-29 12:43:10 +01:00
Matt Pass
a6891e1817 Upgrade to newer version of Adminer
Version update from 3.3.3 to 3.4.0, saving of 5k too!
2012-07-29 12:41:07 +01:00
Matt Pass
de35d2fe15 Wrapped htmlentities around $loadedFile
Stops conversion of entities such as &amp; to &. Obviously we want it to
be exactly the same as the loaded file and this should ensure that is
the case.
2012-07-28 13:47:41 +01:00
Matt Pass
eeffd207be docRoot being passed in, delimiting on asterisk
Recently started using $docRoot in place of the $_SERVER version but
this var isn't available within the class. Now being passed in so it can
be used.

Also now exploding the exclude list on asterisk rather than comma to
avoid problems elsewhere.
2012-07-28 13:20:02 +01:00
Matt Pass
047daf4e44 ZipIt plugin reintegrated with error corrected
The exclude value in the URL's querystring had a list of exclude items
previously seperated by comma. However, we're exploding the whole plugin
by commas and because of this, the exclude list ended up becoming
subsequent array values, getting caught up in the mix.

This in turn caused 1000's of errors p/s as it ended up with a NaN value
which ended up as 0 (or -1)? and a very very quick, erroneous
setInterval.

Now delimiting by asterisks which looks neater, makes more sense
visually and solves the problem. Commas now only seperate the 6 array
values.
2012-07-28 13:17:38 +01:00
Matt Pass
b0012bee27 Value not in rtrim but not needed anyway 2012-07-27 13:56:21 +01:00
Matt Pass
f81ea9fe57 settings include,
Inclusion of settings.php moved to start to be like other PHP files
docRoot replaces $_SERVER equivalent
$path now gone in favour of specifying the file path chunks we need
Simplification in a few areas that previously used $path
Other areas of code also simplified for clarity
All file refs (links, ids etc) now relaitive to doc root. This means
less code and doesn't expose full server paths which is a good security
tweak.
2012-07-27 12:17:39 +01:00
Matt Pass
5f5ebd12a4 shortURLStarts gone, close highlights & tweaks
Have removed shortURLStarts from everywhere, too problematic
Close button highlights on mouse hover
File refs used client side are relative/local now
(Means less messing with strings and better security)
fullPath now also gone for same reason
2012-07-27 12:10:47 +01:00
Matt Pass
a63b9e3ff4 Many session & setting tweaks & simplication
Only start a session if we haven't yet got a session object
(Avoids warnings from PHP)
Define our settingsFile, used in many places now
serverRoot gone, no longer needed (this is now docRoot)
Specify versionNo, codeMirrorDir & cMThisVer here now
(This means we don't overwrite users config settings each time we change
version no and they pull from Github, overwriting all their settings)
These 3 vars prefixed to the ICEcoder settings array
settingsNew now created from array & for loop, much simpler
Same for 4 session vars, created in similar way
docRoot & iceRoot now defined here
(As settings.php is loaded by just about every PHP file, they are now
available everywhere)
These, plus user level, security vars, IP address code moved to all be
together
settingsContents 1 & 2 now just settingsContents
saved files in previousFiles & last10Files now docRoot prefixed, making
them full paths to files
Clearer wording & other minor tweaks
2012-07-27 12:05:37 +01:00
Matt Pass
d256b35a67 file & root alts, shortURLStarts gone & onLoad
docRoot defined in settings.php now so no need to set
docRoot swapped for iceRoot in a few areas (there were kind of one and
the same before, ugghh)
Conditionally prefix file refs with $docRoot and/or $iceRoot if
different paths are needed
Removed shortURLStarts - too inefficient & problematic
Only on winow load begin to createNewCMInstance
(In the rare case the files frame loads before the editor frame)
Code simplified in a few areas
2012-07-27 11:52:40 +01:00
Matt Pass
a3e553c04f root not prefixed any more
As root is not prefixed with the doc root anymore no need to replace
Better wording in title tag
2012-07-27 11:43:42 +01:00
Matt Pass
dadf055a54 settings tweaks, fullPath alts & clearer wording
Now loading settings.php rather than config.php so we can use vars such
as docRoot
Using docRoot rather than the $_SERVER version
ICEcoder root now shows full path rather than just root portion
fullPath no longer needed in JS clickable link
As full paths are passed through, remove this from displaying to user
(So they get a doc root relative version)
Clearer wording in a few areas
2012-07-27 11:42:31 +01:00
Matt Pass
8d2f7da823 shortening to use docRoot
Now using docRoot var to simplify things
Version no change & note on keepLastDays
2012-07-27 11:34:37 +01:00
Matt Pass
61a6c86ae2 fullPath replaced by docRoot
fullPath is replaced by docRoot in the JS link to open file
(Means it's accessable from any file tree root now as it's a full path)
No need to prefix on fileRef
Minor text tweak
2012-07-27 11:33:33 +01:00
Matt Pass
2c958deebf Realigning fileName, serverRoot is now docRoot
fileName is now prefixed with docRoot & iceRoot
Means we accept relative paths and prefix server side
serverRoot is now docRoot
2012-07-27 11:31:58 +01:00
Matt Pass
0b4871c299 3 x vars gone, now iceRoot instead
shortURLStarts now gone, was very ineffecient to use
basePath gone also gone, not needed
fullPath is now iceRoot, clerarer name to use
No need to substr in rightClickedFile
Minor text tweaks
2012-07-27 11:30:21 +01:00
Matt Pass
1fa86272d6 version nos moved, root change & ZipIt removed
versionNo, codeMirrorDir & cMThisVer now moved to settings.php
These 3 settings are prefixed to array after initiated
This means this file doesn't need to get updated each time there is a
version no change. This in turn means that user settings aren't
overwritten each time a release made and pulled from Github
root setting is now the relative path from the doc root only, not
prefixed by it (ie, full path)
ZipIt plugin removed until I figure out the issues with it after
changing settings via settings screen
2012-07-27 11:26:14 +01:00
Matt Pass
97f430b2b7 shortURL changes
shortURL is now basePath with shortURLStarts conditionally removed from
start
2012-07-25 19:10:08 +01:00
Matt Pass
9c6be944fc Conditional file highlighting, custom path tweaks
Now only highlight files in File Manager if link exists
shortURL is now basePath conditionally with shortURLStarts removed from
start also
Files stored in config.php are now full paths
(So autoOpenFiles function now no longer needs to prefix this)
2012-07-25 19:09:05 +01:00
Matt Pass
f04cdad89d basePath variable
To define the document root level of the server
2012-07-25 19:00:15 +01:00
Matt Pass
862777f067 New var to define if we are OK to open last files 2012-07-25 17:44:00 +01:00
Matt Pass
4eb6ffc618 openLastFiles triggering & cursor error catching
openLastFiles function now triggered from:
init (this is for reloads of the browser) and
refreshFileManager (for logins)
Also now only changing cursor if we have iFrames in DOM
2012-07-25 17:43:35 +01:00
Matt Pass
b75118b4c2 Set previous files array on login
Also don't trigger autoOpenFiles() here
(Triggering in 2 other places in coder.js now)
2012-07-25 17:40:08 +01:00
Matt Pass
529f7198b1 replace indexOf with lastIndex on shortURLstarts
causes probs if you have the same term more than once in your path
(ie, var/www/mysite/www), previously took first www
Now takes last one and solves path issues in quite a few areas
2012-07-24 13:41:08 +01:00
Matt Pass
5d08a963d5 Fix to ternary statement
Was causing probs so reverted to standard if statement for now
2012-07-24 13:38:57 +01:00
Matt Pass
0ee2193b3c v0.7.9 and upgrade to CodeMirror 2.32 2012-07-24 07:25:18 +01:00
Matt Pass
e6bc582e16 v0.92, set perms before del & unlink fix
set 0777 perms on the file before deleting
$entry needs to be $backup
2012-07-24 07:24:45 +01:00
Matt Pass
6d23133101 Upgrade to CodeMirror 2.32
IE fix on linewrapping bug
2012-07-24 07:23:16 +01:00
Matt Pass
11c3d77513 Remove CodeMirror 2.31
Updating to 2.32
2012-07-24 07:22:33 +01:00
Matt Pass
d9baa76804 ZipIt now backs up every 30 mins and dels >7 days
Now backs up every 30 mins instead of 10 mins
New var defining no of days to keep
Location & filename now seperate params
keepLastDays var passed through as well now
This is used when scanning backups dir
Any files older than this no of days removed
All zip files created are perm 777 now so you can manually delete
2012-07-23 08:06:15 +01:00
Matt Pass
88cd0996ec Alter top CSS property to be 10px now not 80px
Because X & Y positions now picked up in iFrames
The top pos doesn't need so much added to it
2012-07-22 19:10:14 +01:00
Matt Pass
93726f9bb3 No need for note now in settings screen
Users can now update in settings screen
2012-07-22 17:35:37 +01:00
Matt Pass
fb7eccee3d Can now update root value in ICEcoder array 2012-07-22 17:33:01 +01:00
Matt Pass
7fb596a744 Syntax error on ternary false condition 2012-07-22 17:30:48 +01:00
Matt Pass
ab43714359 full now ICEcoder root 2012-07-22 17:26:53 +01:00
Matt Pass
4928b0087e New file manager root setting & slight shuffle
Tab width now next to theme dropdown
Slight adjustments to sizes & layout to accomodate new option
Option for file manager root also added
CSS for plugins textarea not as high, also auto overflow
2012-07-22 17:25:24 +01:00
Matt Pass
9d23e4cfba if condition checks for node existence first 2012-07-22 17:17:13 +01:00
Matt Pass
57fd479a9c Editor now 100% h+w using CSS, JS only on height
Width and height now 100% rather then 100px
This is to avoid occasional issues with non resizing on login
No longer setting the width, no need
(Could also leave the height to 100% but it's only as high as the no of
lines in the document, looks a bit weird)
2012-07-21 14:11:12 +01:00
mattpass
91e30ef9bd Merge pull request #66 from martinhbramwell/patch-1
Declare vars before adding values to avoid PHP notice errors
2012-07-20 13:04:40 -07:00
Martin 'Hasan' Bramwell
8af42aa7ac To fix https://github.com/mattpass/ICEcoder/issues/65 2012-07-20 14:18:19 -05:00
Matt Pass
b9921e155b Backups folder added, text file as a placeholder
Small text file added to this folder giving info on ZipIt backups
Wanted the backups folder in the repo as standard
Added note to readme file to mention adding perms on this folder too
(Saves asking users to give perms on parent ICEcoder dir
2012-07-20 17:54:37 +01:00
Matt Pass
d7ed877ebd Added note about setting perms on backups folder
Used by ZipIt and unable to save backups if it can't create the folder
in the first place
2012-07-20 17:52:25 +01:00
Matt Pass
436630b5c8 Now using CodeMirror 2.31 & new root setting
Upgraded Codemirror from 2.3 to 2.31
New setting in ICEcoder array, root which defines the tree root
2012-07-20 17:48:17 +01:00
Matt Pass
5d2edc911d serverRoot, ternary shortening & using tree root
docRoot is now serverRoot here
Ternary shortening in quite a few areas
Using user defined tree root now instead of document root
2012-07-20 17:45:19 +01:00
Matt Pass
f0dcf68f8f Ternary shortening on 3 x areas 2012-07-20 17:31:30 +01:00
Matt Pass
caca296562 Ternary shortening htmlTagArray & getcMInstance
Reduced & simplified code to get the same result
2012-07-20 17:30:27 +01:00
Matt Pass
948978b5e1 docRoot is now the tree root, simplified saveFile 2012-07-20 17:25:51 +01:00
Matt Pass
a1c7a54172 docRoot now serverRoot here & ternary shortening 2012-07-20 17:18:10 +01:00
Matt Pass
38254f51d1 Combined CM libs, ternary statement & root info
3 x util libs (foldcode, searchcursor & match-highlighter) now in
codemirror-compressed.js
(this means less files and saves around 7k of data)
Ternary statement now used to specify theme CSS file
ICEcoder root shown which is the file manager tree root
2012-07-20 17:16:10 +01:00
Matt Pass
fe8c94bb90 Shortened 2 ternary conditions 2012-07-20 17:02:02 +01:00
Matt Pass
891aff80ed Shoter ternary statements, fullPath = serverRoot
Simpler statements now for a couple of ternary conditions
fullPath in JS is now serverRoot in PHP
(So you can define your own tree root)
2012-07-20 16:56:09 +01:00
Matt Pass
cfa77ab0a4 Clarifying code & using configurable root
Couple of ternary conditions shortened
$path equals a new ICEcoder setting which defines the FM tree root
(Means you can set your own tree root now!)
Broke long echo statement into seperate lines
Shows root name or [ROOT] if it's the server root
2012-07-20 16:53:56 +01:00
Matt Pass
7ecbc2c407 Upgrade to CodeMirror 2.31 & More Compression
CodeMirror upgraded from 2.3 to 2.31
3 x util JS libs now included in codemirror-compression.js
Means we no longer need /util folder and 3 x files in it
Also saves around 7k in filesize
2012-07-20 16:42:13 +01:00
Matt Pass
f185438b08 Remove CodeMirror 2.3
Upgrading to 2.31
2012-07-20 16:40:16 +01:00
Matt Pass
d413370104 Handling the ignoring of .. path differently
No longer using rtrim
Added as new condition in if statement
2012-07-20 07:49:07 +01:00
Matt Pass
2b54b192ed 'Zipping Files' is now the message
Removed 'open' from server message
(as we're zipping more than just open files now)
2012-07-20 07:47:20 +01:00
Matt Pass
0296379cfa Fix to when we can show cursor & filesize shown
Now only changes cursor if both iframes are loaded
unitSize is shown in 2 decimal places now if unit type is megabytes
2012-07-13 18:10:01 +01:00
Matt Pass
e4e9217d84 Putting server vars into $ICEcoder array
All server variables such as codeMirrorDir, visibleTabs etc now in
$ICEcoder array
This is so we have a single object to contain all settings, just like
the JS equivalent
2012-07-13 18:05:28 +01:00
Matt Pass
bf06a64734 Version no update to v0.7.8 only 2012-07-11 13:40:24 +01:00
Matt Pass
7429ec9576 New var to determin if ICEcoder is ready
False to start, true on init
Only consider resizing file manager width if it's true
2012-07-11 13:34:06 +01:00
Matt Pass
176c8fc557 Only get mouseXY & test FM resizeon ICEcoder obj 2012-07-11 13:33:08 +01:00
Matt Pass
d2e5476432 Tweaks to getMouseXY & dragCursorTest
Now passing through the area the function was triggered from
If it's not the top strip, add on 40+50 px
If it's the editor, add on the filesW value
This gives us an XY position across the whole of ICEcoder
Icon applied to top, content & filesFrame now
2012-07-11 13:20:10 +01:00
Matt Pass
c53b0ba3ad Detect mouse down, up & move plus test FM resize
Setting up mouseDown value as bool on down & up events
Mouse move now gets X & Y pos along with determining area event
triggered in
Also then determins if we can resize file manager width & show w-resize
icon
All of this applied to HTML tag so at hightest DOM level
2012-07-11 13:16:54 +01:00
Matt Pass
e2137b3503 GIF icon changed
Given it's own icon, previously looked too much like JPEG icon
2012-07-10 17:53:58 +01:00
Matt Pass
dc051e993b closeTab CM 2.3 fix & new params
Fix to closing tabs as now using CodeMirror 2.3
oldName & newName params passed to renameFile
This is used by the replace in filenames function, but can also be API
updateFileManagerList now has new param
This again is so it can be used by find/replace, passed from
file-control.php
2012-07-10 07:17:37 +01:00
Matt Pass
a0dbbbe397 Multiple results working with find in filenames
Title outside of results DIV, which is now the scrollable container
Rename all/replace all button wording
Handling both cases now, find & documents and filenames
The latter works by scanning IDs and building up array
Find in filenames also handles selected filenames as well as all
filenames
Can rename singularly, rename all or click link to open file
2012-07-10 07:08:25 +01:00
Matt Pass
a5d473c546 h1 now outside of resultsPane, resultsPane scolls 2012-07-09 07:43:13 +01:00
Matt Pass
2204a15350 Focus on password box on load, style BG change 2012-07-09 07:36:25 +01:00
Matt Pass
971cd573fc Now passing back oldFileName to updateFileManager
Allows for API calls now not using rightClickedFile
2012-07-09 07:35:45 +01:00
Matt Pass
d3ba467e6a Style improvements & removing plural
Darker password box plus no border now
Darker login button
No longer want plurals DIV, class not needed
Minor changes to find box height & adding margin-right
Similar changes made to settings screen
2012-07-09 07:34:09 +01:00
Matt Pass
eb68960dca No longer using plurals 2012-07-09 07:13:50 +01:00
Matt Pass
1297705b53 Version no now 0.7.7 and using CodeMirror 2.3 2012-07-07 14:37:19 +01:00
Matt Pass
1a81c0b918 Focus on password field and CSS DOM changes
Now focuses on the password field if you're not logged in
Width now set on the .CodeMirror class and not .CodeMirror-scroll
Removed visible & hidden classes so no need to update this
Hiding & showing instances happens in better way now with CodeMirror 2.3
(So no longer applying theme + hidden/visible to theme)
(Instead changing display none/block on wrapper and applying theme with
setOption only)
2012-07-07 14:36:48 +01:00
Matt Pass
dd351eeaa5 CSS changes to work with new DOM
CodeMirror 2.3 has new DOM, so now setting width on .CodeMirror class
No longer need visible and hidden classes
2012-07-07 14:32:25 +01:00
Matt Pass
c505f4249d Title tooltip to show path
Hover mouse over files & folders to see path from root
2012-07-07 14:21:43 +01:00
Matt Pass
26340a0d54 Width now set on .CodeMirror class & new theme
New CodeMirror 2.3 structure means you have to set width on .CodeMirror
class
.CodeMirror-scroll is for height now only, this is because it's a fake
scroller
New theme added - Vibrant Ink
2012-07-07 14:20:59 +01:00
Matt Pass
6779ec9ab8 Upgrade to CodeMirror 2.3
Has reworked DOM for better scrolling of big docs
However, this includes changes to how scrolling is handled
(So need to work with new DOM instead)
2012-07-07 14:17:31 +01:00
Matt Pass
9a4944f91d Removed CodeMirror 2.25, using 2.3 now
Upgrade to CodeMirror 2.3
2012-07-07 14:15:12 +01:00
Matt Pass
5a2f004c20 CSS structure display changes & find in files QS
No longer using open & closed classes (italic text on open dirs)
This is because we have new icon to show open dirs
Reworked code to handle new UL & LI structure
Target querystring passed through if we're finding in files or filenames
2012-07-05 23:06:26 +01:00
Matt Pass
939eed7b3e open & closed classes now removed
No longer want italic on open dirs, we have icon to indicate this
2012-07-05 22:58:45 +01:00
Matt Pass
e7515b0fdb 2nd dir icon, refresh icon fixed position, UL fix
PNG image now has 2nd state for open dirs
.refresh class is now fixed position to always be visible
UL has margin-left set also to resolve CSS issues
New dirOpen:before pseudo class to show open dir icon
All other icon X position refs moved along 16px
2012-07-05 22:39:29 +01:00
Matt Pass
3eb97098bb Completely rewritten dir tree generator
Previous dir tree was working via the usual recursive method of scandir
The code was problematic as it was creating 3 dir trees and had an
incorrect UL structure
This now works in a completely different way, using PHPs inbuilt
iterators
Performance results are visibly noticable as file manager loads much
quicker
Tests show around a 100% increase in efficiency on servers with 1000's
of files & folders
There is also much less code, less repitition and it's much cleaner to
work with
The incorrect UL & LI structure has now been fixed and is valid
Loads of junk and redundant code removed also
2012-07-05 22:33:13 +01:00
102 changed files with 11452 additions and 4383 deletions

3
.gitignore vendored Normal file
View File

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

View File

@@ -1,6 +0,0 @@
# CodeMirror 2
CodeMirror 2 is a rewrite of [CodeMirror
1](http://github.com/marijnh/CodeMirror). The docs live
[here](http://codemirror.net/doc/manual.html), and the project page is
[http://codemirror.net/](http://codemirror.net/).

File diff suppressed because one or more lines are too long

View File

@@ -1,126 +0,0 @@
.CodeMirror {
line-height: 1em;
font-family: monospace;
}
.CodeMirror-scroll {
overflow: auto;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}

View File

@@ -1,191 +0,0 @@
// the tagRangeFinder function is
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var nameChar = nameStartChar + "\-\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
var lineText = cm.getLine(line);
var found = false;
var tag = null;
var pos = 0;
while (!found) {
pos = lineText.indexOf("<", pos);
if (-1 == pos) // no tag on line
return;
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
pos++;
continue;
}
// ok we weem to have a start tag
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
pos++;
continue;
}
var gtPos = lineText.indexOf(">", pos + 1);
if (-1 == gtPos) { // end of start tag not in line
var l = line + 1;
var foundGt = false;
var lastLine = cm.lineCount();
while (l < lastLine && !foundGt) {
var lt = cm.getLine(l);
var gt = lt.indexOf(">");
if (-1 != gt) { // found a >
foundGt = true;
var slash = lt.lastIndexOf("/", gt);
if (-1 != slash && slash < gt) {
var str = lineText.substr(slash, gt - slash + 1);
if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
found = true;
}
else {
var slashPos = lineText.lastIndexOf("/", gtPos);
if (-1 == slashPos) { // cannot be empty tag
found = true;
// don't continue
}
else { // empty tag?
// check if really empty tag
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
if (!str.match( /\/\s*\>/ )) { // finally not empty
found = true;
// don't continue
}
}
}
if (found) {
var subLine = lineText.substr(pos + 1);
tag = subLine.match(xmlNAMERegExp);
if (tag) {
// we have an element name, wooohooo !
tag = tag[0];
// do we have the close tag on same line ???
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
{
found = false;
}
// we don't, so we have a candidate...
}
else
found = false;
}
if (!found)
pos++;
}
if (found) {
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
var startTagRegExp = new RegExp(startTag, "g");
var endTag = "</" + tag + ">";
var depth = 1;
var l = line + 1;
var lastLine = cm.lineCount();
while (l < lastLine) {
lineText = cm.getLine(l);
var match = lineText.match(startTagRegExp);
if (match) {
for (var i = 0; i < match.length; i++) {
if (match[i] == endTag)
depth--;
else
depth++;
if (!depth) {
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
return;
}
};
CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {
var lineText = cm.getLine(line);
var startChar = lineText.lastIndexOf("{");
if (startChar < 0 || lineText.lastIndexOf("}") > startChar) return;
var tokenType = cm.getTokenAt({line: line, ch: startChar}).className;
var count = 1, lastLine = cm.lineCount(), end;
outer: for (var i = line + 1; i < lastLine; ++i) {
var text = cm.getLine(i), pos = 0;
for (;;) {
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
if (nextOpen < 0) nextOpen = text.length;
if (nextClose < 0) nextClose = text.length;
pos = Math.min(nextOpen, nextClose);
if (pos == text.length) break;
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
if (pos == nextOpen) ++count;
else if (!--count) { end = i; break outer; }
}
++pos;
}
}
if (end == null || end == line + 1) return;
if (hideEnd === true) end++;
return end;
};
CodeMirror.indentRangeFinder = function(cm, line) {
var tabSize = cm.getOption("tabSize");
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
var handle = cm.getLineHandle(i);
if (!/^\s*$/.test(handle.text)) {
if (handle.indentation(tabSize) <= myIndent) break;
last = i;
}
}
if (!last) return null;
return last + 1;
};
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
var folded = [];
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">&#x25bc;</div>%N%';
function isFolded(cm, n) {
for (var i = 0; i < folded.length; ++i) {
var start = cm.lineInfo(folded[i].start);
if (!start) folded.splice(i--, 1);
else if (start.line == n) return {pos: i, region: folded[i]};
}
}
function expand(cm, region) {
cm.clearMarker(region.start);
for (var i = 0; i < region.hidden.length; ++i)
cm.showLine(region.hidden[i]);
}
return function(cm, line) {
cm.operation(function() {
var known = isFolded(cm, line);
if (known) {
folded.splice(known.pos, 1);
expand(cm, known.region);
} else {
var end = rangeFinder(cm, line, hideEnd);
if (end == null) return;
var hidden = [];
for (var i = line + 1; i < end; ++i) {
var handle = cm.hideLine(i);
if (handle) hidden.push(handle);
}
var first = cm.setMarker(line, markText);
var region = {start: first, hidden: hidden};
cm.onDeleteLine(first, function() { expand(cm, region); });
folded.push(region);
}
});
};
};

View File

@@ -1,44 +0,0 @@
// Define match-highlighter commands. Depends on searchcursor.js
// Use by attaching the following function call to the onCursorActivity event:
//myCodeMirror.matchHighlight(minChars);
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
(function() {
var DEFAULT_MIN_CHARS = 2;
function MatchHighlightState() {
this.marked = [];
}
function getMatchHighlightState(cm) {
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
}
function clearMarks(cm) {
var state = getMatchHighlightState(cm);
for (var i = 0; i < state.marked.length; ++i)
state.marked[i].clear();
state.marked = [];
}
function markDocument(cm, className, minChars) {
clearMarks(cm);
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
var state = getMatchHighlightState(cm);
var query = cm.getSelection();
cm.operation(function() {
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
//Only apply matchhighlight to the matches other than the one actually selected
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
}
}
});
}
}
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
markDocument(this, className, minChars);
});
})();

View File

@@ -1,117 +0,0 @@
(function(){
function SearchCursor(cm, query, pos, caseFold) {
this.atOccurrence = false; this.cm = cm;
if (caseFold == null && typeof query == "string") caseFold = false;
pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
this.pos = {from: pos, to: pos};
// The matches method is filled in based on the type of query.
// It takes a position and a direction, and returns an object
// describing the next occurrence of the query, or null if no
// more matches were found.
if (typeof query != "string") // Regexp match
this.matches = function(reverse, pos) {
if (reverse) {
var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0;
while (match) {
var ind = line.indexOf(match[0]);
start += ind;
line = line.slice(ind + 1);
var newmatch = line.match(query);
if (newmatch) match = newmatch;
else break;
start++;
}
}
else {
var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query),
start = match && pos.ch + line.indexOf(match[0]);
}
if (match)
return {from: {line: pos.line, ch: start},
to: {line: pos.line, ch: start + match[0].length},
match: match};
};
else { // String query
if (caseFold) query = query.toLowerCase();
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
var target = query.split("\n");
// Different methods for single-line and multi-line queries
if (target.length == 1)
this.matches = function(reverse, pos) {
var line = fold(cm.getLine(pos.line)), len = query.length, match;
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
: (match = line.indexOf(query, pos.ch)) != -1)
return {from: {line: pos.line, ch: match},
to: {line: pos.line, ch: match + len}};
};
else
this.matches = function(reverse, pos) {
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= pos.ch || offsetA != match.length
: offsetA <= pos.ch || offsetA != line.length - match.length)
return;
for (;;) {
if (reverse ? !ln : ln == cm.lineCount() - 1) return;
line = fold(cm.getLine(ln += reverse ? -1 : 1));
match = target[reverse ? --idx : ++idx];
if (idx > 0 && idx < target.length - 1) {
if (line != match) return;
else continue;
}
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
return;
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
return {from: reverse ? end : start, to: reverse ? start : end};
}
};
}
}
SearchCursor.prototype = {
findNext: function() {return this.find(false);},
findPrevious: function() {return this.find(true);},
find: function(reverse) {
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
function savePosAndFail(line) {
var pos = {line: line, ch: 0};
self.pos = {from: pos, to: pos};
self.atOccurrence = false;
return false;
}
for (;;) {
if (this.pos = this.matches(reverse, pos)) {
this.atOccurrence = true;
return this.pos.match || true;
}
if (reverse) {
if (!pos.line) return savePosAndFail(0);
pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
}
else {
var maxLine = this.cm.lineCount();
if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
pos = {line: pos.line+1, ch: 0};
}
}
},
from: function() {if (this.atOccurrence) return this.pos.from;},
to: function() {if (this.atOccurrence) return this.pos.to;},
replace: function(newText) {
var self = this;
if (this.atOccurrence)
self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
}
};
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
return new SearchCursor(this, query, pos, caseFold);
});
})();

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
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

@@ -0,0 +1,245 @@
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
}
.CodeMirror-scroll {
/* Set scrolling behaviour here */
overflow: auto;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
}
/* CURSOR */
.CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
/* DEFAULT THEME */
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable {color: black;}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3 {color: #085;}
.cm-s-default .cm-property {color: black;}
.cm-s-default .cm-operator {color: black;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-error {color: #f00;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-emstrong {font-style: italic; font-weight: bold;}
.cm-link {text-decoration: underline;}
.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
line-height: 1;
position: relative;
overflow: hidden;
}
.CodeMirror-scroll {
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-right: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
z-index: 6;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
height: 100%;
padding-bottom: 30px;
z-index: 3;
}
.CodeMirror-gutter {
height: 100%;
display: inline-block;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-lines {
cursor: text;
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {
display: inline-block;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror-measure {
position: absolute;
width: 100%; height: 0px;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor {
position: absolute;
visibility: hidden;
border-right: none;
width: 0;
}
.CodeMirror-focused div.CodeMirror-cursor {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursor {
visibility: hidden;
}
}

View File

@@ -0,0 +1,6 @@
.cm-s-ambiance.CodeMirror {
-webkit-box-shadow: none;
-moz-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
/* Port of TextMate's Blackboard theme */
.cm-s-blackboard { background: #0C1021; color: #F8F8F8; }
.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
.cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; }
.cm-s-blackboard .CodeMirror-gutter-text { color: #888; }
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
.cm-s-blackboard .CodeMirror-linenumber { color: #888; }
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }

View File

@@ -1,7 +1,7 @@
.cm-s-cobalt { background: #002240; color: white; }
.cm-s-cobalt.CodeMirror { background: #002240; color: white; }
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-cobalt span.cm-comment { color: #08f; }

View File

@@ -1,7 +1,7 @@
.cm-s-erlang-dark { background: #002240; color: white; }
.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
.cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; }
.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-erlang-dark span.cm-atom { color: #845dc4; }

View File

@@ -2,23 +2,22 @@
http://lesscss.org/ dark theme
Ported to CodeMirror by Peter Kroon
*/
.CodeMirror{
line-height: 15px;
.cm-s-lesser-dark {
line-height: 1.3em;
}
.cm-s-lesser-dark {
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
font-size:12px;
}
.cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
.cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; }
.cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; }
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }

View File

@@ -1,9 +1,9 @@
/* Based on Sublime Text's Monokai theme */
.cm-s-monokai {background: #272822; color: #f8f8f2;}
.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
.cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;}
.cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;}
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
.cm-s-monokai span.cm-comment {color: #75715e;}

View File

@@ -1,9 +1,9 @@
/* Loosely based on the Midnight Textmate theme */
.cm-s-night { background: #0a001f; color: #f8f8f8; }
.cm-s-night div.CodeMirror-selected { background: #a8f !important; }
.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-night div.CodeMirror-selected { background: #447 !important; }
.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-night span.cm-comment { color: #6900a1; }

View File

@@ -1,9 +1,9 @@
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
.cm-s-rubyblue { background: #112435; color: white; }
.cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }
.cm-s-rubyblue .CodeMirror-gutter-text { color: white; }
.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
.cm-s-rubyblue .CodeMirror-linenumber { color: white; }
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
.cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
.cm-s-twilight .cm-atom { color: #FC0; }
.cm-s-twilight .cm-number { color: #ca7841; } /**/
.cm-s-twilight .cm-def { color: #8DA6CE; }
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
.cm-s-twilight .cm-operator { color: #cda869; } /**/
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
.cm-s-twilight .cm-tag { color: #997643; } /**/
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
.cm-s-twilight .cm-header { color: #FF6400; }
.cm-s-twilight .cm-hr { color: #AEAEAE; }
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/

View File

@@ -0,0 +1,27 @@
/* Taken from the popular Visual Studio Vibrant Ink Schema */
.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
.cm-s-vibrant-ink .cm-atom { color: #FC0; }
.cm-s-vibrant-ink .cm-number { color: #FFEE98; }
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
.cm-s-vibrant-ink .cm-operator { color: #888; }
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
.cm-s-vibrant-ink .cm-string { color: #A5C25C }
.cm-s-vibrant-ink .cm-string-2 { color: red }
.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
.cm-s-vibrant-ink .cm-link { color: blue; }

View File

@@ -20,10 +20,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }
.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}

View File

@@ -3,6 +3,8 @@
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-v1pt6-web-ide.jpg" alt="ICEcoder web IDE">
###Features you'd expect
* Context aware code highlighting
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP & Ruby
@@ -32,9 +34,17 @@ Early version of the web based IDE which allows for creation of websites in the
* CTRL+S+Enter opens a sticky tab to show live edits
* ESC = Comment/Uncomment line, incl partial lines
* Image viewer
* Colour preview block on CSS colours, ie red, #ff0000 or RGBA(255,0,0,0.5)
* Colour preview block on CSS colours, ie red, #f00 or RGBA(255,0,0,0.5)
* MySQL Database management via Adminer plugin
* Backs up files every 10 mins or on click of backup plugin icon
* Github repo syncing with ICErepo plugin
* Shell terminal
* JS Hint validation as you type
* Emmet snippet typing booster
* JavaScript code hinting
* Alphanumeric tab sorting
* Tag wrappers
* Config template
###Installation
@@ -47,7 +57,7 @@ $ git clone git@github:mattpass/ICEcoder
####Step 2: Upload the files (Linux or Windows hosting OK)
```
Upload to a new sub-dir URL such as yourdomain.com/_coder
Set public write permissions on the lib/config.php file
Set public write permissions (757 recommended) on the 'backups' and 'lib' folders
```
####Step 3: Start coding

0
backups/.gitkeep Normal file
View File

View File

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

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

203
files.php
View File

@@ -1,173 +1,50 @@
<?php
function fileManager($directory, $return_link) {
$code = "";
// Generates a list of all directories, sub-directories, and files in $directory
// Remove trailing slash
if(substr($directory, -1) == "/" ) {$directory = substr($directory, 0, strlen($directory)-1);};
$code .= fileManager_dir($directory, $return_link);
return $code;
}
function fileManager_dir($directory, $return_link, $first_call=true) {
if (!isset($_SESSION['restrictedFiles'])) {include("lib/settings.php");};
$restrictedFiles = $_SESSION['restrictedFiles'];
$bannedFiles = $_SESSION['bannedFiles'];
$docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
if (strrpos($_SERVER['DOCUMENT_ROOT'],":")) {
$serverType = "Windows";
} else {
$serverType = "Linux";
}
// Chop off trailing slash
if (strrpos($docRoot,"/")==strlen($docRoot)-1) {$docRoot = substr($docRoot,0,strlen($docRoot)-1);};
$fileManager = "";
// Recursive function called by fileManager() to list directories/files
// Get and sort directories/files
if(function_exists("scandir")) {$file = scandir($directory);} else {$file = php4_scandir($directory);};
natcasesort($file);
// Make directories first
$files = $dirs = array();
foreach($file as $this_file) {
if(is_dir("$directory/$this_file")) {$dirs[] = $this_file;} else {$files[] = $this_file;};
}
$file = array_merge($dirs, $files);
// Filter unwanted files
if(!empty($bannedFiles)) {
foreach(array_keys($file) as $key) {
$fileFolder = $file[$key];
for ($i=0;$i<count($bannedFiles);$i++) {
if(strpos($fileFolder,$bannedFiles[$i])!==false) {unset($file[$key]);};
}
}
}
if(count($file) > 2) { // To ignore . and .. directories
if($first_call) {
// Root Directory
$dirRep = str_replace("\\","/",$directory);
$link = str_replace("[link]", "$dirRep/", $return_link);
$link = str_replace("//","/",$link);
$fileAtts = "";
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($link)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="|_perms">'.$chmodInfo.'</span>';
}
$fileManager = "<ul class=\"fileManager\">";
$fileManager .= "<li class=\"pft-directory\"><a href=\"#\" onMouseOver=\"top.ICEcoder.overFileFolder('folder','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('folder','')\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"|\">/ [ROOT]</span> ".$fileAtts."</a>";
$fileManager .= $fileManager .= fileManager_dir("$directory/", $return_link ,false);
$fileManager .= "</li>";
$first_call = false;
} else {
$fileManager = "<ul>";
}
foreach( $file as $this_file ) {
$bannedFile=false;
for ($i=0;$i<count($bannedFiles);$i++) {
if (strpos($directory,$bannedFiles[$i])!=""||strpos($this_file,$bannedFiles[$i])!="") {
$bannedFile=true;
}
}
if( $this_file != "." && $this_file != ".." && $bannedFile == false) {
if( is_dir("$directory/$this_file") ) {
// Directory
$dirCount++;
$dirRep = str_replace("\\","/",$directory);
$link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link);
$link = str_replace("//","/",$link);
$restrictedFile=false;
for ($i=0;$i<count($restrictedFiles);$i++) {
if (strpos($link,$restrictedFiles[$i])!="") {
$restrictedFile=true;
}
}
$fileAtts = "";
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($link)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace("/","|",str_replace($docRoot,"",$link)).'_perms">'.$chmodInfo.'</span>';
}
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $restrictedFile==false)) {
$fileManager .= "<li class=\"pft-directory\"><a href=\"#\" onMouseOver=\"top.ICEcoder.overFileFolder('folder','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('folder','')\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a>";
$fileManager .= fileManager_dir("$directory/$this_file", $return_link , false);
$fileManager .= "</li>";
} else {
$fileManager .= "<li class=\"pft-directory\" style=\"cursor: pointer\"><span style=\"position: relative; left:-22px; color: #888\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [HIDDEN] ".$fileAtts."</span></li>";
}
} else {
// File
$fileCount++;
$fileBytes+=filesize($link);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1);
$dirRep = str_replace("\\","/",$directory);
$link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link);
$link = str_replace("//","/",$link);
$restrictedFile=false;
for ($i=0;$i<count($restrictedFiles);$i++) {
if (strpos($link,$restrictedFiles[$i])!="") {
$restrictedFile=true;
}
}
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $restrictedFile==false)) {
$fileAtts = "";
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($link)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace("/","|",str_replace($docRoot,"",$link)).'_perms">'.$chmodInfo.'</span>';
}
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\"><a nohref onMouseOver=\"top.ICEcoder.overFileFolder('file','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('file','')\" style=\"position: relative; left:-22px; cursor: pointer\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a></li>";
} else {
$fileAtts = "<img src=\"images/padlock.png\" style=\"cursor: pointer\" onClick=\"top.ICEcoder.message('Sorry, you need higher admin level rights to view.')\">";
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\" style=\"cursor: default\"><span style=\"position: relative; left:-22px; color: #888\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [HIDDEN] ".$fileAtts."</span></li>";
}
}
}
}
$fileManager .= "</ul>";
}
$varOutput = "";
if ($dirCount) {$varOutput .= "top.ICEcoder.dirCount+=".$dirCount.";".PHP_EOL;};
if ($fileCount) {$varOutput .= "top.ICEcoder.fileCount+=".$fileCount.";".PHP_EOL;};
if ($fileBytes) {$varOutput .= "top.ICEcoder.fileBytes+=".$fileBytes.";".PHP_EOL;};
// After outputting the fileManager, output the JS vars, but only the first time
return $fileManager."<script>if (top.ICEcoder.dirCount==0) {".PHP_EOL.$varOutput."}</script>";
}
// For PHP4 compatibility
function php4_scandir($dir) {
$dh = opendir($dir);
while( false !== ($filename = readdir($dh)) ) {
$files[] = $filename;
}
sort($files);
return($files);
}
?>
<?php include("lib/settings.php");?>
<!DOCTYPE html>
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="top.ICEcoder.getMouseXY(event);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>
<title>ICE Coder File Manager</title>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title>
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="lib/files.css">
<script src="lib/coder.js" type="text/javascript"></script>
<script src="lib/ice-coder.js" type="text/javascript"></script>
</head>
<body onLoad="top.ICEcoder.fileManager()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<div onClick="top.ICEcoder.refreshFileManager()" class="refresh"><img src="images/refresh.png"></div>
<script>
top.ICEcoder.dirCount = 0;
top.ICEcoder.fileCount = 0;
top.ICEcoder.fileBytes = 0;
</script>
<?php
<body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
echo fileManager($_SERVER['DOCUMENT_ROOT'], "[link]");
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
<?php
$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 dirOpen">
<a nohref title="/" onMouseOver="top.ICEcoder.overFileFolder('folder','/')" onMouseOut="top.ICEcoder.overFileFolder('folder','')" onClick="top.ICEcoder.openCloseDir(this)" 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
include("lib/get-branch.php");
?>
</ul>
<?php
// 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>

BIN
images/big-arrow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 55 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: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

BIN
images/files-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/nav-alpha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/nav-bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

BIN
images/nest-tag-bg.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

173
index.php
View File

@@ -1,77 +1,74 @@
<?php
include("lib/settings.php");
$allowedIP = false;
for($i=0;$i<count($_SESSION['allowedIPs']);$i++) {
if ($_SESSION['allowedIPs'][$i]==$_SERVER["REMOTE_ADDR"]||$_SESSION['allowedIPs'][$i]=="*") {
$allowedIP = true;
}
}
if (!$allowedIP) {
<?php include("lib/settings.php");
// Check IP permissions
if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*", $_SESSION['allowedIPs'])) {
header('Location: /');
};
// Check for updates of ICEcoder & CodeMirror
if ($checkUpdates) {
$ICEcoderLatestVer = json_encode(file_get_contents("http://icecoder.net/latest-version.txt"));
$ICEcoderLatestVer = rtrim(ltrim($ICEcoderLatestVer,"\""),"\"\\n");
if (ltrim($versionNo,"v ")<ltrim($ICEcoderLatestVer,"v ")) {
echo '<script>top.ICEcoder.message(\'ICEcoder '.$ICEcoderLatestVer.' now released\n\nPlease upgrade\');</script>';
} else {
$cMLatestVer = json_encode(file_get_contents("http://codemirror.net/latest-version.txt"));
$cMLatestVer = rtrim(ltrim($cMLatestVer,"\""),"\"\\n");
if ($cMThisVer<$cMLatestVer) {
echo '<script>top.ICEcoder.message(\'Code Mirror '.$cMLatestVer.' now released\n\nPlease upgrade\');</script>';
}
$updateMsg = '';
// Check for updates
if ($ICEcoder["checkUpdates"]) {
$icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]));
$icv = $icv[0];
$icv = rtrim(ltrim($icv,'"'),'"\\n');
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>
<html>
<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>
<title>ICE Coder - <?php echo $versionNo;?></title>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="lib/coder.css">
<link rel="stylesheet" type="text/css" href="lib/ice-coder.css">
<link rel="icon" type="image/png" href="favicon.png">
<script>
shortURLStarts = "<?php echo $shortURLStarts;?>";
theme = "<?php if ($theme=="default") {echo 'icecoder';} else {echo $theme;};?>";
tabsIndent = <?php if ($tabsIndent) {echo 'true';} else {echo 'false';};?>;
tabWidth = <?php echo $tabWidth; ?>;
<?
echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
?>
iceRoot = "<?php echo $ICEcoder['root']; ?>";
window.onbeforeunload = function() {
for (var i=0; i<=top.ICEcoder.changedContent.length; i++) {
if (top.ICEcoder.changedContent[i]==1) {
return "You have some unsaved changes.";
}
if (top.ICEcoder.changedContent.indexOf(1)>-1) {
return "You have some unsaved changes.";
}
}
previousFiles = [<?php
if ($previousFiles!="" && $_SESSION['userLevel'] == 10) {
$openFilesArray = explode(",",$previousFiles);
for ($i=0;$i<count($openFilesArray);$i++) {
echo "'".$openFilesArray[$i]."'";
if ($i<count($openFilesArray)-1) {echo ",";};
}
}
?>];
</script>
<script language="JavaScript" src="lib/coder.js"></script>
<script language="JavaScript" src="lib/ice-coder.js"></script>
<?php
if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
echo '<script src="plugins/jshint/jshint.js"></script>';
}
?>
</head>
<body onLoad="ICEcoder.init(<?php if ($_SESSION['userLevel'] == 10) {echo "'login'";} ?>)<?php echo $onLoadExtras;?>" onResize="ICEcoder.setLayout()" onMouseMove="top.ICEcoder.getMouseXY(event);top.ICEcoder.canResizeFilesW()" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onKeyDown="return ICEcoder.interceptKeys('coder', event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
<body onLoad="<?php
echo 'top.ICEcoder.previousFiles = [';
if ($ICEcoder["previousFiles"]!="") {
$openFilesArray = explode(",",$ICEcoder["previousFiles"]);
echo "'".implode("','",$openFilesArray)."'";
}
echo "];top.ICEcoder.theme = '";
echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];
echo "'";
echo ';top.ICEcoder.tabsIndent = ';
echo $ICEcoder["tabsIndent"] ? 'true' : 'false';
echo ';top.ICEcoder.openLastFiles = ';
echo $ICEcoder["openLastFiles"] ? 'true' : 'false';
echo ';top.ICEcoder.lineWrapping = ';
echo $ICEcoder["lineWrapping"] ? 'true' : 'false';
echo ';top.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);">
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)">
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)" onContextMenu="return false">
<div class="popupVCenter">
<div class="popup" id="mediaContainer"></div>
</div>
</div>
<div id="loadingMask" class="blackMask" style="visibility: visible">
<span class="progressBar"></span>
<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>
<div class="popupVCenter">
<div class="popup">
<div class="circleOutside"></div>
@@ -81,67 +78,72 @@ previousFiles = [<?php
</div>
</div>
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');this.style.display='none'">
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');this.style.display='none'" onContextMenu="return false">
<span id="folderMenuItems">
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New File</a>
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New Folder</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.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()" id="fmMenuPasteOption" style="display: none">Paste</a>
<a href="javascript:top.ICEcoder.uploadFilesSelect(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Upload File(s)</a>
<div style="display: none">
<form enctype="multipart/form-data" id="uploadFilesForm" action="lib/file-control.php?action=upload&file=/uploaded" method="POST" target="fileControl">
<input type="hidden" name="folder" id="uploadDir" value="/">
<input type="file" name="filesInput[]" id="fileInput" onchange="top.ICEcoder.uploadFilesSubmit(this)" multiple>
<input type="submit" value="Upload File">
</form>
</div>
</span>
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Delete</a>
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Delete</a>
<span id="singleFileMenuItems">
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Rename</a>
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length))" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">View Webpage</a>
<a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</a>
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Rename</a>
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()">View Webpage</a>
</span>
<a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Zip It!</a>
<a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Properties</a>
<a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Zip It!</a>
<a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Properties</a>
</div>
<div id="header" class="header" onContextMenu="return false">
<div class="plugins" id="pluginsContainer">
<?php echo $pluginsDisplay; ?>
</div>
<div class="version"><?php echo $versionNo;?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
<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()">
<img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
</div>
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';">
<div class="account" id="account">
<div class="accountLoginContainer" id="accountLoginContainer">
<div class="accountLogin" id="accountLogin">
<form name="login" action="lib/settings.php" method="POST" target="ff">
<input type="password" name="loginPassword" class="accountPassword">
<input type="submit" name="submit" value="Login" class="button">
</form>
</div>
</div>
<div class="accountOptions">
<a nohref title="Save" onClick="ICEcoder.fMIcon('save')"><img src="images/save.png" alt="Save" id="fMSave" style="opacity: 0.3"></a>
<a nohref title="Open" onClick="ICEcoder.fMIcon('open')"><img src="images/open.png" alt="Open" id="fMOpen" style="margin-left: 7px; opacity: 0.3"></a>
<a nohref title="New File" onClick="ICEcoder.fMIcon('newFile')"><img src="images/new-file.png" alt="New File" id="fMNewFile" style="margin: 8px 0 0 10px; opacity: 0.3"></a>
<a nohref title="New Folder" onClick="ICEcoder.fMIcon('newFolder')"><img src="images/new-folder.png" alt="New Folder" id="fMNewFolder" style="margin: 9px 0 0 5px; opacity: 0.3"></a>
<a nohref title="Delete" onClick="ICEcoder.fMIcon('delete')"><img src="images/delete.png" alt="Delete" id="fMDelete" style="margin: 9px 0 0 5px; opacity: 0.3"></a>
<a nohref title="Rename" onClick="ICEcoder.fMIcon('rename')"><img src="images/rename.png" alt="Rename" id="fMRename" style="margin: 9px 0 0 5px; opacity: 0.3"></a>
<a nohref title="View" onClick="ICEcoder.fMIcon('view')"><img src="images/view.png" alt="View" id="fMView" style="margin: 9px 0 0 5px; opacity: 0.3"></a>
<div title="Save" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div>
<div title="Open" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div>
<div title="New File" onClick="ICEcoder.fMIcon('newFile')" id="fMNewFile" class="newFile"></div>
<div title="New Folder" onClick="ICEcoder.fMIcon('newFolder')" id="fMNewFolder" class="newFolder"></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 title="View" onClick="ICEcoder.fMIcon('view')" id="fMView" class="view"></div>
<div title="Lock" onClick="ICEcoder.lockUnlockNav()" id="fmLock" class="lock"></div>
</div>
<a nohref style="cursor: pointer" onClick="ICEcoder.lockUnlockNav()"><img src="images/padlock.png" id="fmLock" class="lock"></a>
</div>
<iframe id="filesFrame" class="frame" name="ff" src="files.php" style="opacity: 0" onLoad="this.style.opacity='1'"></iframe>
<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>
<div id="editor" class="editor">
<div id="tabsBar" class="tabsBar" onContextMenu="return false">
<a nohref onClick="top.ICEcoder.closeAllTabs()"><img src="images/nav-close.gif" class="closeAllTabs" title="Close all tabs"></a>
<a nohref onClick="top.ICEcoder.alphaTabs()"><img src="images/nav-alpha.png" class="alphaTabs" title="Alphabetize tabs"></a>
<?php
for ($i=1;$i<=10;$i++) {
echo '<div id="tab'.$i.'" class="tab" draggable="true" onClick="if(ICEcoder.canSwitchTabs) {ICEcoder.switchTab('.$i.')} else {ICEcoder.canSwitchTabs=true}"></div>';
for ($i=1;$i<=100;$i++) {
echo '<div id="tab'.$i.'" class="tab" onMouseDown="ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3),10)) : ICEcoder.canSwitchTabs=true; thisColor=\'#000\'; ICEcoder.tabDragStart(parseInt(this.id.slice(3),10))" onMouseOver="thisColor=this.style.color;this.style.color=\'#000\'" onMouseOut="this.style.color=thisColor"></div>';
}
?><div class="newTab" onClick="ICEcoder.newTab()"><img src="images/nav-new.png"></div>
?><div class="newTab" onClick="ICEcoder.newTab()" id="newTab"><img src="images/nav-new.png"></div>
</div>
<div id="findBar" class="findBar" onContextMenu="return false">
<form name="findAndReplace">
<form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false">
<div class="findReplace">
<div class="findText">Find</div>
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true,false)">
<div class="findTextPlural">'s</div>
<select name="connector" onChange="ICEcoder.findReplaceOptions()">
<option>in</option>
<option>and</option>
@@ -161,7 +163,7 @@ previousFiles = [<?php
<option>all files</option>
<option>all filenames</option>
</select>
<input type="button" name="submit" value="&gt;&gt;" class="submit" onClick="ICEcoder.findReplace('findReplace',false,true)">
<input type="submit" name="submit" value="&gt;&gt;" class="submit">
<div class="results" id="results"></div>
</div>
</form>
@@ -170,13 +172,12 @@ previousFiles = [<?php
<div class="goLine">Go to Line<input type="text" name="goToLine" value="" id="goToLineNo" class="textbox goToLine">
</form>
</div>
<iframe name="contentFrame" id="content" src="editor.php" class="code">
</iframe>
<iframe name="contentFrame" id="content" src="editor.php" class="code"></iframe>
</div>
<div class="footer" id="footer" onContextMenu="return false">
<div class="nesting" id="nestValid">Nesting OK</div>
<div class="nestLoc">Cursor nest location</div>
<div class="nestLoc">cursor nest location</div>
<div class="nestDisplay" id="nestDisplay"></div>
<div class="charDisplay" id="charDisplay"><span id="char"></span></div>
</div>

File diff suppressed because it is too large Load Diff

32
lib/config-template.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
$ICEcoder = array(
"root" => "",
"tabsIndent" => true,
"checkUpdates" => true,
"openLastFiles" => true,
"findFilesExclude" => array("_coder","ICEcoder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip"),
"codeAssist" => true,
"visibleTabs" => false,
"lockedNav" => true,
"accountPassword" => "",
"bannedFiles" => array("_coder","ICEcoder"),
"bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"),
"allowedIPs" => array("*"),
"plugins" => array(
array("Terminal","plugins/terminal/icon.gif","margin-top: 3px","plugins/terminal","_blank",""),
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
array("JS Hint","plugins/jshint/icon.png","margin-top: 3px","http://www.jshint.com","_blank",""),
array("Emmet","plugins/emmet/icon.png","margin-top: 3px","http://docs.emmet.io","_blank",""),
array("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("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")
),
"theme" => "default",
"lineWrapping" => true,
"tabWidth" => 4,
"previousFiles" => "",
"last10Files" => ""
);
?>

View File

@@ -1,25 +0,0 @@
<?php
$versionNo = "v 0.7.6";
$codeMirrorDir = "CodeMirror-2.25";
$cMThisVer = 2.25;
$tabsIndent = true;
$checkUpdates = false;
$openLastFiles = true;
$findFilesExclude = array("_coder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip");
$codeAssist = true;
$visibleTabs = false;
$lockedNav = true;
$accountPassword = "";
$restrictedFiles = array("wp-",".php",".rb",".sql");
$bannedFiles = array("_coder","wp-",".exe");
$allowedIPs = array("*");
$plugins = array(
array("Database Admin","images/database.png","margin-top: 3px","plugins/adminer/adminer-3.3.3-mysql-en.php","_blank",""),
array("Batch Image Processor","images/images.png","margin-top: 5px","http://birme.net","_blank",""),
array("Zip It!","images/zip-it.png","margin-top: 3px","plugins/zip-it/?zip=|&exclude=.doc,.gif,.jpg,.jpeg,.pdf,.png,.swf,.xml,.zip","fileControl:<b>Zipping Open Files</b>","10")
);
$theme = "default";
$tabWidth = 4;
$previousFiles = "";
$last10Files = "";
?>

View File

@@ -1,40 +1,40 @@
/* ICE coder default theme: Based VERY loosely on Monokai */
.cm-s-icecoder {font-size: 12px; color: #666; background: #1c1c19;}
.cm-s-icecoder {color: #666; background: #1c1c19}
.cm-s-icecoder span.cm-keyword {color: #f8f8f8; font-weight:bold;}
.cm-s-icecoder span.cm-atom {color: #ae81ff;}
.cm-s-icecoder span.cm-number {color: #0a0;}
.cm-s-icecoder span.cm-def {color: #fd971f;}
.cm-s-icecoder span.cm-keyword {color: #f8f8f8; font-weight:bold}
.cm-s-icecoder span.cm-atom {color: #ae81ff}
.cm-s-icecoder span.cm-number {color: #0a0}
.cm-s-icecoder span.cm-def {color: #fd971f}
.cm-s-icecoder span.cm-variable {color: #a6e22e;}
.cm-s-icecoder span.cm-variable-2 {color: #f92672;}
.cm-s-icecoder span.cm-variable-3 {color: #0a0;}
.cm-s-icecoder span.cm-variable {color: #a6e22e}
.cm-s-icecoder span.cm-variable-2 {color: #f92672}
.cm-s-icecoder span.cm-variable-3 {color: #0a0}
.cm-s-icecoder span.cm-property {color: #a6e22e;}
.cm-s-icecoder span.cm-operator {color: #0a0;}
.cm-s-icecoder span.cm-comment {color: #444;}
.cm-s-icecoder span.cm-property {color: #a6e22e}
.cm-s-icecoder span.cm-operator {color: #0a0}
.cm-s-icecoder span.cm-comment {color: #444}
.cm-s-icecoder span.cm-string {color: #fd0;}
.cm-s-icecoder span.cm-string-2 {color: #f80;}
.cm-s-icecoder span.cm-string {color: #fd0}
.cm-s-icecoder span.cm-string-2 {color: #f80}
.cm-s-icecoder span.cm-meta {color: #555;}
.cm-s-icecoder span.cm-error {color: #f00;}
.cm-s-icecoder span.cm-meta {color: #555}
.cm-s-icecoder span.cm-error {color: #f00}
.cm-s-icecoder span.cm-qualifier {color: #555;}
.cm-s-icecoder span.cm-builtin {color: #06c;}
.cm-s-icecoder span.cm-bracket {color: #cc7;}
.cm-s-icecoder span.cm-qualifier {color: #555}
.cm-s-icecoder span.cm-builtin {color: #06c}
.cm-s-icecoder span.cm-bracket {color: #cc7}
.cm-s-icecoder span.cm-tag {color: #e8e8e8;}
.cm-s-icecoder span.cm-attribute {color: #00b8bb;}
.cm-s-icecoder span.cm-tag {color: #e8e8e8}
.cm-s-icecoder span.cm-attribute {color: #00b8bb}
.cm-s-icecoder span.cm-header {color: #a0a;}
.cm-s-icecoder span.cm-quote {color: #090;}
.cm-s-icecoder span.cm-hr {color: #999;}
.cm-s-icecoder span.cm-link {color: #ff0;}
.cm-s-icecoder span.cm-header {color: #a0a}
.cm-s-icecoder span.cm-quote {color: #090}
.cm-s-icecoder span.cm-hr {color: #999}
.cm-s-icecoder span.cm-link {color: #ff0}
.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important;}
.cm-s-icecoder .CodeMirror-selected {background: #037 !important;}
.cm-s-icecoder .CodeMirror-gutter {background: #333; border-right: 1px solid #e8e8e8}
.cm-s-icecoder .CodeMirror-gutter-text {color: #999; width: 35px; cursor: default}
.cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important;}
.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !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-linenumber {color: #999; cursor: default}
.cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important}

View File

@@ -1,135 +1,214 @@
<?php include("settings.php");?>
<?php
// Establish the full file path reference
$file=strClean($_GET['file']);
// Get the save type if any
$saveType = "";
if (isset($_GET['saveType'])) {$saveType = strClean($_GET['saveType']);};
$docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
// Not done the first time we are on the save loop (ie, before the form posting reload)
if ($_GET['action']=="load"||$_GET['action']=="newFolder"||$_GET['action']=="rename"||$_GET['action']=="delete"||$_GET['action']=="perms"||isset($_POST['contents'])) {
$file= str_replace("|","/",$file);
}
// Establish the filename/new filename
$file = str_replace("|","/",strClean(
isset($_POST['newFileName']) && $_POST['newFileName']!=""
? $_POST['newFileName']
: $_GET['file']
));
// Make $file a full path and establish the $fileLoc and $fileName
if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
$fileName = basename($file);
// If we're due to open a file...
if ($_GET['action']=="load") {
echo '<script>action="load";</script>';
// Determine what to do based on filename
// Everything is opened as text in the editor unless specified otherwise
$fileType="text";
if (strpos($file,".jpg")>0||strpos($file,".jpeg")>0||strpos($file,".gif")>0||strpos($file,".png")>0) {$fileType="image";};
if ($fileType=="text") {
$bannedFile=false;
for ($i=0;$i<count($restrictedFiles);$i++) {
if (strpos($file,$restrictedFiles[$i])!="") {
$bannedFile=true;
}
}
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $bannedFile==false)) {
echo '<script>fileType="text";top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=\''.$file.'\';';
echo 'shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");';
echo 'top.ICEcoder.shortURL = shortURL.substr((shortURL.indexOf(top.shortURLStarts)+top.shortURLStarts.length),shortURL.length);</script>';
if (file_exists($file)) {
// Determine what to do based on mime type
$finfo = finfo_open(FILEINFO_MIME_TYPE);
if (strpos(finfo_file($finfo, $file),"text")===0 || strpos(finfo_file($finfo, $file),"empty")!==false) {
echo '<script>fileType="text";';
echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";';
echo '</script>';
$loadedFile = file_get_contents($file);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",$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) {
echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>';
} else {
echo '<script>fileType="nothing";</script>';
echo '<script>top.ICEcoder.message(\'Sorry, you need a higher admin level to view this file\');</script>';
}
};
if ($fileType=="image") {
echo '<script>fileType="image";fileName=\''.$file.'\'</script>';
};
echo '<script>fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');</script>';
};
} else {
echo '<script>fileType="nothing"; top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</script>';
}
finfo_close($finfo);
};
// If we're due to add a new folder...
if ($_GET['action']=="newFolder") {
if ($_SESSION['userLevel'] > 0) {
mkdir($docRoot.$file, 0707);
if (!$demoMode && is_writable($docRoot.$fileLoc)) {
mkdir($file, 0705);
// Reload file manager
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="newFolder";</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
} else {
if (!is_writable($docRoot.$file)) {
echo "<script>top.ICEcoder.message('Sorry, cannot create folder at\\n".substr($file,0,strrpos($file,"/"))."');</script>";
} else {
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to add folders\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</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>';
}
// If we're due to rename a file...
if ($_GET['action']=="rename") {
if ($_SESSION['userLevel'] > 0 && is_writable($_GET['oldFileName'])) {
rename(strClean($_GET['oldFileName']),$docRoot.$file);
// Reload file manager
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="rename";</script>';
} else {
if (!is_writable($_GET['oldFileName'])) {
echo "<script>top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."');</script>";
// If we're due to paste a new file...
if ($_GET['action']=="paste") {
$source = $file;
$dest = str_replace("//","/",$docRoot.strClean(str_replace("|","/",$_GET['location']))."/".basename($source));
if (!$demoMode && is_writable(dirname($dest))) {
if (is_dir($source)) {
if (!is_dir($dest)) {
mkdir($dest, 0705);
}
foreach ($iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST) as $item
) {
if ($item->isDir()) {
mkdir($dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), 0705);
} else {
copy($item, $dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
}
}
} else {
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to rename\');</script>';
if (!file_exists($dest)) {
copy($source, $dest);
} else {
for ($i=2; $i<1000000000; $i++) {
if (!file_exists($dest." (".$i.")")) {
$dest = $dest." (".$i.")";
copy($source, $dest);
$i=1000000000;
}
}
}
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
// Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.strClean(str_replace("|","/",$_GET['location'])).'\',\''.basename($dest).'\');action="pasteFile";</script>';
} else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy \\n".str_replace($docRoot,"",$source)."\\n into \\n".str_replace($docRoot,"",$dest)."')</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to upload files...
if ($_GET['action']=="upload") {
if (!$demoMode) {
class fileUploader {
public function __construct($uploads) {
global $docRoot;
$uploadDir=$docRoot.$iceRoot.str_replace("..","",str_replace("|","/",strClean($_POST['folder'])."/"));
foreach($uploads as $current) {
$this->uploadFile=$uploadDir.$current->name;
$fileName = $current->name;
if ($this->upload($current,$this->uploadFile)) {
echo '<script>action="upload"; top.ICEcoder.updateFileManagerList(\'add\',top.ICEcoder.rightClickedFile.replace(/\|/g,\'/\'),\''.$fileName.'\',false,false,true); top.ICEcoder.serverMessage("Uploaded file(s) OK");setTimeout(function(){top.ICEcoder.serverMessage();},2000);</script>';
} else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload \\n".$fileName."\\n into \\n'+top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))</script>";
}
}
}
public function upload($current,$uploadFile){
if(move_uploaded_file($current->tmp_name,$uploadFile)){
return true;
}
}
}
function getDetails($fileArr) {
foreach($fileArr['name'] as $keyee => $info) {
$uploads[$keyee]->name=$fileArr['name'][$keyee];
$uploads[$keyee]->type=$fileArr['type'][$keyee];
$uploads[$keyee]->tmp_name=$fileArr['tmp_name'][$keyee];
$uploads[$keyee]->error=$fileArr['error'][$keyee];
}
return $uploads;
}
if($_FILES['filesInput']){
$uploads = getDetails($_FILES['filesInput']);
$fileUploader=new fileUploader($uploads);
}
} else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot upload whilst in demo mode');</script>";
}
echo "<script>top.ICEcoder.hideFileMenu();top.document.getElementById('fileInput').value='';top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));</script>";
}
// If we're due to rename a file/folder...
if ($_GET['action']=="rename") {
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
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');';
echo 'action="rename";</script>';
$renamed=true;
} else {
$renamed=false;
}
} else {
$renamed=false;
}
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>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to replace text in a file...
if ($_GET['action']=="replaceText") {
if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
$file = str_replace("|","/",strClean($_GET['fileRef']));
$loadedFile = file_get_contents($file);
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
$fh = fopen($file, 'w') or die("Sorry, cannot save");
fwrite($fh, $newContent);
fclose($fh);
echo '<script>action="replaceText";</script>';
} else {
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>';
}
// If we're due to change permissions on a file/folder...
if ($_GET['action']=="perms") {
if ($_SESSION['userLevel'] > 0 && is_writable($docRoot.$file)) {
chmod($docRoot.$file,octdec(numClean($_GET['perms'])));
if (!$demoMode && is_writable($file)) {
chmod($file,octdec(numClean($_GET['perms'])));
// Reload file manager
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="perms";</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
echo 'action="perms";</script>';
} else {
if (!is_writable($docRoot.$file)) {
echo "<script>top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($docRoot.$file)."');</script>";
} else {
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to change permissions\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($file)."');</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to delete a file...
if ($_GET['action']=="delete") {
if ($_SESSION['userLevel'] > 0) {
$filesArray = split(";",$file); // May contain more than one file here
for ($i=0;$i<=count($filesArray)-1;$i++) {
if (is_writable($docRoot.$filesArray[$i])) {
if (is_dir($docRoot.$filesArray[$i])) {
rrmdir($docRoot.$filesArray[$i]);
} else {
unlink($docRoot.$filesArray[$i]);
}
// Reload file manager
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="delete";</script>';
} else {
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".$filesArray[$i]."');</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
} else {
if (!is_writable($docRoot.$filesArray[$i])) {
echo "<script>top.ICEcoder.message('Sorry, cannot delete\\n".$docRoot.$filesArray[$i]."');</script>";
$filesArray = explode(";",$file); // May contain more than one file here
for ($i=0;$i<=count($filesArray)-1;$i++) {
$fullPath = str_replace($docRoot,"",$filesArray[$i]);
$fullPath = str_replace($iceRoot,"",$fullPath);
$fullPath = $docRoot.$iceRoot.$fullPath;
if (!$demoMode && is_writable($fullPath)) {
is_dir($fullPath)
? rrmdir($fullPath)
: unlink($fullPath);
$fileName = basename($fullPath);
$fileLoc = dirname(str_replace($docRoot,"",$fullPath));
// Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
echo 'action="delete";</script>';
} else {
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to delete\');</script>';
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".str_replace($docRoot,"",$fullPath)."');</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
echo '<script>action="nothing";</script>';
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// The function to recursively remove folders & files
@@ -138,7 +217,9 @@ function rrmdir($dir) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
filetype($dir."/".$object) == "dir"
? rrmdir($dir."/".$object)
: unlink($dir."/".$object);
}
}
reset($objects);
@@ -150,138 +231,133 @@ if ($_GET['action']=="save") {
echo '<script>action="save";</script>';
// on the form posting via a reload, save the file
if (isset($_POST['contents'])) {
if ($_SESSION['userLevel'] > 0) {
if (isset($_POST['newFileName'])&&$_POST['newFileName']!="") {
$file = strClean($_POST['newFileName']);
}
$saveFile = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']).$file;
$saveFile = str_replace("//","/",$saveFile);
if ((file_exists($saveFile) && is_writable($saveFile)) || $_POST['newFileName']!="") {
if (filemtime($saveFile)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
$fh = fopen($saveFile, 'w') or die("Sorry, cannot save");
fwrite($fh, $_POST['contents']);
fclose($fh);
clearstatcache();
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($saveFile).'";</script>';
if (isset($_POST['newFileName'])&&$_POST['newFileName']!="") {
// Reload file manager & stop CTRL+s being sticky
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\')</script>';
}
if (isset($_POST['newFileName'])&&$_POST['newFileName']!="") {
echo '<script>top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$file.'\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);if (top.ICEcoder.stickyTabWindow.location) {top.ICEcoder.stickyTabWindow.location.reload()};action="doneSave";</script>';
} else {
$loadedFile = file_get_contents($saveFile);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",$loadedFile).'</textarea>';
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?');
if (refreshFile) {
var cM = top.ICEcoder.getcMInstance();
var thisTab = top.ICEcoder.selectedTab;
document.getElementById('userVersionFile').value = cM.getValue();
// Revert back to original
cM.setValue(document.getElementById('loadedFile').value);
top.ICEcoder.changedContent[thisTab-1] = 0;
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($saveFile); ?>";
cM.clearHistory();
// Now for the new file
top.ICEcoder.newTab();
cM = top.ICEcoder.getcMInstance();
cM.setValue(document.getElementById('userVersionFile').value);
cM.clearHistory();
// Finally, switch back to original tab
top.ICEcoder.switchTab(thisTab);
}
</script>
<?php
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="")) {
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
$fh = fopen($file, 'w') or die("Sorry, cannot save");
fwrite($fh, $_POST['contents']);
fclose($fh);
clearstatcache();
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>';
// Reload file manager & rename tab if it was a new file
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');';
echo 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>';
}
} else {
echo "<script>top.ICEcoder.message('Sorry, cannot write\\n".$file."');</script>";
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
} else {
if (!is_writable($saveFile)) {
echo "<script>top.ICEcoder.message('Sorry, cannot write\\n".$file."');</script>";
// Reload stickytab window
echo '<script>if (top.ICEcoder.stickyTab.location) {top.ICEcoder.stickyTab.location.reload()};action="doneSave";</script>';
} else {
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to save\');</script>';
$loadedFile = file_get_contents($file);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
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?');
if (refreshFile) {
var cM = top.ICEcoder.getcMInstance();
var thisTab = top.ICEcoder.selectedTab;
document.getElementById('userVersionFile').value = cM.getValue();
// Revert back to original
cM.setValue(document.getElementById('loadedFile').value);
top.ICEcoder.changedContent[thisTab-1] = 0;
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($file); ?>";
cM.clearHistory();
// Now for the new file
top.ICEcoder.newTab();
cM = top.ICEcoder.getcMInstance();
cM.setValue(document.getElementById('userVersionFile').value);
cM.clearHistory();
// Finally, switch back to original tab
top.ICEcoder.switchTab(thisTab);
}
action='nothing';
</script>
<?php
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
} else {
echo "<script>action='nothing';top.ICEcoder.message('Sorry, cannot write\\n".$file."')</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
};
?>
<script>
if (action=="load") {
if (fileType=="text") {
top.ICEcoder.loadingFile = true;
// Reset the various states back to their initial setting
selectedTab = top.ICEcoder.openFiles.length; // The tab that's currently selected
setTimeout(function() {
if (!top.ICEcoder.content.contentWindow.createNewCMInstance) {
console.log('There was tech hiccup, likely something wasn\'t quite ready. So ICEcoder reloaded it\'s file control again.');
window.location.reload();
<?php
if (file_exists($file)) {
?>
} else {
top.ICEcoder.loadingFile = true;
// 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
top.ICEcoder.createNewTab();
top.ICEcoder.cMInstances.push(top.ICEcoder.nextcMInstance);
top.ICEcoder.content.contentWindow.createNewCMInstance(top.ICEcoder.nextcMInstance);
// Finally, store all data, show tabs etc
top.ICEcoder.createNewTab();
top.ICEcoder.cMInstances.push(top.ICEcoder.nextcMInstance);
top.ICEcoder.setLayout();
top.ICEcoder.content.contentWindow.createNewCMInstance(top.ICEcoder.nextcMInstance);
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on _coder's load)
top.ICEcoder.switchMode();
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();
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on _coder's load)
top.ICEcoder.switchMode();
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]].setLineClass(top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab], null);
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(0, "cm-s-activeLine");
top.ICEcoder.nextcMInstance++;
top.ICEcoder.openFileMDTs.push('<?php echo filemtime($file); ?>');
top.ICEcoder.loadingFile = false;
// 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 str_replace($docRoot,"",$file);?>\" 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 str_replace($docRoot,"",$file);?></span>";
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);
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="">
<textarea name="contents"></textarea>
<input type="hidden" name="newFileName" value="">
</form>
<script>
if (action=="save") {
<?php
if ($file=="|[NEW]"||$saveType=="saveAs") {
if (strpos($file,"[NEW]")>0||$saveType=="saveAs") {
if (strpos($fileName,"[NEW]")>0) {echo "fileLoc = '".$fileLoc."';";} else {echo "fileLoc = '';";};
?>
if (top.ICEcoder.rightClickedFile) {
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(top.shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/")+"/";
newFileName = top.ICEcoder.getInput('Enter Filename',shortURL);
} else {
newFileName = top.ICEcoder.getInput('Enter Filename','/');
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 = newFileName;
document.saveFile.newFileName.value = '<?php echo $docRoot; ?>' + newFileName;
<?php ;};?>
if ("undefined" == typeof newFileName || (newFileName && "undefined" == typeof overwriteOK) || ("undefined" != typeof overwriteOK && overwriteOK)) {
if ("undefined" != typeof newFileName) {
top.ICEcoder.serverMessage('<b>Saving</b><br>'+newFileName);
}
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 {

View File

@@ -19,7 +19,7 @@ table, caption, tbody, tfoot, thead, tr, th, td {
body {margin: 0; overflow: auto}
.refresh {float: right; margin-right: 15px; cursor: pointer}
.refresh {position: fixed; display: inline-block; width: 14px; height: 14px; background: url('../images/file-manager-icons.png') -100px -16px no-repeat; right: 0; margin-right: 15px; cursor: pointer}
.fileManager {
margin: 15px 0 15px 22px;
@@ -30,42 +30,33 @@ body {margin: 0; overflow: auto}
}
.fileManager span {font-family: helvetica, arial, swiss, verdana}
.fileManager a {color: #eee; text-decoration: none}
.fileManager .open {font-style: italic}
.fileManager .closed {font-style: normal}
.fileManager a {color: #eee; text-decoration: none; cursor: pointer}
.fileManager .pft-directory, .fileManager .pft-file {list-style-image: url(../images/blank.gif)}
.fileManager li {margin-left: 15px}
.fileManager ul, .fileManager li {margin-left: 15px}
/* Default file */
.fileManager LI.pft-directory:before, .fileManager LI.pft-file:before {
position: absolute; display: block; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -23px; background:url(../images/file-manager-icons.png) no-repeat 0 0;
position: absolute; display: block; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -23px; background:url(../images/file-folder-icons.png) no-repeat 0 0;
}
.fileManager LI.dirOpen:before {background-position: -16px 0}
@media screen and (-webkit-min-device-pixel-ratio:0) { /* hacked for chrome and safari */
.fileManager LI.pft-directory:before, .fileManager LI.pft-file:before {
margin-top: -19px;
}
}
.fileManager LI.pft-file:before {background-position: -16px 0}
.fileManager LI.pft-file:before {background-position: -32px 0}
/* Additional file types */
.fileManager LI.ext-coffee:before {background-position: -32px 0}
.fileManager LI.ext-css:before {background-position: -48px 0}
.fileManager LI.ext-gif:before {background-position: -64px 0}
.fileManager LI.ext-htm:before {background-position: -80px 0}
.fileManager LI.ext-html:before {background-position: -80px 0}
.fileManager LI.ext-jpg:before {background-position: -96px 0}
.fileManager LI.ext-jpeg:before {background-position: -96px 0}
.fileManager LI.ext-js:before {background-position: -112px 0}
/*.fileManager LI.ext-pdf:before {background-position: -???px 0} */
.fileManager LI.ext-less:before {background-position: -128px 0}
.fileManager LI.ext-php:before {background-position: -144px 0}
.fileManager LI.ext-png:before {background-position: -160px 0}
.fileManager LI.ext-rb:before {background-position: -176px 0}
.fileManager LI.ext-rbx:before {background-position: -176px 0}
.fileManager LI.ext-rhtml:before {background-position: -176px 0}
.fileManager LI.ext-ruby:before {background-position: -176px 0}
/*.fileManager LI.ext-sql:before {background-position: -???px 0} */
/*.fileManager LI.ext-swf:before {background-position: -???px 0} */
.fileManager LI.ext-txt:before {background-position: -192px 0}
/*.fileManager LI.ext-xml:before {background-position: -???px 0} */
.fileManager LI.ext-zip:before {background-position: -208px 0}
.fileManager LI.ext-coffee:before {background-position: -48px 0}
.fileManager LI.ext-css:before {background-position: -64px 0}
.fileManager LI.ext-gif:before {background-position: -80px 0}
.fileManager LI.ext-htm:before, .fileManager LI.ext-html:before {background-position: -96px 0}
.fileManager LI.ext-jpg:before, .fileManager LI.ext-jpeg:before {background-position: -112px 0}
.fileManager LI.ext-js:before {background-position: -128px 0}
.fileManager LI.ext-less:before {background-position: -144px 0}
.fileManager LI.ext-php:before {background-position: -160px 0}
.fileManager LI.ext-png:before {background-position: -176px 0}
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -192px 0}
.fileManager LI.ext-txt:before {background-position: -208px 0}
.fileManager LI.ext-zip:before {background-position: -224px 0}

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}
a {color: #fff; text-decoration: none}
.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}
.help .key .plus {color: #888}
.help .shortcut {display: inline-block; width: 175px; color: #888; margin-left: 5px; float: left}
.key {display: inline-block; width: 175px; text-align: right; margin-right: 5px; float: left}
.key .plus {color: #888}
.shortcut {display: inline-block; width: 175px; color: #888; margin-left: 5px; float: left}

View File

@@ -3,8 +3,9 @@
<html>
<head>
<title>ICE Coder - <?php echo $versionNo;?> :: Help & Shortcuts</title>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> help</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="help.css">
</head>
@@ -12,26 +13,50 @@
<h1 id="title">help</h1>
<h2>In file manager</h2>
<span class="key">Delete</span> <span class="shortcut">Delete file</span><br><br>
<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>
<h2>Within document</h2>
<span class="key">CTRL <span class="plus">+</span> I</span> <span class="shortcut">Search selected text</span><br>
<span class="key">Esc</span> <span class="shortcut">Comment / uncomment text</span><br>
<span class="key">Tab</span> <span class="shortcut">Insert tab / indent selected text</span><br><br>
<div style="display: inline-block; width: 365px; margin-right: 20px">
<h2>Within file manager</h2>
<span class="key">Left click</span> <span class="shortcut">Select file / folder</span><br>
<span class="key">Double click</span> <span class="shortcut">Open file</span><br>
<span class="key">CTRL <span class="plus">+</span> click</span> <span class="shortcut">Multiple select</span><br>
<span class="key">Right click</span> <span class="shortcut">Options for selected</span><br>
<span class="key">Delete</span> <span class="shortcut">Delete selected</span><br><br><br>
<h2>Anywhere</h2>
<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>
<h2>Within document</h2>
<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> &darr;</span> <span class="shortcut">Move line down</span><br>
<span class="key">CTRL <span class="plus">+</span> I</span> <span class="shortcut">Search selected text</span><br>
<span class="key">Esc</span> <span class="shortcut">Comment / uncomment text</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> 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> 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> 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> 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> Alt <span class="plus">+</span> b</span> <span class="shortcut">Wrap selected in &lt;b&gt;</span><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>
<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>
</div>
<h2>Clicking logo</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 style="display: inline-block; width: 365px">
<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>

View File

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

2086
lib/ice-coder.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,18 +17,18 @@ table, caption, tbody, tfoot, thead, tr, th, td {
}
body {overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select:none;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select:none;
user-select: none;
}
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
h1 {font-size: 36px; font-weight: normal; color: #888; margin: 20px 20px 0 20px}
h2 {font-size: 18px; font-weight: normal; color: #fff}
hr {border: 0; height: 1px; background-color: #888}
.results {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff}
.results .resultsPane {position: relative; width: 660px; height: 560px; font-size: 10px; padding: 20px; float: left}
.results .resultsPane {position: relative; width: 660px; height: 340px; overflow: auto; font-size: 10px; padding: 20px; float: left}
.results .resultsPane a {color: rgba(0,198,255,0.7); text-decoration: none}
.results .resultsPane a:hover {text-decoration: underline}
.replace {position: absolute; margin-top: -28px; right: 20px; padding: 5px 10px; font-size: 14px; background-color: rgba(0,198,255,0.7); cursor: pointer}

View File

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

View File

@@ -1,159 +1,148 @@
<?php include("settings.php");?>
<!DOCTYPE html>
<html onContextMenu="return false">
<head>
<title>ICE Coder - <?php echo $versionNo;?> :: File/Folder Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="file-folder-properties.css">
</head>
<body class="properties">
<h1 id="title">properties</h1>
<?php
$fileName=str_replace("|","/",strClean($_GET['fileName']));
?>
<h2><?php echo basename($fileName); ?></h2><br>
<span class="column" style="width: 180px">Size: <?php
$bytes = filesize($fileName);
// If it's a dir, get the dir size
if (is_dir($fileName)) {
$io = popen('/usr/bin/du -sb '.$fileName, 'r');
$bytes = intval(fgets($io,80));
pclose($io);
}
// Change into kilobytes
$outputSize = ($bytes/1024);
$outputUnit = "kb";
// Maybe we should show in megabytes?
if ($outputSize >= 1024) {
$outputSize = ($outputSize/1024);
$outputUnit = "mb";
}
echo number_format($outputSize, 2, '.', '').$outputUnit." (".number_format($bytes)." bytes)";
?></span>
<span class="column" style="margin: 0 10px">Modified: <?php echo date( "D d M Y g:i:sa", filemtime($fileName)); ?></span>
<span class="column">Last access: <?php echo date( "D d M Y g:i:sa", fileatime($fileName)); ?></span>
<br><br>
<span class="column" style="width: 180px">Type: <?php echo is_dir($fileName) ? "Folder" : "File"; ?></span>
<span class="column" style="margin: 0 10px">Readable / Writeable: <?php
if ($_SESSION['userLevel'] == 10) {
echo is_readable($fileName) ? "Yes" : "No"; ?> / <?php echo is_writeable($fileName) ? "Yes" : "No";
} else {
echo '[HIDDEN]';
}
?></span>
<span class="column">Relative path: <?php echo str_replace($docRoot,"",$fileName);?></span>
<span style="font-size:10px">
<br><br>
Absolute path:<br><?php
if ($_SESSION['userLevel'] == 10) {echo $fileName;} else {echo '[HIDDEN]';}
?>
<br><br>
</span>
<span class="column" style="width: 180px">
Permissions:
<?
$chmodInfo = substr(sprintf('%o', fileperms($fileName)), -4);
echo $chmodInfo;
?>
</span>
<span class="column" style="margin: 0 10px">
<?php
$perms = str_split(substr($chmodInfo,1,3)); // reduces 0705 down to 705
$readVars = array(4,5,6,7);
$writeVars = array(2,3,6,7);
$execVars = array(1,3,5,7);
?>
<table>
<tr><th>Owner</th><th>Group</th><th>Public</th></tr>
<tr>
<td><input type="checkbox" name="ownerR" id="owner4"<?php if(in_array($perms[0],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
<td><input type="checkbox" name="groupR" id="group4"<?php if(in_array($perms[1],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
<td><input type="checkbox" name="publicR" id="public4"<?php if(in_array($perms[2],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
</tr>
<tr>
<td><input type="checkbox" name="ownerW" id="owner2"<?php if(in_array($perms[0],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
<td><input type="checkbox" name="groupW" id="group2"<?php if(in_array($perms[1],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
<td><input type="checkbox" name="publicW" id="public2"<?php if(in_array($perms[2],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
</tr>
<tr>
<td><input type="checkbox" name="ownerE" id="owner1"<?php if(in_array($perms[0],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
<td><input type="checkbox" name="groupE" id="group1"<?php if(in_array($perms[1],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
<td><input type="checkbox" name="publicE" id="public1"<?php if(in_array($perms[2],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
</tr>
</table>
</span>
<span class="column">
Change to:<br>
<form name="chmod" action="#" method="GET">
<input type="text" name="chmod" id="permText" style="width: 30px; border: 0; background-color: #444; font-size: 10px; color: #fff" maxlength="3" value="<?php echo substr($chmodInfo,1,3); ?>" onKeyUp="changePerms(this.value);showButton()" onChange="changePerms(this.value);showButton()">
</form>
</span>
<div class="update" id="updateButton" onClick="validatePerms()">update</div>
<script>
readVars = [4,5,6,7];
writeVars = [2,3,6,7];
execVars = [1,3,5,7];
permGroups = ['owner','group','public'];
permValues = [4,2,1];
permTypes = ['read','write','exec'];
function changePerms(val) {
var permText = document.getElementById('permText').value;
// change checkboxes
if (val) {
// set values
if (permText.length==3) {
for (var i=0;i<=2;i++) {
for (var j=0;j<=2;j++) {
document.getElementById(permGroups[i]+permValues[j]).checked = window[permTypes[j]+'Vars'].indexOf(permText.split("")[i]*1)>-1;
}
}
// clear values
} else {
for (var i=0;i<=2;i++) {
for (var j=0;j<=2;j++) {
document.getElementById(permGroups[i]+permValues[j]).checked = false;
}
}
}
// change text value
} else {
ownerPerms = (document.getElementById('owner4').checked*4)+(document.getElementById('owner2').checked*2)+(document.getElementById('owner1').checked*1);
groupPerms = (document.getElementById('group4').checked*4)+(document.getElementById('group2').checked*2)+(document.getElementById('group1').checked*1);
publicPerms = (document.getElementById('public4').checked*4)+(document.getElementById('public2').checked*2)+(document.getElementById('public1').checked*1);
document.getElementById('permText').value = ownerPerms.toString() + groupPerms.toString() + publicPerms.toString();
}
}
var showButton = function() {
document.getElementById('updateButton').style.opacity = 1;
}
var validatePerms = function() {
var permText = document.getElementById('permText').value;
canUpdate = true;
if (permText.length!=3 || isNaN(permText)) {canUpdate = false};
if ( permText.split("")[0]*1 <0 || permText.split("")[0]*1 >7 ||
permText.split("")[1]*1 <0 || permText.split("")[1]*1 >7 ||
permText.split("")[2]*1 <0 || permText.split("")[2]*1 >7) {
canUpdate = false;
}
<?php
if ($_SESSION['userLevel'] == 10) {
?>
if (canUpdate) {top.ICEcoder.chmod('<?php echo str_replace($docRoot,"",$fileName);?>',permText)};
<?php
;};
?>
}
</script>
</body>
<?php include("settings.php");?>
<!DOCTYPE html>
<html onContextMenu="return false">
<head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> file/folder properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="properties.css">
</head>
<body class="properties">
<h1 id="title">properties</h1>
<?php
$fileName=$docRoot.$iceRoot.str_replace("|","/",strClean($_GET['fileName']));
?>
<h2><?php echo basename($fileName); ?></h2><br>
<span class="column" style="width: 180px">Size: <?php
$bytes = filesize($fileName);
// If it's a dir, get the dir size
if (is_dir($fileName)) {
$io = popen('/usr/bin/du -sb '.$fileName, 'r');
$bytes = intval(fgets($io,80));
pclose($io);
}
// Change into kilobytes
$outputSize = ($bytes/1024);
$outputUnit = "kb";
// Maybe we should show in megabytes?
if ($outputSize >= 1024) {
$outputSize = ($outputSize/1024);
$outputUnit = "mb";
}
echo number_format($outputSize, 2, '.', '').$outputUnit." (".number_format($bytes)." bytes)";
?></span>
<span class="column" style="margin: 0 10px">Modified: <?php echo date( "D d M Y g:i:sa", filemtime($fileName)); ?></span>
<span class="column">Last access: <?php echo date( "D d M Y g:i:sa", fileatime($fileName)); ?></span>
<br><br>
<span class="column" style="width: 180px">Type: <?php echo is_dir($fileName) ? "Folder" : "File"; ?></span>
<span class="column" style="margin: 0 10px">Readable / Writeable:
<?php echo is_readable($fileName) ? "Yes" : "No"; ?> / <?php echo is_writeable($fileName) ? "Yes" : "No";?>
</span>
<span class="column">Relative path: <?php echo str_replace($docRoot,"",$fileName);?></span>
<span style="font-size:10px">
<br><br>
Absolute path:<br><?php echo $fileName;?>
<br><br>
</span>
<span class="column" style="width: 180px">
Permissions:
<?php
$chmodInfo = substr(sprintf('%o', fileperms($fileName)), -4);
echo $chmodInfo;
?>
</span>
<span class="column" style="margin: 0 10px">
<?php
$perms = str_split(substr($chmodInfo,1,3)); // reduces 0705 down to 705
$readVars = array(4,5,6,7);
$writeVars = array(2,3,6,7);
$execVars = array(1,3,5,7);
?>
<table>
<tr><th>Owner</th><th>Group</th><th>Public</th></tr>
<tr>
<td><input type="checkbox" name="ownerR" id="owner4"<?php if(in_array($perms[0],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
<td><input type="checkbox" name="groupR" id="group4"<?php if(in_array($perms[1],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
<td><input type="checkbox" name="publicR" id="public4"<?php if(in_array($perms[2],$readVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Read</td>
</tr>
<tr>
<td><input type="checkbox" name="ownerW" id="owner2"<?php if(in_array($perms[0],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
<td><input type="checkbox" name="groupW" id="group2"<?php if(in_array($perms[1],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
<td><input type="checkbox" name="publicW" id="public2"<?php if(in_array($perms[2],$writeVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Write</td>
</tr>
<tr>
<td><input type="checkbox" name="ownerE" id="owner1"<?php if(in_array($perms[0],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
<td><input type="checkbox" name="groupE" id="group1"<?php if(in_array($perms[1],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
<td><input type="checkbox" name="publicE" id="public1"<?php if(in_array($perms[2],$execVars)!="") {echo ' checked';};?> onClick="changePerms();showButton()"> Execute</td>
</tr>
</table>
</span>
<span class="column">
Change to:<br>
<form name="chmod" action="#" method="GET">
<input type="text" name="chmod" id="permText" style="width: 30px; border: 0; background-color: #444; font-size: 10px; color: #fff" maxlength="3" value="<?php echo substr($chmodInfo,1,3); ?>" onKeyUp="changePerms(this.value);showButton()" onChange="changePerms(this.value);showButton()">
</form>
</span>
<div class="update" id="updateButton" onClick="validatePerms()">update</div>
<script>
readVars = [4,5,6,7];
writeVars = [2,3,6,7];
execVars = [1,3,5,7];
permGroups = ['owner','group','public'];
permValues = [4,2,1];
permTypes = ['read','write','exec'];
function changePerms(val) {
var permText = document.getElementById('permText').value;
// change checkboxes
if (val) {
// set values
if (permText.length==3) {
for (var i=0;i<=2;i++) {
for (var j=0;j<=2;j++) {
document.getElementById(permGroups[i]+permValues[j]).checked = window[permTypes[j]+'Vars'].indexOf(permText.split("")[i]*1)>-1;
}
}
// clear values
} else {
for (var i=0;i<=2;i++) {
for (var j=0;j<=2;j++) {
document.getElementById(permGroups[i]+permValues[j]).checked = false;
}
}
}
// change text value
} else {
ownerPerms = (document.getElementById('owner4').checked*4)+(document.getElementById('owner2').checked*2)+(document.getElementById('owner1').checked*1);
groupPerms = (document.getElementById('group4').checked*4)+(document.getElementById('group2').checked*2)+(document.getElementById('group1').checked*1);
publicPerms = (document.getElementById('public4').checked*4)+(document.getElementById('public2').checked*2)+(document.getElementById('public1').checked*1);
document.getElementById('permText').value = ownerPerms.toString() + groupPerms.toString() + publicPerms.toString();
}
}
var showButton = function() {
document.getElementById('updateButton').style.opacity = 1;
}
var validatePerms = function() {
var permText = document.getElementById('permText').value;
canUpdate = true;
if (permText.length!=3 || isNaN(permText)) {canUpdate = false};
if ( permText.split("")[0]*1 <0 || permText.split("")[0]*1 >7 ||
permText.split("")[1]*1 <0 || permText.split("")[1]*1 >7 ||
permText.split("")[2]*1 <0 || permText.split("")[2]*1 >7) {
canUpdate = false;
}
if (canUpdate) {top.ICEcoder.chmod('<?php echo str_replace($docRoot,"",$fileName);?>',permText)};
}
</script>
</body>
</html>

View File

@@ -41,5 +41,5 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
-moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7);
box-shadow: 0 0 10px 1px rgba(0,198,255,0.7);
}
.settings .plugins {font-family: arial, verdana, helvetica, sans-serif; width: 410px; height: 123px; overflow: hidden}
.settings .plugins {font-family: arial, verdana, helvetica, sans-serif; width: 410px; height: 95px; overflow: auto}
.settings .update {position: absolute; bottom: 0; right: 20px; padding: 5px 10px; font-size: 18px; background-color: rgba(0,198,255,0.7); opacity: 0.1; cursor: pointer}

View File

@@ -1,27 +1,34 @@
<?php include("settings.php");?>
<!DOCTYPE html>
<html>
<head>
<title>ICE Coder - <?php echo $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 name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="settings-screen.css">
<link rel="stylesheet" href="../<?php echo $codeMirrorDir; ?>/lib/codemirror.css">
<script src="../<?php echo $codeMirrorDir; ?>/lib/codemirror-compressed.js"></script>
<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
<style type="text/css">
.CodeMirror {position: absolute; width: 0; background-color: #fff; font-family: monospace}
.CodeMirror-scroll {height: 220px; width: 420px; overflow: hidden}
.CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; font-family: monospace; width: 420px}
.CodeMirror-scroll {height: 240px; overflow: hidden}
/* 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($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>
<link rel="stylesheet" href="editor.css">
<?php
$themeArray = array("ambiance","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","monokai","neat","night","rubyblue","xq-dark");
for ($i=0;$i<count($themeArray)-1;$i++) {
echo '<link rel="stylesheet" href="../'.$codeMirrorDir.'/theme/'.$themeArray[$i].'.css">'.PHP_EOL;
$themeArray = array();
$handle = opendir('../'.$ICEcoder["codeMirrorDir"].'/theme/');
while (false !== ($file = readdir($handle))) {
if ($file !== "." && $file != "..") {
array_push($themeArray,basename($file,".css"));
}
}
sort($themeArray);
for ($i=0;$i<count($themeArray);$i++) {
echo '<link rel="stylesheet" href="../'.$ICEcoder["codeMirrorDir"].'/theme/'.$themeArray[$i].'.css">'.PHP_EOL;
}
?>
</head>
@@ -29,8 +36,8 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
<body class="settings">
<div class="infoPane">
<img src="../images/ice-coder.gif" class="logo">
<div class="version"><?php echo $versionNo;?></div>
<img src="../images/ice-coder.png" class="logo">
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<p>
git:<br>
@@ -38,15 +45,17 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
<br><br>
codemirror dir:<br>
<?php echo $codeMirrorDir; ?>
<?php echo $ICEcoder["codeMirrorDir"]; ?>
<br><br>
codemirror version:<br>
<?php echo $cMThisVer; ?>
<script>
document.write(CodeMirror.version);
</script>
<br><br>
doc root:<br>
<?php if($_SESSION['userLevel']==10) { echo $_SERVER['DOCUMENT_ROOT']; } else { echo '[HIDDEN]'; }; ?>
file manager root:<br>
<?php echo $ICEcoder['root'];?>
<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>
@@ -72,18 +81,18 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
<div class="settingsColumn1">
<h1>settings</h1>
<h2>functionality</h2>
<input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($tabsIndent) {echo ' checked';};?>> tab indents selection<br>
<input type="checkbox" onclick="showButton()" name="checkUpdates" value="true"<?php if($checkUpdates) {echo ' checked';};?>> check for updates on load<br>
<input type="checkbox" onclick="showButton()" name="openLastFiles" value="true"<?php if($openLastFiles) {echo ' checked';};?>> auto open last files on login<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="openLastFiles" value="true"<?php if($ICEcoder["openLastFiles"]) {echo ' checked';};?>> auto open last files on login<br>
<br>
when finding in files, exclude:<br>
<input type="text" onkeydown="showButton()" name="findFilesExclude" value="<?php for($i=0;$i<=count($findFilesExclude)-1;$i++) {echo $findFilesExclude[$i]; if ($i<count($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>
<h2>assisting</h2>
<input type="checkbox" onclick="showButton()" name="codeAssist" value="true"<?php if($codeAssist) {echo ' checked';};?>> code assist<br>
<input type="checkbox" onclick="showButton();showHideTabs()" name="visibleTabs" value="true"<?php if($visibleTabs) {echo ' checked';};?>> visible tabs<br>
<input type="checkbox" onclick="showButton()" name="lockedNav" value="true"<?php if($lockedNav) {echo ' checked';};?>> locked nav<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()" name="lockedNav" value="true"<?php if($ICEcoder["lockedNav"]) {echo ' checked';};?>> locked nav<br>
<br>
<h2>security</h2>
@@ -92,32 +101,23 @@ new password <span style="font-size: 10px; color: #888">8 chars</span><br>
confirm password<br>
<input type="password" name="confirmPassword" onkeydown="showButton()"><br>
<br>
restricted files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="restrictedFiles" value="<?php for($i=0;$i<=count($restrictedFiles)-1;$i++) {echo $restrictedFiles[$i]; if ($i<count($restrictedFiles)-1) {echo ', ';};}; ?>"><br>
banned files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($bannedFiles)-1;$i++) {echo $bannedFiles[$i]; if ($i<count($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>
<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">
<br>
ip addresses<br>
<input type="text" onkeydown="showButton()" name="allowedIPs" value="<?php for($i=0;$i<=count($allowedIPs)-1;$i++) {echo $allowedIPs[$i]; if ($i<count($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 class="settingsColumn2">
<h2>plugins</h2>
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
for($i=0;$i<count($plugins);$i++) {
for($j=0;$j<count($plugins[$i]);$j++) {
echo '"'.$plugins[$i][$j].'"';
if ($j<count($plugins[$i])-1) {
echo ',';
};
if (!($i==count($plugins)-1 && $j==count($plugins[$i])-1)) {
echo PHP_EOL;
}
if (($i<count($plugins)-1 && $j==count($plugins[$i])-1)) {
echo "====================".PHP_EOL;
}
for($i=0;$i<count($ICEcoder["plugins"]);$i++) {
echo '"'.implode('",'.PHP_EOL.'"', $ICEcoder["plugins"][$i]).'"';
if ($i<count($ICEcoder["plugins"])-1) {
echo PHP_EOL."====================".PHP_EOL;
}
}
?></textarea>
@@ -126,14 +126,27 @@ for($i=0;$i<count($plugins);$i++) {
<h2>style</h2>
theme<br>
<select onchange="selectTheme();showButton()" id="select" name="theme">
<option<?php if ($theme=="default") {echo ' selected';}; ?>>default</option>
<option<?php if ($ICEcoder["theme"]=="default") {echo ' selected';}; ?>>default</option>
<?php
for ($i=0;$i<count($themeArray)-1;$i++) {
if ($theme==$themeArray[$i]) {$optionSelected = ' selected';} else {$optionSelected = '';};
for ($i=0;$i<count($themeArray);$i++) {
$optionSelected = $ICEcoder["theme"]==$themeArray[$i] ? ' selected' : '';
echo '<option'.$optionSelected.'>'.$themeArray[$i].'</option>'.PHP_EOL;
}
?>
</select>
<span style="position: absolute; margin: -15px 0 0 20px">
line wrapping<br>
<select onchange="showButton()" name="lineWrapping">
<option value="true"<?php if($ICEcoder["lineWrapping"]) {echo " selected";};?>>yes</option>
<option value="false"<?php if(!$ICEcoder["lineWrapping"]) {echo " selected";};?>>no</option>
</select>
</span>
<span style="position: absolute; margin: -15px 0 0 120px">
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"];?>">
</span>
<br><br>
<textarea id="code" name="code">
@@ -151,19 +164,20 @@ function findSequence(goal) {
}</textarea>
<br>
<span style="position: absolute; top: 520px">
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 $tabWidth;?>">
<span style="position: absolute; top: 510px">
<h2>file manager</h2>
root <span style="font-size: 10px; color: #888">slash prefixed</span><br>
<input type="text" name="root" style="width: 200px" onkeydown="document.settings.changedFileSettings.value='true';showButton()" value="<?php echo $ICEcoder["root"];?>">
</span>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
readOnly: "nocursor",
indentUnit: top.tabWidth,
tabSize: top.tabWidth,
indentUnit: top.ICEcoder.tabWidth,
tabSize: top.ICEcoder.tabWidth,
mode: "javascript",
theme: "<?php if ($theme=="default") {echo 'icecoder';} else {echo $theme;}; ?>"
theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>"
});
var input = document.getElementById("select");
@@ -190,7 +204,6 @@ var showHideTabs = function() {
}
var validatePasswords = function() {
<?php if($_SESSION['userLevel']==10) { ?>
if (document.settings.accountPassword.value != 0 && document.settings.accountPassword.value.length<8) {
top.ICEcoder.message('Please use at least 8 chars in the password');
} else {
@@ -200,9 +213,6 @@ var validatePasswords = function() {
document.settings.submit();
}
}
<?php } else { ?>
top.ICEcoder.message('Sorry, you need to be logged in to change settings');
<?php ;}; ?>
}
</script>

View File

@@ -1,5 +1,22 @@
<?php
session_start();
// Display & log all errors
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__).'/../error-log.txt');
error_reporting(-1);
// Set our default timezone and supress warning with @
@date_default_timezone_set(date_default_timezone_get());
// Start a session if we haven't already
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
define('SALT_LENGTH',9);
@@ -23,117 +40,99 @@ function numClean($var) {
}
// Settings are stored in this file
include("config.php");
$settingsTemplate = 'config-template.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);
$docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
if (strrpos($docRoot,"/")==strlen($docRoot)-1) {$docRoot = substr($docRoot,0,strlen($docRoot)-1);};
// Add ICEcoder settings to beginning of $ICEcoder array
$ICEcoder = array(
"versionNo" => "2.0 beta",
"codeMirrorDir" => "CodeMirror-3.1",
"demoMode" => false
)+$ICEcoder;
$onLoadExtras = "";
$pluginsDisplay = "";
if ($ICEcoder['demoMode'] && $ICEcoder['accountPassword']!="") {$_SESSION['loggedIn']=true;};
$demoMode = $ICEcoder['demoMode'];
// Update this config file?
if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
$settingsFile = 'config.php';
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
$settingsContents = file_get_contents($settingsFile);
// Replace our settings vars
$repPosStart = strpos($settingsContents,'$tabsIndent');
$repPosEnd = strpos($settingsContents,'$previousFiles');
$repPosStart = strpos($settingsContents,'"root"');
$repPosEnd = strpos($settingsContents,'"previousFiles"');
// Prepare all our vars
if ($_POST['tabsIndent']) {$tabsIndent = "true";} else {$tabsIndent = "false";};
if ($_POST['checkUpdates']) {$checkUpdates = "true";} else {$checkUpdates = "false";};
if ($_POST['openLastFiles']) {$openLastFiles = "true";} else {$openLastFiles = "false";};
$findFilesExclude = 'array("'.str_replace(', ','","',strClean($_POST['findFilesExclude'])).'")';
if ($_POST['codeAssist']) {$codeAssist = "true";} else {$codeAssist = "false";};
if ($_POST['visibleTabs']) {$visibleTabs = "true";} else {$visibleTabs = "false";};
if ($_POST['lockedNav']) {$lockedNav = "true";} else {$lockedNav = "false";};
if ($_POST['accountPassword']!="") {$accountPassword = generateHash(strClean($_POST['accountPassword']));};
$restrictedFiles = 'array("'.str_replace(', ','","',strClean($_POST['restrictedFiles'])).'")';
$bannedFiles = 'array("'.str_replace(', ','","',strClean($_POST['bannedFiles'])).'")';
$allowedIPs = 'array("'.str_replace(', ','","',strClean($_POST['allowedIPs'])).'")';
$plugins = 'array('.PHP_EOL.' array('.PHP_EOL.' '.str_replace('====================','),'.PHP_EOL.' array(',$_POST['plugins']).'))';
$theme = strClean($_POST['theme']);
$tabWidth = numClean($_POST['tabWidth']);
$ICEcoder["root"] = strClean($_POST['root']);
$ICEcoder["tabsIndent"] = isset($_POST['tabsIndent']) && $_POST['tabsIndent'] ? "true" : "false";
$ICEcoder["checkUpdates"] = isset($_POST['checkUpdates']) && $_POST['checkUpdates'] ? "true" : "false";
$ICEcoder["openLastFiles"] = isset($_POST['openLastFiles']) && $_POST['openLastFiles'] ? "true" : "false";
$ICEcoder["findFilesExclude"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['findFilesExclude']))).'")';
$ICEcoder["codeAssist"] = isset($_POST['codeAssist']) && $_POST['codeAssist'] ? "true" : "false";
$ICEcoder["visibleTabs"] = isset($_POST['visibleTabs']) && $_POST['visibleTabs'] ? "true" : "false";
$ICEcoder["lockedNav"] = isset($_POST['lockedNav']) && $_POST['lockedNav'] ? "true" : "false";
if ($_POST['accountPassword']!="") {$ICEcoder["accountPassword"] = generateHash(strClean($_POST['accountPassword']));};
$ICEcoder["bannedFiles"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bannedFiles']))).'")';
$ICEcoder["bannedPaths"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bannedPaths']))).'")';
$ICEcoder["allowedIPs"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['allowedIPs']))).'")';
$ICEcoder["plugins"] = 'array('.PHP_EOL.' array('.PHP_EOL.' '.str_replace('====================','),'.PHP_EOL.' array(',$_POST['plugins']).'))';
$ICEcoder["theme"] = strClean($_POST['theme']);
$ICEcoder["lineWrapping"] = strClean($_POST['lineWrapping']);
$ICEcoder["tabWidth"] = numClean($_POST['tabWidth']);
$settingsNew = '$tabsIndent = '.$tabsIndent.';'.PHP_EOL;
$settingsNew .= '$checkUpdates = '.$checkUpdates.';'.PHP_EOL;
$settingsNew .= '$openLastFiles = '.$openLastFiles.';'.PHP_EOL;
$settingsNew .= '$findFilesExclude = '.$findFilesExclude.';'.PHP_EOL;
$settingsNew .= '$codeAssist = '.$codeAssist.';'.PHP_EOL;
$settingsNew .= '$visibleTabs = '.$visibleTabs.';'.PHP_EOL;
$settingsNew .= '$lockedNav = '.$lockedNav.';'.PHP_EOL;
$settingsNew .= '$accountPassword = "'.$accountPassword.'";'.PHP_EOL;
$settingsNew .= '$restrictedFiles = '.$restrictedFiles.';'.PHP_EOL;
$settingsNew .= '$bannedFiles = '.$bannedFiles.';'.PHP_EOL;
$settingsNew .= '$allowedIPs = '.$allowedIPs.';'.PHP_EOL;
$settingsNew .= '$plugins = '.$plugins.';'.PHP_EOL;
$settingsNew .= '$theme = "'.$theme.'";'.PHP_EOL;
$settingsNew .= '$tabWidth = '.$tabWidth.';'.PHP_EOL;
$settingsArray = array("root","tabsIndent","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","bannedPaths","allowedIPs","plugins","theme","lineWrapping","tabWidth");
$settingsNew = "";
for ($i=0;$i<count($settingsArray);$i++) {
$settingsNew .= '"'.$settingsArray[$i].'"'.PHP_EOL.' => ';
$settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="accountPassword"||$settingsArray[$i]=="theme" ? '"' : '';
$settingsNew .= $settingWrap.$ICEcoder[$settingsArray[$i]].$settingWrap.','.PHP_EOL.PHP_EOL;
}
// Compile our new settings
$settingsContents = substr($settingsContents,0,$repPosStart).$settingsNew.substr($settingsContents,($repPosEnd),strlen($settingsContents));
// Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/".$settingsFile." and press refresh");
fwrite($fh, $settingsContents);
fclose($fh);
// OK, now the config file has been updated, update our current session with new arrays
$_SESSION['findFilesExclude'] = $findFilesExclude = explode(", ",strClean($_POST['findFilesExclude']));
$_SESSION['restrictedFiles'] = $restrictedFiles = explode(", ",strClean($_POST['restrictedFiles']));
$_SESSION['bannedFiles'] = $bannedFiles = explode(", ",strClean($_POST['bannedFiles']));
$_SESSION['allowedIPs'] = $allowedIPs = explode(", ",strClean($_POST['allowedIPs']));
// Work out the theme to use now
if ($theme=="default") {$themeURL="lib/editor.css";} else {$themeURL=$codeMirrorDir."/theme/".$theme.".css";};
// Do we need a file manager refresh?
if ($_POST['changedFileSettings']=="true") {$refreshFM="true";} else {$refreshFM="false";};
// With all that worked out, we can now hide the settings screen and apply the new settings
echo "<script>top.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$tabsIndent.",".$codeAssist.",".$lockedNav.",".$visibleTabs.",".$tabWidth.",".$refreshFM.");</script>";
}
// Save the currently opened files for next time
if (isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
if ($_SESSION['userLevel'] == 10) {
$settingsFile = 'config.php';
$settingsContents = file_get_contents($settingsFile);
// Replace our previousFiles var with the the current
$repPosStart = strpos($settingsContents,'previousFiles = "')+18;
$repPosEnd = strpos($settingsContents,'";',$repPosStart)-$repPosStart;
if ($_GET['saveFiles']!="CLEAR") {
$saveFiles=strClean($_GET['saveFiles']);
$settingsContents1 = substr($settingsContents,0,$repPosStart).$saveFiles.substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
// Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
fwrite($fh, $settingsContents1);
// Update our last10Files var?
$saveFilesArray = explode(",",$saveFiles);
$last10FilesArray = explode(",",$last10Files);
for ($i=0;$i<count($saveFilesArray);$i++) {
$inLast10Files = in_array($saveFilesArray[$i],$last10FilesArray);
if (!$inLast10Files && $saveFilesArray[$i] !="") {
$repPosStart = strpos($settingsContents1,'last10Files = "')+16;
$repPosEnd = strpos($settingsContents1,'";',$repPosStart)-$repPosStart;
if ($last10Files!="") {$commaExtra=",";} else {$commaExtra="";};
if (count($last10FilesArray)>=10) {$last10Files=substr($last10Files,0,strrpos($last10Files,','));};
$settingsContents2 = substr($settingsContents1,0,$repPosStart).$saveFilesArray[$i].$commaExtra.$last10Files.substr($settingsContents1,($repPosStart+$repPosEnd),strlen($settingsContents1));
// Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
fwrite($fh, $settingsContents2);
}
}
}
fclose($fh);
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
for ($i=0;$i<count($settingsArray);$i++) {
$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]] = explode(",",str_replace(" ","",strClean($_POST[$settingsArray[$i]])));
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
// Work out the theme to use now
$ICEcoder["theme"]=="default" ? $themeURL = 'lib/editor.css' : $themeURL = $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';
// Do we need a file manager refresh?
$refreshFM = $_POST['changedFileSettings']=="true" ? "true" : "false";
// With all that worked out, we can now hide the settings screen and apply the new settings
echo "<script>top.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$ICEcoder["tabsIndent"].",".$ICEcoder["codeAssist"].",".$ICEcoder["lockedNav"].",".$ICEcoder["visibleTabs"].",".$ICEcoder["lineWrapping"].",".$ICEcoder["tabWidth"].",".$refreshFM.");</script>";
}
// Establish our user level
if (!isset($_SESSION['userLevel'])) {$_SESSION['userLevel'] = 0;};
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$accountPassword)==$accountPassword) {$_SESSION['userLevel'] = 10;};
$_SESSION['userLevel'] = $_SESSION['userLevel'];
if (!isset($_SESSION['loggedIn'])) {$_SESSION['loggedIn'] = false;};
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) {$_SESSION['loggedIn'] = true; header('Location: ../');};
$_SESSION['loggedIn'] = $_SESSION['loggedIn'];
if (!isset($_SESSION['findFilesExclude'])) {$_SESSION['findFilesExclude'] = $findFilesExclude;}
if (!isset($_SESSION['restrictedFiles'])) {$_SESSION['restrictedFiles'] = $restrictedFiles;}
if (!isset($_SESSION['bannedFiles'])) {$_SESSION['bannedFiles'] = $bannedFiles;}
if (!isset($_SESSION['allowedIPs'])) {$_SESSION['allowedIPs'] = $allowedIPs;}
// Define the serverType, docRoot & iceRoot
$serverType = stristr($_SERVER['SERVER_SOFTWARE'], "win") ? "Windows" : "Linux";
$docRoot = rtrim(str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']));
$iceRoot = rtrim(str_replace("\\","/",$ICEcoder["root"]));
if ($_SESSION['loggedIn']) {
echo "<script>top.docRoot='".$docRoot."';top.iceRoot='".$iceRoot."'</script>";
}
// Setup our file security vars
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
for ($i=0;$i<count($settingsArray);$i++) {
if (!isset($_SESSION[$settingsArray[$i]])) {$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]];}
}
// Determin our allowed IP addresses
$allowedIP = false;
@@ -147,48 +146,83 @@ if (!$allowedIP) {
echo '<script>top.window.location="/";</script>';
};
// Establish our shortened URL, explode the path based on server type (Linux or Windows)
if (strpos($_SERVER['DOCUMENT_ROOT'],"/")>-1) {$slashType = "/";} else {$slashType = "\\";};
$shortURLStarts = explode($slashType,$_SERVER['DOCUMENT_ROOT']);
// Save the currently opened files for next time
if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
$settingsContents = file_get_contents($settingsFile);
// Then clear item at the end if there is one, plus trailing slash
// We end up with the directory name of the server root
if ($shortURLStarts[count($shortURLStarts)-1]!="") {$trimArray=1;} else {$trimArray=2;}
$shortURLStarts = $shortURLStarts[count($shortURLStarts)-$trimArray];
// Replace our previousFiles var with the the current
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
if (!$demoMode) {
if ($_GET['saveFiles']!="CLEAR") {
$saveFiles=strClean($_GET['saveFiles']);
$saveFilesArray = explode(",",$saveFiles);
$saveFiles="";
for ($i=0;$i<count($saveFilesArray);$i++) {
$saveFilesArray[$i] = str_replace("/","|",$docRoot).$saveFilesArray[$i];
$saveFiles .= $saveFilesArray[$i].",";
}
$saveFiles = rtrim($saveFiles,",");
} else {
$saveFilesArray = array();
$saveFiles = "";
}
$settingsContents = substr($settingsContents,0,$repPosStart).$saveFiles.substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
// 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");
fwrite($fh, $settingsContents);
// If we're updating or calling from the index.php page, do/redo plugins & last opened files
if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) || strpos($_SERVER['PHP_SELF'],"index.php")>0) {
// Update our last10Files var?
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
for ($i=0;$i<count($saveFilesArray);$i++) {
$inLast10Files = in_array($saveFilesArray[$i],$last10FilesArray);
if (!$inLast10Files && $saveFilesArray[$i] !="") {
$repPosStart = strpos($settingsContents,'last10Files" => "')+18;
$repPosEnd = strpos($settingsContents,'"',$repPosStart)-$repPosStart;
$commaExtra = $ICEcoder["last10Files"]!="" ? "," : "";
if (count($last10FilesArray)>=10) {$ICEcoder["last10Files"]=substr($ICEcoder["last10Files"],0,strrpos($ICEcoder["last10Files"],','));};
$settingsContents = substr($settingsContents,0,$repPosStart).$saveFilesArray[$i].$commaExtra.$ICEcoder["last10Files"].substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
// 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");
fwrite($fh, $settingsContents);
}
}
fclose($fh);
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're updating, do/redo plugins
if ($_SESSION['loggedIn']) {
// If we're updating, we need to recreate the plugins array
if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
$plugins = array();
if (isset($_POST["theme"]) && $_POST["theme"]) {
$ICEcoder["plugins"] = array();
$pluginsArray = explode("====================",str_replace("\"","",str_replace("\r","",str_replace("\n","",$_POST['plugins']))));
for ($i=0;$i<count($pluginsArray);$i++) {
array_push($plugins, explode(",",$pluginsArray[$i]));
array_push($ICEcoder["plugins"], explode(",",$pluginsArray[$i]));
}
}
// Work out the plugins to display to the user
$pluginsDisplay = "";
for ($i=0;$i<count($plugins);$i++) {
$target = explode(":",$plugins[$i][4]);
$pluginsDisplay .= '<a href="'.$plugins[$i][3].'" title="'.$plugins[$i][0].'" target="'.$target[0].'"><img src="'.$plugins[$i][1].'" style="'.$plugins[$i][2].'" alt="'.$plugins[$i][0].'"></a>';
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
$target = explode(":",$ICEcoder["plugins"][$i][4]);
$pluginsDisplay .= '<a href="'.$ICEcoder["plugins"][$i][3].'" title="'.$ICEcoder["plugins"][$i][0].'" target="'.$target[0].'"><img src="'.$ICEcoder["plugins"][$i][1].'" style="'.$ICEcoder["plugins"][$i][2].'" alt="'.$ICEcoder["plugins"][$i][0].'"></a>';
};
// If we're updating, replace the plugin display with our newly established one
if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
echo "<script>top.document.getElementById('pluginsContainer').innerHTML = '".$pluginsDisplay."';</script>";
}
echo "<script>if(top.document.getElementById('pluginsContainer')) {top.document.getElementById('pluginsContainer').innerHTML = '".$pluginsDisplay."'};</script>";
// Work out what plugins we'll need to set on a setInterval
$onLoadExtras = "";
for ($i=0;$i<count($plugins);$i++) {
if ($plugins[$i][5]!="") {
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$plugins[$i][3]."','".$plugins[$i][4]."','".$plugins[$i][5]."')";
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
if ($ICEcoder["plugins"][$i][5]!="") {
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$ICEcoder["plugins"][$i][3]."','".$ICEcoder["plugins"][$i][4]."','".$ICEcoder["plugins"][$i][5]."')";
};
};
// If we're updating our settings, clear existing setIntervals & the array refs, then start new ones
if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
if (isset($_POST["theme"]) && $_POST["theme"]) {
?>
<script>
for (i=0;i<=top.ICEcoder.pluginIntervalRefs.length-1;i++) {
@@ -200,80 +234,63 @@ if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10)
<?php
}
// Finally, open last opened files if we need to (applies to index.php only)
if ($openLastFiles) {
$onLoadExtras .= ";top.ICEcoder.autoOpenFiles()";
}
// Show server data if we're logged in
if ($_SESSION['userLevel'] == 10) {
$onLoadExtras .= ";top.ICEcoder.content.style.visibility='visible'";
}
// Finally, show server data
$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 ($accountPassword == "" && isset($_GET['settings'])) {
} elseif (!$_SESSION['loggedIn']) {
// If the password hasn't been set and we're setting it
if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) {
$password = generateHash(strClean($_POST['accountPassword']));
$settingsFile = $settingsFile;
$settingsContents = file_get_contents($settingsFile);
// Replace our empty password with the one submitted by user
$settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents);
// Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on ".$settingsFile." and press refresh");
fwrite($fh, $settingsContents);
fclose($fh);
// Set the session user level
$_SESSION['loggedIn'] = true;
// Finally, load again as now this file has changed and auto login
header('Location: ../');
}
?>
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<title>ICE Coder - <?php echo $versionNo;?> :: Settings</title>
<link rel="stylesheet" type="text/css" href="coder.css">
</head>
<html>
<head>
<title>ICEcoder <?php
echo $ICEcoder["versionNo"]." : ";
echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="ice-coder.css">
<link rel="icon" type="image/png" href="../favicon.png">
</head>
<body>
<body onLoad="document.settingsUpdate.<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password.focus()">
<div class="screenContainer">
<div class="screenVCenter">
<div class="screenCenter">
<img src="../images/ice-coder.png">
<div class="version"><?php echo $versionNo;?></div>
<form name="settingsUpdate" action="../index.php" method="POST">
<input type="password" name="accountPassword" class="accountPassword">
<input type="submit" name="submit" value="Set Password" class="button">
</form>
</div>
<div class="screenContainer" style="background-color: #141414">
<div class="screenVCenter">
<div class="screenCenter">
<img src="../images/ice-coder.png">
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<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="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "set password" : "login"; ?>" class="button">
</form>
</div>
</div>
</div>
</body>
</body>
</html>
</html>
<?php
} else {
// If the password hasn't been set, set it, but only if we're including
// from the index.php file (as this file is included from multiple places)
if ($accountPassword == "" && strpos($_SERVER['PHP_SELF'],"index.php")>0) {
// If we're setting a password
if (isset($_POST['accountPassword'])) {
$password = generateHash(strClean($_POST['accountPassword']));
$settingsFile = 'lib/config.php';
$settingsContents = file_get_contents($settingsFile);
// Replace our empty password with the one submitted by user
$settingsContents = str_replace('$accountPassword = "";','$accountPassword = "'.$password.'";',$settingsContents);
// Now update the config file
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
fwrite($fh, $settingsContents);
fclose($fh);
// Set the session user level
$_SESSION['userLevel'] = 10;
// Finally, load again as now this file has changed and auto login
header('Location: index.php');
} else {
// We need to set the password
header('Location: lib/settings.php?settings=set');
}
}
// If we're logging in, refresh the file manager and show icons if login is correct
if(isset($_POST['loginPassword'])) {
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$accountPassword)==$accountPassword) {
$loginAttempt = 'loginOK';
} else {
$loginAttempt = 'loginFailed';
}
echo "<script>top.ICEcoder.refreshFileManager('".$loginAttempt."');</script>";
}
}
?>

View File

@@ -1,877 +0,0 @@
<?php
/** Adminer - Compact database management
* @link http://www.adminer.org/
* @author Jakub Vrana, http://www.vrana.cz/
* @copyright 2007 Jakub Vrana
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
* @version 3.3.3
*/error_reporting(6135);$Tb=(!ereg('^(unsafe_raw)?$',ini_get("filter.default")));if($Tb||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$xf=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($xf){$$X=$xf;}}}if(isset($_GET["file"])){header("Expires: ".gmdate("D, d M Y H:i:s",time()+365*24*60*60)." GMT");if($_GET["file"]=="favicon.ico"){header("Content-Type: image/x-icon");echo
base64_decode("AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA/wBhTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERERAAAAAAETMzEQAAAAATERExAAAAABMRETEAAAAAExERMQAAAAATERExAAAAABMRETEAAAAAEzMzMREREQATERExEhEhABEzMxEhEREAAREREhERIRAAAAARIRESEAAAAAESEiEQAAAAABEREQAAAAAAAAAAD//9UAwP/VAIB/AACAf/AAgH+kAIB/gACAfwAAgH8AAIABAACAAf8AgAH/AMAA/wD+AP8A/wAIAf+B1QD//9UA");}elseif($_GET["file"]=="default.css"){header("Content-Type: text/css; charset=utf-8");echo'body{color:#000;background:#fff;font:90%/1.25 Verdana,Arial,Helvetica,sans-serif;margin:0;}a{color:blue;}a:visited{color:navy;}a:hover{color:red;}h1{font-size:150%;margin:0;padding:.8em 1em;border-bottom:1px solid #999;font-weight:normal;color:#777;background:#eee;}h2{font-size:150%;margin:0 0 20px -18px;padding:.8em 1em;border-bottom:1px solid #000;color:#000;font-weight:normal;background:#ddf;}h3{font-weight:normal;font-size:130%;margin:1em 0 0;}form{margin:0;}table{margin:1em 20px 0 0;border:0;border-top:1px solid #999;border-left:1px solid #999;font-size:90%;}td,th{border:0;border-right:1px solid #999;border-bottom:1px solid #999;padding:.2em .3em;}th{background:#eee;text-align:left;}thead th{text-align:center;}thead td,thead th{background:#ddf;}fieldset{display:inline;vertical-align:top;padding:.5em .8em;margin:.8em .5em 0 0;border:1px solid #999;}p{margin:.8em 20px 0 0;}img{vertical-align:middle;border:0;}td img{max-width:200px;max-height:200px;}code{background:#eee;}tbody tr:hover td,tbody tr:hover th{background:#eee;}pre{margin:1em 0 0;}input[type=image]{vertical-align:middle;}.version{color:#777;font-size:67%;}.js .hidden,.nojs .jsonly{display:none;}.nowrap td,.nowrap th,td.nowrap{white-space:pre;}.wrap td{white-space:normal;}.error{color:red;background:#fee;}.error b{background:#fff;font-weight:normal;}.message{color:green;background:#efe;}.error,.message{padding:.5em .8em;margin:1em 20px 0 0;}.char{color:#007F00;}.date{color:#7F007F;}.enum{color:#007F7F;}.binary{color:red;}.odd td{background:#F5F5F5;}.js .checked td,.js .checked th{background:#ddf;}.time{color:silver;font-size:70%;}.function{text-align:right;}.number{text-align:right;}.datetime{text-align:right;}.type{width:15ex;width:auto\\9;}.options select{width:20ex;width:auto\\9;}.active{font-weight:bold;}.sqlarea{width:98%;}#menu{position:absolute;margin:10px 0 0;padding:0 0 30px 0;top:2em;left:0;width:19em;overflow:auto;overflow-y:hidden;white-space:nowrap;}#menu p{padding:.8em 1em;margin:0;border-bottom:1px solid #ccc;}#content{margin:2em 0 0 21em;padding:10px 20px 20px 0;}#lang{position:absolute;top:0;left:0;line-height:1.8em;padding:.3em 1em;}#breadcrumb{white-space:nowrap;position:absolute;top:0;left:21em;background:#eee;height:2em;line-height:1.8em;padding:0 1em;margin:0 0 0 -18px;}#loader{position:fixed;top:0;left:18em;z-index:1;}#h1{color:#777;text-decoration:none;font-style:italic;}#version{font-size:67%;color:red;}#schema{margin-left:60px;position:relative;}#schema .table{border:1px solid silver;padding:0 2px;cursor:move;position:absolute;}#schema .references{position:absolute;}.rtl h2{margin:0 -18px 20px 0;}.rtl p,.rtl table,.rtl .error,.rtl .message{margin:1em 0 0 20px;}.rtl #content{margin:2em 21em 0 0;padding:10px 0 20px 20px;}.rtl #breadcrumb{left:auto;right:21em;margin:0 -18px 0 0;}.rtl #lang,.rtl #menu{left:auto;right:0;}@media print{#lang,#menu{display:none;}#content{margin-left:1em;}#breadcrumb{left:1em;}.nowrap td,.nowrap th,td.nowrap{white-space:normal;}}';}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");?>
function toggle(id){var el=document.getElementById(id);el.className=(el.className=='hidden'?'':'hidden');return true;}
function cookie(assign,days){var date=new Date();date.setDate(date.getDate()+days);document.cookie=assign+'; expires='+date;}
function verifyVersion(){cookie('adminer_version=0',1);var script=document.createElement('script');script.src=location.protocol+'//www.adminer.org/version.php';document.body.appendChild(script);}
function selectValue(select){var selected=select.options[select.selectedIndex];return((selected.attributes.value||{}).specified?selected.value:selected.text);}
function trCheck(el){var tr=el.parentNode.parentNode;tr.className=tr.className.replace(/(^|\s)checked(\s|$)/,'$2')+(el.checked?' checked':'');}
function formCheck(el,name){var elems=el.form.elements;for(var i=0;i<elems.length;i++){if(name.test(elems[i].name)){elems[i].checked=el.checked;trCheck(elems[i]);}}}
function tableCheck(){var tables=document.getElementsByTagName('table');for(var i=0;i<tables.length;i++){if(/(^|\s)checkable(\s|$)/.test(tables[i].className)){var trs=tables[i].getElementsByTagName('tr');for(var j=0;j<trs.length;j++){trCheck(trs[j].firstChild.firstChild);}}}}
function formUncheck(id){var el=document.getElementById(id);el.checked=false;trCheck(el);}
function formChecked(el,name){var checked=0;var elems=el.form.elements;for(var i=0;i<elems.length;i++){if(name.test(elems[i].name)&&elems[i].checked){checked++;}}
return checked;}
function tableClick(event){var click=true;var el=event.target||event.srcElement;while(!/^tr$/i.test(el.tagName)){if(/^table$/i.test(el.tagName)){return;}
if(/^(a|input|textarea)$/i.test(el.tagName)){click=false;}
el=el.parentNode;}
el=el.firstChild.firstChild;if(click){el.click&&el.click();el.onclick&&el.onclick();}
trCheck(el);}
function setHtml(id,html){var el=document.getElementById(id);if(el){if(html==undefined){el.parentNode.innerHTML='&nbsp;';}else{el.innerHTML=html;}}}
function nodePosition(el){var pos=0;while(el=el.previousSibling){pos++;}
return pos;}
function pageClick(href,page,event){if(!isNaN(page)&&page){href+=(page!=1?'&page='+(page-1):'');if(!ajaxSend(href)){location.href=href;}}}
function selectAddRow(field){field.onchange=function(){};var row=field.parentNode.cloneNode(true);var selects=row.getElementsByTagName('select');for(var i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/[a-z]\[\d+/,'$&1');selects[i].selectedIndex=0;}
var inputs=row.getElementsByTagName('input');if(inputs.length){inputs[0].name=inputs[0].name.replace(/[a-z]\[\d+/,'$&1');inputs[0].value='';inputs[0].className='';}
field.parentNode.parentNode.appendChild(row);}
function bodyKeydown(event,button){var target=event.target||event.srcElement;if(event.ctrlKey&&(event.keyCode==13||event.keyCode==10)&&!event.altKey&&!event.metaKey&&/select|textarea|input/i.test(target.tagName)){target.blur();if(!ajaxForm(target.form,(button?button+'=1':''))){if(button){target.form[button].click();}else{target.form.submit();}}
return false;}
return true;}
function editingKeydown(event){if((event.keyCode==40||event.keyCode==38)&&event.ctrlKey&&!event.altKey&&!event.metaKey){var target=event.target||event.srcElement;var sibling=(event.keyCode==40?'nextSibling':'previousSibling');var el=target.parentNode.parentNode[sibling];if(el&&(/^tr$/i.test(el.tagName)||(el=el[sibling]))&&/^tr$/i.test(el.tagName)&&(el=el.childNodes[nodePosition(target.parentNode)])&&(el=el.childNodes[nodePosition(target)])){el.focus();}
return false;}
if(event.shiftKey&&!bodyKeydown(event,'insert')){eventStop(event);return false;}
return true;}
function functionChange(select){var input=select.form[select.name.replace(/^function/,'fields')];if(selectValue(select)){if(input.origMaxLength===undefined){input.origMaxLength=input.maxLength;}
input.removeAttribute('maxlength');}else if(input.origMaxLength>=0){input.maxLength=input.origMaxLength;}}
function ajax(url,callback,data){var xmlhttp=(window.XMLHttpRequest?new XMLHttpRequest():(window.ActiveXObject?new ActiveXObject('Microsoft.XMLHTTP'):false));if(xmlhttp){xmlhttp.open((data?'POST':'GET'),url);if(data){xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){callback(xmlhttp);}};xmlhttp.send(data);}
return xmlhttp;}
function ajaxSetHtml(url){return ajax(url,function(xmlhttp){if(xmlhttp.status){var data=eval('('+xmlhttp.responseText+')');for(var key in data){setHtml(key,data[key]);}}});}
var originalFavicon;function replaceFavicon(href){var favicon=document.getElementById('favicon');if(favicon){favicon.href=href;favicon.parentNode.appendChild(favicon);}}
var ajaxState=0;function ajaxSend(url,data,popState,noscroll){if(!history.pushState){return false;}
var currentState=++ajaxState;onblur=function(){if(!originalFavicon){originalFavicon=(document.getElementById('favicon')||{}).href;}
replaceFavicon(location.pathname+'?file=loader.gif&amp;version=3.3.3');};setHtml('loader','<img src="'+location.pathname+'?file=loader.gif&amp;version=3.3.3" alt="">');return ajax(url,function(xmlhttp){if(currentState==ajaxState){var title=xmlhttp.getResponseHeader('X-AJAX-Title');if(title){document.title=decodeURIComponent(title);}
var redirect=xmlhttp.getResponseHeader('X-AJAX-Redirect');if(redirect){return ajaxSend(redirect,'',popState);}
onblur=function(){};if(originalFavicon){replaceFavicon(originalFavicon);}
if(!xmlhttp.status){setHtml('loader','');}else{if(!popState){if(data||url!=location.href){history.pushState(data,'',url);}}
if(!noscroll&&!/&order/.test(url)){scrollTo(0,0);}
setHtml('content',xmlhttp.responseText);var content=document.getElementById('content');var scripts=content.getElementsByTagName('script');var length=scripts.length;for(var i=0;i<length;i++){var script=document.createElement('script');script.text=scripts[i].text;content.appendChild(script);}
var as=document.getElementById('menu').getElementsByTagName('a');var href=location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/,'$1');for(var i=0;i<as.length;i++){as[i].className=(href==as[i].href?'active':'');}
var dump=document.getElementById('dump');if(dump){var match=/&(select|table)=([^&]+)/.exec(href);dump.href=dump.href.replace(/[^=]+$/,'')+(match?match[2]:'');}
if(window.jush){jush.highlight_tag('code',0);}}}},data);}
onpopstate=function(event){if((ajaxState||event.state)&&!/#/.test(location.href)){ajaxSend(location.href,(event.state&&confirm(areYouSure)?event.state:''),1);}else{ajaxState++;}};function ajaxForm(form,data,noscroll){if((/&(database|scheme|create|view|sql|user|dump|call)=/.test(location.href)&&!/\./.test(data))||(form.onsubmit&&form.onsubmit()===false)){return false;}
var params=[];for(var i=0;i<form.elements.length;i++){var el=form.elements[i];if(/file/i.test(el.type)&&el.value){return false;}else if(el.name&&(!/checkbox|radio|submit|file/i.test(el.type)||el.checked)){params.push(encodeURIComponent(el.name)+'='+encodeURIComponent(/select/i.test(el.tagName)?selectValue(el):el.value));}}
if(data){params.push(data);}
if(form.method=='post'){return ajaxSend((/\?/.test(form.action)?form.action:location.href),params.join('&'),false,noscroll);}
return ajaxSend((form.action||location.href).replace(/\?.*/,'')+'?'+params.join('&'),'',false,noscroll);}
function selectDblClick(td,event,text){if(/input|textarea/i.test(td.firstChild.tagName)){return;}
var original=td.innerHTML;var input=document.createElement(text?'textarea':'input');input.onkeydown=function(event){if(!event){event=window.event;}
if(event.keyCode==27&&!(event.ctrlKey||event.shiftKey||event.altKey||event.metaKey)){td.innerHTML=original;}};var pos=event.rangeOffset;var value=td.firstChild.alt||td.textContent||td.innerText;input.style.width=Math.max(td.clientWidth-14,20)+'px';if(text){var rows=1;value.replace(/\n/g,function(){rows++;});input.rows=rows;}
if(value=='\u00A0'||td.getElementsByTagName('i').length){value='';}
if(document.selection){var range=document.selection.createRange();range.moveToPoint(event.clientX,event.clientY);var range2=range.duplicate();range2.moveToElementText(td);range2.setEndPoint('EndToEnd',range);pos=range2.text.length;}
td.innerHTML='';td.appendChild(input);input.focus();if(text==2){return ajax(location.href+'&'+encodeURIComponent(td.id)+'=',function(xmlhttp){if(xmlhttp.status){input.value=xmlhttp.responseText;input.name=td.id;}});}
input.value=value;input.name=td.id;input.selectionStart=pos;input.selectionEnd=pos;if(document.selection){var range=document.selection.createRange();range.moveEnd('character',-input.value.length+pos);range.select();}}
function bodyClick(event,db,ns){if(event.button||event.ctrlKey||event.shiftKey||event.altKey||event.metaKey){return;}
if(event.getPreventDefault?event.getPreventDefault():event.returnValue===false||event.defaultPrevented){return false;}
var el=event.target||event.srcElement;if(/^a$/i.test(el.parentNode.tagName)){el=el.parentNode;}
if(/^a$/i.test(el.tagName)&&!/:|#|&download=/i.test(el.getAttribute('href'))&&/[&?]username=/.test(el.href)){var match=/&db=([^&]*)/.exec(el.href);var match2=/&ns=([^&]*)/.exec(el.href);return!(db==(match?match[1]:'')&&ns==(match2?match2[1]:'')&&ajaxSend(el.href));}
if(/^input$/i.test(el.tagName)&&/image|submit/.test(el.type)){return!ajaxForm(el.form,(el.name?encodeURIComponent(el.name)+(el.type=='image'?'.x':'')+'=1':''),el.type=='image');}
return true;}
function eventStop(event){if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}}
var jushRoot=location.protocol + '//www.adminer.org/static/';function bodyLoad(version){if(history.state!==undefined){onpopstate(history);}
if(jushRoot){var script=document.createElement('script');script.src=jushRoot+'jush.js';script.onload=function(){if(window.jush){jush.create_links=' target="_blank" rel="noreferrer"';jush.urls.sql_sqlset=jush.urls.sql[0]=jush.urls.sqlset[0]=jush.urls.sqlstatus[0]='http://dev.mysql.com/doc/refman/'+version+'/en/$key';var pgsql='http://www.postgresql.org/docs/'+version+'/static/';jush.urls.pgsql_pgsqlset=jush.urls.pgsql[0]=pgsql+'$key';jush.urls.pgsqlset[0]=pgsql+'runtime-config-$key.html#GUC-$1';jush.style(jushRoot+'jush.css');if(window.jushLinks){jush.custom_links=jushLinks;}
jush.highlight_tag('code',0);}};script.onreadystatechange=function(){if(/^(loaded|complete)$/.test(script.readyState)){script.onload();}};document.body.appendChild(script);}}
function formField(form,name){for(var i=0;i<form.length;i++){if(form[i].name==name){return form[i];}}}
function typePassword(el,disable){try{el.type=(disable?'text':'password');}catch(e){}}
function loginDriver(driver){var trs=driver.parentNode.parentNode.parentNode.rows;for(var i=1;i<trs.length;i++){trs[i].className=(/sqlite/.test(driver.value)?'hidden':'');}}
function textareaKeydown(target,event){if(!event.shiftKey&&!event.altKey&&!event.ctrlKey&&!event.metaKey){if(event.keyCode==9){if(target.setSelectionRange){var start=target.selectionStart;var scrolled=target.scrollTop;target.value=target.value.substr(0,start)+'\t'+target.value.substr(target.selectionEnd);target.setSelectionRange(start+1,start+1);target.scrollTop=scrolled;return false;}else if(target.createTextRange){document.selection.createRange().text='\t';return false;}}
if(event.keyCode==27){var els=target.form.elements;for(var i=1;i<els.length;i++){if(els[i-1]==target){els[i].focus();break;}}
return false;}}
return true;}
var added='.',rowCount;function delimiterEqual(val,a,b){return(val==a+'_'+b||val==a+b||val==a+b.charAt(0).toUpperCase()+b.substr(1));}
function idfEscape(s){return s.replace(/`/,'``');}
function editingNameChange(field){var name=field.name.substr(0,field.name.length-7);var type=formField(field.form,name+'[type]');var opts=type.options;var candidate;var val=field.value;for(var i=opts.length;i--;){var match=/(.+)`(.+)/.exec(opts[i].value);if(!match){if(candidate&&i==opts.length-2&&val==opts[candidate].value.replace(/.+`/,'')&&name=='fields[1]'){return;}
break;}
var table=match[1];var column=match[2];var tables=[table,table.replace(/s$/,''),table.replace(/es$/,'')];for(var j=0;j<tables.length;j++){table=tables[j];if(val==column||val==table||delimiterEqual(val,table,column)||delimiterEqual(val,column,table)){if(candidate){return;}
candidate=i;break;}}}
if(candidate){type.selectedIndex=candidate;type.onchange();}}
function editingAddRow(button,allowed,focus){if(allowed&&rowCount>=allowed){return false;}
var match=/(\d+)(\.\d+)?/.exec(button.name);var x=match[0]+(match[2]?added.substr(match[2].length):added)+'1';var row=button.parentNode.parentNode;var row2=row.cloneNode(true);var tags=row.getElementsByTagName('select');var tags2=row2.getElementsByTagName('select');for(var i=0;i<tags.length;i++){tags2[i].name=tags[i].name.replace(/([0-9.]+)/,x);tags2[i].selectedIndex=tags[i].selectedIndex;}
tags=row.getElementsByTagName('input');tags2=row2.getElementsByTagName('input');var input=tags2[0];for(var i=0;i<tags.length;i++){if(tags[i].name=='auto_increment_col'){tags2[i].value=x;tags2[i].checked=false;}
tags2[i].name=tags[i].name.replace(/([0-9.]+)/,x);if(/\[(orig|field|comment|default)/.test(tags[i].name)){tags2[i].value='';}
if(/\[(has_default)/.test(tags[i].name)){tags2[i].checked=false;}}
tags[0].onchange=function(){editingNameChange(tags[0]);};row.parentNode.insertBefore(row2,row.nextSibling);if(focus){input.onchange=function(){editingNameChange(input);};input.focus();}
added+='0';rowCount++;return true;}
function editingRemoveRow(button){var field=formField(button.form,button.name.replace(/drop_col(.+)/,'fields$1[field]'));field.parentNode.removeChild(field);button.parentNode.parentNode.style.display='none';return true;}
var lastType='';function editingTypeChange(type){var name=type.name.substr(0,type.name.length-6);var text=selectValue(type);for(var i=0;i<type.form.elements.length;i++){var el=type.form.elements[i];if(el.name==name+'[length]'&&!((/(char|binary)$/.test(lastType)&&/(char|binary)$/.test(text))||(/(enum|set)$/.test(lastType)&&/(enum|set)$/.test(text)))){el.value='';}
if(lastType=='timestamp'&&el.name==name+'[has_default]'&&/timestamp/i.test(formField(type.form,name+'[default]').value)){el.checked=false;}
if(el.name==name+'[collation]'){el.className=(/(char|text|enum|set)$/.test(text)?'':'hidden');}
if(el.name==name+'[unsigned]'){el.className=(/(int|float|double|decimal)$/.test(text)?'':'hidden');}
if(el.name==name+'[on_delete]'){el.className=(/`/.test(text)?'':'hidden');}}}
function editingLengthFocus(field){var td=field.parentNode;if(/(enum|set)$/.test(selectValue(td.previousSibling.firstChild))){var edit=document.getElementById('enum-edit');var val=field.value;edit.value=(/^'.+','.+'$/.test(val)?val.substr(1,val.length-2).replace(/','/g,"\n").replace(/''/g,"'"):val);td.appendChild(edit);field.style.display='none';edit.style.display='inline';edit.focus();}}
function editingLengthBlur(edit){var field=edit.parentNode.firstChild;var val=edit.value;field.value=(/\n/.test(val)?"'"+val.replace(/\n+$/,'').replace(/'/g,"''").replace(/\n/g,"','")+"'":val);field.style.display='inline';edit.style.display='none';}
function columnShow(checked,column){var trs=document.getElementById('edit-fields').getElementsByTagName('tr');for(var i=0;i<trs.length;i++){trs[i].getElementsByTagName('td')[column].className=(checked?'':'hidden');}}
function partitionByChange(el){var partitionTable=/RANGE|LIST/.test(selectValue(el));el.form['partitions'].className=(partitionTable||!el.selectedIndex?'hidden':'');document.getElementById('partition-table').className=(partitionTable?'':'hidden');}
function partitionNameChange(el){var row=el.parentNode.parentNode.cloneNode(true);row.firstChild.firstChild.value='';el.parentNode.parentNode.parentNode.appendChild(row);el.onchange=function(){};}
function foreignAddRow(field){field.onchange=function(){};var row=field.parentNode.parentNode.cloneNode(true);var selects=row.getElementsByTagName('select');for(var i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/\]/,'1$&');selects[i].selectedIndex=0;}
field.parentNode.parentNode.parentNode.appendChild(row);}
function indexesAddRow(field){field.onchange=function(){};var parent=field.parentNode.parentNode;var row=parent.cloneNode(true);var selects=row.getElementsByTagName('select');for(var i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/indexes\[\d+/,'$&1');selects[i].selectedIndex=0;}
var inputs=row.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){inputs[i].name=inputs[i].name.replace(/indexes\[\d+/,'$&1');inputs[i].value='';}
parent.parentNode.appendChild(row);}
function indexesChangeColumn(field,prefix){var columns=field.parentNode.parentNode.getElementsByTagName('select');var names=[];for(var i=0;i<columns.length;i++){var value=selectValue(columns[i]);if(value){names.push(value);}}
field.form[field.name.replace(/\].*/,'][name]')].value=prefix+names.join('_');}
function indexesAddColumn(field,prefix){field.onchange=function(){indexesChangeColumn(field,prefix);};var select=field.form[field.name.replace(/\].*/,'][type]')];if(!select.selectedIndex){select.selectedIndex=3;select.onchange();}
var column=field.parentNode.cloneNode(true);select=column.getElementsByTagName('select')[0];select.name=select.name.replace(/\]\[\d+/,'$&1');select.selectedIndex=0;var input=column.getElementsByTagName('input')[0];input.name=input.name.replace(/\]\[\d+/,'$&1');input.value='';field.parentNode.parentNode.appendChild(column);field.onchange();}
var that,x,y,em,tablePos;function schemaMousedown(el,event){that=el;x=event.clientX-el.offsetLeft;y=event.clientY-el.offsetTop;}
function schemaMousemove(ev){if(that!==undefined){ev=ev||event;var left=(ev.clientX-x)/em;var top=(ev.clientY-y)/em;var divs=that.getElementsByTagName('div');var lineSet={};for(var i=0;i<divs.length;i++){if(divs[i].className=='references'){var div2=document.getElementById((divs[i].id.substr(0,4)=='refs'?'refd':'refs')+divs[i].id.substr(4));var ref=(tablePos[divs[i].title]?tablePos[divs[i].title]:[div2.parentNode.offsetTop/em,0]);var left1=-1;var isTop=true;var id=divs[i].id.replace(/^ref.(.+)-.+/,'$1');if(divs[i].parentNode!=div2.parentNode){left1=Math.min(0,ref[1]-left)-1;divs[i].style.left=left1+'em';divs[i].getElementsByTagName('div')[0].style.width=-left1+'em';var left2=Math.min(0,left-ref[1])-1;div2.style.left=left2+'em';div2.getElementsByTagName('div')[0].style.width=-left2+'em';isTop=(div2.offsetTop+ref[0]*em>divs[i].offsetTop+top*em);}
if(!lineSet[id]){var line=document.getElementById(divs[i].id.replace(/^....(.+)-\d+$/,'refl$1'));var shift=ev.clientY-y-that.offsetTop;line.style.left=(left+left1)+'em';if(isTop){line.style.top=(line.offsetTop+shift)/em+'em';}
if(divs[i].parentNode!=div2.parentNode){line=line.getElementsByTagName('div')[0];line.style.height=(line.offsetHeight+(isTop?-1:1)*shift)/em+'em';}
lineSet[id]=true;}}}
that.style.left=left+'em';that.style.top=top+'em';}}
function schemaMouseup(ev,db){if(that!==undefined){ev=ev||event;tablePos[that.firstChild.firstChild.firstChild.data]=[(ev.clientY-y)/em,(ev.clientX-x)/em];that=undefined;var s='';for(var key in tablePos){s+='_'+key+':'+Math.round(tablePos[key][0]*10000)/10000+'x'+Math.round(tablePos[key][1]*10000)/10000;}
s=encodeURIComponent(s.substr(1));var link=document.getElementById('schema-link');link.href=link.href.replace(/[^=]+$/,'')+s;cookie('adminer_schema-'+db+'='+s,30);}}<?php
}else{header("Content-Type: image/gif");switch($_GET["file"]){case"plus.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIYSPqcvtD00I8cwqKb5v+q8pIAhxlRmhZYi17iPE8kzLBQA7");break;case"cross.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACI4SPqcvtDyMKYdZGb355wy6BX3dhlOEx57FK7gtHwkzXNl0AADs=");break;case"up.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00IUU4K730T9J5hFTiKEXmaYcW2rgDH8hwXADs=");break;case"down.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00I8cwqKb5bV/5cosdMJtmcHca2lQDH8hwXADs=");break;case"arrow.gif":echo
base64_decode("R0lGODlhCAAKAIAAAICAgP///yH5BAEAAAEALAAAAAAIAAoAAAIPBIJplrGLnpQRqtOy3rsAADs=");break;case"loader.gif":echo
base64_decode("R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==");break;}}exit;}function
connection(){global$e;return$e;}function
adminer(){global$b;return$b;}function
idf_unescape($lc){$Ac=substr($lc,-1);return
str_replace($Ac.$Ac,$Ac,substr($lc,1,-1));}function
escape_string($X){return
substr(q($X),1,-1);}function
remove_slashes($Yd,$Tb=false){if(get_magic_quotes_gpc()){while(list($y,$X)=each($Yd)){foreach($X
as$xc=>$W){unset($Yd[$y][$xc]);if(is_array($W)){$Yd[$y][stripslashes($xc)]=$W;$Yd[]=&$Yd[$y][stripslashes($xc)];}else{$Yd[$y][stripslashes($xc)]=($Tb?$W:stripslashes($W));}}}}}function
bracket_escape($lc,$wa=false){static$kf=array(':'=>':1',']'=>':2','['=>':3');return
strtr($lc,($wa?array_flip($kf):$kf));}function
h($Q){return
htmlspecialchars(str_replace("\0","",$Q),ENT_QUOTES);}function
nbsp($Q){return(trim($Q)!=""?h($Q):"&nbsp;");}function
nl_br($Q){return
str_replace("\n","<br>",$Q);}function
checkbox($D,$Y,$Fa,$zc="",$od="",$wc=false){static$t=0;$t++;$J="<input type='checkbox' name='$D' value='".h($Y)."'".($Fa?" checked":"").($od?' onclick="'.h($od).'"':'').($wc?" class='jsonly'":"")." id='checkbox-$t'>";return($zc!=""?"<label for='checkbox-$t'>$J".h($zc)."</label>":$J);}function
optionlist($rd,$we=null,$Bf=false){$J="";foreach($rd
as$xc=>$W){$sd=array($xc=>$W);if(is_array($W)){$J.='<optgroup label="'.h($xc).'">';$sd=$W;}foreach($sd
as$y=>$X){$J.='<option'.($Bf||is_string($y)?' value="'.h($y).'"':'').(($Bf||is_string($y)?(string)$y:$X)===$we?' selected':'').'>'.h($X);}if(is_array($W)){$J.='</optgroup>';}}return$J;}function
html_select($D,$rd,$Y="",$nd=true){if($nd){return"<select name='".h($D)."'".(is_string($nd)?' onchange="'.h($nd).'"':"").">".optionlist($rd,$Y)."</select>";}$J="";foreach($rd
as$y=>$X){$J.="<label><input type='radio' name='".h($D)."' value='".h($y)."'".($y==$Y?" checked":"").">".h($X)."</label>";}return$J;}function
confirm($Wa="",$He=false){return" onclick=\"".($He?"eventStop(event); ":"")."return confirm('".'Are you sure?'.($Wa?" (' + $Wa + ')":"")."');\"";}function
print_fieldset($t,$Fc,$Hf=false,$od=""){echo"<fieldset><legend><a href='#fieldset-$t' onclick=\"".h($od)."return !toggle('fieldset-$t');\">$Fc</a></legend><div id='fieldset-$t'".($Hf?"":" class='hidden'").">\n";}function
bold($Aa){return($Aa?" class='active'":"");}function
odd($J=' class="odd"'){static$s=0;if(!$J){$s=-1;}return($s++%
2?$J:'');}function
js_escape($Q){return
addcslashes($Q,"\r\n'\\/");}function
json_row($y,$X=null){static$Ub=true;if($Ub){echo"{";}if($y!=""){echo($Ub?"":",")."\n\t\"".addcslashes($y,"\r\n\"\\").'": '.(isset($X)?'"'.addcslashes($X,"\r\n\"\\").'"':'undefined');$Ub=false;}else{echo"\n}\n";$Ub=true;}}function
ini_bool($pc){$X=ini_get($pc);return(eregi('^(on|true|yes)$',$X)||(int)$X);}function
sid(){static$J;if(!isset($J)){$J=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));}return$J;}function
q($Q){global$e;return$e->quote($Q);}function
get_vals($H,$Ma=0){global$e;$J=array();$I=$e->query($H);if(is_object($I)){while($K=$I->fetch_row()){$J[]=$K[$Ma];}}return$J;}function
get_key_vals($H,$f=null){global$e;if(!is_object($f)){$f=$e;}$J=array();$I=$f->query($H);if(is_object($I)){while($K=$I->fetch_row()){$J[$K[0]]=$K[1];}}return$J;}function
get_rows($H,$f=null,$i="<p class='error'>"){global$e;if(!is_object($f)){$f=$e;}$J=array();$I=$f->query($H);if(is_object($I)){while($K=$I->fetch_assoc()){$J[]=$K;}}elseif(!$I&&$e->error&&$i&&defined("PAGE_HEADER")){echo$i.error()."\n";}return$J;}function
unique_array($K,$v){foreach($v
as$u){if(ereg("PRIMARY|UNIQUE",$u["type"])){$J=array();foreach($u["columns"]as$y){if(!isset($K[$y])){continue
2;}$J[$y]=$K[$y];}return$J;}}$J=array();foreach($K
as$y=>$X){if(!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~',$y)){$J[$y]=$X;}}return$J;}function
where($Z){global$x;$J=array();foreach((array)$Z["where"]as$y=>$X){$J[]=idf_escape(bracket_escape($y,1)).(ereg('\\.',$X)||$x=="mssql"?" LIKE ".exact_value(addcslashes($X,"%_\\")):" = ".exact_value($X));}foreach((array)$Z["null"]as$y){$J[]=idf_escape($y)." IS NULL";}return
implode(" AND ",$J);}function
where_check($X){parse_str($X,$Ea);remove_slashes(array(&$Ea));return
where($Ea);}function
where_link($s,$Ma,$Y,$pd="="){return"&where%5B$s%5D%5Bcol%5D=".urlencode($Ma)."&where%5B$s%5D%5Bop%5D=".urlencode((isset($Y)?$pd:"IS NULL"))."&where%5B$s%5D%5Bval%5D=".urlencode($Y);}function
cookie($D,$Y){global$ba;$Dd=array($D,(ereg("\n",$Y)?"":$Y),time()+2592000,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0){$Dd[]=true;}return
call_user_func_array('setcookie',$Dd);}function
restart_session(){if(!ini_bool("session.use_cookies")){session_start();}}function&get_session($y){return$_SESSION[$y][DRIVER][SERVER][$_GET["username"]];}function
set_session($y,$X){$_SESSION[$y][DRIVER][SERVER][$_GET["username"]]=$X;}function
auth_url($nb,$O,$Cf){global$ob;preg_match('~([^?]*)\\??(.*)~',remove_from_uri(implode("|",array_keys($ob))."|username|".session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($nb!="server"||$O!=""?urlencode($nb)."=".urlencode($O)."&":"")."username=".urlencode($Cf).($B[2]?"&$B[2]":"");}function
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
redirect($A,$Sc=null){if(isset($Sc)){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',(isset($A)?$A:$_SERVER["REQUEST_URI"]))][]=$Sc;}if(isset($A)){if($A==""){$A=".";}header((is_ajax()?"X-AJAX-Redirect":"Location").": $A");exit;}}function
query_redirect($H,$A,$Sc,$de=true,$Jb=true,$Pb=false){global$e,$i,$b;if($Jb){$Pb=!$e->query($H);}$De="";if($H){$De=$b->messageQuery("$H;");}if($Pb){$i=error().$De;return
false;}if($de){redirect($A,$Sc.$De);}return
true;}function
queries($H=null){global$e;static$be=array();if(!isset($H)){return
implode(";\n",$be);}$be[]=(ereg(';$',$H)?"DELIMITER ;;\n$H;\nDELIMITER ":$H);return$e->query($H);}function
apply_queries($H,$Ve,$Fb='table'){foreach($Ve
as$S){if(!queries("$H ".$Fb($S))){return
false;}}return
true;}function
queries_redirect($A,$Sc,$de){return
query_redirect(queries(),$A,$Sc,$de,false,!$de);}function
remove_from_uri($Cd=""){return
substr(preg_replace("~(?<=[?&])($Cd".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
pagination($E,$bb){return" ".($E==$bb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E":"")).'">'.($E+1)."</a>");}function
get_file($y,$gb=false){$Rb=$_FILES[$y];if(!$Rb||$Rb["error"]){return$Rb["error"];}$J=file_get_contents($gb&&ereg('\\.gz$',$Rb["name"])?"compress.zlib://$Rb[tmp_name]":($gb&&ereg('\\.bz2$',$Rb["name"])?"compress.bzip2://$Rb[tmp_name]":$Rb["tmp_name"]));if($gb){$Ee=substr($J,0,3);if(function_exists("iconv")&&ereg("^\xFE\xFF|^\xFF\xFE",$Ee,$je)){$J=iconv("utf-16","utf-8",$J);}elseif($Ee=="\xEF\xBB\xBF"){$J=substr($J,3);}}return$J;}function
upload_error($i){$Qc=($i==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):null);return($i?'Unable to upload a file.'.($Qc?" ".sprintf('Maximum allowed file size is %sB.',$Qc):""):'File does not exist.');}function
repeat_pattern($F,$Gc){return
str_repeat("$F{0,65535}",$Gc/65535)."$F{0,".($Gc
%
65535)."}";}function
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~',$X));}function
shorten_utf8($Q,$Gc=80,$Le=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{FFFF}]",$Gc).")($)?)u",$Q,$B)){preg_match("(^(".repeat_pattern("[\t\r\n -~]",$Gc).")($)?)",$Q,$B);}return
h($B[1]).$Le.(isset($B[2])?"":"<i>...</i>");}function
friendly_url($X){return
preg_replace('~[^a-z0-9_]~i','-',$X);}function
hidden_fields($Yd,$mc=array()){while(list($y,$X)=each($Yd)){if(is_array($X)){foreach($X
as$xc=>$W){$Yd[$y."[$xc]"]=$W;}}elseif(!in_array($y,$mc)){echo'<input type="hidden" name="'.h($y).'" value="'.h($X).'">';}}}function
hidden_fields_get(){echo(sid()?'<input type="hidden" name="'.session_name().'" value="'.h(session_id()).'">':''),(SERVER!==null?'<input type="hidden" name="'.DRIVER.'" value="'.h(SERVER).'">':""),'<input type="hidden" name="username" value="'.h($_GET["username"]).'">';}function
column_foreign_keys($S){global$b;$J=array();foreach($b->foreignKeys($S)as$l){foreach($l["source"]as$X){$J[$X][]=$l;}}return$J;}function
enum_input($V,$ta,$j,$Y,$zb=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$j["length"],$Lc);$J=(isset($zb)?"<label><input type='$V'$ta value='$zb'".((is_array($Y)?in_array($zb,$Y):$Y===0)?" checked":"")."><i>".'empty'."</i></label>":"");foreach($Lc[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$Fa=(is_int($Y)?$Y==$s+1:(is_array($Y)?in_array($s+1,$Y):$Y===$X));$J.=" <label><input type='$V'$ta value='".($s+1)."'".($Fa?' checked':'').'>'.h($b->editVal($X,$j)).'</label>';}return$J;}function
input($j,$Y,$o){global$sf,$b,$x;$D=h(bracket_escape($j["field"]));echo"<td class='function'>";$le=($x=="mssql"&&$j["auto_increment"]);if($le&&!$_POST["save"]){$o=null;}$p=(isset($_GET["select"])||$le?array("orig"=>'original'):array())+$b->editFunctions($j);$ta=" name='fields[$D]'";if($j["type"]=="enum"){echo
nbsp($p[""])."<td>".$b->editInput($_GET["edit"],$j,$ta,$Y);}else{$Ub=0;foreach($p
as$y=>$X){if($y===""||!$X){break;}$Ub++;}$nd=($Ub?" onchange=\"var f = this.form['function[".h(js_escape(bracket_escape($j["field"])))."]']; if ($Ub > f.selectedIndex) f.selectedIndex = $Ub;\"":"");$ta.=$nd;echo(count($p)>1?html_select("function[$D]",$p,!isset($o)||in_array($o,$p)||isset($p[$o])?$o:"","functionChange(this);"):nbsp(reset($p))).'<td>';$rc=$b->editInput($_GET["edit"],$j,$ta,$Y);if($rc!=""){echo$rc;}elseif($j["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$j["length"],$Lc);foreach($Lc[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$Fa=(is_int($Y)?($Y>>$s)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$D][$s]' value='".(1<<$s)."'".($Fa?' checked':'')."$nd>".h($b->editVal($X,$j)).'</label>';}}elseif(ereg('blob|bytea|raw|file',$j["type"])&&ini_bool("file_uploads")){echo"<input type='file' name='fields-$D'$nd>";}elseif(ereg('text|lob',$j["type"])){echo"<textarea ".($x!="sqlite"||ereg("\n",$Y)?"cols='50' rows='12'":"cols='30' rows='1' style='height: 1.2em;'")."$ta>".h($Y).'</textarea>';}else{$Rc=(!ereg('int',$j["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$j["length"],$B)?((ereg("binary",$j["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$j["unsigned"]?1:0)):($sf[$j["type"]]?$sf[$j["type"]]+($j["unsigned"]?0:1):0));echo"<input value='".h($Y)."'".($Rc?" maxlength='$Rc'":"").(ereg('char|binary',$j["type"])&&$Rc>20?" size='40'":"")."$ta>";}}}function
process_input($j){global$b;$lc=bracket_escape($j["field"]);$o=$_POST["function"][$lc];$Y=$_POST["fields"][$lc];if($j["type"]=="enum"){if($Y==-1){return
false;}if($Y==""){return"NULL";}return+$Y;}if($j["auto_increment"]&&$Y==""){return
null;}if($o=="orig"){return($j["on_update"]=="CURRENT_TIMESTAMP"?idf_escape($j["field"]):false);}if($o=="NULL"){return"NULL";}if($j["type"]=="set"){return
array_sum((array)$Y);}if(ereg('blob|bytea|raw|file',$j["type"])&&ini_bool("file_uploads")){$Rb=get_file("fields-$lc");if(!is_string($Rb)){return
false;}return
q($Rb);}return$b->processInput($j,$Y,$o);}function
search_tables(){global$b,$e;$_GET["where"][0]["op"]="LIKE %%";$_GET["where"][0]["val"]=$_POST["query"];$n=false;foreach(table_status()as$S=>$T){$D=$b->tableName($T);if(isset($T["Engine"])&&$D!=""&&(!$_POST["tables"]||in_array($S,$_POST["tables"]))){$I=$e->query("SELECT".limit("1 FROM ".table($S)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($S),array())),1));if($I->fetch_row()){if(!$n){echo"<ul>\n";$n=true;}echo"<li><a href='".h(ME."select=".urlencode($S)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$D</a>\n";}}}echo($n?"</ul>":"<p class='message'>".'No tables.')."\n";}function
dump_headers($kc,$Zc=false){global$b;$J=$b->dumpHeaders($kc,$Zc);$Ad=$_POST["output"];if($Ad!="text"){header("Content-Disposition: attachment; filename=".friendly_url($kc!=""?$kc:(SERVER!=""?SERVER:"localhost")).".$J".($Ad!="file"&&!ereg('[^0-9a-z]',$Ad)?".$Ad":""));}session_write_close();return$J;}function
dump_csv($K){foreach($K
as$y=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X===""){$K[$y]='"'.str_replace('"','""',$X).'"';}}echo
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$K)."\r\n";}function
apply_sql_function($o,$Ma){return($o?($o=="unixepoch"?"DATETIME($Ma, '$o')":($o=="count distinct"?"COUNT(DISTINCT ":strtoupper("$o("))."$Ma)"):$Ma);}function
password_file(){$kb=ini_get("upload_tmp_dir");if(!$kb){if(function_exists('sys_get_temp_dir')){$kb=sys_get_temp_dir();}else{$Sb=@tempnam("","");if(!$Sb){return
false;}$kb=dirname($Sb);unlink($Sb);}}$Sb="$kb/adminer.key";$J=@file_get_contents($Sb);if($J){return$J;}$Zb=@fopen($Sb,"w");if($Zb){$J=md5(uniqid(mt_rand(),true));fwrite($Zb,$J);fclose($Zb);}return$J;}function
is_mail($wb){$sa='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$mb='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$F="$sa+(\\.$sa+)*@($mb?\\.)+$mb";return
preg_match("(^$F(,\\s*$F)*\$)i",$wb);}function
is_url($Q){$mb='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return(preg_match("~^(https?)://($mb?\\.)+$mb(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$Q,$B)?strtolower($B[1]):"");}global$b,$e,$ob,$ub,$Cb,$i,$p,$ec,$ba,$qc,$x,$ca,$_c,$md,$Je,$U,$mf,$sf,$zf,$ga;if(!isset($_SERVER["REQUEST_URI"])){$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"].($_SERVER["QUERY_STRING"]!=""?"?$_SERVER[QUERY_STRING]":"");}$ba=$_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off");@ini_set("session.use_trans_sid",false);if(!defined("SID")){session_name("adminer_sid");$Dd=array(0,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0){$Dd[]=true;}call_user_func_array('session_set_cookie_params',$Dd);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Tb);if(function_exists("set_magic_quotes_runtime")){set_magic_quotes_runtime(false);}@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",20);function
get_lang(){return'en';}function
lang($lf,$fd){$Nd=($fd==1?0:1);return
sprintf($lf[$Nd],$fd);}if(extension_loaded('pdo')){class
Min_PDO
extends
PDO{var$_result,$server_info,$affected_rows,$error;function
__construct(){}function
dsn($rb,$Cf,$Kd,$Ib='auth_error'){set_exception_handler($Ib);parent::__construct($rb,$Cf,$Kd);restore_exception_handler();$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=$this->getAttribute(4);}function
query($H,$tf=false){$I=parent::query($H);if(!$I){$Db=$this->errorInfo();$this->error=$Db[2];return
false;}$this->store_result($I);return$I;}function
multi_query($H){return$this->_result=$this->query($H);}function
store_result($I=null){if(!$I){$I=$this->_result;}if($I->columnCount()){$I->num_rows=$I->rowCount();return$I;}$this->affected_rows=$I->rowCount();return
true;}function
next_result(){return$this->_result->nextRowset();}function
result($H,$j=0){$I=$this->query($H);if(!$I){return
false;}$K=$I->fetch();return$K[$j];}}class
Min_PDOStatement
extends
PDOStatement{var$_offset=0,$num_rows;function
fetch_assoc(){return$this->fetch(2);}function
fetch_row(){return$this->fetch(3);}function
fetch_field(){$K=(object)$this->getColumnMeta($this->_offset++);$K->orgtable=$K->table;$K->orgname=$K->name;$K->charsetnr=(in_array("blob",$K->flags)?63:0);return$K;}}}$ob=array();$ob=array("server"=>"MySQL")+$ob;if(!defined("DRIVER")){$Qd=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
Min_DB
extends
MySQLi{var$extension="MySQLi";function
Min_DB(){parent::init();}function
connect($O,$Cf,$Kd){mysqli_report(MYSQLI_REPORT_OFF);list($ic,$Md)=explode(":",$O,2);$J=@$this->real_connect(($O!=""?$ic:ini_get("mysqli.default_host")),($O.$Cf!=""?$Cf:ini_get("mysqli.default_user")),($O.$Cf.$Kd!=""?$Kd:ini_get("mysqli.default_pw")),null,(is_numeric($Md)?$Md:ini_get("mysqli.default_port")),(!is_numeric($Md)?$Md:null));if($J){if(method_exists($this,'set_charset')){$this->set_charset("utf8");}else{$this->query("SET NAMES utf8");}}return$J;}function
result($H,$j=0){$I=$this->query($H);if(!$I){return
false;}$K=$I->fetch_array();return$K[$j];}function
quote($Q){return"'".$this->escape_string($Q)."'";}}}elseif(extension_loaded("mysql")){class
Min_DB{var$extension="MySQL",$server_info,$affected_rows,$error,$_link,$_result;function
connect($O,$Cf,$Kd){$this->_link=@mysql_connect(($O!=""?$O:ini_get("mysql.default_host")),("$O$Cf"!=""?$Cf:ini_get("mysql.default_user")),("$O$Cf$Kd"!=""?$Kd:ini_get("mysql.default_password")),true,131072);if($this->_link){$this->server_info=mysql_get_server_info($this->_link);if(function_exists('mysql_set_charset')){mysql_set_charset("utf8",$this->_link);}else{$this->query("SET NAMES utf8");}}else{$this->error=mysql_error();}return(bool)$this->_link;}function
quote($Q){return"'".mysql_real_escape_string($Q,$this->_link)."'";}function
select_db($eb){return
mysql_select_db($eb,$this->_link);}function
query($H,$tf=false){$I=@($tf?mysql_unbuffered_query($H,$this->_link):mysql_query($H,$this->_link));if(!$I){$this->error=mysql_error($this->_link);return
false;}if($I===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
true;}return
new
Min_Result($I);}function
multi_query($H){return$this->_result=$this->query($H);}function
store_result(){return$this->_result;}function
next_result(){return
false;}function
result($H,$j=0){$I=$this->query($H);if(!$I||!$I->num_rows){return
false;}return
mysql_result($I->_result,0,$j);}}class
Min_Result{var$num_rows,$_result,$_offset=0;function
Min_Result($I){$this->_result=$I;$this->num_rows=mysql_num_rows($I);}function
fetch_assoc(){return
mysql_fetch_assoc($this->_result);}function
fetch_row(){return
mysql_fetch_row($this->_result);}function
fetch_field(){$J=mysql_fetch_field($this->_result,$this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=($J->blob?63:0);return$J;}function
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
Min_DB
extends
Min_PDO{var$extension="PDO_MySQL";function
connect($O,$Cf,$Kd){$this->dsn("mysql:host=".str_replace(":",";unix_socket=",preg_replace('~:(\\d)~',';port=\\1',$O)),$Cf,$Kd);$this->query("SET NAMES utf8");return
true;}function
select_db($eb){return$this->query("USE ".idf_escape($eb));}function
query($H,$tf=false){$this->setAttribute(1000,!$tf);return
parent::query($H,$tf);}}}function
idf_escape($lc){return"`".str_replace("`","``",$lc)."`";}function
table($lc){return
idf_escape($lc);}function
connect(){global$b;$e=new
Min_DB;$ab=$b->credentials();if($e->connect($ab[0],$ab[1],$ab[2])){$e->query("SET sql_quote_show_create = 1");return$e;}$J=$e->error;if(function_exists('iconv')&&!is_utf8($J)&&strlen($M=iconv("windows-1250","utf-8",$J))>strlen($J)){$J=$M;}return$J;}function
get_databases($Vb=true){global$e;$J=&get_session("dbs");if(!isset($J)){if($Vb){restart_session();ob_flush();flush();}$J=get_vals($e->server_info>=5?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA":"SHOW DATABASES");}return$J;}function
limit($H,$Z,$z,$hd=0,$ye=" "){return" $H$Z".(isset($z)?$ye."LIMIT $z".($hd?" OFFSET $hd":""):"");}function
limit1($H,$Z){return
limit($H,$Z,1);}function
db_collation($h,$c){global$e;$J=null;$Xa=$e->result("SHOW CREATE DATABASE ".idf_escape($h),1);if(preg_match('~ COLLATE ([^ ]+)~',$Xa,$B)){$J=$B[1];}elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$Xa,$B)){$J=$c[$B[1]][-1];}return$J;}function
engines(){$J=array();foreach(get_rows("SHOW ENGINES")as$K){if(ereg("YES|DEFAULT",$K["Support"])){$J[]=$K["Engine"];}}return$J;}function
logged_user(){global$e;return$e->result("SELECT USER()");}function
tables_list(){global$e;return
get_key_vals("SHOW".($e->server_info>=5?" FULL":"")." TABLES");}function
count_tables($g){$J=array();foreach($g
as$h){$J[$h]=count(get_vals("SHOW TABLES IN ".idf_escape($h)));}return$J;}function
table_status($D=""){$J=array();foreach(get_rows("SHOW TABLE STATUS".($D!=""?" LIKE ".q(addcslashes($D,"%_")):""))as$K){if($K["Engine"]=="InnoDB"){$K["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$K["Comment"]);}if(!isset($K["Rows"])){$K["Comment"]="";}if($D!=""){return$K;}$J[$K["Name"]]=$K;}return$J;}function
is_view($T){return!isset($T["Rows"]);}function
fk_support($T){return
eregi("InnoDB|IBMDB2I",$T["Engine"]);}function
fields($S){$J=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($S))as$K){preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~',$K["Type"],$B);$J[$K["Field"]]=array("field"=>$K["Field"],"full_type"=>$K["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($K["Default"]!=""||ereg("char",$B[1])?$K["Default"]:null),"null"=>($K["Null"]=="YES"),"auto_increment"=>($K["Extra"]=="auto_increment"),"on_update"=>(eregi('^on update (.+)',$K["Extra"],$B)?$B[1]:""),"collation"=>$K["Collation"],"privileges"=>array_flip(explode(",",$K["Privileges"])),"comment"=>$K["Comment"],"primary"=>($K["Key"]=="PRI"),);}return$J;}function
indexes($S,$f=null){$J=array();foreach(get_rows("SHOW INDEX FROM ".table($S),$f)as$K){$J[$K["Key_name"]]["type"]=($K["Key_name"]=="PRIMARY"?"PRIMARY":($K["Index_type"]=="FULLTEXT"?"FULLTEXT":($K["Non_unique"]?"INDEX":"UNIQUE")));$J[$K["Key_name"]]["columns"][]=$K["Column_name"];$J[$K["Key_name"]]["lengths"][]=$K["Sub_part"];}return$J;}function
foreign_keys($S){global$e,$md;static$F='`(?:[^`]|``)+`';$J=array();$Ya=$e->result("SHOW CREATE TABLE ".table($S),1);if($Ya){preg_match_all("~CONSTRAINT ($F) FOREIGN KEY \\(((?:$F,? ?)+)\\) REFERENCES ($F)(?:\\.($F))? \\(((?:$F,? ?)+)\\)(?: ON DELETE ($md))?(?: ON UPDATE ($md))?~",$Ya,$Lc,PREG_SET_ORDER);foreach($Lc
as$B){preg_match_all("~$F~",$B[2],$Be);preg_match_all("~$F~",$B[5],$Ye);$J[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$Be[0]),"target"=>array_map('idf_unescape',$Ye[0]),"on_delete"=>$B[6],"on_update"=>$B[7],);}}return$J;}function
view($D){global$e;return
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$e->result("SHOW CREATE VIEW ".table($D),1)));}function
collations(){$J=array();foreach(get_rows("SHOW COLLATION")as$K){if($K["Default"]){$J[$K["Charset"]][-1]=$K["Collation"];}else{$J[$K["Charset"]][]=$K["Collation"];}}ksort($J);foreach($J
as$y=>$X){asort($J[$y]);}return$J;}function
information_schema($h){global$e;return($e->server_info>=5&&$h=="information_schema");}function
error(){global$e;return
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$e->error));}function
exact_value($X){return
q($X)." COLLATE utf8_bin";}function
create_database($h,$Ka){set_session("dbs",null);return
queries("CREATE DATABASE ".idf_escape($h).($Ka?" COLLATE ".q($Ka):""));}function
drop_databases($g){set_session("dbs",null);return
apply_queries("DROP DATABASE",$g,'idf_escape');}function
rename_database($D,$Ka){if(create_database($D,$Ka)){$ke=array();foreach(tables_list()as$S=>$V){$ke[]=table($S)." TO ".idf_escape($D).".".table($S);}if(!$ke||queries("RENAME TABLE ".implode(", ",$ke))){queries("DROP DATABASE ".idf_escape(DB));return
true;}}return
false;}function
auto_increment(){$va=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$u){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$u["columns"],true)){$va="";break;}if($u["type"]=="PRIMARY"){$va=" UNIQUE";}}}return" AUTO_INCREMENT$va";}function
alter_table($S,$D,$k,$Wb,$Pa,$Ab,$Ka,$ua,$Hd){$ra=array();foreach($k
as$j){$ra[]=($j[1]?($S!=""?($j[0]!=""?"CHANGE ".idf_escape($j[0]):"ADD"):" ")." ".implode($j[1]).($S!=""?" $j[2]":""):"DROP ".idf_escape($j[0]));}$ra=array_merge($ra,$Wb);$Fe="COMMENT=".q($Pa).($Ab?" ENGINE=".q($Ab):"").($Ka?" COLLATE ".q($Ka):"").($ua!=""?" AUTO_INCREMENT=$ua":"").$Hd;if($S==""){return
queries("CREATE TABLE ".table($D)." (\n".implode(",\n",$ra)."\n) $Fe");}if($S!=$D){$ra[]="RENAME TO ".table($D);}$ra[]=$Fe;return
queries("ALTER TABLE ".table($S)."\n".implode(",\n",$ra));}function
alter_indexes($S,$ra){foreach($ra
as$y=>$X){$ra[$y]=($X[2]=="DROP"?"\nDROP INDEX ".idf_escape($X[1]):"\nADD $X[0] ".($X[0]=="PRIMARY"?"KEY ":"").($X[1]!=""?idf_escape($X[1])." ":"").$X[2]);}return
queries("ALTER TABLE ".table($S).implode(",",$ra));}function
truncate_tables($Ve){return
apply_queries("TRUNCATE TABLE",$Ve);}function
drop_views($Gf){return
queries("DROP VIEW ".implode(", ",array_map('table',$Gf)));}function
drop_tables($Ve){return
queries("DROP TABLE ".implode(", ",array_map('table',$Ve)));}function
move_tables($Ve,$Gf,$Ye){$ke=array();foreach(array_merge($Ve,$Gf)as$S){$ke[]=table($S)." TO ".idf_escape($Ye).".".table($S);}return
queries("RENAME TABLE ".implode(", ",$ke));}function
copy_tables($Ve,$Gf,$Ye){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($Ve
as$S){$D=($Ye==DB?table("copy_$S"):idf_escape($Ye).".".table($S));if(!queries("DROP TABLE IF EXISTS $D")||!queries("CREATE TABLE $D LIKE ".table($S))||!queries("INSERT INTO $D SELECT * FROM ".table($S))){return
false;}}foreach($Gf
as$S){$D=($Ye==DB?table("copy_$S"):idf_escape($Ye).".".table($S));$Ff=view($S);if(!queries("DROP VIEW IF EXISTS $D")||!queries("CREATE VIEW $D AS $Ff[select]")){return
false;}}return
true;}function
trigger($D){if($D==""){return
array();}$L=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($D));return
reset($L);}function
triggers($S){$J=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($S,"%_")))as$K){$J[$K["Trigger"]]=array($K["Timing"],$K["Event"]);}return$J;}function
trigger_options(){return
array("Timing"=>array("BEFORE","AFTER"),"Type"=>array("FOR EACH ROW"),);}function
routine($D,$V){global$e,$Cb,$qc,$sf;$pa=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$rf="((".implode("|",array_merge(array_keys($sf),$pa)).")(?:\\s*\\(((?:[^'\")]*|$Cb)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";$F="\\s*(".($V=="FUNCTION"?"":$qc).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$rf";$Xa=$e->result("SHOW CREATE $V ".idf_escape($D),2);preg_match("~\\(((?:$F\\s*,?)*)\\)".($V=="FUNCTION"?"\\s*RETURNS\\s+$rf":"")."\\s*(.*)~is",$Xa,$B);$k=array();preg_match_all("~$F\\s*,?~is",$B[1],$Lc,PREG_SET_ORDER);foreach($Lc
as$Cd){$D=str_replace("``","`",$Cd[2]).$Cd[3];$k[]=array("field"=>$D,"type"=>strtolower($Cd[5]),"length"=>preg_replace_callback("~$Cb~s",'normalize_enum',$Cd[6]),"unsigned"=>strtolower(preg_replace('~\\s+~',' ',trim("$Cd[8] $Cd[7]"))),"full_type"=>$Cd[4],"inout"=>strtoupper($Cd[1]),"collation"=>strtolower($Cd[9]),);}if($V!="FUNCTION"){return
array("fields"=>$k,"definition"=>$B[11]);}return
array("fields"=>$k,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[17],"language"=>"SQL",);}function
routines(){return
get_rows("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = ".q(DB));}function
routine_languages(){return
array();}function
begin(){return
queries("BEGIN");}function
insert_into($S,$P){return
queries("INSERT INTO ".table($S)." (".implode(", ",array_keys($P)).")\nVALUES (".implode(", ",$P).")");}function
insert_update($S,$P,$Td){foreach($P
as$y=>$X){$P[$y]="$y = $X";}$_f=implode(", ",$P);return
queries("INSERT INTO ".table($S)." SET $_f ON DUPLICATE KEY UPDATE $_f");}function
last_id(){global$e;return$e->result("SELECT LAST_INSERT_ID()");}function
explain($e,$H){return$e->query("EXPLAIN $H");}function
found_rows($T,$Z){return($Z||$T["Engine"]!="InnoDB"?null:$T["Rows"]);}function
types(){return
array();}function
schemas(){return
array();}function
get_schema(){return"";}function
set_schema($ue){return
true;}function
create_sql($S,$ua){global$e;$J=$e->result("SHOW CREATE TABLE ".table($S),1);if(!$ua){$J=preg_replace('~ AUTO_INCREMENT=\\d+~','',$J);}return$J;}function
truncate_sql($S){return"TRUNCATE ".table($S);}function
use_sql($eb){return"USE ".idf_escape($eb);}function
trigger_sql($S,$R){$J="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($S,"%_")),null,"-- ")as$K){$J.="\n".($R=='CREATE+ALTER'?"DROP TRIGGER IF EXISTS ".idf_escape($K["Trigger"]).";;\n":"")."CREATE TRIGGER ".idf_escape($K["Trigger"])." $K[Timing] $K[Event] ON ".table($K["Table"])." FOR EACH ROW\n$K[Statement];;\n";}return$J;}function
show_variables(){return
get_key_vals("SHOW VARIABLES");}function
process_list(){return
get_rows("SHOW FULL PROCESSLIST");}function
show_status(){return
get_key_vals("SHOW STATUS");}function
support($Qb){global$e;return!ereg("scheme|sequence|type".($e->server_info<5.1?"|event|partitioning".($e->server_info<5?"|view|routine|trigger":""):""),$Qb);}$x="sql";$sf=array();$Je=array();foreach(array('Numbers'=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),'Date and time'=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),'Strings'=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),'Binary'=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),'Lists'=>array("enum"=>65535,"set"=>64),)as$y=>$X){$sf+=$X;$Je[$y]=array_keys($X);}$zf=array("unsigned","zerofill","unsigned zerofill");$qd=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","");$p=array("char_length","date","from_unixtime","hex","lower","round","sec_to_time","time_to_sec","upper");$ec=array("avg","count","count distinct","group_concat","max","min","sum");$ub=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1/hex","date|time"=>"now",),array("int|float|double|decimal"=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",preg_replace('~^[^?]*/([^?]*).*~','\\1',$_SERVER["REQUEST_URI"]).'?'.(sid()?SID.'&':'').(SERVER!==null?DRIVER."=".urlencode(SERVER).'&':'').(isset($_GET["username"])?"username=".urlencode($_GET["username"]).'&':'').(DB!=""?'db='.urlencode(DB).'&'.(isset($_GET["ns"])?"ns=".urlencode($_GET["ns"])."&":""):''));$ga="3.3.3";class
Adminer{var$operators;function
name(){return"<a href='http://www.adminer.org/' id='h1'>Adminer</a>";}function
credentials(){return
array(SERVER,$_GET["username"],get_session("pwds"));}function
permanentLogin(){return
password_file();}function
database(){return
DB;}function
headers(){return
true;}function
head(){return
true;}function
loginForm(){global$ob;echo'<table cellspacing="0">
<tr><th>System<td>',html_select("driver",$ob,DRIVER,"loginDriver(this);"),'<tr><th>Server<td><input name="server" value="',h(SERVER),'" title="hostname[:port]">
<tr><th>Username<td><input id="username" name="username" value="',h($_GET["username"]);?>">
<tr><th>Password<td><input type="password" name="password">
</table>
<script type="text/javascript">
var username = document.getElementById('username');
username.focus();
username.form['driver'].onchange();
</script>
<?php
echo"<p><input type='submit' value='".'Login'."'>\n",checkbox("permanent",1,$_COOKIE["adminer_permanent"],'Permanent login')."\n";}function
login($Jc,$Kd){return
true;}function
tableName($Qe){return
h($Qe["Name"]);}function
fieldName($j,$td=0){return'<span title="'.h($j["full_type"]).'">'.h($j["field"]).'</span>';}function
selectLinks($Qe,$P=""){echo'<p class="tabs">';$Ic=array("select"=>'Select data',"table"=>'Show structure');if(is_view($Qe)){$Ic["view"]='Alter view';}else{$Ic["create"]='Alter table';}if(isset($P)){$Ic["edit"]='New item';}foreach($Ic
as$y=>$X){echo" <a href='".h(ME)."$y=".urlencode($Qe["Name"]).($y=="edit"?$P:"")."'".bold(isset($_GET[$y])).">$X</a>";}echo"\n";}function
foreignKeys($S){return
foreign_keys($S);}function
backwardKeys($S,$Pe){return
array();}function
backwardKeysPrint($xa,$K){}function
selectQuery($H){global$x;return"<p><a href='".h(remove_from_uri("page"))."&amp;page=last' title='".'Last page'."'>&gt;&gt;</a> <code class='jush-$x'>".h(str_replace("\n"," ",$H))."</code> <a href='".h(ME)."sql=".urlencode($H)."'>".'Edit'."</a></p>\n";}function
rowDescription($S){return"";}function
rowDescriptions($L,$Xb){return$L;}function
selectVal($X,$_,$j){$J=($X!="<i>NULL</i>"&&ereg("char|binary",$j["type"])&&!ereg("var",$j["type"])?"<code>$X</code>":$X);if(ereg('blob|bytea|raw|file',$j["type"])&&!is_utf8($X)){$J=lang(array('%d byte','%d bytes'),strlen(html_entity_decode($X,ENT_QUOTES)));}return($_?"<a href='$_'>$J</a>":$J);}function
editVal($X,$j){return(ereg("binary",$j["type"])?reset(unpack("H*",$X)):$X);}function
selectColumnsPrint($N,$d){global$p,$ec;print_fieldset("select",'Select',$N);$s=0;$bc=array('Functions'=>$p,'Aggregation'=>$ec);foreach($N
as$y=>$X){$X=$_GET["columns"][$y];echo"<div>".html_select("columns[$s][fun]",array(-1=>"")+$bc,$X["fun"]),"(<select name='columns[$s][col]'><option>".optionlist($d,$X["col"],true)."</select>)</div>\n";$s++;}echo"<div>".html_select("columns[$s][fun]",array(-1=>"")+$bc,"","this.nextSibling.nextSibling.onchange();"),"(<select name='columns[$s][col]' onchange='selectAddRow(this);'><option>".optionlist($d,null,true)."</select>)</div>\n","</div></fieldset>\n";}function
selectSearchPrint($Z,$d,$v){print_fieldset("search",'Search',$Z);foreach($v
as$s=>$u){if($u["type"]=="FULLTEXT"){echo"(<i>".implode("</i>, <i>",array_map('h',$u["columns"]))."</i>) AGAINST"," <input name='fulltext[$s]' value='".h($_GET["fulltext"][$s])."'>",checkbox("boolean[$s]",1,isset($_GET["boolean"][$s]),"BOOL"),"<br>\n";}}$s=0;foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){echo"<div><select name='where[$s][col]'><option value=''>(".'anywhere'.")".optionlist($d,$X["col"],true)."</select>",html_select("where[$s][op]",$this->operators,$X["op"]),"<input name='where[$s][val]' value='".h($X["val"])."'></div>\n";$s++;}}echo"<div><select name='where[$s][col]' onchange='selectAddRow(this);'><option value=''>(".'anywhere'.")".optionlist($d,null,true)."</select>",html_select("where[$s][op]",$this->operators,"="),"<input name='where[$s][val]'></div>\n","</div></fieldset>\n";}function
selectOrderPrint($td,$d,$v){print_fieldset("sort",'Sort',$td);$s=0;foreach((array)$_GET["order"]as$y=>$X){if(isset($d[$X])){echo"<div><select name='order[$s]'><option>".optionlist($d,$X,true)."</select>",checkbox("desc[$s]",1,isset($_GET["desc"][$y]),'descending')."</div>\n";$s++;}}echo"<div><select name='order[$s]' onchange='selectAddRow(this);'><option>".optionlist($d,null,true)."</select>","<label><input type='checkbox' name='desc[$s]' value='1'>".'descending'."</label></div>\n";echo"</div></fieldset>\n";}function
selectLimitPrint($z){echo"<fieldset><legend>".'Limit'."</legend><div>";echo"<input name='limit' size='3' value='".h($z)."'>","</div></fieldset>\n";}function
selectLengthPrint($bf){if(isset($bf)){echo"<fieldset><legend>".'Text length'."</legend><div>",'<input name="text_length" size="3" value="'.h($bf).'">',"</div></fieldset>\n";}}function
selectActionPrint(){echo"<fieldset><legend>".'Action'."</legend><div>","<input type='submit' value='".'Select'."'>","</div></fieldset>\n";}function
selectCommandPrint(){return!information_schema(DB);}function
selectImportPrint(){return
true;}function
selectEmailPrint($xb,$d){}function
selectColumnsProcess($d,$v){global$p,$ec;$N=array();$r=array();foreach((array)$_GET["columns"]as$y=>$X){if($X["fun"]=="count"||(isset($d[$X["col"]])&&(!$X["fun"]||in_array($X["fun"],$p)||in_array($X["fun"],$ec)))){$N[$y]=apply_sql_function($X["fun"],(isset($d[$X["col"]])?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$ec)){$r[]=$N[$y];}}}return
array($N,$r);}function
selectSearchProcess($k,$v){global$x;$J=array();foreach($v
as$s=>$u){if($u["type"]=="FULLTEXT"&&$_GET["fulltext"][$s]!=""){$J[]="MATCH (".implode(", ",array_map('idf_escape',$u["columns"])).") AGAINST (".q($_GET["fulltext"][$s]).(isset($_GET["boolean"][$s])?" IN BOOLEAN MODE":"").")";}}foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$Sa=" $X[op]";if(ereg('IN$',$X["op"])){$nc=process_length($X["val"]);$Sa.=" (".($nc!=""?$nc:"NULL").")";}elseif(!$X["op"]){$Sa.=$X["val"];}elseif($X["op"]=="LIKE %%"){$Sa=" LIKE ".$this->processInput($k[$X["col"]],"%$X[val]%");}elseif(!ereg('NULL$',$X["op"])){$Sa.=" ".$this->processInput($k[$X["col"]],$X["val"]);}if($X["col"]!=""){$J[]=idf_escape($X["col"]).$Sa;}else{$La=array();foreach($k
as$D=>$j){if(is_numeric($X["val"])||!ereg('int|float|double|decimal',$j["type"])){$D=idf_escape($D);$La[]=($x=="sql"&&ereg('char|text|enum|set',$j["type"])&&!ereg('^utf8',$j["collation"])?"CONVERT($D USING utf8)":$D);}}$J[]=($La?"(".implode("$Sa OR ",$La)."$Sa)":"0");}}}return$J;}function
selectOrderProcess($k,$v){$J=array();foreach((array)$_GET["order"]as$y=>$X){if(isset($k[$X])||preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~',$X)){$J[]=(isset($k[$X])?idf_escape($X):$X).(isset($_GET["desc"][$y])?" DESC":"");}}return$J;}function
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"30");}function
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
selectEmailProcess($Z,$Xb){return
false;}function
messageQuery($H){global$x;static$Wa=0;restart_session();$t="sql-".($Wa++);$gc=&get_session("queries");if(strlen($H)>1e6){$H=ereg_replace('[\x80-\xFF]+$','',substr($H,0,1e6))."\n...";}$gc[$_GET["db"]][]=$H;return" <a href='#$t' onclick=\"return !toggle('$t');\">".'SQL command'."</a><div id='$t' class='hidden'><pre><code class='jush-$x'>".shorten_utf8($H,1000).'</code></pre><p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($gc[$_GET["db"]])-1)).'">'.'Edit'.'</a></div>';}function
editFunctions($j){global$ub;$J=($j["null"]?"NULL/":"");foreach($ub
as$y=>$p){if(!$y||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($p
as$F=>$X){if(!$F||ereg($F,$j["type"])){$J.="/$X";}}if($y&&!ereg('set|blob|bytea|raw|file',$j["type"])){$J.="/=";}}}return
explode("/",$J);}function
editInput($S,$j,$ta,$Y){if($j["type"]=="enum"){return(isset($_GET["select"])?"<label><input type='radio'$ta value='-1' checked><i>".'original'."</i></label> ":"").($j["null"]?"<label><input type='radio'$ta value=''".(isset($Y)||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$ta,$j,$Y,0);}return"";}function
processInput($j,$Y,$o=""){if($o=="="){return$Y;}$D=$j["field"];$J=($j["type"]=="bit"&&ereg("^([0-9]+|b'[0-1]+')\$",$Y)?$Y:q($Y));if(ereg('^(now|getdate|uuid)$',$o)){$J="$o()";}elseif(ereg('^current_(date|timestamp)$',$o)){$J=$o;}elseif(ereg('^([+-]|\\|\\|)$',$o)){$J=idf_escape($D)." $o $J";}elseif(ereg('^[+-] interval$',$o)){$J=idf_escape($D)." $o ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i",$Y)?$Y:$J);}elseif(ereg('^(addtime|subtime|concat)$',$o)){$J="$o(".idf_escape($D).", $J)";}elseif(ereg('^(md5|sha1|password|encrypt|hex)$',$o)){$J="$o($J)";}if(ereg("binary",$j["type"])){$J="unhex($J)";}return$J;}function
dumpOutput(){$J=array('text'=>'open','file'=>'save');if(function_exists('gzencode')){$J['gz']='gzip';}if(function_exists('bzcompress')){$J['bz2']='bzip2';}return$J;}function
dumpFormat(){return
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
dumpTable($S,$R,$vc=false){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($R){dump_csv(array_keys(fields($S)));}}elseif($R){$Xa=create_sql($S,$_POST["auto_increment"]);if($Xa){if($R=="DROP+CREATE"){echo"DROP ".($vc?"VIEW":"TABLE")." IF EXISTS ".table($S).";\n";}if($vc){$Xa=preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\\1)',logged_user()).'`~','\\1',$Xa);}echo($R!="CREATE+ALTER"?$Xa:($vc?substr_replace($Xa," OR REPLACE",6,0):substr_replace($Xa," IF NOT EXISTS",12,0))).";\n\n";}if($R=="CREATE+ALTER"&&!$vc){$H="SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ".q($S)." ORDER BY ORDINAL_POSITION";echo"DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
DECLARE _column_type, _column_default text;
DECLARE _is_nullable char(3);
DECLARE _extra varchar(30);
DECLARE _column_comment varchar(255);
DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '";$k=array();$oa="";foreach(get_rows($H)as$K){$hb=$K["COLUMN_DEFAULT"];$K["default"]=(isset($hb)?q($hb):"NULL");$K["after"]=q($oa);$K["alter"]=escape_string(idf_escape($K["COLUMN_NAME"])." $K[COLUMN_TYPE]".($K["COLLATION_NAME"]?" COLLATE $K[COLLATION_NAME]":"").(isset($hb)?" DEFAULT ".($hb=="CURRENT_TIMESTAMP"?$hb:$K["default"]):"").($K["IS_NULLABLE"]=="YES"?"":" NOT NULL").($K["EXTRA"]?" $K[EXTRA]":"").($K["COLUMN_COMMENT"]?" COMMENT ".q($K["COLUMN_COMMENT"]):"").($oa?" AFTER ".idf_escape($oa):" FIRST"));echo", ADD $K[alter]";$k[]=$K;$oa=$K["COLUMN_NAME"];}echo"';
DECLARE columns CURSOR FOR $H;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET @alter_table = '';
OPEN columns;
REPEAT
FETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;
IF NOT done THEN
SET set_after = 1;
CASE _column_name";foreach($k
as$K){echo"
WHEN ".q($K["COLUMN_NAME"])." THEN
SET add_columns = REPLACE(add_columns, ', ADD $K[alter]', IF(
_column_default <=> $K[default] AND _is_nullable = '$K[IS_NULLABLE]' AND _collation_name <=> ".(isset($K["COLLATION_NAME"])?"'$K[COLLATION_NAME]'":"NULL")." AND _column_type = ".q($K["COLUMN_TYPE"])." AND _extra = '$K[EXTRA]' AND _column_comment = ".q($K["COLUMN_COMMENT"])." AND after = $K[after]
, '', ', MODIFY $K[alter]'));";}echo"
ELSE
SET @alter_table = CONCAT(@alter_table, ', DROP ', _column_name);
SET set_after = 0;
END CASE;
IF set_after THEN
SET after = _column_name;
END IF;
END IF;
UNTIL done END REPEAT;
CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN
SET alter_command = CONCAT(alter_command, 'ALTER TABLE ".table($S)."', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');
END IF;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";}}}function
dumpData($S,$R,$H){global$e,$x;$Nc=($x=="sqlite"?0:1048576);if($R){if($_POST["format"]=="sql"&&$R=="TRUNCATE+INSERT"){echo
truncate_sql($S).";\n";}if($_POST["format"]=="sql"){$k=fields($S);}$I=$e->query($H,1);if($I){$sc="";$Ca="";while($K=$I->fetch_assoc()){if($_POST["format"]!="sql"){if($R=="table"){dump_csv(array_keys($K));$R="INSERT";}dump_csv($K);}else{if(!$sc){$sc="INSERT INTO ".table($S)." (".implode(", ",array_map('idf_escape',array_keys($K))).") VALUES";}foreach($K
as$y=>$X){$K[$y]=(isset($X)?(ereg('int|float|double|decimal',$k[$y]["type"])?$X:q($X)):"NULL");}$M=implode(",\t",$K);if($R=="INSERT+UPDATE"){$P=array();foreach($K
as$y=>$X){$P[]=idf_escape($y)." = $X";}echo"$sc ($M) ON DUPLICATE KEY UPDATE ".implode(", ",$P).";\n";}else{$M=($Nc?"\n":" ")."($M)";if(!$Ca){$Ca=$sc.$M;}elseif(strlen($Ca)+4+strlen($M)<$Nc){$Ca.=",$M";}else{echo"$Ca;\n";$Ca=$sc.$M;}}}}if($_POST["format"]=="sql"&&$R!="INSERT+UPDATE"&&$Ca){$Ca.=";\n";echo$Ca;}}elseif($_POST["format"]=="sql"){echo"-- ".str_replace("\n"," ",$e->error)."\n";}}}function
dumpHeaders($kc,$Zc=false){$Ad=$_POST["output"];$Nb=($_POST["format"]=="sql"?"sql":($Zc?"tar":"csv"));header("Content-Type: ".($Ad=="bz2"?"application/x-bzip":($Ad=="gz"?"application/x-gzip":($Nb=="tar"?"application/x-tar":($Nb=="sql"||$Ad!="file"?"text/plain":"text/csv")."; charset=utf-8"))));if($Ad=="bz2"){ob_start('bzcompress',1e6);}if($Ad=="gz"){ob_start('gzencode',1e6);}return$Nb;}function
homepage(){echo'<p>'.($_GET["ns"]==""?'<a href="'.h(ME).'database=">'.'Alter database'."</a>\n":""),(support("scheme")?"<a href='".h(ME)."scheme='>".($_GET["ns"]!=""?'Alter schema':'Create schema')."</a>\n":""),($_GET["ns"]!==""?'<a href="'.h(ME).'schema=">'.'Database schema'."</a>\n":""),(support("privileges")?"<a href='".h(ME)."privileges='>".'Privileges'."</a>\n":"");return
true;}function
navigation($Yc){global$ga,$e,$U,$x,$ob;echo'<h1>
',$this->name(),' <span class="version">',$ga,'</span>
<a href="http://www.adminer.org/#download" id="version">',(version_compare($ga,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
</h1>
';if($Yc=="auth"){$Ub=true;foreach((array)$_SESSION["pwds"]as$nb=>$_e){foreach($_e
as$O=>$Df){foreach($Df
as$Cf=>$Kd){if(isset($Kd)){if($Ub){echo"<p onclick='eventStop(event);'>\n";$Ub=false;}echo"<a href='".h(auth_url($nb,$O,$Cf))."'>($ob[$nb]) ".h($Cf.($O!=""?"@$O":""))."</a><br>\n";}}}}}else{$g=get_databases();echo'<form action="" method="post">
<p class="logout">
';if(DB==""||!$Yc){echo"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])).">".'SQL command'."</a>\n";if(support("dump")){echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".'Dump'."</a>\n";}}echo'<input type="submit" name="logout" value="Logout" onclick="eventStop(event);">
<input type="hidden" name="token" value="',$U,'">
</p>
</form>
<form action="">
<p>
';hidden_fields_get();echo($g?html_select("db",array(""=>"(".'database'.")")+$g,DB,"this.form.submit();"):'<input name="db" value="'.h(DB).'">'),'<input type="submit" value="Use"',($g?" class='hidden'":""),' onclick="eventStop(event);">
';if($Yc!="db"&&DB!=""&&$e->select_db(DB)){if($_GET["ns"]!==""&&!$Yc){echo'<p><a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".'Create new table'."</a>\n";$Ve=tables_list();if(!$Ve){echo"<p class='message'>".'No tables.'."\n";}else{$this->tablesPrint($Ve);$Ic=array();foreach($Ve
as$S=>$V){$Ic[]=preg_quote($S,'/');}echo"<script type='text/javascript'>\n","var jushLinks = { $x: [ '".js_escape(ME)."table=\$&', /\\b(".implode("|",$Ic).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X){echo"jushLinks.$X = jushLinks.$x;\n";}echo"</script>\n";}}}echo(isset($_GET["sql"])?'<input type="hidden" name="sql" value="">':(isset($_GET["schema"])?'<input type="hidden" name="schema" value="">':(isset($_GET["dump"])?'<input type="hidden" name="dump" value="">':""))),"</p></form>\n";}}function
tablesPrint($Ve){echo"<p id='tables'>\n";foreach($Ve
as$S=>$V){echo'<a href="'.h(ME).'select='.urlencode($S).'"'.bold($_GET["select"]==$S).">".'select'."</a> ",'<a href="'.h(ME).'table='.urlencode($S).'"'.bold($_GET["table"]==$S)." title='".'Show structure'."'>".$this->tableName(array("Name"=>$S))."</a><br>\n";}}}$b=(function_exists('adminer_object')?adminer_object():new
Adminer);if(!isset($b->operators)){$b->operators=$qd;}function
page_header($ef,$i="",$Ba=array(),$ff=""){global$ca,$b,$e,$ob;header("Content-Type: text/html; charset=utf-8");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}$gf=$ef.($ff!=""?": ".h($ff):"");$hf=strip_tags($gf.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());if(is_ajax()){header("X-AJAX-Title: ".rawurlencode($hf));}else{echo'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<title>',$hf,'</title>
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME))."?file=default.css&amp;version=3.3.3",'">
<script type="text/javascript">
var areYouSure = \'Resend POST data?\';
</script>
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&amp;version=3.3.3",'"></script>
';if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=3.3.3",'" id="favicon">
';if(file_exists("adminer.css")){echo'<link rel="stylesheet" type="text/css" href="adminer.css">
';}}echo'
<body class="ltr nojs"',($_POST?"":" onclick=\"return bodyClick(event, '".h(js_escape(DB)."', '".js_escape($_GET["ns"]))."');\"");echo' onkeydown="bodyKeydown(event);" onload="bodyLoad(\'',(is_object($e)?substr($e->server_info,0,3):""),'\');',(isset($_COOKIE["adminer_version"])?"":" verifyVersion();");?>">
<script type="text/javascript">
document.body.className = document.body.className.replace(/(^|\s)nojs(\s|$)/, '$1js$2');
</script>
<div id="content">
<?php
}if(isset($Ba)){$_=substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$ob[DRIVER].'</a> &raquo; ';$_=substr(preg_replace('~(db|ns)=[^&]*&~','',ME),0,-1);$O=(SERVER!=""?h(SERVER):'Server');if($Ba===false){echo"$O\n";}else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$O</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ba))){echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';}if(is_array($Ba)){if($_GET["ns"]!=""){echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';}foreach($Ba
as$y=>$X){$jb=(is_array($X)?$X[1]:$X);if($jb!=""){echo'<a href="'.h(ME."$y=").urlencode(is_array($X)?$X[0]:$X).'">'.h($jb).'</a> &raquo; ';}}}echo"$ef\n";}}echo"<span id='loader'></span>\n","<h2>$gf</h2>\n";restart_session();$Af=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Wc=$_SESSION["messages"][$Af];if($Wc){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Wc)."</div>\n";unset($_SESSION["messages"][$Af]);}$g=&get_session("dbs");if(DB!=""&&$g&&!in_array(DB,$g,true)){$g=null;}if($i){echo"<div class='error'>$i</div>\n";}define("PAGE_HEADER",1);}function
page_footer($Yc=""){global$b;if(!is_ajax()){echo'</div>
<div id="menu">
';$b->navigation($Yc);echo'</div>
';}}function
int32($C){while($C>=2147483648){$C-=4294967296;}while($C<=-2147483649){$C+=4294967296;}return(int)$C;}function
long2str($W,$If){$M='';foreach($W
as$X){$M.=pack('V',$X);}if($If){return
substr($M,0,end($W));}return$M;}function
str2long($M,$If){$W=array_values(unpack('V*',str_pad($M,4*ceil(strlen($M)/4),"\0")));if($If){$W[]=strlen($M);}return$W;}function
xxtea_mx($Mf,$Lf,$Ne,$xc){return
int32((($Mf>>5&0x7FFFFFF)^$Lf<<2)+(($Lf>>3&0x1FFFFFFF)^$Mf<<4))^int32(($Ne^$Lf)+($xc^$Mf));}function
encrypt_string($Ie,$y){if($Ie==""){return"";}$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Ie,true);$C=count($W)-1;$Mf=$W[$C];$Lf=$W[0];$G=floor(6+52/($C+1));$Ne=0;while($G-->0){$Ne=int32($Ne+0x9E3779B9);$tb=$Ne>>2&3;for($Bd=0;$Bd<$C;$Bd++){$Lf=$W[$Bd+1];$ad=xxtea_mx($Mf,$Lf,$Ne,$y[$Bd&3^$tb]);$Mf=int32($W[$Bd]+$ad);$W[$Bd]=$Mf;}$Lf=$W[0];$ad=xxtea_mx($Mf,$Lf,$Ne,$y[$Bd&3^$tb]);$Mf=int32($W[$C]+$ad);$W[$C]=$Mf;}return
long2str($W,false);}function
decrypt_string($Ie,$y){if($Ie==""){return"";}$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Ie,false);$C=count($W)-1;$Mf=$W[$C];$Lf=$W[0];$G=floor(6+52/($C+1));$Ne=int32($G*0x9E3779B9);while($Ne){$tb=$Ne>>2&3;for($Bd=$C;$Bd>0;$Bd--){$Mf=$W[$Bd-1];$ad=xxtea_mx($Mf,$Lf,$Ne,$y[$Bd&3^$tb]);$Lf=int32($W[$Bd]-$ad);$W[$Bd]=$Lf;}$Mf=$W[$C];$ad=xxtea_mx($Mf,$Lf,$Ne,$y[$Bd&3^$tb]);$Lf=int32($W[0]-$ad);$W[0]=$Lf;$Ne=int32($Ne-0x9E3779B9);}return
long2str($W,true);}$e='';$U=$_SESSION["token"];if(!$_SESSION["token"]){$_SESSION["token"]=rand(1,1e6);}$Ld=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($y)=explode(":",$X);$Ld[$y]=$X;}}if(isset($_POST["server"])){session_regenerate_id();$_SESSION["pwds"][$_POST["driver"]][$_POST["server"]][$_POST["username"]]=$_POST["password"];if($_POST["permanent"]){$y=base64_encode($_POST["driver"])."-".base64_encode($_POST["server"])."-".base64_encode($_POST["username"]);$Vd=$b->permanentLogin();$Ld[$y]="$y:".base64_encode($Vd?encrypt_string($_POST["password"],$Vd):"");cookie("adminer_permanent",implode(" ",$Ld));}if(count($_POST)==($_POST["permanent"]?5:4)||DRIVER!=$_POST["driver"]||SERVER!=$_POST["server"]||$_GET["username"]!==$_POST["username"]){redirect(auth_url($_POST["driver"],$_POST["server"],$_POST["username"]));}}elseif($_POST["logout"]){if($U&&$_POST["token"]!=$U){page_header('Logout','Invalid CSRF token. Send the form again.');page_footer("db");exit;}else{foreach(array("pwds","dbs","queries")as$y){set_session($y,null);}$y=base64_encode(DRIVER)."-".base64_encode(SERVER)."-".base64_encode($_GET["username"]);if($Ld[$y]){unset($Ld[$y]);cookie("adminer_permanent",implode(" ",$Ld));}redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1),'Logout successful.');}}elseif($Ld&&!$_SESSION["pwds"]){session_regenerate_id();$Vd=$b->permanentLogin();foreach($Ld
as$y=>$X){list(,$Ha)=explode(":",$X);list($nb,$O,$Cf)=array_map('base64_decode',explode("-",$y));$_SESSION["pwds"][$nb][$O][$Cf]=decrypt_string(base64_decode($Ha),$Vd);}}function
auth_error($Hb=null){global$e,$b,$U;$Ae=session_name();$i="";if(!$_COOKIE[$Ae]&&$_GET[$Ae]&&ini_bool("session.use_only_cookies")){$i='Session support must be enabled.';}elseif(isset($_GET["username"])){if(($_COOKIE[$Ae]||$_GET[$Ae])&&!$U){$i='Session expired, please login again.';}else{$Kd=&get_session("pwds");if(isset($Kd)){$i=h($Hb?$Hb->getMessage():(is_string($e)?$e:'Invalid credentials.'));$Kd=null;}}}page_header('Login',$i,null);echo"<form action='' method='post' onclick='eventStop(event);'>\n";$b->loginForm();echo"<div>";hidden_fields($_POST,array("driver","server","username","password","permanent"));echo"</div>\n","</form>\n";page_footer("auth");}if(isset($_GET["username"])){if(!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);page_header('No extension',sprintf('None of the supported PHP extensions (%s) are available.',implode(", ",$Qd)),false);page_footer("auth");exit;}$e=connect();}if(is_string($e)||!$b->login($_GET["username"],get_session("pwds"))){auth_error();exit;}$U=$_SESSION["token"];if(isset($_POST["server"])&&$_POST["token"]){$_POST["token"]=$U;}$i=($_POST?($_POST["token"]==$U?"":'Invalid CSRF token. Send the form again.'):($_SERVER["REQUEST_METHOD"]!="POST"?"":sprintf('Too big POST data. Reduce the data or increase the %s configuration directive.','"post_max_size"')));function
connect_error(){global$e,$U,$i,$ob;$g=array();if(DB!=""){page_header('Database'.": ".h(DB),'Invalid database.',true);}else{if($_POST["db"]&&!$i){queries_redirect(substr(ME,0,-1),'Databases have been dropped.',drop_databases($_POST["db"]));}page_header('Select database',$i,false);echo"<p><a href='".h(ME)."database='>".'Create new database'."</a>\n";foreach(array('privileges'=>'Privileges','processlist'=>'Process list','variables'=>'Variables','status'=>'Status',)as$y=>$X){if(support($y)){echo"<a href='".h(ME)."$y='>$X</a>\n";}}echo"<p>".sprintf('%s version: %s through PHP extension %s',$ob[DRIVER],"<b>$e->server_info</b>","<b>$e->extension</b>")."\n","<p>".sprintf('Logged as: %s',"<b>".h(logged_user())."</b>")."\n";if($_GET["refresh"]){set_session("dbs",null);}$g=get_databases();if($g){$ve=support("scheme");$c=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n","<thead><tr><td>&nbsp;<th>".'Database'."<td>".'Collation'."<td>".'Tables'."</thead>\n";foreach($g
as$h){$oe=h(ME)."db=".urlencode($h);echo"<tr".odd()."><td>".checkbox("db[]",$h,in_array($h,(array)$_POST["db"])),"<th><a href='$oe'>".h($h)."</a>","<td><a href='$oe".($ve?"&amp;ns=":"")."&amp;database=' title='".'Alter database'."'>".nbsp(db_collation($h,$c))."</a>","<td align='right'><a href='$oe&amp;schema=' id='tables-".h($h)."' title='".'Database schema'."'>?</a>","\n";}echo"</table>\n","<script type='text/javascript'>tableCheck();</script>\n","<p><input type='submit' name='drop' value='".'Drop'."'".confirm("formChecked(this, /db/)",1).">\n";echo"<input type='hidden' name='token' value='$U'>\n","<a href='".h(ME)."refresh=1' onclick='eventStop(event);'>".'Refresh'."</a>\n","</form>\n";}}page_footer("db");if($g){echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=connect');</script>\n";}}if(isset($_GET["status"])){$_GET["variables"]=$_GET["status"];}if(!(DB!=""?$e->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect")){if(DB!=""){set_session("dbs",null);}connect_error();exit;}function
select($I,$f=null,$jc=""){$Ic=array();$v=array();$d=array();$_a=array();$sf=array();odd('');for($s=0;$K=$I->fetch_row();$s++){if(!$s){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($w=0;$w<count($K);$w++){$j=$I->fetch_field();$D=$j->name;$vd=$j->orgtable;$ud=$j->orgname;if($jc){$Ic[$w]=($D=="table"?"table=":($D=="possible_keys"?"indexes=":null));}elseif($vd!=""){if(!isset($v[$vd])){$v[$vd]=array();foreach(indexes($vd,$f)as$u){if($u["type"]=="PRIMARY"){$v[$vd]=array_flip($u["columns"]);break;}}$d[$vd]=$v[$vd];}if(isset($d[$vd][$ud])){unset($d[$vd][$ud]);$v[$vd][$ud]=$w;$Ic[$w]=$vd;}}if($j->charsetnr==63){$_a[$w]=true;}$sf[$w]=$j->type;$D=h($D);echo"<th".($vd!=""||$j->name!=$ud?" title='".h(($vd!=""?"$vd.":"").$ud)."'":"").">".($jc?"<a href='$jc".strtolower($D)."' target='_blank' rel='noreferrer'>$D</a>":$D);}echo"</thead>\n";}echo"<tr".odd().">";foreach($K
as$y=>$X){if(!isset($X)){$X="<i>NULL</i>";}elseif($_a[$y]&&!is_utf8($X)){$X="<i>".lang(array('%d byte','%d bytes'),strlen($X))."</i>";}elseif(!strlen($X)){$X="&nbsp;";}else{$X=h($X);if($sf[$y]==254){$X="<code>$X</code>";}}if(isset($Ic[$y])&&!$d[$Ic[$y]]){if($jc){$_=$Ic[$y].urlencode($K[array_search("table=",$Ic)]);}else{$_="edit=".urlencode($Ic[$y]);foreach($v[$Ic[$y]]as$Ia=>$w){$_.="&where".urlencode("[".bracket_escape($Ia)."]")."=".urlencode($K[$w]);}}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($s?"</table>":"<p class='message'>".'No rows.')."\n";}function
referencable_primary($xe){$J=array();foreach(table_status()as$Re=>$S){if($Re!=$xe&&fk_support($S)){foreach(fields($Re)as$j){if($j["primary"]){if($J[$Re]){unset($J[$Re]);break;}$J[$Re]=$j;}}}}return$J;}function
textarea($D,$Y,$L=10,$La=80){echo"<textarea name='$D' rows='$L' cols='$La' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>";if(is_array($Y)){foreach($Y
as$X){echo
h($X)."\n\n\n";}}else{echo
h($Y);}echo"</textarea>";}function
format_time($Ee,$_b){return" <span class='time'>(".sprintf('%.3f s',max(0,array_sum(explode(" ",$_b))-array_sum(explode(" ",$Ee)))).")</span>";}function
edit_type($y,$j,$c,$m=array()){global$Je,$sf,$zf,$md;echo'<td><select name="',$y,'[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);">',optionlist((!$j["type"]||isset($sf[$j["type"]])?array():array($j["type"]))+$Je+($m?array('Foreign keys'=>$m):array()),$j["type"]),'</select>
<td><input name="',$y,'[length]" value="',h($j["length"]),'" size="3" onfocus="editingLengthFocus(this);"><td class="options">',"<select name='$y"."[collation]'".(ereg('(char|text|enum|set)$',$j["type"])?"":" class='hidden'").'><option value="">('.'collation'.')'.optionlist($c,$j["collation"]).'</select>',($zf?"<select name='$y"."[unsigned]'".(!$j["type"]||ereg('(int|float|double|decimal)$',$j["type"])?"":" class='hidden'").'><option>'.optionlist($zf,$j["unsigned"]).'</select>':''),($m?"<select name='$y"."[on_delete]'".(ereg("`",$j["type"])?"":" class='hidden'")."><option value=''>(".'ON DELETE'.")".optionlist(explode("|",$md),$j["on_delete"])."</select> ":" ");}function
process_length($Gc){global$Cb;return(preg_match("~^\\s*(?:$Cb)(?:\\s*,\\s*(?:$Cb))*\\s*\$~",$Gc)&&preg_match_all("~$Cb~",$Gc,$Lc)?implode(",",$Lc[0]):preg_replace('~[^0-9,+-]~','',$Gc));}function
process_type($j,$Ja="COLLATE"){global$zf;return" $j[type]".($j["length"]!=""?"(".process_length($j["length"]).")":"").(ereg('int|float|double|decimal',$j["type"])&&in_array($j["unsigned"],$zf)?" $j[unsigned]":"").(ereg('char|text|enum|set',$j["type"])&&$j["collation"]?" $Ja ".q($j["collation"]):"");}function
process_field($j,$qf){return
array(idf_escape($j["field"]),process_type($qf),($j["null"]?" NULL":" NOT NULL"),(isset($j["default"])?" DEFAULT ".(($j["type"]=="timestamp"&&eregi('^CURRENT_TIMESTAMP$',$j["default"]))||($j["type"]=="bit"&&ereg("^([0-9]+|b'[0-1]+')\$",$j["default"]))?$j["default"]:q($j["default"])):""),($j["on_update"]?" ON UPDATE $j[on_update]":""),(support("comment")&&$j["comment"]!=""?" COMMENT ".q($j["comment"]):""),($j["auto_increment"]?auto_increment():null),);}function
type_class($V){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$y=>$X){if(ereg("$y|$X",$V)){return" class='$y'";}}}function
edit_fields($k,$c,$V="TABLE",$qa=0,$m=array(),$Qa=false){global$qc;echo'<thead><tr class="wrap">
';if($V=="PROCEDURE"){echo'<td>&nbsp;';}echo'<th>',($V=="TABLE"?'Column name':'Parameter name'),'<td>Type<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
<td>Length
<td>Options
';if($V=="TABLE"){echo'<td>NULL
<td><input type="radio" name="auto_increment_col" value=""><acronym title="Auto Increment">AI</acronym>
<td',($_POST["defaults"]?"":" class='hidden'"),'>Default values
',(support("comment")?"<td".($Qa?"":" class='hidden'").">".'Comment':"");}echo'<td>',"<input type='image' name='add[".(support("move_col")?0:count($k))."]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.3.3' alt='+' title='".'Add next'."'>",'<script type="text/javascript">row_count = ',count($k),';</script>
</thead>
<tbody onkeydown="return editingKeydown(event);">
';foreach($k
as$s=>$j){$s++;$wd=$j[($_POST?"orig":"field")];$lb=(isset($_POST["add"][$s-1])||(isset($j["field"])&&!$_POST["drop_col"][$s]))&&(support("drop_col")||$wd=="");echo'<tr',($lb?"":" style='display: none;'"),'>
',($V=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$qc),$j["inout"]):""),'<th>';if($lb){echo'<input name="fields[',$s,'][field]" value="',h($j["field"]),'" onchange="',($j["field"]!=""||count($k)>1?"":"editingAddRow(this, $qa); "),'editingNameChange(this);" maxlength="64">';}echo'<input type="hidden" name="fields[',$s,'][orig]" value="',h($wd),'">
';edit_type("fields[$s]",$j,$c,$m);if($V=="TABLE"){echo'<td>',checkbox("fields[$s][null]",1,$j["null"]),'<td><input type="radio" name="auto_increment_col" value="',$s,'"';if($j["auto_increment"]){echo' checked';}?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }">
<td<?php echo($_POST["defaults"]?"":" class='hidden'"),'>',checkbox("fields[$s][has_default]",1,$j["has_default"]),'<input name="fields[',$s,'][default]" value="',h($j["default"]),'" onchange="this.previousSibling.checked = true;">
',(support("comment")?"<td".($Qa?"":" class='hidden'")."><input name='fields[$s][comment]' value='".h($j["comment"])."' maxlength='255'>":"");}echo"<td>",(support("move_col")?"<input type='image' name='add[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.3.3' alt='+' title='".'Add next'."' onclick='return !editingAddRow(this, $qa, 1);'>&nbsp;"."<input type='image' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=up.gif&amp;version=3.3.3' alt='^' title='".'Move up'."'>&nbsp;"."<input type='image' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=down.gif&amp;version=3.3.3' alt='v' title='".'Move down'."'>&nbsp;":""),($wd==""||support("drop_col")?"<input type='image' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=cross.gif&amp;version=3.3.3' alt='x' title='".'Remove'."' onclick='return !editingRemoveRow(this);'>":""),"\n";}}function
process_fields(&$k){ksort($k);$hd=0;if($_POST["up"]){$Ac=0;foreach($k
as$y=>$j){if(key($_POST["up"])==$y){unset($k[$y]);array_splice($k,$Ac,0,array($j));break;}if(isset($j["field"])){$Ac=$hd;}$hd++;}}if($_POST["down"]){$n=false;foreach($k
as$y=>$j){if(isset($j["field"])&&$n){unset($k[key($_POST["down"])]);array_splice($k,$hd,0,array($n));break;}if(key($_POST["down"])==$y){$n=$j;}$hd++;}}$k=array_values($k);if($_POST["add"]){array_splice($k,key($_POST["add"]),0,array(array()));}}function
normalize_enum($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
grant($q,$Xd,$d,$ld){if(!$Xd){return
true;}if($Xd==array("ALL PRIVILEGES","GRANT OPTION")){return($q=="GRANT"?queries("$q ALL PRIVILEGES$ld WITH GRANT OPTION"):queries("$q ALL PRIVILEGES$ld")&&queries("$q GRANT OPTION$ld"));}return
queries("$q ".preg_replace('~(GRANT OPTION)\\([^)]*\\)~','\\1',implode("$d, ",$Xd).$d).$ld);}function
drop_create($pb,$Xa,$A,$Vc,$Tc,$Uc,$D){if($_POST["drop"]){return
query_redirect($pb,$A,$Vc,true,!$_POST["dropped"]);}$qb=$D!=""&&($_POST["dropped"]||queries($pb));$Za=queries($Xa);if(!queries_redirect($A,($D!=""?$Tc:$Uc),$Za)&&$qb){redirect(null,$Vc);}return$qb;}function
tar_file($Sb,$Ta){$J=pack("a100a8a8a8a12a12",$Sb,644,0,0,decoct(strlen($Ta)),decoct(time()));$Ga=8*32;for($s=0;$s<strlen($J);$s++){$Ga+=ord($J{$s});}$J.=sprintf("%06o",$Ga)."\0 ";return$J.str_repeat("\0",512-strlen($J)).$Ta.str_repeat("\0",511-(strlen($Ta)+511)%
512);}session_cache_limiter("");if(!ini_bool("session.use_cookies")||@ini_set("session.use_cookies",false)!==false){session_write_close();}$md="RESTRICT|CASCADE|SET NULL|NO ACTION";$Cb="'(?:''|[^'\\\\]|\\\\.)*+'";$qc="IN|OUT|INOUT";if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"]){$_GET["edit"]=$_GET["select"];}if(isset($_GET["callf"])){$_GET["call"]=$_GET["callf"];}if(isset($_GET["function"])){$_GET["procedure"]=$_GET["function"];}if(isset($_GET["download"])){$a=$_GET["download"];header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));echo$e->result("SELECT".limit(idf_escape($_GET["field"])." FROM ".table($a)," WHERE ".where($_GET),1));exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$k=fields($a);if(!$k){$i=error();}$T=($k?table_status($a):array());page_header(($k&&is_view($T)?'View':'Table').": ".h($a),$i);$b->selectLinks($T);$Pa=$T["Comment"];if($Pa!=""){echo"<p>".'Comment'.": ".h($Pa)."\n";}if($k){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Column'."<td>".'Type'.(support("comment")?"<td>".'Comment':"")."</thead>\n";foreach($k
as$j){echo"<tr".odd()."><th>".h($j["field"]),"<td title='".h($j["collation"])."'>".h($j["full_type"]).($j["null"]?" <i>NULL</i>":"").($j["auto_increment"]?" <i>".'Auto Increment'."</i>":""),(isset($j["default"])?" [<b>".h($j["default"])."</b>]":""),(support("comment")?"<td>".nbsp($j["comment"]):""),"\n";}echo"</table>\n";if(!is_view($T)){echo"<h3>".'Indexes'."</h3>\n";$v=indexes($a);if($v){echo"<table cellspacing='0'>\n";foreach($v
as$D=>$u){ksort($u["columns"]);$Ud=array();foreach($u["columns"]as$y=>$X){$Ud[]="<i>".h($X)."</i>".($u["lengths"][$y]?"(".$u["lengths"][$y].")":"");}echo"<tr title='".h($D)."'><th>$u[type]<td>".implode(", ",$Ud)."\n";}echo"</table>\n";}echo'<p><a href="'.h(ME).'indexes='.urlencode($a).'">'.'Alter indexes'."</a>\n";if(fk_support($T)){echo"<h3>".'Foreign keys'."</h3>\n";$m=foreign_keys($a);if($m){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Source'."<td>".'Target'."<td>".'ON DELETE'."<td>".'ON UPDATE'.($x!="sqlite"?"<td>&nbsp;":"")."</thead>\n";foreach($m
as$D=>$l){echo"<tr title='".h($D)."'>","<th><i>".implode("</i>, <i>",array_map('h',$l["source"]))."</i>","<td><a href='".h($l["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($l["db"]),ME):($l["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($l["ns"]),ME):ME))."table=".urlencode($l["table"])."'>".($l["db"]!=""?"<b>".h($l["db"])."</b>.":"").($l["ns"]!=""?"<b>".h($l["ns"])."</b>.":"").h($l["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$l["target"]))."</i>)","<td>".nbsp($l["on_delete"])."\n","<td>".nbsp($l["on_update"])."\n";if($x!="sqlite"){echo'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($D)).'">'.'Alter'.'</a>';}}echo"</table>\n";}if($x!="sqlite"){echo'<p><a href="'.h(ME).'foreign='.urlencode($a).'">'.'Add foreign key'."</a>\n";}}if(support("trigger")){echo"<h3>".'Triggers'."</h3>\n";$pf=triggers($a);if($pf){echo"<table cellspacing='0'>\n";foreach($pf
as$y=>$X){echo"<tr valign='top'><td>$X[0]<td>$X[1]<th>".h($y)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($y))."'>".'Alter'."</a>\n";}echo"</table>\n";}echo'<p><a href="'.h(ME).'trigger='.urlencode($a).'">'.'Add trigger'."</a>\n";}}}}elseif(isset($_GET["schema"])){page_header('Database schema',"",array(),DB.($_GET["ns"]?".$_GET[ns]":""));$Se=array();$Te=array();$D="adminer_schema";$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE[($_COOKIE["$D-".DB]?"$D-".DB:$D)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$Lc,PREG_SET_ORDER);foreach($Lc
as$s=>$B){$Se[$B[1]]=array($B[2],$B[3]);$Te[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$if=0;$za=-1;$ue=array();$he=array();$Ec=array();foreach(table_status()as$T){if(!isset($T["Engine"])){continue;}$Nd=0;$ue[$T["Name"]]["fields"]=array();foreach(fields($T["Name"])as$D=>$j){$Nd+=1.25;$j["pos"]=$Nd;$ue[$T["Name"]]["fields"][$D]=$j;}$ue[$T["Name"]]["pos"]=($Se[$T["Name"]]?$Se[$T["Name"]]:array($if,0));foreach($b->foreignKeys($T["Name"])as$X){if(!$X["db"]){$Cc=$za;if($Se[$T["Name"]][1]||$Se[$X["table"]][1]){$Cc=min(floatval($Se[$T["Name"]][1]),floatval($Se[$X["table"]][1]))-1;}else{$za-=.1;}while($Ec[(string)$Cc]){$Cc-=.0001;}$ue[$T["Name"]]["references"][$X["table"]][(string)$Cc]=array($X["source"],$X["target"]);$he[$X["table"]][$T["Name"]][(string)$Cc]=$X["target"];$Ec[(string)$Cc]=true;}}$if=max($if,$ue[$T["Name"]]["pos"][0]+2.5+$Nd);}echo'<div id="schema" style="height: ',$if,'em;">
<script type="text/javascript">
tablePos = {',implode(",",$Te)."\n",'};
em = document.getElementById(\'schema\').offsetHeight / ',$if,';
document.onmousemove = schemaMousemove;
document.onmouseup = function (ev) {
schemaMouseup(ev, \'',js_escape(DB),'\');
};
</script>
';foreach($ue
as$D=>$S){echo"<div class='table' style='top: ".$S["pos"][0]."em; left: ".$S["pos"][1]."em;' onmousedown='schemaMousedown(this, event);'>",'<a href="'.h(ME).'table='.urlencode($D).'"><b>'.h($D)."</b></a><br>\n";foreach($S["fields"]as$j){$X='<span'.type_class($j["type"]).' title="'.h($j["full_type"].($j["null"]?" NULL":'')).'">'.h($j["field"]).'</span>';echo($j["primary"]?"<i>$X</i>":$X)."<br>\n";}foreach((array)$S["references"]as$Ze=>$ie){foreach($ie
as$Cc=>$ee){$Dc=$Cc-$Se[$D][1];$s=0;foreach($ee[0]as$Be){echo"<div class='references' title='".h($Ze)."' id='refs$Cc-".($s++)."' style='left: $Dc"."em; top: ".$S["fields"][$Be]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$Dc)."em;'></div></div>\n";}}}foreach((array)$he[$D]as$Ze=>$ie){foreach($ie
as$Cc=>$d){$Dc=$Cc-$Se[$D][1];$s=0;foreach($d
as$Ye){echo"<div class='references' title='".h($Ze)."' id='refd$Cc-".($s++)."' style='left: $Dc"."em; top: ".$S["fields"][$Ye]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME))."?file=arrow.gif) no-repeat right center;&amp;version=3.3.3'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$Dc)."em;'></div></div>\n";}}}echo"</div>\n";}foreach($ue
as$D=>$S){foreach((array)$S["references"]as$Ze=>$ie){foreach($ie
as$Cc=>$ee){$Xc=$if;$Pc=-10;foreach($ee[0]as$y=>$Be){$Od=$S["pos"][0]+$S["fields"][$Be]["pos"];$Pd=$ue[$Ze]["pos"][0]+$ue[$Ze]["fields"][$ee[1][$y]]["pos"];$Xc=min($Xc,$Od,$Pd);$Pc=max($Pc,$Od,$Pd);}echo"<div class='references' id='refl$Cc' style='left: $Cc"."em; top: $Xc"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Pc-$Xc)."em;'></div></div>\n";}}}echo'</div>
<p><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">Permanent link</a>
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST){$Va="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y){$Va.="&$y=".urlencode($_POST[$y]);}cookie("adminer_export",substr($Va,1));$Nb=dump_headers(($a!=""?$a:DB),(DB==""||count((array)$_POST["tables"]+(array)$_POST["data"])>1));$uc=($_POST["format"]=="sql");if($uc){echo"-- Adminer $ga ".$ob[DRIVER]." dump
".($x!="sql"?"":"SET NAMES utf8;
SET foreign_key_checks = 0;
SET time_zone = ".q($e->result("SELECT @@time_zone")).";
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
");}$R=$_POST["db_style"];$g=array(DB);if(DB==""){$g=$_POST["databases"];if(is_string($g)){$g=explode("\n",rtrim(str_replace("\r","",$g),"\n"));}}foreach((array)$g
as$h){if($e->select_db($h)){if($uc&&ereg('CREATE',$R)&&($Xa=$e->result("SHOW CREATE DATABASE ".idf_escape($h),1))){if($R=="DROP+CREATE"){echo"DROP DATABASE IF EXISTS ".idf_escape($h).";\n";}echo($R=="CREATE+ALTER"?preg_replace('~^CREATE DATABASE ~','\\0IF NOT EXISTS ',$Xa):$Xa).";\n";}if($uc){if($R){echo
use_sql($h).";\n\n";}if(in_array("CREATE+ALTER",array($R,$_POST["table_style"]))){echo"SET @adminer_alter = '';\n\n";}$_d="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$pe){foreach(get_rows("SHOW $pe STATUS WHERE Db = ".q($h),null,"-- ")as$K){$_d.=($R!='DROP+CREATE'?"DROP $pe IF EXISTS ".idf_escape($K["Name"]).";;\n":"").$e->result("SHOW CREATE $pe ".idf_escape($K["Name"]),2).";;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$K){$_d.=($R!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($K["Name"]).";;\n":"").$e->result("SHOW CREATE EVENT ".idf_escape($K["Name"]),3).";;\n\n";}}if($_d){echo"DELIMITER ;;\n\n$_d"."DELIMITER ;\n\n";}}if($_POST["table_style"]||$_POST["data_style"]){$Gf=array();foreach(table_status()as$T){$S=(DB==""||in_array($T["Name"],(array)$_POST["tables"]));$cb=(DB==""||in_array($T["Name"],(array)$_POST["data"]));if($S||$cb){if(!is_view($T)){if($Nb=="tar"){ob_start();}$b->dumpTable($T["Name"],($S?$_POST["table_style"]:""));if($cb){$b->dumpData($T["Name"],$_POST["data_style"],"SELECT * FROM ".table($T["Name"]));}if($uc&&$_POST["triggers"]&&$S&&($pf=trigger_sql($T["Name"],$_POST["table_style"]))){echo"\nDELIMITER ;;\n$pf\nDELIMITER ;\n";}if($Nb=="tar"){echo
tar_file((DB!=""?"":"$h/")."$T[Name].csv",ob_get_clean());}elseif($uc){echo"\n";}}elseif($uc){$Gf[]=$T["Name"];}}}foreach($Gf
as$Ff){$b->dumpTable($Ff,$_POST["table_style"],true);}if($Nb=="tar"){echo
pack("x512");}}if($R=="CREATE+ALTER"&&$uc){$H="SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";echo"DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _table_name, _engine, _table_collation varchar(64);
DECLARE _table_comment varchar(64);
DECLARE done bool DEFAULT 0;
DECLARE tables CURSOR FOR $H;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN tables;
REPEAT
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN
CASE _table_name";foreach(get_rows($H)as$K){$Pa=q($K["ENGINE"]=="InnoDB"?preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$K["TABLE_COMMENT"]):$K["TABLE_COMMENT"]);echo"
WHEN ".q($K["TABLE_NAME"])." THEN
".(isset($K["ENGINE"])?"IF _engine != '$K[ENGINE]' OR _table_collation != '$K[TABLE_COLLATION]' OR _table_comment != $Pa THEN
ALTER TABLE ".idf_escape($K["TABLE_NAME"])." ENGINE=$K[ENGINE] COLLATE=$K[TABLE_COLLATION] COMMENT=$Pa;
END IF":"BEGIN END").";";}echo"
ELSE
SET alter_command = CONCAT(alter_command, 'DROP TABLE `', REPLACE(_table_name, '`', '``'), '`;\\n');
END CASE;
END IF;
UNTIL done END REPEAT;
CLOSE tables;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";}if(in_array("CREATE+ALTER",array($R,$_POST["table_style"]))&&$uc){echo"SELECT @adminer_alter;\n";}}}if($uc){echo"-- ".$e->result("SELECT NOW()")."\n";}exit;}page_header('Export',"",($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),DB);echo'
<form action="" method="post">
<table cellspacing="0">
';$fb=array('','USE','DROP+CREATE','CREATE');$Ue=array('','DROP+CREATE','CREATE');$db=array('','TRUNCATE+INSERT','INSERT');if($x=="sql"){$fb[]='CREATE+ALTER';$Ue[]='CREATE+ALTER';$db[]='INSERT+UPDATE';}parse_str($_COOKIE["adminer_export"],$K);if(!$K){$K=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");}if(!isset($K["events"])){$K["routines"]=$K["events"]=($_GET["dump"]=="");$K["triggers"]=$K["table_style"];}echo"<tr><th>".'Output'."<td>".html_select("output",$b->dumpOutput(),$K["output"],0)."\n";echo"<tr><th>".'Format'."<td>".html_select("format",$b->dumpFormat(),$K["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".'Database'."<td>".html_select('db_style',$fb,$K["db_style"]).(support("routine")?checkbox("routines",1,$K["routines"],'Routines'):"").(support("event")?checkbox("events",1,$K["events"],'Events'):"")),"<tr><th>".'Tables'."<td>".html_select('table_style',$Ue,$K["table_style"]).checkbox("auto_increment",1,$K["auto_increment"],'Auto Increment').(support("trigger")?checkbox("triggers",1,$K["triggers"],'Triggers'):""),"<tr><th>".'Data'."<td>".html_select('data_style',$db,$K["data_style"]),'</table>
<p><input type="submit" value="Export">
<table cellspacing="0">
';$Sd=array();if(DB!=""){$Fa=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$Fa onclick='formCheck(this, /^tables\\[/);'>".'Tables'."</label>","<th style='text-align: right;'><label>".'Data'."<input type='checkbox' id='check-data'$Fa onclick='formCheck(this, /^data\\[/);'></label>","</thead>\n";$Gf="";foreach(table_status()as$T){$D=$T["Name"];$Rd=ereg_replace("_.*","",$D);$Fa=($a==""||$a==(substr($a,-1)=="%"?"$Rd%":$D));$Ud="<tr><td>".checkbox("tables[]",$D,$Fa,$D,"formUncheck('check-tables');");if(is_view($T)){$Gf.="$Ud\n";}else{echo"$Ud<td align='right'><label>".($T["Engine"]=="InnoDB"&&$T["Rows"]?"~ ":"").$T["Rows"].checkbox("data[]",$D,$Fa,"","formUncheck('check-data');")."</label>\n";}$Sd[$Rd]++;}echo$Gf;}else{echo"<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'".($a==""?" checked":"")." onclick='formCheck(this, /^databases\\[/);'>".'Database'."</label></thead>\n";$g=get_databases();if($g){foreach($g
as$h){if(!information_schema($h)){$Rd=ereg_replace("_.*","",$h);echo"<tr><td>".checkbox("databases[]",$h,$a==""||$a=="$Rd%",$h,"formUncheck('check-databases');")."</label>\n";$Sd[$Rd]++;}}}else{echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}}echo'</table>
</form>
';$Ub=true;foreach($Sd
as$y=>$X){if($y!=""&&$X>1){echo($Ub?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$y%")."'>".h($y)."</a>";$Ub=false;}}}elseif(isset($_GET["privileges"])){page_header('Privileges');$I=$e->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$q=$I;if(!$I){$I=$e->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");}echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($q?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".'Username'."<th>".'Server'."<th>&nbsp;</thead>\n";while($K=$I->fetch_assoc()){echo'<tr'.odd().'><td>'.h($K["User"])."<td>".h($K["Host"]).'<td><a href="'.h(ME.'user='.urlencode($K["User"]).'&host='.urlencode($K["Host"])).'">'.'Edit'."</a>\n";}if(!$q||DB!=""){echo"<tr".odd()."><td><input name='user'><td><input name='host' value='localhost'><td><input type='submit' value='".'Edit'."'>\n";}echo"</table>\n","</form>\n",'<p><a href="'.h(ME).'user=">'.'Create user'."</a>";}elseif(isset($_GET["sql"])){if(!$i&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$hc=&get_session("queries");$gc=&$hc[DB];if(!$i&&$_POST["clear"]){$gc=array();redirect(remove_from_uri("history"));}page_header('SQL command',$i);if(!$i&&$_POST){$Zb=false;$H=$_POST["query"];if($_POST["webfile"]){$Zb=@fopen((file_exists("adminer.sql")?"adminer.sql":(file_exists("adminer.sql.gz")?"compress.zlib://adminer.sql.gz":"compress.bzip2://adminer.sql.bz2")),"rb");$H=($Zb?fread($Zb,1e6):false);}elseif($_FILES&&$_FILES["sql_file"]["error"]!=4){$H=get_file("sql_file",true);}if(is_string($H)){if(function_exists('memory_get_usage')){@ini_set("memory_limit",max(ini_get("memory_limit"),2*strlen($H)+memory_get_usage()+8e6));}if($H!=""&&strlen($H)<1e6){$G=$H.(ereg(';$',$H)?"":";");if(!$gc||end($gc)!=$G){$gc[]=$G;}}$Ce="(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";if(!ini_bool("session.use_cookies")){session_write_close();}$ib=";";$hd=0;$zb=true;$f=connect();if(is_object($f)&&DB!=""){$f->select_db(DB);}$Oa=0;$Eb=array();$Ed='[\'"'.($x=="sql"?'`#':($x=="sqlite"?'`[':($x=="mssql"?'[':''))).']|/\\*|-- |$'.($x=="pgsql"?'|\\$[^$]*\\$':'');$jf=microtime();parse_str($_COOKIE["adminer_export"],$ka);$sb=$b->dumpFormat();unset($sb["sql"]);while($H!=""){if(!$hd&&preg_match("~^$Ce*DELIMITER\\s+(.+)~i",$H,$B)){$ib=$B[1];$H=substr($H,strlen($B[0]));}else{preg_match('('.preg_quote($ib)."|$Ed)",$H,$B,PREG_OFFSET_CAPTURE,$hd);$n=$B[0][0];if(!$n&&$Zb&&!feof($Zb)){$H.=fread($Zb,1e5);}else{$hd=$B[0][1]+strlen($n);if(!$n&&rtrim($H)==""){break;}if($n&&$n!=$ib){while(preg_match('('.($n=='/*'?'\\*/':($n=='['?']':(ereg('^-- |^#',$n)?"\n":preg_quote($n)."|\\\\."))).'|$)s',$H,$B,PREG_OFFSET_CAPTURE,$hd)){$M=$B[0][0];$hd=$B[0][1]+strlen($M);if(!$M&&$Zb&&!feof($Zb)){$hd-=strlen($n);$H.=fread($Zb,1e5);}elseif($M[0]!="\\"){break;}}}else{$zb=false;$G=substr($H,0,$B[0][1]);$Oa++;$Ud="<pre id='sql-$Oa'><code class='jush-$x'>".shorten_utf8(trim($G),1000)."</code></pre>\n";if(!$_POST["only_errors"]){echo$Ud;ob_flush();flush();}$Ee=microtime();if($e->multi_query($G)&&is_object($f)&&preg_match("~^$Ce*USE\\b~isU",$G)){$f->query($G);}do{$I=$e->store_result();$_b=microtime();$cf=format_time($Ee,$_b).(strlen($G)<1000?" <a href='".h(ME)."sql=".urlencode(trim($G))."'>".'Edit'."</a>":"");if($e->error){echo($_POST["only_errors"]?$Ud:""),"<p class='error'>".'Error in query'.": ".error()."\n";$Eb[]=" <a href='#sql-$Oa'>$Oa</a>";if($_POST["error_stops"]){break
2;}}elseif(is_object($I)){select($I,$f);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n","<p>".($I->num_rows?lang(array('%d row','%d rows'),$I->num_rows):"").$cf;$t="export-$Oa";$Mb=", <a href='#$t' onclick=\"return !toggle('$t');\">".'Export'."</a><span id='$t' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ka["output"])." ".html_select("format",$sb,$ka["format"])."<input type='hidden' name='query' value='".h($G)."'>"." <input type='submit' name='export' value='".'Export'."' onclick='eventStop(event);'><input type='hidden' name='token' value='$U'></span>\n";if($f&&preg_match("~^($Ce|\\()*SELECT\\b~isU",$G)&&($Lb=explain($f,$G))){$t="explain-$Oa";echo", <a href='#$t' onclick=\"return !toggle('$t');\">EXPLAIN</a>$Mb","<div id='$t' class='hidden'>\n";select($Lb,$f,($x=="sql"?"http://dev.mysql.com/doc/refman/".substr($e->server_info,0,3)."/en/explain-output.html#explain_":""));echo"</div>\n";}else{echo$Mb;}echo"</form>\n";}}else{if(preg_match("~^$Ce*(CREATE|DROP|ALTER)$Ce+(DATABASE|SCHEMA)\\b~isU",$G)){restart_session();set_session("dbs",null);session_write_close();}if(!$_POST["only_errors"]){echo"<p class='message' title='".h($e->info)."'>".lang(array('Query executed OK, %d row affected.','Query executed OK, %d rows affected.'),$e->affected_rows)."$cf\n";}}$Ee=$_b;}while($e->next_result());$H=substr($H,$hd);$hd=0;}}}}if($zb){echo"<p class='message'>".'No commands to execute.'."\n";}elseif($_POST["only_errors"]){echo"<p class='message'>".lang(array('%d query executed OK.','%d queries executed OK.'),$Oa-count($Eb)).format_time($jf,microtime())."\n";}elseif($Eb&&$Oa>1){echo"<p class='error'>".'Error in query'.": ".implode("",$Eb)."\n";}}else{echo"<p class='error'>".upload_error($H)."\n";}}echo'
<form action="" method="post" enctype="multipart/form-data" id="form">
<p>';$G=$_GET["sql"];if($_POST){$G=$_POST["query"];}elseif($_GET["history"]=="all"){$G=$gc;}elseif($_GET["history"]!=""){$G=$gc[$_GET["history"]];}textarea("query",$G,20);echo($_POST?"":"<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n"),"<p>".(ini_bool("file_uploads")?'File upload'.': <input type="file" name="sql_file"'.($_FILES&&$_FILES["sql_file"]["error"]!=4?'':' onchange="this.form[\'only_errors\'].checked = true;"').'> (&lt; '.ini_get("upload_max_filesize").'B)':'File uploads are disabled.'),'<p>
<input type="submit" value="Execute" title="Ctrl+Enter">
<input type="hidden" name="token" value="',$U,'">
',checkbox("error_stops",1,$_POST["error_stops"],'Stop on error')."\n",checkbox("only_errors",1,$_POST["only_errors"],'Show only errors')."\n";print_fieldset("webfile",'From server',$_POST["webfile"],"document.getElementById('form')['only_errors'].checked = true; ");$Ra=array();foreach(array("gz"=>"zlib","bz2"=>"bz2")as$y=>$X){if(extension_loaded($X)){$Ra[]=".$y";}}echo
sprintf('Webserver file %s',"<code>adminer.sql".($Ra?"[".implode("|",$Ra)."]":"")."</code>"),' <input type="submit" name="webfile" value="'.'Run file'.'">',"</div></fieldset>\n";if($gc){print_fieldset("history",'History',$_GET["history"]!="");foreach($gc
as$y=>$X){echo'<a href="'.h(ME."sql=&history=$y").'">'.'Edit'."</a> <code class='jush-$x'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$X)))),80,"</code>")."<br>\n";}echo"<input type='submit' name='clear' value='".'Clear'."'>\n","<a href='".h(ME."sql=&history=all")."'>".'Edit all'."</a>\n","</div></fieldset>\n";}echo'
</form>
';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$Z=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0]):""):where($_GET));$_f=(isset($_GET["select"])?$_POST["edit"]:$Z);$k=fields($a);foreach($k
as$D=>$j){if(!isset($j["privileges"][$_f?"update":"insert"])||$b->fieldName($j)==""){unset($k[$D]);}}if($_POST&&!$i&&!isset($_GET["select"])){$A=$_POST["referer"];if($_POST["insert"]){$A=($_f?null:$_SERVER["REQUEST_URI"]);}elseif(!ereg('^.+&select=.+$',$A)){$A=ME."select=".urlencode($a);}if(isset($_POST["delete"])){query_redirect("DELETE".limit1("FROM ".table($a)," WHERE $Z"),$A,'Item has been deleted.');}else{$P=array();foreach($k
as$D=>$j){$X=process_input($j);if($X!==false&&$X!==null){$P[idf_escape($D)]=($_f?"\n".idf_escape($D)." = $X":$X);}}if($_f){if(!$P){redirect($A);}query_redirect("UPDATE".limit1(table($a)." SET".implode(",",$P),"\nWHERE $Z"),$A,'Item has been updated.');}else{$I=insert_into($a,$P);$Bc=($I?last_id():0);queries_redirect($A,sprintf('Item%s has been inserted.',($Bc?" $Bc":"")),$I);}}}$Re=$b->tableName(table_status($a));page_header(($_f?'Edit':'Insert'),$i,array("select"=>array($a,$Re)),$Re);$K=null;if($_POST["save"]){$K=(array)$_POST["fields"];}elseif($Z){$N=array();foreach($k
as$D=>$j){if(isset($j["privileges"]["select"])){$N[]=($_POST["clone"]&&$j["auto_increment"]?"'' AS ":(ereg("enum|set",$j["type"])?"1*".idf_escape($D)." AS ":"")).idf_escape($D);}}$K=array();if($N){$L=get_rows("SELECT".limit(implode(", ",$N)." FROM ".table($a)," WHERE $Z",(isset($_GET["select"])?2:1)));$K=(isset($_GET["select"])&&count($L)!=1?null:reset($L));}}if($K===false){echo"<p class='error'>".'No rows.'."\n";}echo'
<form action="" method="post" enctype="multipart/form-data" id="form">
';if($k){echo"<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";foreach($k
as$D=>$j){echo"<tr><th>".$b->fieldName($j);$hb=$_GET["set"][bracket_escape($D)];$Y=(isset($K)?($K[$D]!=""&&ereg("enum|set",$j["type"])?(is_array($K[$D])?array_sum($K[$D]):+$K[$D]):$K[$D]):(!$_f&&$j["auto_increment"]?"":(isset($_GET["select"])?false:(isset($hb)?$hb:$j["default"]))));if(!$_POST["save"]&&is_string($Y)){$Y=$b->editVal($Y,$j);}$o=($_POST["save"]?(string)$_POST["function"][$D]:($_f&&$j["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:(isset($Y)?'':'NULL'))));if($j["type"]=="timestamp"&&$Y=="CURRENT_TIMESTAMP"){$Y="";$o="now";}input($j,$Y,$o);echo"\n";}echo"</table>\n";}echo'<p>
';if($k){echo"<input type='submit' value='".'Save'."'>\n";if(!isset($_GET["select"])){echo"<input type='submit' name='insert' value='".($_f?'Save and continue edit':'Save and insert next')."' title='Ctrl+Shift+Enter'>\n";}}echo($_f?"<input type='submit' name='delete' value='".'Delete'."' onclick=\"return confirm('".'Are you sure?'."');\">\n":($_POST||!$k?"":"<script type='text/javascript'>document.getElementById('form').getElementsByTagName('td')[1].firstChild.focus();</script>\n"));if(isset($_GET["select"])){hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));}echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
<input type="hidden" name="save" value="1">
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["create"])){$a=$_GET["create"];$Fd=array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST');$ge=referencable_primary($a);$m=array();foreach($ge
as$Re=>$j){$m[str_replace("`","``",$Re)."`".str_replace("`","``",$j["field"])]=$Re;}$yd=array();$zd=array();if($a!=""){$yd=fields($a);$zd=table_status($a);}if($_POST&&!$_POST["fields"]){$_POST["fields"]=array();}if($_POST&&!$i&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){if($_POST["drop"]){query_redirect("DROP TABLE ".table($a),substr(ME,0,-1),'Table has been dropped.');}else{$k=array();$Wb=array();ksort($_POST["fields"]);$xd=reset($yd);$oa="FIRST";foreach($_POST["fields"]as$y=>$j){$l=$m[$j["type"]];$qf=(isset($l)?$ge[$l]:$j);if($j["field"]!=""){if(!$j["has_default"]){$j["default"]=null;}$hb=eregi_replace(" *on update CURRENT_TIMESTAMP","",$j["default"]);if($hb!=$j["default"]){$j["on_update"]="CURRENT_TIMESTAMP";$j["default"]=$hb;}if($y==$_POST["auto_increment_col"]){$j["auto_increment"]=true;}$Zd=process_field($j,$qf);if($Zd!=process_field($xd,$xd)){$k[]=array($j["orig"],$Zd,$oa);}if(isset($l)){$Wb[idf_escape($j["field"])]=($a!=""?"ADD":" ")." FOREIGN KEY (".idf_escape($j["field"]).") REFERENCES ".table($m[$j["type"]])." (".idf_escape($qf["field"]).")".(ereg("^($md)\$",$j["on_delete"])?" ON DELETE $j[on_delete]":"");}$oa="AFTER ".idf_escape($j["field"]);}elseif($j["orig"]!=""){$k[]=array($j["orig"]);}if($j["orig"]!=""){$xd=next($yd);}}$Hd="";if(in_array($_POST["partition_by"],$Fd)){$Id=array();if($_POST["partition_by"]=='RANGE'||$_POST["partition_by"]=='LIST'){foreach(array_filter($_POST["partition_names"])as$y=>$X){$Y=$_POST["partition_values"][$y];$Id[]="\nPARTITION ".idf_escape($X)." VALUES ".($_POST["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Hd.="\nPARTITION BY $_POST[partition_by]($_POST[partition])".($Id?" (".implode(",",$Id)."\n)":($_POST["partitions"]?" PARTITIONS ".(+$_POST["partitions"]):""));}elseif($a!=""&&support("partitioning")){$Hd.="\nREMOVE PARTITIONING";}$Sc='Table has been altered.';if($a==""){cookie("adminer_engine",$_POST["Engine"]);$Sc='Table has been created.';}queries_redirect(ME."table=".urlencode($_POST["name"]),$Sc,alter_table($a,$_POST["name"],$k,$Wb,$_POST["Comment"],($_POST["Engine"]&&$_POST["Engine"]!=$zd["Engine"]?$_POST["Engine"]:""),($_POST["Collation"]&&$_POST["Collation"]!=$zd["Collation"]?$_POST["Collation"]:""),($_POST["Auto_increment"]!=""?+$_POST["Auto_increment"]:""),$Hd));}}page_header(($a!=""?'Alter table':'Create table'),$i,array("table"=>$a),$a);$K=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($sf["int"])?"int":(isset($sf["integer"])?"integer":"")))),"partition_names"=>array(""),);if($_POST){$K=$_POST;if($K["auto_increment_col"]){$K["fields"][$K["auto_increment_col"]]["auto_increment"]=true;}process_fields($K["fields"]);}elseif($a!=""){$K=$zd;$K["name"]=$a;$K["fields"]=array();if(!$_GET["auto_increment"]){$K["Auto_increment"]="";}foreach($yd
as$j){$j["has_default"]=isset($j["default"]);if($j["on_update"]){$j["default"].=" ON UPDATE $j[on_update]";}$K["fields"][]=$j;}if(support("partitioning")){$ac="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$I=$e->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $ac ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($K["partition_by"],$K["partitions"],$K["partition"])=$I->fetch_row();$K["partition_names"]=array();$K["partition_values"]=array();foreach(get_rows("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $ac AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION")as$se){$K["partition_names"][]=$se["PARTITION_NAME"];$K["partition_values"][]=$se["PARTITION_DESCRIPTION"];}$K["partition_names"][]="";}}$c=collations();$Me=floor(extension_loaded("suhosin")?(min(ini_get("suhosin.request.max_vars"),ini_get("suhosin.post.max_vars"))-13)/10:0);if($Me&&count($K["fields"])>$Me){echo"<p class='error'>".h(sprintf('Maximum number of allowed fields exceeded. Please increase %s and %s.','suhosin.post.max_vars','suhosin.request.max_vars'))."\n";}$Bb=engines();foreach($Bb
as$Ab){if(!strcasecmp($Ab,$K["Engine"])){$K["Engine"]=$Ab;break;}}echo'
<form action="" method="post" id="form">
<p>
Table name: <input name="name" maxlength="64" value="',h($K["name"]),'">
';if($a==""&&!$_POST){?><script type='text/javascript'>document.getElementById('form')['name'].focus();</script><?php }echo($Bb?html_select("Engine",array(""=>"(".'engine'.")")+$Bb,$K["Engine"]):""),' ',($c&&!ereg("sqlite|mssql",$x)?html_select("Collation",array(""=>"(".'collation'.")")+$c,$K["Collation"]):""),' <input type="submit" value="Save">
<table cellspacing="0" id="edit-fields" class="nowrap">
';$Qa=($_POST?$_POST["comments"]:$K["Comment"]!="");if(!$_POST&&!$Qa){foreach($K["fields"]as$j){if($j["comment"]!=""){$Qa=true;break;}}}edit_fields($K["fields"],$c,"TABLE",$Me,$m,$Qa);echo'</table>
<p>
Auto Increment: <input name="Auto_increment" size="6" value="',h($K["Auto_increment"]),'">
<label class="jsonly"><input type="checkbox" name="defaults" value="1"',($_POST["defaults"]?" checked":""),' onclick="columnShow(this.checked, 5);">Default values</label>
',(support("comment")?checkbox("comments",1,$Qa,'Comment',"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();",true).' <input id="Comment" name="Comment" value="'.h($K["Comment"]).'" maxlength="60"'.($Qa?'':' class="hidden"').'>':''),'<p>
<input type="submit" value="Save">
';if($_GET["create"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
';if(support("partitioning")){$Gd=ereg('RANGE|LIST',$K["partition_by"]);print_fieldset("partition",'Partition by',$K["partition_by"]);echo'<p>
',html_select("partition_by",array(-1=>"")+$Fd,$K["partition_by"],"partitionByChange(this);"),'(<input name="partition" value="',h($K["partition"]),'">)
Partitions: <input name="partitions" size="2" value="',h($K["partitions"]),'"',($Gd||!$K["partition_by"]?" class='hidden'":""),'>
<table cellspacing="0" id="partition-table"',($Gd?"":" class='hidden'"),'>
<thead><tr><th>Partition name<th>Values</thead>
';foreach($K["partition_names"]as$y=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'"'.($y==count($K["partition_names"])-1?' onchange="partitionNameChange(this);"':'').'>','<td><input name="partition_values[]" value="'.h($K["partition_values"][$y]).'">';}echo'</table>
</div></fieldset>
';}echo'</form>
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$oc=array("PRIMARY","UNIQUE","INDEX");$T=table_status($a);if(eregi("MyISAM|M?aria",$T["Engine"])){$oc[]="FULLTEXT";}$v=indexes($a);if($x=="sqlite"){unset($oc[0]);unset($v[""]);}if($_POST&&!$i&&!$_POST["add"]){$ra=array();foreach($_POST["indexes"]as$u){$D=$u["name"];if(in_array($u["type"],$oc)){$d=array();$Hc=array();$P=array();ksort($u["columns"]);foreach($u["columns"]as$y=>$Ma){if($Ma!=""){$Gc=$u["lengths"][$y];$P[]=idf_escape($Ma).($Gc?"(".(+$Gc).")":"");$d[]=$Ma;$Hc[]=($Gc?$Gc:null);}}if($d){$Kb=$v[$D];if($Kb){ksort($Kb["columns"]);ksort($Kb["lengths"]);if($u["type"]==$Kb["type"]&&array_values($Kb["columns"])===$d&&(!$Kb["lengths"]||array_values($Kb["lengths"])===$Hc)){unset($v[$D]);continue;}}$ra[]=array($u["type"],$D,"(".implode(", ",$P).")");}}}foreach($v
as$D=>$Kb){$ra[]=array($Kb["type"],$D,"DROP");}if(!$ra){redirect(ME."table=".urlencode($a));}queries_redirect(ME."table=".urlencode($a),'Indexes have been altered.',alter_indexes($a,$ra));}page_header('Indexes',$i,array("table"=>$a),$a);$k=array_keys(fields($a));$K=array("indexes"=>$v);if($_POST){$K=$_POST;if($_POST["add"]){foreach($K["indexes"]as$y=>$u){if($u["columns"][count($u["columns"])]!=""){$K["indexes"][$y]["columns"][]="";}}$u=end($K["indexes"]);if($u["type"]||array_filter($u["columns"],'strlen')||array_filter($u["lengths"],'strlen')){$K["indexes"][]=array("columns"=>array(1=>""));}}}else{foreach($K["indexes"]as$y=>$u){$K["indexes"][$y]["name"]=$y;$K["indexes"][$y]["columns"][]="";}$K["indexes"][]=array("columns"=>array(1=>""));}echo'
<form action="" method="post">
<table cellspacing="0" class="nowrap">
<thead><tr><th>Index Type<th>Column (length)<th>Name</thead>
';$w=1;foreach($K["indexes"]as$u){echo"<tr><td>".html_select("indexes[$w][type]",array(-1=>"")+$oc,$u["type"],($w==count($K["indexes"])?"indexesAddRow(this);":1))."<td>";ksort($u["columns"]);$s=1;foreach($u["columns"]as$y=>$Ma){echo"<span>".html_select("indexes[$w][columns][$s]",array(-1=>"")+$k,$Ma,($s==count($u["columns"])?"indexesAddColumn":"indexesChangeColumn")."(this, '".js_escape($x=="sql"?"":$_GET["indexes"]."_")."');"),"<input name='indexes[$w][lengths][$s]' size='2' value='".h($u["lengths"][$y])."'> </span>";$s++;}echo"<td><input name='indexes[$w][name]' value='".h($u["name"])."'>\n";$w++;}echo'</table>
<p>
<input type="submit" value="Save">
<noscript><p><input type="submit" name="add" value="Add next"></noscript>
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["database"])){if($_POST&&!$i&&!isset($_POST["add_x"])){restart_session();if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),'Database has been dropped.',drop_databases(array(DB)));}elseif(DB!==$_POST["name"]){if(DB!=""){$_GET["db"]=$_POST["name"];queries_redirect(preg_replace('~db=[^&]*&~','',ME)."db=".urlencode($_POST["name"]),'Database has been renamed.',rename_database($_POST["name"],$_POST["collation"]));}else{$g=explode("\n",str_replace("\r","",$_POST["name"]));$Ke=true;$Ac="";foreach($g
as$h){if(count($g)==1||$h!=""){if(!create_database($h,$_POST["collation"])){$Ke=false;}$Ac=$h;}}queries_redirect(ME."db=".urlencode($Ac),'Database has been created.',$Ke);}}else{if(!$_POST["collation"]){redirect(substr(ME,0,-1));}query_redirect("ALTER DATABASE ".idf_escape($_POST["name"]).(eregi('^[a-z0-9_]+$',$_POST["collation"])?" COLLATE $_POST[collation]":""),substr(ME,0,-1),'Database has been altered.');}}page_header(DB!=""?'Alter database':'Create database',$i,array(),DB);$c=collations();$D=DB;$Ja=null;if($_POST){$D=$_POST["name"];$Ja=$_POST["collation"];}elseif(DB!=""){$Ja=db_collation(DB,$c);}elseif($x=="sql"){foreach(get_vals("SHOW GRANTS")as$q){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~',$q,$B)&&$B[1]){$D=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
<form action="" method="post">
<p>
',($_POST["add_x"]||strpos($D,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($D).'</textarea><br>':'<input id="name" name="name" value="'.h($D).'" maxlength="64">')."\n".($c?html_select("collation",array(""=>"(".'collation'.")")+$c,$Ja):"");?>
<script type='text/javascript'>document.getElementById('name').focus();</script>
<input type="submit" value="Save">
<?php
if(DB!=""){echo"<input type='submit' name='drop' value='".'Drop'."'".confirm().">\n";}elseif(!$_POST["add_x"]&&$_GET["db"]==""){echo"<input type='image' name='add' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.3.3' alt='+' title='".'Add next'."'>\n";}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header('Call'.": ".h($da),$i);$pe=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$nc=array();$_d=array();foreach($pe["fields"]as$s=>$j){if(substr($j["inout"],-3)=="OUT"){$_d[$s]="@".idf_escape($j["field"])." AS ".idf_escape($j["field"]);}if(!$j["inout"]||substr($j["inout"],0,2)=="IN"){$nc[]=$s;}}if(!$i&&$_POST){$Da=array();foreach($pe["fields"]as$y=>$j){if(in_array($y,$nc)){$X=process_input($j);if($X===false){$X="''";}if(isset($_d[$y])){$e->query("SET @".idf_escape($j["field"])." = $X");}}$Da[]=(isset($_d[$y])?"@".idf_escape($j["field"]):$X);}$H=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Da).")";echo"<p><code class='jush-$x'>".h($H)."</code> <a href='".h(ME)."sql=".urlencode($H)."'>".'Edit'."</a>\n";if(!$e->multi_query($H)){echo"<p class='error'>".error()."\n";}else{$f=connect();if(is_object($f)){$f->select_db(DB);}do{$I=$e->store_result();if(is_object($I)){select($I,$f);}else{echo"<p class='message'>".lang(array('Routine has been called, %d row affected.','Routine has been called, %d rows affected.'),$e->affected_rows)."\n";}}while($e->next_result());if($_d){select($e->query("SELECT ".implode(", ",$_d)));}}}echo'
<form action="" method="post">
';if($nc){echo"<table cellspacing='0'>\n";foreach($nc
as$y){$j=$pe["fields"][$y];$D=$j["field"];echo"<tr><th>".$b->fieldName($j);$Y=$_POST["fields"][$D];if($Y!=""){if($j["type"]=="enum"){$Y=+$Y;}if($j["type"]=="set"){$Y=array_sum($Y);}}input($j,$Y,(string)$_POST["function"][$D]);echo"\n";}echo"</table>\n";}echo'<p>
<input type="submit" value="Call">
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];if($_POST&&!$i&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){if($_POST["drop"]){query_redirect("ALTER TABLE ".table($a)."\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($_GET["name"]),ME."table=".urlencode($a),'Foreign key has been dropped.');}else{$Be=array_filter($_POST["source"],'strlen');ksort($Be);$Ye=array();foreach($Be
as$y=>$X){$Ye[$y]=$_POST["target"][$y];}query_redirect("ALTER TABLE ".table($a).($_GET["name"]!=""?"\nDROP FOREIGN KEY ".idf_escape($_GET["name"]).",":"")."\nADD FOREIGN KEY (".implode(", ",array_map('idf_escape',$Be)).") REFERENCES ".table($_POST["table"])." (".implode(", ",array_map('idf_escape',$Ye)).")".(ereg("^($md)\$",$_POST["on_delete"])?" ON DELETE $_POST[on_delete]":"").(ereg("^($md)\$",$_POST["on_update"])?" ON UPDATE $_POST[on_update]":""),ME."table=".urlencode($a),($_GET["name"]!=""?'Foreign key has been altered.':'Foreign key has been created.'));$i='Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.'."<br>$i";}}page_header('Foreign key',$i,array("table"=>$a),$a);$K=array("table"=>$a,"source"=>array(""));if($_POST){$K=$_POST;ksort($K["source"]);if($_POST["add"]){$K["source"][]="";}elseif($_POST["change"]||$_POST["change-js"]){$K["target"]=array();}}elseif($_GET["name"]!=""){$m=foreign_keys($a);$K=$m[$_GET["name"]];$K["source"][]="";}$Be=array_keys(fields($a));$Ye=($a===$K["table"]?$Be:array_keys(fields($K["table"])));$fe=array();foreach(table_status()as$D=>$T){if(fk_support($T)){$fe[]=$D;}}echo'
<form action="" method="post">
<p>
';if($K["db"]==""&&$K["ns"]==""){echo'Target table:
',html_select("table",$fe,$K["table"],"this.form['change-js'].value = '1'; if (!ajaxForm(this.form)) this.form.submit();"),'<input type="hidden" name="change-js" value="">
<noscript><p><input type="submit" name="change" value="Change"></noscript>
<table cellspacing="0">
<thead><tr><th>Source<th>Target</thead>
';$w=0;foreach($K["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$Be,$X,($w==count($K["source"])-1?"foreignAddRow(this);":1)),"<td>".html_select("target[".(+$y)."]",$Ye,$K["target"][$y]);$w++;}echo'</table>
<p>
ON DELETE: ',html_select("on_delete",array(-1=>"")+explode("|",$md),$K["on_delete"]),' ON UPDATE: ',html_select("on_update",array(-1=>"")+explode("|",$md),$K["on_update"]),'<p>
<input type="submit" value="Save">
<noscript><p><input type="submit" name="add" value="Add column"></noscript>
';}if($_GET["name"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$qb=false;if($_POST&&!$i){$qb=drop_create("DROP VIEW ".table($a),"CREATE VIEW ".table($_POST["name"])." AS\n$_POST[select]",($_POST["drop"]?substr(ME,0,-1):ME."table=".urlencode($_POST["name"])),'View has been dropped.','View has been altered.','View has been created.',$a);}page_header(($a!=""?'Alter view':'Create view'),$i,array("table"=>$a),$a);$K=$_POST;if(!$K&&$a!=""){$K=view($a);$K["name"]=$a;}echo'
<form action="" method="post">
<p>Name: <input name="name" value="',h($K["name"]),'" maxlength="64">
<p>';textarea("select",$K["select"]);echo'<p>
';if($qb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="submit" value="Save">
';if($_GET["view"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$tc=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Ge=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");if($_POST&&!$i){if($_POST["drop"]){query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),'Event has been dropped.');}elseif(in_array($_POST["INTERVAL_FIELD"],$tc)&&isset($Ge[$_POST["STATUS"]])){$te="\nON SCHEDULE ".($_POST["INTERVAL_VALUE"]?"EVERY ".q($_POST["INTERVAL_VALUE"])." $_POST[INTERVAL_FIELD]".($_POST["STARTS"]?" STARTS ".q($_POST["STARTS"]):"").($_POST["ENDS"]?" ENDS ".q($_POST["ENDS"]):""):"AT ".q($_POST["STARTS"]))." ON COMPLETION".($_POST["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?'Event has been altered.':'Event has been created.'),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$te.($aa!=$_POST["EVENT_NAME"]?"\nRENAME TO ".idf_escape($_POST["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($_POST["EVENT_NAME"]).$te)."\n".$Ge[$_POST["STATUS"]]." COMMENT ".q($_POST["EVENT_COMMENT"]).rtrim(" DO\n$_POST[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?'Alter event'.": ".h($aa):'Create event'),$i);$K=$_POST;if(!$K&&$aa!=""){$L=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$K=reset($L);}echo'
<form action="" method="post">
<table cellspacing="0">
<tr><th>Name<td><input name="EVENT_NAME" value="',h($K["EVENT_NAME"]),'" maxlength="64">
<tr><th>Start<td><input name="STARTS" value="',h("$K[EXECUTE_AT]$K[STARTS]"),'">
<tr><th>End<td><input name="ENDS" value="',h($K["ENDS"]),'">
<tr><th>Every<td><input name="INTERVAL_VALUE" value="',h($K["INTERVAL_VALUE"]),'" size="6"> ',html_select("INTERVAL_FIELD",$tc,$K["INTERVAL_FIELD"]),'<tr><th>Status<td>',html_select("STATUS",$Ge,$K["STATUS"]),'<tr><th>Comment<td><input name="EVENT_COMMENT" value="',h($K["EVENT_COMMENT"]),'" maxlength="64">
<tr><th>&nbsp;<td>',checkbox("ON_COMPLETION","PRESERVE",$K["ON_COMPLETION"]=="PRESERVE",'On completion preserve'),'</table>
<p>';textarea("EVENT_DEFINITION",$K["EVENT_DEFINITION"]);echo'<p>
<input type="submit" value="Save">
';if($aa!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$pe=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$qe=routine_languages();$qb=false;if($_POST&&!$i&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){$P=array();$k=(array)$_POST["fields"];ksort($k);foreach($k
as$j){if($j["field"]!=""){$P[]=(ereg("^($qc)\$",$j["inout"])?"$j[inout] ":"").idf_escape($j["field"]).process_type($j,"CHARACTER SET");}}$qb=drop_create("DROP $pe ".idf_escape($da),"CREATE $pe ".idf_escape($_POST["name"])." (".implode(", ",$P).")".(isset($_GET["function"])?" RETURNS".process_type($_POST["returns"],"CHARACTER SET"):"").(in_array($_POST["language"],$qe)?" LANGUAGE $_POST[language]":"").rtrim("\n$_POST[definition]",";").";",substr(ME,0,-1),'Routine has been dropped.','Routine has been altered.','Routine has been created.',$da);}page_header(($da!=""?(isset($_GET["function"])?'Alter function':'Alter procedure').": ".h($da):(isset($_GET["function"])?'Create function':'Create procedure')),$i);$c=get_vals("SHOW CHARACTER SET");sort($c);$K=array("fields"=>array());if($_POST){$K=$_POST;$K["fields"]=(array)$K["fields"];process_fields($K["fields"]);}elseif($da!=""){$K=routine($da,$pe);$K["name"]=$da;}echo'
<form action="" method="post" id="form">
<p>Name: <input name="name" value="',h($K["name"]),'" maxlength="64">
',($qe?'Language'.": ".html_select("language",$qe,$K["language"]):""),'<table cellspacing="0" class="nowrap">
';edit_fields($K["fields"],$c,$pe);if(isset($_GET["function"])){echo"<tr><td>".'Return type';edit_type("returns",$K["returns"],$c);}echo'</table>
<p>';textarea("definition",$K["definition"]);echo'<p>
<input type="submit" value="Save">
';if($da!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}if($qb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$of=trigger_options();$nf=array("INSERT","UPDATE","DELETE");$qb=false;if($_POST&&!$i&&in_array($_POST["Timing"],$of["Timing"])&&in_array($_POST["Event"],$nf)&&in_array($_POST["Type"],$of["Type"])){$df=" $_POST[Timing] $_POST[Event]";$ld=" ON ".table($a);$qb=drop_create("DROP TRIGGER ".idf_escape($_GET["name"]).($x=="pgsql"?$ld:""),"CREATE TRIGGER ".idf_escape($_POST["Trigger"]).($x=="mssql"?$ld.$df:$df.$ld).rtrim(" $_POST[Type]\n$_POST[Statement]",";").";",ME."table=".urlencode($a),'Trigger has been dropped.','Trigger has been altered.','Trigger has been created.',$_GET["name"]);}page_header(($_GET["name"]!=""?'Alter trigger'.": ".h($_GET["name"]):'Create trigger'),$i,array("table"=>$a));$K=$_POST;if(!$K){$K=trigger($_GET["name"])+array("Trigger"=>$a."_bi");}echo'
<form action="" method="post" id="form">
<table cellspacing="0">
<tr><th>Time<td>',html_select("Timing",$of["Timing"],$K["Timing"],"if (/^".preg_quote($a,"/")."_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '".js_escape($a)."_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"),'<tr><th>Event<td>',html_select("Event",$nf,$K["Event"],"this.form['Timing'].onchange();"),'<tr><th>Type<td>',html_select("Type",$of["Type"],$K["Type"]),'</table>
<p>Name: <input name="Trigger" value="',h($K["Trigger"]),'" maxlength="64">
<p>';textarea("Statement",$K["Statement"]);echo'<p>
<input type="submit" value="Save">
';if($_GET["name"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}if($qb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["user"])){$fa=$_GET["user"];$Xd=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$K){foreach(explode(",",($K["Privilege"]=="Grant option"?"":$K["Context"]))as$Ua){$Xd[$Ua][$K["Privilege"]]=$K["Comment"];}}$Xd["Server Admin"]+=$Xd["File access on server"];$Xd["Databases"]["Create routine"]=$Xd["Procedures"]["Create routine"];unset($Xd["Procedures"]["Create routine"]);$Xd["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X){$Xd["Columns"][$X]=$Xd["Tables"][$X];}unset($Xd["Server Admin"]["Usage"]);foreach($Xd["Tables"]as$y=>$X){unset($Xd["Databases"][$y]);}$cd=array();if($_POST){foreach($_POST["objects"]as$y=>$X){$cd[$X]=(array)$cd[$X]+(array)$_POST["grants"][$y];}}$cc=array();$jd="";if(isset($_GET["host"])&&($I=$e->query("SHOW GRANTS FOR ".q($fa)."@".q($_GET["host"])))){while($K=$I->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$K[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$B[1],$Lc,PREG_SET_ORDER)){foreach($Lc
as$X){if($X[1]!="USAGE"){$cc["$B[2]$X[2]"][$X[1]]=true;}if(ereg(' WITH GRANT OPTION',$K[0])){$cc["$B[2]$X[2]"]["GRANT OPTION"]=true;}}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$K[0],$B)){$jd=$B[1];}}}if($_POST&&!$i){$kd=(isset($_GET["host"])?q($fa)."@".q($_GET["host"]):"''");$dd=q($_POST["user"])."@".q($_POST["host"]);$Jd=q($_POST["pass"]);if($_POST["drop"]){query_redirect("DROP USER $kd",ME."privileges=",'User has been dropped.');}else{$Za=false;if($kd!=$dd){$Za=queries(($e->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." $dd IDENTIFIED BY".($_POST["hashed"]?" PASSWORD":"")." $Jd");$i=!$Za;}elseif($_POST["pass"]!=$jd||!$_POST["hashed"]){queries("SET PASSWORD FOR $dd = ".($_POST["hashed"]?$Jd:"PASSWORD($Jd)"));}if(!$i){$me=array();foreach($cd
as$gd=>$q){if(isset($_GET["grant"])){$q=array_filter($q);}$q=array_keys($q);if(isset($_GET["grant"])){$me=array_diff(array_keys(array_filter($cd[$gd],'strlen')),$q);}elseif($kd==$dd){$id=array_keys((array)$cc[$gd]);$me=array_diff($id,$q);$q=array_diff($q,$id);unset($cc[$gd]);}if(preg_match('~^(.+)\\s*(\\(.*\\))?$~U',$gd,$B)&&(!grant("REVOKE",$me,$B[2]," ON $B[1] FROM $dd")||!grant("GRANT",$q,$B[2]," ON $B[1] TO $dd"))){$i=true;break;}}}if(!$i&&isset($_GET["host"])){if($kd!=$dd){queries("DROP USER $kd");}elseif(!isset($_GET["grant"])){foreach($cc
as$gd=>$me){if(preg_match('~^(.+)(\\(.*\\))?$~U',$gd,$B)){grant("REVOKE",array_keys($me),$B[2]," ON $B[1] FROM $dd");}}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?'User has been altered.':'User has been created.'),!$i);if($Za){$e->query("DROP USER $dd");}}}page_header((isset($_GET["host"])?'Username'.": ".h("$fa@$_GET[host]"):'Create user'),$i,array("privileges"=>array('','Privileges')));if($_POST){$K=$_POST;$cc=$cd;}else{$K=$_GET+array("host"=>$e->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$K["pass"]=$jd;if($jd!=""){$K["hashed"]=true;}$cc[DB!=""&&!isset($_GET["host"])?idf_escape(addcslashes(DB,"%_")).".*":""]=array();}echo'<form action="" method="post">
<table cellspacing="0">
<tr><th>Server<td><input name="host" maxlength="60" value="',h($K["host"]),'">
<tr><th>Username<td><input name="user" maxlength="16" value="',h($K["user"]),'">
<tr><th>Password<td><input id="pass" name="pass" value="',h($K["pass"]),'">
';if(!$K["hashed"]){echo'<script type="text/javascript">typePassword(document.getElementById(\'pass\'));</script>';}echo
checkbox("hashed",1,$K["hashed"],'Hashed',"typePassword(this.form['pass'], this.checked);"),'</table>
';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'><a href='http://dev.mysql.com/doc/refman/".substr($e->server_info,0,3)."/en/grant.html#priv_level' target='_blank' rel='noreferrer'>".'Privileges'."</a>";$s=0;foreach($cc
as$gd=>$q){echo'<th>'.($gd!="*.*"?"<input name='objects[$s]' value='".h($gd)."' size='10'>":"<input type='hidden' name='objects[$s]' value='*.*' size='10'>*.*");$s++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>'Server',"Databases"=>'Database',"Tables"=>'Table',"Columns"=>'Column',"Procedures"=>'Routine',)as$Ua=>$jb){foreach((array)$Xd[$Ua]as$Wd=>$Pa){echo"<tr".odd()."><td".($jb?">$jb<td":" colspan='2'").' lang="en" title="'.h($Pa).'">'.h($Wd);$s=0;foreach($cc
as$gd=>$q){$D="'grants[$s][".h(strtoupper($Wd))."]'";$Y=$q[strtoupper($Wd)];if($Ua=="Server Admin"&&$gd!=(isset($cc["*.*"])?"*.*":"")){echo"<td>&nbsp;";}elseif(isset($_GET["grant"])){echo"<td><select name=$D><option><option value='1'".($Y?" selected":"").">".'Grant'."<option value='0'".($Y=="0"?" selected":"").">".'Revoke'."</select>";}else{echo"<td align='center'><input type='checkbox' name=$D value='1'".($Y?" checked":"").($Wd=="All privileges"?" id='grants-$s-all'":($Wd=="Grant option"?"":" onclick=\"if (this.checked) formUncheck('grants-$s-all');\"")).">";}$s++;}}}echo"</table>\n",'<p>
<input type="submit" value="Save">
';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$i){$yc=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".(+$X))){$yc++;}}queries_redirect(ME."processlist=",lang(array('%d process has been killed.','%d processes have been killed.'),$yc),$yc||!$_POST["kill"]);}page_header('Process list',$i);echo'
<form action="" method="post">
<table cellspacing="0" onclick="tableClick(event);" class="nowrap checkable">
';$s=-1;foreach(process_list()as$s=>$K){if(!$s){echo"<thead><tr lang='en'>".(support("kill")?"<th>&nbsp;":"")."<th>".implode("<th>",array_keys($K))."</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$K["Id"],0):"");foreach($K
as$y=>$X){echo"<td>".(($x=="sql"?$y=="Info"&&$X!="":$y=="current_query"&&$X!="<IDLE>")?"<code class='jush-$x'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($K["db"]!=""?"db=".urlencode($K["db"])."&":"")."sql=".urlencode($X)).'">'.'Edit'.'</a>':nbsp($X));}echo"\n";}echo'</table>
<script type=\'text/javascript\'>tableCheck();</script>
<p>
';if(support("kill")){echo($s+1)."/".sprintf('%d in total',$e->result("SELECT @@max_connections")),"<p><input type='submit' value='".'Kill'."'>\n";}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["select"])){$a=$_GET["select"];$T=table_status($a);$v=indexes($a);$k=fields($a);$m=column_foreign_keys($a);if($T["Oid"]=="t"){$v[]=array("type"=>"PRIMARY","columns"=>array("oid"));}parse_str($_COOKIE["adminer_import"],$la);$ne=array();$d=array();$bf=null;foreach($k
as$y=>$j){$D=$b->fieldName($j);if(isset($j["privileges"]["select"])&&$D!=""){$d[$y]=html_entity_decode(strip_tags($D));if(ereg('text|lob',$j["type"])){$bf=$b->selectLengthProcess();}}$ne+=$j["privileges"];}list($N,$r)=$b->selectColumnsProcess($d,$v);$Z=$b->selectSearchProcess($k,$v);$td=$b->selectOrderProcess($k,$v);$z=$b->selectLimitProcess();$ac=($N?implode(", ",$N):($T["Oid"]=="t"?"oid, ":"")."*")."\nFROM ".table($a);$dc=($r&&count($r)<count($N)?"\nGROUP BY ".implode(", ",$r):"").($td?"\nORDER BY ".implode(", ",$td):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$wf=>$K){echo$e->result("SELECT".limit(idf_escape(key($K))." FROM ".table($a)," WHERE ".where_check($wf).($Z?" AND ".implode(" AND ",$Z):"").($td?" ORDER BY ".implode(", ",$td):""),1));}exit;}if($_POST&&!$i){$Kf="(".implode(") OR (",array_map('where_check',(array)$_POST["check"])).")";$Td=$yf=null;foreach($v
as$u){if($u["type"]=="PRIMARY"){$Td=array_flip($u["columns"]);$yf=($N?$Td:array());break;}}foreach((array)$yf
as$y=>$X){if(in_array(idf_escape($y),$N)){unset($yf[$y]);}}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$yf===array()){$Jf=$Z;if(is_array($_POST["check"])){$Jf[]="($Kf)";}$H="SELECT $ac".($Jf?"\nWHERE ".implode(" AND ",$Jf):"").$dc;}else{$uf=array();foreach($_POST["check"]as$X){$uf[]="(SELECT".limit($ac,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X).$dc,1).")";}$H=implode(" UNION ALL ",$uf);}$b->dumpData($a,"table",$H);exit;}if(!$b->selectEmailProcess($Z,$m)){if($_POST["save"]||$_POST["delete"]){$I=true;$ma=0;$H=table($a);$P=array();if(!$_POST["delete"]){foreach($d
as$D=>$X){$X=process_input($k[$D]);if($X!==null){if($_POST["clone"]){$P[idf_escape($D)]=($X!==false?$X:idf_escape($D));}elseif($X!==false){$P[]=idf_escape($D)." = $X";}}}$H.=($_POST["clone"]?" (".implode(", ",array_keys($P)).")\nSELECT ".implode(", ",$P)."\nFROM ".table($a):" SET\n".implode(",\n",$P));}if($_POST["delete"]||$P){$Na="UPDATE";if($_POST["delete"]){$Na="DELETE";$H="FROM $H";}if($_POST["clone"]){$Na="INSERT";$H="INTO $H";}if($_POST["all"]||($yf===array()&&$_POST["check"])||count($r)<count($N)){$I=queries($Na." $H".($_POST["all"]?($Z?"\nWHERE ".implode(" AND ",$Z):""):"\nWHERE $Kf"));$ma=$e->affected_rows;}else{foreach((array)$_POST["check"]as$X){$I=queries($Na.limit1($H,"\nWHERE ".where_check($X)));if(!$I){break;}$ma+=$e->affected_rows;}}}queries_redirect(remove_from_uri("page"),lang(array('%d item has been affected.','%d items have been affected.'),$ma),$I);}elseif(!$_POST["import"]){if(!$_POST["val"]){$i='Double click on a value to modify it.';}else{$I=true;$ma=0;foreach($_POST["val"]as$wf=>$K){$P=array();foreach($K
as$y=>$X){$y=bracket_escape($y,1);$P[]=idf_escape($y)." = ".(ereg('char|text',$k[$y]["type"])||$X!=""?$b->processInput($k[$y],$X):"NULL");}$H=table($a)." SET ".implode(", ",$P);$Jf=" WHERE ".where_check($wf).($Z?" AND ".implode(" AND ",$Z):"");$I=queries("UPDATE".(count($r)<count($N)?" $H$Jf":limit1($H,$Jf)));if(!$I){break;}$ma+=$e->affected_rows;}queries_redirect(remove_from_uri(),lang(array('%d item has been affected.','%d items have been affected.'),$ma),$I);}}elseif(is_string($Rb=get_file("csv_file",true))){cookie("adminer_import","output=".urlencode($la["output"])."&format=".urlencode($_POST["separator"]));$I=true;$La=array_keys($k);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$Rb,$Lc);$ma=count($Lc[0]);begin();$ye=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));foreach($Lc[0]as$y=>$X){preg_match_all("~((\"[^\"]*\")+|[^$ye]*)$ye~",$X.$ye,$Mc);if(!$y&&!array_diff($Mc[1],$La)){$La=$Mc[1];$ma--;}else{$P=array();foreach($Mc[1]as$s=>$Ia){$P[idf_escape($La[$s])]=($Ia==""&&$k[$La[$s]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$Ia))));}$I=insert_update($a,$P,$Td);if(!$I){break;}}}if($I){queries("COMMIT");}queries_redirect(remove_from_uri("page"),lang(array('%d row has been imported.','%d rows have been imported.'),$ma),$I);queries("ROLLBACK");}else{$i=upload_error($Rb);}}}$Re=$b->tableName($T);page_header('Select'.": $Re",$i);session_write_close();$P=null;if(isset($ne["insert"])){$P="";foreach((array)$_GET["where"]as$X){if(count($m[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!ereg('[_%]',$X["val"])))){$P.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}}$b->selectLinks($T,$P);if(!$d){echo"<p class='error'>".'Unable to select the table'.($k?".":": ".error())."\n";}else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($N,$d);$b->selectSearchPrint($Z,$d,$v);$b->selectOrderPrint($td,$d,$v);$b->selectLimitPrint($z);$b->selectLengthPrint($bf);$b->selectActionPrint();echo"</form>\n";$E=$_GET["page"];if($E=="last"){$Yb=$e->result("SELECT COUNT(*) FROM ".table($a).($Z?" WHERE ".implode(" AND ",$Z):""));$E=floor(max(0,$Yb-1)/$z);}$H="SELECT".limit((+$z&&$r&&count($r)<count($N)&&$x=="sql"?"SQL_CALC_FOUND_ROWS ":"").$ac,($Z?"\nWHERE ".implode(" AND ",$Z):"").$dc,($z!=""?+$z:null),($E?$z*$E:0),"\n");echo$b->selectQuery($H);$I=$e->query($H);if(!$I){echo"<p class='error'>".error()."\n";}else{if($x=="mssql"){$I->seek($z*$E);}$yb=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$L=array();while($K=$I->fetch_assoc()){if($E&&$x=="oracle"){unset($K["RNUM"]);}$L[]=$K;}if($_GET["page"]!="last"){$Yb=(+$z&&$r&&count($r)<count($N)?($x=="sql"?$e->result(" SELECT FOUND_ROWS()"):$e->result("SELECT COUNT(*) FROM ($H) x")):count($L));}if(!$L){echo"<p class='message'>".'No rows.'."\n";}else{$ya=$b->backwardKeys($a,$Re);echo"<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n","<thead><tr>".(!$r&&$N?"":"<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".'edit'."</a>");$bd=array();$p=array();reset($N);$ce=1;foreach($L[0]as$y=>$X){if($T["Oid"]!="t"||$y!="oid"){$X=$_GET["columns"][key($N)];$j=$k[$N?($X?$X["col"]:current($N)):$y];$D=($j?$b->fieldName($j,$ce):"*");if($D!=""){$ce++;$bd[$y]=$D;$Ma=idf_escape($y);echo'<th><a href="'.h(remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($y).($td[0]==$Ma||$td[0]==$y||(!$td&&count($r)<count($N)&&$r[0]==$Ma)?'&desc%5B0%5D=1':'')).'">'.(!$N||$X?apply_sql_function($X["fun"],$D):h(current($N)))."</a>";}$p[$y]=$X["fun"];next($N);}}$Hc=array();if($_GET["modify"]){foreach($L
as$K){foreach($K
as$y=>$X){$Hc[$y]=max($Hc[$y],min(40,strlen(utf8_decode($X))));}}}echo($ya?"<th>".'Relations':"")."</thead>\n";foreach($b->rowDescriptions($L,$m)as$C=>$K){$vf=unique_array($L[$C],$v);$wf="";foreach($vf
as$y=>$X){$wf.="&".(isset($X)?urlencode("where[".bracket_escape($y)."]")."=".urlencode($X):"null%5B%5D=".urlencode($y));}echo"<tr".odd().">".(!$r&&$N?"":"<td>".checkbox("check[]",substr($wf,1),in_array(substr($wf,1),(array)$_POST["check"]),"","this.form['all'].checked = false; formUncheck('all-page');").(count($r)<count($N)||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$wf)."'>".'edit'."</a>"));foreach($K
as$y=>$X){if(isset($bd[$y])){$j=$k[$y];if($X!=""&&(!isset($yb[$y])||$yb[$y]!="")){$yb[$y]=(is_mail($X)?$bd[$y]:"");}$_="";$X=$b->editVal($X,$j);if(!isset($X)){$X="<i>NULL</i>";}else{if(ereg('blob|bytea|raw|file',$j["type"])&&$X!=""){$_=h(ME.'download='.urlencode($a).'&field='.urlencode($y).$wf);}if($X===""){$X="&nbsp;";}elseif($bf!=""&&ereg('text|blob',$j["type"])&&is_utf8($X)){$X=shorten_utf8($X,max(0,+$bf));}else{$X=h($X);}if(!$_){foreach((array)$m[$y]as$l){if(count($m[$y])==1||end($l["source"])==$y){$_="";foreach($l["source"]as$s=>$Be){$_.=where_link($s,$l["target"][$s],$L[$C][$Be]);}$_=h(($l["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($l["db"]),ME):ME).'select='.urlencode($l["table"]).$_);if(count($l["source"])==1){break;}}}}if($y=="COUNT(*)"){$_=h(ME."select=".urlencode($a));$s=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$vf)){$_.=h(where_link($s++,$W["col"],$W["val"],$W["op"]));}}foreach($vf
as$xc=>$W){$_.=h(where_link($s++,$xc,$W));}}}if(!$_){if(is_mail($X)){$_="mailto:$X";}if($ae=is_url($K[$y])){$_=($ae=="http"&&$ba?$K[$y]:"$ae://www.adminer.org/redirect/?url=".urlencode($K[$y]));}}$t=h("val[$wf][".bracket_escape($y)."]");$Y=$_POST["val"][$wf][bracket_escape($y)];$fc=h(isset($Y)?$Y:$K[$y]);$Kc=strpos($X,"<i>...</i>");$vb=is_utf8($X)&&$L[$C][$y]==$K[$y]&&!$p[$y];$af=ereg('text|lob',$j["type"]);echo(($_GET["modify"]&&$vb)||isset($Y)?"<td>".($af?"<textarea name='$t' cols='30' rows='".(substr_count($K[$y],"\n")+1)."'>$fc</textarea>":"<input name='$t' value='$fc' size='$Hc[$y]'>"):"<td id='$t' ondblclick=\"".($vb?"selectDblClick(this, event".($Kc?", 2":($af?", 1":"")).")":"alert('".h('Use edit link to modify this value.')."')").";\">".$b->selectVal($X,$_,$j));}}if($ya){echo"<td>";}$b->backwardKeysPrint($ya,$L[$C]);echo"</tr>\n";}echo"</table>\n",(!$r&&$N?"":"<script type='text/javascript'>tableCheck();</script>\n");}if($L||$E){$Gb=true;if($_GET["page"]!="last"&&+$z&&count($r)>=count($N)&&($Yb>=$z||$E)){$Yb=found_rows($T,$Z);if($Yb<max(1e4,2*($E+1)*$z)){ob_flush();flush();$Yb=$e->result("SELECT COUNT(*) FROM ".table($a).($Z?" WHERE ".implode(" AND ",$Z):""));}else{$Gb=false;}}echo"<p class='pages'>";if(+$z&&$Yb>$z){$Oc=floor(($Yb-1)/$z);echo'<a href="'.h(remove_from_uri("page"))."\" onclick=\"pageClick(this.href, +prompt('".'Page'."', '".($E+1)."'), event); return false;\">".'Page'."</a>:",pagination(0,$E).($E>5?" ...":"");for($s=max(1,$E-4);$s<min($Oc,$E+5);$s++){echo
pagination($s,$E);}echo($E+5<$Oc?" ...":"").($Gb?pagination($Oc,$E):' <a href="'.h(remove_from_uri()."&page=last").'">'.'last'."</a>");}echo" (".($Gb?"":"~ ").lang(array('%d row','%d rows'),$Yb).") ".checkbox("all",1,0,'whole result')."\n";if($b->selectCommandPrint()){echo'<fieldset><legend>Edit</legend><div>
<input type="submit" value="Save"',($_GET["modify"]?'':' title="'.'Double click on a value to modify it.'.'" class="jsonly"');?>>
<input type="submit" name="edit" value="Edit">
<input type="submit" name="clone" value="Clone">
<input type="submit" name="delete" value="Delete" onclick="return confirm('Are you sure? (' + (this.form['all'].checked ? <?php echo$Yb,' : formChecked(this, /check/)) + \')\');">
</div></fieldset>
';}print_fieldset("export",'Export');$Ad=$b->dumpOutput();echo($Ad?html_select("output",$Ad,$la["output"])." ":""),html_select("format",$b->dumpFormat(),$la["format"])," <input type='submit' name='export' value='".'Export'."' onclick='eventStop(event);'>\n","</div></fieldset>\n";}if($b->selectImportPrint()){print_fieldset("import",'Import',!$L);echo"<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$la["format"],1);echo" <input type='submit' name='import' value='".'Import'."'>","<input type='hidden' name='token' value='$U'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($yb,'strlen'),$d);echo"</form>\n";}}}elseif(isset($_GET["variables"])){$Fe=isset($_GET["status"]);page_header($Fe?'Status':'Variables');$Ef=($Fe?show_status():show_variables());if(!$Ef){echo"<p class='message'>".'No rows.'."\n";}else{echo"<table cellspacing='0'>\n";foreach($Ef
as$y=>$X){echo"<tr>","<th><code class='jush-".$x.($Fe?"status":"set")."'>".h($y)."</code>","<td>".nbsp($X);}echo"</table>\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Oe=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$T){$t=js_escape($T["Name"]);json_row("Comment-$t",nbsp($T["Comment"]));if(!is_view($T)){foreach(array("Engine","Collation")as$y){json_row("$y-$t",nbsp($T[$y]));}foreach($Oe+array("Auto_increment"=>0,"Rows"=>0)as$y=>$X){if($T[$y]!=""){$X=number_format($T[$y],0,'.',',');json_row("$y-$t",($y=="Rows"&&$T["Engine"]=="InnoDB"&&$X?"~ $X":$X));if(isset($Oe[$y])){$Oe[$y]+=($T["Engine"]!="InnoDB"||$y!="Data_free"?$T[$y]:0);}}elseif(array_key_exists($y,$T)){json_row("$y-$t");}}}}foreach($Oe
as$y=>$X){json_row("sum-$y",number_format($X,0,'.',','));}json_row("");}else{foreach(count_tables(get_databases())as$h=>$X){json_row("tables-".js_escape($h),$X);}json_row("");}exit;}else{$Xe=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Xe&&!$i&&!$_POST["search"]){$I=true;$Sc="";if($x=="sql"&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"])){queries("SET foreign_key_checks = 0");}if($_POST["truncate"]){if($_POST["tables"]){$I=truncate_tables($_POST["tables"]);}$Sc='Tables have been truncated.';}elseif($_POST["move"]){$I=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Sc='Tables have been moved.';}elseif($_POST["copy"]){$I=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Sc='Tables have been copied.';}elseif($_POST["drop"]){if($_POST["views"]){$I=drop_views($_POST["views"]);}if($I&&$_POST["tables"]){$I=drop_tables($_POST["tables"]);}$Sc='Tables have been dropped.';}elseif($_POST["tables"]&&($I=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"]))))){while($K=$I->fetch_assoc()){$Sc.="<b>".h($K["Table"])."</b>: ".h($K["Msg_text"])."<br>";}}queries_redirect(substr(ME,0,-1),$Sc,$I);}page_header(($_GET["ns"]==""?'Database'.": ".h(DB):'Schema'.": ".h($_GET["ns"])),$i,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3>".'Tables and views'."</h3>\n";$We=tables_list();if(!$We){echo"<p class='message'>".'No tables.'."\n";}else{echo"<form action='' method='post'>\n","<p>".'Search data in tables'.": <input name='query' value='".h($_POST["query"])."'> <input type='submit' name='search' value='".'Search'."'>\n";if($_POST["search"]&&$_POST["query"]!=""){search_tables();}echo"<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n",'<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">','<th>'.'Table','<td>'.'Engine','<td>'.'Collation','<td>'.'Data Length','<td>'.'Index Length','<td>'.'Data Free','<td>'.'Auto Increment','<td>'.'Rows',(support("comment")?'<td>'.'Comment':''),"</thead>\n";foreach($We
as$D=>$V){$Ff=(isset($V)&&!eregi("table",$V));echo'<tr'.odd().'><td>'.checkbox(($Ff?"views[]":"tables[]"),$D,in_array($D,$Xe,true),"","formUncheck('check-all');"),'<th><a href="'.h(ME).'table='.urlencode($D).'" title="'.'Show structure'.'">'.h($D).'</a>';if($Ff){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($D).'" title="'.'Alter view'.'">'.'View'.'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($D).'" title="'.'Select data'.'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",'Alter table'),"Index_length"=>array("indexes",'Alter indexes'),"Data_free"=>array("edit",'New item'),"Auto_increment"=>array("auto_increment=1&create",'Alter table'),"Rows"=>array("select",'Select data'),)as$y=>$_){echo($_?"<td align='right'><a href='".h(ME."$_[0]=").urlencode($D)."' id='$y-".h($D)."' title='$_[1]'>?</a>":"<td id='$y-".h($D)."'>&nbsp;");}}echo(support("comment")?"<td id='Comment-".h($D)."'>&nbsp;":"");}echo"<tr><td>&nbsp;<th>".sprintf('%d in total',count($We)),"<td>".nbsp($x=="sql"?$e->result("SELECT @@storage_engine"):""),"<td>".nbsp(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$y){echo"<td align='right' id='sum-$y'>&nbsp;";}echo"</table>\n","<script type='text/javascript'>tableCheck();</script>\n";if(!information_schema(DB)){echo"<p>".($x=="sql"?"<input type='submit' value='".'Analyze'."'> <input type='submit' name='optimize' value='".'Optimize'."'> <input type='submit' name='check' value='".'Check'."'> <input type='submit' name='repair' value='".'Repair'."'> ":"")."<input type='submit' name='truncate' value='".'Truncate'."'".confirm("formChecked(this, /tables/)")."> <input type='submit' name='drop' value='".'Drop'."'".confirm("formChecked(this, /tables|views/)",1).">\n";$g=(support("scheme")?schemas():get_databases());if(count($g)!=1&&$x!="sqlite"){$h=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".'Move to other database'.": ",($g?html_select("target",$g,$h):'<input name="target" value="'.h($h).'">')," <input type='submit' name='move' value='".'Move'."' onclick='eventStop(event);'>",(support("copy")?" <input type='submit' name='copy' value='".'Copy'."' onclick='eventStop(event);'>":""),"\n";}echo"<input type='hidden' name='token' value='$U'>\n";}echo"</form>\n";}echo'<p><a href="'.h(ME).'create=">'.'Create table'."</a>\n";if(support("view")){echo'<a href="'.h(ME).'view=">'.'Create view'."</a>\n";}if(support("routine")){echo"<h3>".'Routines'."</h3>\n";$re=routines();if($re){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.'Name'.'<td>'.'Type'.'<td>'.'Return type'."<td>&nbsp;</thead>\n";odd('');foreach($re
as$K){echo'<tr'.odd().'>','<th><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($K["ROUTINE_NAME"]).'">'.h($K["ROUTINE_NAME"]).'</a>','<td>'.h($K["ROUTINE_TYPE"]),'<td>'.h($K["DTD_IDENTIFIER"]),'<td><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($K["ROUTINE_NAME"]).'">'.'Alter'."</a>";}echo"</table>\n";}echo'<p>'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.'Create procedure'.'</a> ':'').'<a href="'.h(ME).'function=">'.'Create function'."</a>\n";}if(support("event")){echo"<h3>".'Events'."</h3>\n";$L=get_rows("SHOW EVENTS");if($L){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Name'."<td>".'Schedule'."<td>".'Start'."<td>".'End'."</thead>\n";foreach($L
as$K){echo"<tr>",'<th><a href="'.h(ME).'event='.urlencode($K["Name"]).'">'.h($K["Name"])."</a>","<td>".($K["Execute at"]?'At given time'."<td>".$K["Execute at"]:'Every'." ".$K["Interval value"]." ".$K["Interval field"]."<td>$K[Starts]"),"<td>$K[Ends]";}echo"</table>\n";}echo'<p><a href="'.h(ME).'event=">'.'Create event'."</a>\n";}if($We){echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=db');</script>\n";}}}}page_footer();

View File

@@ -0,0 +1,967 @@
<?php
/** Adminer - Compact database management
* @link http://www.adminer.org/
* @author Jakub Vrana, http://www.vrana.cz/
* @copyright 2007 Jakub Vrana
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
* @version 3.4.0
*/error_reporting(6135);$Wb=!ereg('^(unsafe_raw)?$',ini_get("filter.default"));if($Wb||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Cf=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Cf)$$X=$Cf;}}if(isset($_GET["file"])){header("Expires: ".gmdate("D, d M Y H:i:s",time()+365*24*60*60)." GMT");if($_GET["file"]=="favicon.ico"){header("Content-Type: image/x-icon");echo
base64_decode("AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA/wBhTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERERAAAAAAETMzEQAAAAATERExAAAAABMRETEAAAAAExERMQAAAAATERExAAAAABMRETEAAAAAEzMzMREREQATERExEhEhABEzMxEhEREAAREREhERIRAAAAARIRESEAAAAAESEiEQAAAAABEREQAAAAAAAAAAD//9UAwP/VAIB/AACAf/AAgH+kAIB/gACAfwAAgH8AAIABAACAAf8AgAH/AMAA/wD+AP8A/wAIAf+B1QD//9UA");}elseif($_GET["file"]=="default.css"){header("Content-Type: text/css; charset=utf-8");echo'body{color:#000;background:#fff;font:90%/1.25 Verdana,Arial,Helvetica,sans-serif;margin:0;}a{color:blue;}a:visited{color:navy;}a:hover{color:red;}a.text{text-decoration:none;}h1{font-size:150%;margin:0;padding:.8em 1em;border-bottom:1px solid #999;font-weight:normal;color:#777;background:#eee;}h2{font-size:150%;margin:0 0 20px -18px;padding:.8em 1em;border-bottom:1px solid #000;color:#000;font-weight:normal;background:#ddf;}h3{font-weight:normal;font-size:130%;margin:1em 0 0;}form{margin:0;}table{margin:1em 20px 0 0;border:0;border-top:1px solid #999;border-left:1px solid #999;font-size:90%;}td,th{border:0;border-right:1px solid #999;border-bottom:1px solid #999;padding:.2em .3em;}th{background:#eee;text-align:left;}thead th{text-align:center;}thead td,thead th{background:#ddf;}fieldset{display:inline;vertical-align:top;padding:.5em .8em;margin:.8em .5em 0 0;border:1px solid #999;}p{margin:.8em 20px 0 0;}img{vertical-align:middle;border:0;}td img{max-width:200px;max-height:200px;}code{background:#eee;}tbody tr:hover td,tbody tr:hover th{background:#eee;}pre{margin:1em 0 0;}input[type=image]{vertical-align:middle;}.version{color:#777;font-size:67%;}.js .hidden,.nojs .jsonly{display:none;}.nowrap td,.nowrap th,td.nowrap{white-space:pre;}.wrap td{white-space:normal;}.error{color:red;background:#fee;}.error b{background:#fff;font-weight:normal;}.message{color:green;background:#efe;}.error,.message{padding:.5em .8em;margin:1em 20px 0 0;}.char{color:#007F00;}.date{color:#7F007F;}.enum{color:#007F7F;}.binary{color:red;}.odd td{background:#F5F5F5;}.js .checked td,.js .checked th{background:#ddf;}.time{color:silver;font-size:70%;}.function{text-align:right;}.number{text-align:right;}.datetime{text-align:right;}.type{width:15ex;width:auto\\9;}.options select{width:20ex;width:auto\\9;}.active{font-weight:bold;}.sqlarea{width:98%;}#menu{position:absolute;margin:10px 0 0;padding:0 0 30px 0;top:2em;left:0;width:19em;overflow:auto;overflow-y:hidden;white-space:nowrap;}#menu p{padding:.8em 1em;margin:0;border-bottom:1px solid #ccc;}#content{margin:2em 0 0 21em;padding:10px 20px 20px 0;}#lang{position:absolute;top:0;left:0;line-height:1.8em;padding:.3em 1em;}#breadcrumb{white-space:nowrap;position:absolute;top:0;left:21em;background:#eee;height:2em;line-height:1.8em;padding:0 1em;margin:0 0 0 -18px;}#h1{color:#777;text-decoration:none;font-style:italic;}#version{font-size:67%;color:red;}#schema{margin-left:60px;position:relative;-moz-user-select:none;-webkit-user-select:none;}#schema .table{border:1px solid silver;padding:0 2px;cursor:move;position:absolute;}#schema .references{position:absolute;}.rtl h2{margin:0 -18px 20px 0;}.rtl p,.rtl table,.rtl .error,.rtl .message{margin:1em 0 0 20px;}.rtl #content{margin:2em 21em 0 0;padding:10px 0 20px 20px;}.rtl #breadcrumb{left:auto;right:21em;margin:0 -18px 0 0;}.rtl #lang,.rtl #menu{left:auto;right:0;}@media print{#lang,#menu{display:none;}#content{margin-left:1em;}#breadcrumb{left:1em;}.nowrap td,.nowrap th,td.nowrap{white-space:normal;}}';}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");?>function
toggle(id){var
el=document.getElementById(id);el.className=(el.className=='hidden'?'':'hidden');return true;}function
cookie(assign,days){var
date=new
Date();date.setDate(date.getDate()+days);document.cookie=assign+'; expires='+date;}function
verifyVersion(){cookie('adminer_version=0',1);var
script=document.createElement('script');script.src=location.protocol+'//www.adminer.org/version.php';document.body.appendChild(script);}function
selectValue(select){var
selected=select.options[select.selectedIndex];return((selected.attributes.value||{}).specified?selected.value:selected.text);}function
trCheck(el){var
tr=el.parentNode.parentNode;tr.className=tr.className.replace(/(^|\s)checked(\s|$)/,'$2')+(el.checked?' checked':'');}function
formCheck(el,name){var
elems=el.form.elements;for(var
i=0;i<elems.length;i++){if(name.test(elems[i].name)){elems[i].checked=el.checked;trCheck(elems[i]);}}}function
tableCheck(){var
tables=document.getElementsByTagName('table');for(var
i=0;i<tables.length;i++){if(/(^|\s)checkable(\s|$)/.test(tables[i].className)){var
trs=tables[i].getElementsByTagName('tr');for(var
j=0;j<trs.length;j++){trCheck(trs[j].firstChild.firstChild);}}}}function
formUncheck(id){var
el=document.getElementById(id);el.checked=false;trCheck(el);}function
formChecked(el,name){var
checked=0;var
elems=el.form.elements;for(var
i=0;i<elems.length;i++){if(name.test(elems[i].name)&&elems[i].checked){checked++;}}return checked;}function
tableClick(event){var
click=(!window.getSelection||getSelection().isCollapsed);var
el=event.target||event.srcElement;while(!/^tr$/i.test(el.tagName)){if(/^(table|a|input|textarea)$/i.test(el.tagName)){if(el.type!='checkbox'){return;}checkboxClick(event,el);click=false;}el=el.parentNode;}el=el.firstChild.firstChild;if(click){el.click&&el.click();el.onclick&&el.onclick();}trCheck(el);}var
lastChecked;function
checkboxClick(event,el){if(!el.name){return;}if(event.shiftKey&&(!lastChecked||lastChecked.name==el.name)){var
checked=(lastChecked?lastChecked.checked:true);var
inputs=el.parentNode.parentNode.parentNode.getElementsByTagName('input');var
checking=!lastChecked;for(var
i=0;i<inputs.length;i++){var
input=inputs[i];if(input.name===el.name){if(checking){input.checked=checked;trCheck(input);}if(input===el||input===lastChecked){if(checking){break;}checking=true;}}}}lastChecked=el;}function
setHtml(id,html){var
el=document.getElementById(id);if(el){if(html==undefined){el.parentNode.innerHTML='&nbsp;';}else{el.innerHTML=html;}}}function
nodePosition(el){var
pos=0;while(el=el.previousSibling){pos++;}return pos;}function
pageClick(href,page,event){if(!isNaN(page)&&page){href+=(page!=1?'&page='+(page-1):'');location.href=href;}}function
selectAddRow(field){field.onchange=function(){selectFieldChange(field.form);};field.onchange();var
row=field.parentNode.cloneNode(true);var
selects=row.getElementsByTagName('select');for(var
i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/[a-z]\[\d+/,'$&1');selects[i].selectedIndex=0;}var
inputs=row.getElementsByTagName('input');if(inputs.length){inputs[0].name=inputs[0].name.replace(/[a-z]\[\d+/,'$&1');inputs[0].value='';inputs[0].className='';}field.parentNode.parentNode.appendChild(row);}function
selectFieldChange(form){var
ok=(function(){var
inputs=form.getElementsByTagName('input');for(var
i=0;i<inputs.length;i++){var
input=inputs[i];if(/^fulltext/.test(input.name)&&input.value){return true;}}var
ok=true;var
selects=form.getElementsByTagName('select');for(var
i=0;i<selects.length;i++){var
select=selects[i];var
col=selectValue(select);var
match=/^(where.+)col\]/.exec(select.name);if(match){var
op=selectValue(form[match[1]+'op]']);var
val=form[match[1]+'val]'].value;if(col
in
indexColumns&&(!/LIKE|REGEXP/.test(op)||(op=='LIKE'&&val.charAt(0)!='%'))){return true;}else
if(col||val){ok=false;}}if(col&&/^order/.test(select.name)){if(!(col
in
indexColumns)){ok=false;}break;}}return ok;})();setHtml('noindex',(ok?'':'!'));}function
bodyKeydown(event,button){var
target=event.target||event.srcElement;if(event.ctrlKey&&(event.keyCode==13||event.keyCode==10)&&!event.altKey&&!event.metaKey&&/select|textarea|input/i.test(target.tagName)){target.blur();if(button){target.form[button].click();}else{target.form.submit();}return false;}return true;}function
editingKeydown(event){if((event.keyCode==40||event.keyCode==38)&&event.ctrlKey&&!event.altKey&&!event.metaKey){var
target=event.target||event.srcElement;var
sibling=(event.keyCode==40?'nextSibling':'previousSibling');var
el=target.parentNode.parentNode[sibling];if(el&&(/^tr$/i.test(el.tagName)||(el=el[sibling]))&&/^tr$/i.test(el.tagName)&&(el=el.childNodes[nodePosition(target.parentNode)])&&(el=el.childNodes[nodePosition(target)])){el.focus();}return false;}if(event.shiftKey&&!bodyKeydown(event,'insert')){eventStop(event);return false;}return true;}function
functionChange(select){var
input=select.form[select.name.replace(/^function/,'fields')];if(selectValue(select)){if(input.origMaxLength===undefined){input.origMaxLength=input.maxLength;}input.removeAttribute('maxlength');}else
if(input.origMaxLength>=0){input.maxLength=input.origMaxLength;}}function
ajax(url,callback,data){var
request=(window.XMLHttpRequest?new
XMLHttpRequest():(window.ActiveXObject?new
ActiveXObject('Microsoft.XMLHTTP'):false));if(request){request.open((data?'POST':'GET'),url);if(data){request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}request.setRequestHeader('X-Requested-With','XMLHttpRequest');request.onreadystatechange=function(){if(request.readyState==4){callback(request);}};request.send(data);}return request;}function
ajaxSetHtml(url){return ajax(url,function(request){if(request.status){var
data=eval('('+request.responseText+')');for(var
key
in
data){setHtml(key,data[key]);}}});}function
selectDblClick(td,event,text){if(/input|textarea/i.test(td.firstChild.tagName)){return;}var
original=td.innerHTML;var
input=document.createElement(text?'textarea':'input');input.onkeydown=function(event){if(!event){event=window.event;}if(event.keyCode==27&&!(event.ctrlKey||event.shiftKey||event.altKey||event.metaKey)){td.innerHTML=original;}};var
pos=event.rangeOffset;var
value=td.firstChild.alt||td.textContent||td.innerText;input.style.width=Math.max(td.clientWidth-14,20)+'px';if(text){var
rows=1;value.replace(/\n/g,function(){rows++;});input.rows=rows;}if(value=='\u00A0'||td.getElementsByTagName('i').length){value='';}if(document.selection){var
range=document.selection.createRange();range.moveToPoint(event.clientX,event.clientY);var
range2=range.duplicate();range2.moveToElementText(td);range2.setEndPoint('EndToEnd',range);pos=range2.text.length;}td.innerHTML='';td.appendChild(input);input.focus();if(text==2){return ajax(location.href+'&'+encodeURIComponent(td.id)+'=',function(request){if(request.status){input.value=request.responseText;input.name=td.id;}});}input.value=value;input.name=td.id;input.selectionStart=pos;input.selectionEnd=pos;if(document.selection){var
range=document.selection.createRange();range.moveEnd('character',-input.value.length+pos);range.select();}}function
eventStop(event){if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}}var
jushRoot=location.protocol + '//www.adminer.org/static/';function
bodyLoad(version){if(jushRoot){var
link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=jushRoot+'jush.css';document.getElementsByTagName('head')[0].appendChild(link);var
script=document.createElement('script');script.src=jushRoot+'jush.js';script.onload=function(){if(window.jush){jush.create_links=' target="_blank" rel="noreferrer"';jush.urls.sql_sqlset=jush.urls.sql[0]=jush.urls.sqlset[0]=jush.urls.sqlstatus[0]='http://dev.mysql.com/doc/refman/'+version+'/en/$key';var
pgsql='http://www.postgresql.org/docs/'+version+'/static/';jush.urls.pgsql_pgsqlset=jush.urls.pgsql[0]=pgsql+'$key';jush.urls.pgsqlset[0]=pgsql+'runtime-config-$key.html#GUC-$1';if(window.jushLinks){jush.custom_links=jushLinks;}jush.highlight_tag('code',0);}};script.onreadystatechange=function(){if(/^(loaded|complete)$/.test(script.readyState)){script.onload();}};document.body.appendChild(script);}}function
formField(form,name){for(var
i=0;i<form.length;i++){if(form[i].name==name){return form[i];}}}function
typePassword(el,disable){try{el.type=(disable?'text':'password');}catch(e){}}function
loginDriver(driver){var
trs=driver.parentNode.parentNode.parentNode.rows;for(var
i=1;i<trs.length-1;i++){trs[i].className=(/sqlite/.test(driver.value)?'hidden':'');}}function
textareaKeydown(target,event){if(!event.shiftKey&&!event.altKey&&!event.ctrlKey&&!event.metaKey){if(event.keyCode==9){if(target.setSelectionRange){var
start=target.selectionStart;var
scrolled=target.scrollTop;target.value=target.value.substr(0,start)+'\t'+target.value.substr(target.selectionEnd);target.setSelectionRange(start+1,start+1);target.scrollTop=scrolled;return false;}else
if(target.createTextRange){document.selection.createRange().text='\t';return false;}}if(event.keyCode==27){var
els=target.form.elements;for(var
i=1;i<els.length;i++){if(els[i-1]==target){els[i].focus();break;}}return false;}}return true;}var
added='.',rowCount;function
delimiterEqual(val,a,b){return(val==a+'_'+b||val==a+b||val==a+b.charAt(0).toUpperCase()+b.substr(1));}function
idfEscape(s){return s.replace(/`/,'``');}function
editingNameChange(field){var
name=field.name.substr(0,field.name.length-7);var
type=formField(field.form,name+'[type]');var
opts=type.options;var
candidate;var
val=field.value;for(var
i=opts.length;i--;){var
match=/(.+)`(.+)/.exec(opts[i].value);if(!match){if(candidate&&i==opts.length-2&&val==opts[candidate].value.replace(/.+`/,'')&&name=='fields[1]'){return;}break;}var
table=match[1];var
column=match[2];var
tables=[table,table.replace(/s$/,''),table.replace(/es$/,'')];for(var
j=0;j<tables.length;j++){table=tables[j];if(val==column||val==table||delimiterEqual(val,table,column)||delimiterEqual(val,column,table)){if(candidate){return;}candidate=i;break;}}}if(candidate){type.selectedIndex=candidate;type.onchange();}}function
editingAddRow(button,allowed,focus){if(allowed&&rowCount>=allowed){return false;}var
match=/(\d+)(\.\d+)?/.exec(button.name);var
x=match[0]+(match[2]?added.substr(match[2].length):added)+'1';var
row=button.parentNode.parentNode;var
row2=row.cloneNode(true);var
tags=row.getElementsByTagName('select');var
tags2=row2.getElementsByTagName('select');for(var
i=0;i<tags.length;i++){tags2[i].name=tags[i].name.replace(/([0-9.]+)/,x);tags2[i].selectedIndex=tags[i].selectedIndex;}tags=row.getElementsByTagName('input');tags2=row2.getElementsByTagName('input');var
input=tags2[0];for(var
i=0;i<tags.length;i++){if(tags[i].name=='auto_increment_col'){tags2[i].value=x;tags2[i].checked=false;}tags2[i].name=tags[i].name.replace(/([0-9.]+)/,x);if(/\[(orig|field|comment|default)/.test(tags[i].name)){tags2[i].value='';}if(/\[(has_default)/.test(tags[i].name)){tags2[i].checked=false;}}tags[0].onchange=function(){editingNameChange(tags[0]);};row.parentNode.insertBefore(row2,row.nextSibling);if(focus){input.onchange=function(){editingNameChange(input);};input.focus();}added+='0';rowCount++;return true;}function
editingRemoveRow(button){var
field=formField(button.form,button.name.replace(/drop_col(.+)/,'fields$1[field]'));field.parentNode.removeChild(field);button.parentNode.parentNode.style.display='none';return true;}var
lastType='';function
editingTypeChange(type){var
name=type.name.substr(0,type.name.length-6);var
text=selectValue(type);for(var
i=0;i<type.form.elements.length;i++){var
el=type.form.elements[i];if(el.name==name+'[length]'&&!((/(char|binary)$/.test(lastType)&&/(char|binary)$/.test(text))||(/(enum|set)$/.test(lastType)&&/(enum|set)$/.test(text)))){el.value='';}if(lastType=='timestamp'&&el.name==name+'[has_default]'&&/timestamp/i.test(formField(type.form,name+'[default]').value)){el.checked=false;}if(el.name==name+'[collation]'){el.className=(/(char|text|enum|set)$/.test(text)?'':'hidden');}if(el.name==name+'[unsigned]'){el.className=(/(int|float|double|decimal)$/.test(text)?'':'hidden');}if(el.name==name+'[on_delete]'){el.className=(/`/.test(text)?'':'hidden');}}}function
editingLengthFocus(field){var
td=field.parentNode;if(/(enum|set)$/.test(selectValue(td.previousSibling.firstChild))){var
edit=document.getElementById('enum-edit');var
val=field.value;edit.value=(/^'.+','.+'$/.test(val)?val.substr(1,val.length-2).replace(/','/g,"\n").replace(/''/g,"'"):val);td.appendChild(edit);field.style.display='none';edit.style.display='inline';edit.focus();}}function
editingLengthBlur(edit){var
field=edit.parentNode.firstChild;var
val=edit.value;field.value=(/\n/.test(val)?"'"+val.replace(/\n+$/,'').replace(/'/g,"''").replace(/\n/g,"','")+"'":val);field.style.display='inline';edit.style.display='none';}function
columnShow(checked,column){var
trs=document.getElementById('edit-fields').getElementsByTagName('tr');for(var
i=0;i<trs.length;i++){trs[i].getElementsByTagName('td')[column].className=(checked?'':'hidden');}}function
partitionByChange(el){var
partitionTable=/RANGE|LIST/.test(selectValue(el));el.form['partitions'].className=(partitionTable||!el.selectedIndex?'hidden':'');document.getElementById('partition-table').className=(partitionTable?'':'hidden');}function
partitionNameChange(el){var
row=el.parentNode.parentNode.cloneNode(true);row.firstChild.firstChild.value='';el.parentNode.parentNode.parentNode.appendChild(row);el.onchange=function(){};}function
foreignAddRow(field){field.onchange=function(){};var
row=field.parentNode.parentNode.cloneNode(true);var
selects=row.getElementsByTagName('select');for(var
i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/\]/,'1$&');selects[i].selectedIndex=0;}field.parentNode.parentNode.parentNode.appendChild(row);}function
indexesAddRow(field){field.onchange=function(){};var
parent=field.parentNode.parentNode;var
row=parent.cloneNode(true);var
selects=row.getElementsByTagName('select');for(var
i=0;i<selects.length;i++){selects[i].name=selects[i].name.replace(/indexes\[\d+/,'$&1');selects[i].selectedIndex=0;}var
inputs=row.getElementsByTagName('input');for(var
i=0;i<inputs.length;i++){inputs[i].name=inputs[i].name.replace(/indexes\[\d+/,'$&1');inputs[i].value='';}parent.parentNode.appendChild(row);}function
indexesChangeColumn(field,prefix){var
columns=field.parentNode.parentNode.getElementsByTagName('select');var
names=[];for(var
i=0;i<columns.length;i++){var
value=selectValue(columns[i]);if(value){names.push(value);}}field.form[field.name.replace(/\].*/,'][name]')].value=prefix+names.join('_');}function
indexesAddColumn(field,prefix){field.onchange=function(){indexesChangeColumn(field,prefix);};var
select=field.form[field.name.replace(/\].*/,'][type]')];if(!select.selectedIndex){select.selectedIndex=3;select.onchange();}var
column=field.parentNode.cloneNode(true);select=column.getElementsByTagName('select')[0];select.name=select.name.replace(/\]\[\d+/,'$&1');select.selectedIndex=0;var
input=column.getElementsByTagName('input')[0];input.name=input.name.replace(/\]\[\d+/,'$&1');input.value='';field.parentNode.parentNode.appendChild(column);field.onchange();}var
that,x,y;function
schemaMousedown(el,event){if((event.which?event.which:event.button)==1){that=el;x=event.clientX-el.offsetLeft;y=event.clientY-el.offsetTop;}}function
schemaMousemove(ev){if(that!==undefined){ev=ev||event;var
left=(ev.clientX-x)/em;var
top=(ev.clientY-y)/em;var
divs=that.getElementsByTagName('div');var
lineSet={};for(var
i=0;i<divs.length;i++){if(divs[i].className=='references'){var
div2=document.getElementById((/^refs/.test(divs[i].id)?'refd':'refs')+divs[i].id.substr(4));var
ref=(tablePos[divs[i].title]?tablePos[divs[i].title]:[div2.parentNode.offsetTop/em,0]);var
left1=-1;var
id=divs[i].id.replace(/^ref.(.+)-.+/,'$1');if(divs[i].parentNode!=div2.parentNode){left1=Math.min(0,ref[1]-left)-1;divs[i].style.left=left1+'em';divs[i].getElementsByTagName('div')[0].style.width=-left1+'em';var
left2=Math.min(0,left-ref[1])-1;div2.style.left=left2+'em';div2.getElementsByTagName('div')[0].style.width=-left2+'em';}if(!lineSet[id]){var
line=document.getElementById(divs[i].id.replace(/^....(.+)-.+$/,'refl$1'));var
top1=top+divs[i].offsetTop/em;var
top2=top+div2.offsetTop/em;if(divs[i].parentNode!=div2.parentNode){top2+=ref[0]-top;line.getElementsByTagName('div')[0].style.height=Math.abs(top1-top2)+'em';}line.style.left=(left+left1)+'em';line.style.top=Math.min(top1,top2)+'em';lineSet[id]=true;}}}that.style.left=left+'em';that.style.top=top+'em';}}function
schemaMouseup(ev,db){if(that!==undefined){ev=ev||event;tablePos[that.firstChild.firstChild.firstChild.data]=[(ev.clientY-y)/em,(ev.clientX-x)/em];that=undefined;var
s='';for(var
key
in
tablePos){s+='_'+key+':'+Math.round(tablePos[key][0]*10000)/10000+'x'+Math.round(tablePos[key][1]*10000)/10000;}s=encodeURIComponent(s.substr(1));var
link=document.getElementById('schema-link');link.href=link.href.replace(/[^=]+$/,'')+s;cookie('adminer_schema-'+db+'='+s,30);}}<?php
}else{header("Content-Type: image/gif");switch($_GET["file"]){case"plus.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIYSPqcvtD00I8cwqKb5v+q8pIAhxlRmhZYi17iPE8kzLBQA7");break;case"cross.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACI4SPqcvtDyMKYdZGb355wy6BX3dhlOEx57FK7gtHwkzXNl0AADs=");break;case"up.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00IUU4K730T9J5hFTiKEXmaYcW2rgDH8hwXADs=");break;case"down.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00I8cwqKb5bV/5cosdMJtmcHca2lQDH8hwXADs=");break;case"arrow.gif":echo
base64_decode("R0lGODlhCAAKAIAAAICAgP///yH5BAEAAAEALAAAAAAIAAoAAAIPBIJplrGLnpQRqtOy3rsAADs=");break;}}exit;}function
connection(){global$f;return$f;}function
adminer(){global$b;return$b;}function
idf_unescape($qc){$Fc=substr($qc,-1);return
str_replace($Fc.$Fc,$Fc,substr($qc,1,-1));}function
escape_string($X){return
substr(q($X),1,-1);}function
remove_slashes($fe,$Wb=false){if(get_magic_quotes_gpc()){while(list($y,$X)=each($fe)){foreach($X
as$Bc=>$W){unset($fe[$y][$Bc]);if(is_array($W)){$fe[$y][stripslashes($Bc)]=$W;$fe[]=&$fe[$y][stripslashes($Bc)];}else$fe[$y][stripslashes($Bc)]=($Wb?$W:stripslashes($W));}}}}function
bracket_escape($qc,$wa=false){static$qf=array(':'=>':1',']'=>':2','['=>':3');return
strtr($qc,($wa?array_flip($qf):$qf));}function
h($Q){return
htmlspecialchars(str_replace("\0","",$Q),ENT_QUOTES);}function
nbsp($Q){return(trim($Q)!=""?h($Q):"&nbsp;");}function
nl_br($Q){return
str_replace("\n","<br>",$Q);}function
checkbox($D,$Y,$Ga,$Dc="",$ud="",$Ac=false){static$t=0;$t++;$J="<input type='checkbox' name='$D' value='".h($Y)."'".($Ga?" checked":"").($ud?' onclick="'.h($ud).'"':'').($Ac?" class='jsonly'":"")." id='checkbox-$t'>";return($Dc!=""?"<label for='checkbox-$t'>$J".h($Dc)."</label>":$J);}function
optionlist($xd,$Ce=null,$Hf=false){$J="";foreach($xd
as$Bc=>$W){$yd=array($Bc=>$W);if(is_array($W)){$J.='<optgroup label="'.h($Bc).'">';$yd=$W;}foreach($yd
as$y=>$X)$J.='<option'.($Hf||is_string($y)?' value="'.h($y).'"':'').(($Hf||is_string($y)?(string)$y:$X)===$Ce?' selected':'').'>'.h($X);if(is_array($W))$J.='</optgroup>';}return$J;}function
html_select($D,$xd,$Y="",$td=true){if($td)return"<select name='".h($D)."'".(is_string($td)?' onchange="'.h($td).'"':"").">".optionlist($xd,$Y)."</select>";$J="";foreach($xd
as$y=>$X)$J.="<label><input type='radio' name='".h($D)."' value='".h($y)."'".($y==$Y?" checked":"").">".h($X)."</label>";return$J;}function
confirm($Ya=""){return" onclick=\"return confirm('".'Are you sure?'.($Ya?" (' + $Ya + ')":"")."');\"";}function
print_fieldset($t,$Kc,$Nf=false,$ud=""){echo"<fieldset><legend><a href='#fieldset-$t' onclick=\"".h($ud)."return !toggle('fieldset-$t');\">$Kc</a></legend><div id='fieldset-$t'".($Nf?"":" class='hidden'").">\n";}function
bold($Aa){return($Aa?" class='active'":"");}function
odd($J=' class="odd"'){static$s=0;if(!$J)$s=-1;return($s++%
2?$J:'');}function
js_escape($Q){return
addcslashes($Q,"\r\n'\\/");}function
json_row($y,$X=null){static$Xb=true;if($Xb)echo"{";if($y!=""){echo($Xb?"":",")."\n\t\"".addcslashes($y,"\r\n\"\\").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\").'"':'undefined');$Xb=false;}else{echo"\n}\n";$Xb=true;}}function
ini_bool($uc){$X=ini_get($uc);return(eregi('^(on|true|yes)$',$X)||(int)$X);}function
sid(){static$J;if($J===null)$J=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$J;}function
q($Q){global$f;return$f->quote($Q);}function
get_vals($H,$Na=0){global$f;$J=array();$I=$f->query($H);if(is_object($I)){while($K=$I->fetch_row())$J[]=$K[$Na];}return$J;}function
get_key_vals($H,$g=null){global$f;if(!is_object($g))$g=$f;$J=array();$I=$g->query($H);if(is_object($I)){while($K=$I->fetch_row())$J[$K[0]]=$K[1];}return$J;}function
get_rows($H,$g=null,$j="<p class='error'>"){global$f;$Ua=(is_object($g)?$g:$f);$J=array();$I=$Ua->query($H);if(is_object($I)){while($K=$I->fetch_assoc())$J[]=$K;}elseif(!$I&&!is_object($g)&&$j&&defined("PAGE_HEADER"))echo$j.error()."\n";return$J;}function
unique_array($K,$v){foreach($v
as$u){if(ereg("PRIMARY|UNIQUE",$u["type"])){$J=array();foreach($u["columns"]as$y){if(!isset($K[$y]))continue
2;$J[$y]=$K[$y];}return$J;}}$J=array();foreach($K
as$y=>$X){if(!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~',$y))$J[$y]=$X;}return$J;}function
where($Z){global$x;$J=array();foreach((array)$Z["where"]as$y=>$X)$J[]=idf_escape(bracket_escape($y,1)).(($x=="sql"&&ereg('\\.',$X))||$x=="mssql"?" LIKE ".exact_value(addcslashes($X,"%_\\")):" = ".exact_value($X));foreach((array)$Z["null"]as$y)$J[]=idf_escape($y)." IS NULL";return
implode(" AND ",$J);}function
where_check($X){parse_str($X,$Fa);remove_slashes(array(&$Fa));return
where($Fa);}function
where_link($s,$Na,$Y,$vd="="){return"&where%5B$s%5D%5Bcol%5D=".urlencode($Na)."&where%5B$s%5D%5Bop%5D=".urlencode(($Y!==null?$vd:"IS NULL"))."&where%5B$s%5D%5Bval%5D=".urlencode($Y);}function
cookie($D,$Y){global$ba;$Kd=array($D,(ereg("\n",$Y)?"":$Y),time()+2592000,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$Kd[]=true;return
call_user_func_array('setcookie',$Kd);}function
restart_session(){if(!ini_bool("session.use_cookies"))session_start();}function&get_session($y){return$_SESSION[$y][DRIVER][SERVER][$_GET["username"]];}function
set_session($y,$X){$_SESSION[$y][DRIVER][SERVER][$_GET["username"]]=$X;}function
auth_url($pb,$O,$If,$i=null){global$qb;preg_match('~([^?]*)\\??(.*)~',remove_from_uri(implode("|",array_keys($qb))."|username|".($i!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($pb!="server"||$O!=""?urlencode($pb)."=".urlencode($O)."&":"")."username=".urlencode($If).($i!=""?"&db=".urlencode($i):"").($B[2]?"&$B[2]":"");}function
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
redirect($A,$Yc=null){if($Yc!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($A!==null?$A:$_SERVER["REQUEST_URI"]))][]=$Yc;}if($A!==null){if($A=="")$A=".";header("Location: $A");exit;}}function
query_redirect($H,$A,$Yc,$ke=true,$Mb=true,$Sb=false){global$f,$j,$b;if($Mb)$Sb=!$f->query($H);$Ke="";if($H)$Ke=$b->messageQuery("$H;");if($Sb){$j=error().$Ke;return
false;}if($ke)redirect($A,$Yc.$Ke);return
true;}function
queries($H=null){global$f;static$ie=array();if($H===null)return
implode(";\n",$ie);$ie[]=(ereg(';$',$H)?"DELIMITER ;;\n$H;\nDELIMITER ":$H);return$f->query($H);}function
apply_queries($H,$bf,$Hb='table'){foreach($bf
as$S){if(!queries("$H ".$Hb($S)))return
false;}return
true;}function
queries_redirect($A,$Yc,$ke){return
query_redirect(queries(),$A,$Yc,$ke,false,!$ke);}function
remove_from_uri($Jd=""){return
substr(preg_replace("~(?<=[?&])($Jd".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
pagination($E,$db){return" ".($E==$db?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E":"")).'">'.($E+1)."</a>");}function
get_file($y,$ib=false){$Ub=$_FILES[$y];if(!$Ub||$Ub["error"])return$Ub["error"];$J=file_get_contents($ib&&ereg('\\.gz$',$Ub["name"])?"compress.zlib://$Ub[tmp_name]":($ib&&ereg('\\.bz2$',$Ub["name"])?"compress.bzip2://$Ub[tmp_name]":$Ub["tmp_name"]));if($ib){$Le=substr($J,0,3);if(function_exists("iconv")&&ereg("^\xFE\xFF|^\xFF\xFE",$Le,$qe))$J=iconv("utf-16","utf-8",$J);elseif($Le=="\xEF\xBB\xBF")$J=substr($J,3);}return$J;}function
upload_error($j){$Wc=($j==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($j?'Unable to upload a file.'.($Wc?" ".sprintf('Maximum allowed file size is %sB.',$Wc):""):'File does not exist.');}function
repeat_pattern($F,$Lc){return
str_repeat("$F{0,65535}",$Lc/65535)."$F{0,".($Lc
%
65535)."}";}function
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~',$X));}function
shorten_utf8($Q,$Lc=80,$Re=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{FFFF}]",$Lc).")($)?)u",$Q,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$Lc).")($)?)",$Q,$B);return
h($B[1]).$Re.(isset($B[2])?"":"<i>...</i>");}function
friendly_url($X){return
preg_replace('~[^a-z0-9_]~i','-',$X);}function
hidden_fields($fe,$rc=array()){while(list($y,$X)=each($fe)){if(is_array($X)){foreach($X
as$Bc=>$W)$fe[$y."[$Bc]"]=$W;}elseif(!in_array($y,$rc))echo'<input type="hidden" name="'.h($y).'" value="'.h($X).'">';}}function
hidden_fields_get(){echo(sid()?'<input type="hidden" name="'.session_name().'" value="'.h(session_id()).'">':''),(SERVER!==null?'<input type="hidden" name="'.DRIVER.'" value="'.h(SERVER).'">':""),'<input type="hidden" name="username" value="'.h($_GET["username"]).'">';}function
column_foreign_keys($S){global$b;$J=array();foreach($b->foreignKeys($S)as$m){foreach($m["source"]as$X)$J[$X][]=$m;}return$J;}function
enum_input($V,$ta,$k,$Y,$Ab=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$k["length"],$Rc);$J=($Ab!==null?"<label><input type='$V'$ta value='$Ab'".((is_array($Y)?in_array($Ab,$Y):$Y===0)?" checked":"")."><i>".'empty'."</i></label>":"");foreach($Rc[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$Ga=(is_int($Y)?$Y==$s+1:(is_array($Y)?in_array($s+1,$Y):$Y===$X));$J.=" <label><input type='$V'$ta value='".($s+1)."'".($Ga?' checked':'').'>'.h($b->editVal($X,$k)).'</label>';}return$J;}function
input($k,$Y,$p){global$yf,$b,$x;$D=h(bracket_escape($k["field"]));echo"<td class='function'>";$se=($x=="mssql"&&$k["auto_increment"]);if($se&&!$_POST["save"])$p=null;$q=(isset($_GET["select"])||$se?array("orig"=>'original'):array())+$b->editFunctions($k);$ta=" name='fields[$D]'";if($k["type"]=="enum")echo
nbsp($q[""])."<td>".$b->editInput($_GET["edit"],$k,$ta,$Y);else{$Xb=0;foreach($q
as$y=>$X){if($y===""||!$X)break;$Xb++;}$td=($Xb?" onchange=\"var f = this.form['function[".h(js_escape(bracket_escape($k["field"])))."]']; if ($Xb > f.selectedIndex) f.selectedIndex = $Xb;\"":"");$ta.=$td;echo(count($q)>1?html_select("function[$D]",$q,$p===null||in_array($p,$q)||isset($q[$p])?$p:"","functionChange(this);"):nbsp(reset($q))).'<td>';$wc=$b->editInput($_GET["edit"],$k,$ta,$Y);if($wc!="")echo$wc;elseif($k["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$k["length"],$Rc);foreach($Rc[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$Ga=(is_int($Y)?($Y>>$s)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$D][$s]' value='".(1<<$s)."'".($Ga?' checked':'')."$td>".h($b->editVal($X,$k)).'</label>';}}elseif(ereg('blob|bytea|raw|file',$k["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$D'$td>";elseif(ereg('text|lob',$k["type"]))echo"<textarea ".($x!="sqlite"||ereg("\n",$Y)?"cols='50' rows='12'":"cols='30' rows='1' style='height: 1.2em;'")."$ta>".h($Y).'</textarea>';else{$Xc=(!ereg('int',$k["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$k["length"],$B)?((ereg("binary",$k["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$k["unsigned"]?1:0)):($yf[$k["type"]]?$yf[$k["type"]]+($k["unsigned"]?0:1):0));echo"<input value='".h($Y)."'".($Xc?" maxlength='$Xc'":"").(ereg('char|binary',$k["type"])&&$Xc>20?" size='40'":"")."$ta>";}}}function
process_input($k){global$b;$qc=bracket_escape($k["field"]);$p=$_POST["function"][$qc];$Y=$_POST["fields"][$qc];if($k["type"]=="enum"){if($Y==-1)return
false;if($Y=="")return"NULL";return+$Y;}if($k["auto_increment"]&&$Y=="")return
null;if($p=="orig")return($k["on_update"]=="CURRENT_TIMESTAMP"?idf_escape($k["field"]):false);if($p=="NULL")return"NULL";if($k["type"]=="set")return
array_sum((array)$Y);if(ereg('blob|bytea|raw|file',$k["type"])&&ini_bool("file_uploads")){$Ub=get_file("fields-$qc");if(!is_string($Ub))return
false;return
q($Ub);}return$b->processInput($k,$Y,$p);}function
search_tables(){global$b,$f;$_GET["where"][0]["op"]="LIKE %%";$_GET["where"][0]["val"]=$_POST["query"];$o=false;foreach(table_status()as$S=>$T){$D=$b->tableName($T);if(isset($T["Engine"])&&$D!=""&&(!$_POST["tables"]||in_array($S,$_POST["tables"]))){$I=$f->query("SELECT".limit("1 FROM ".table($S)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($S),array())),1));if($I->fetch_row()){if(!$o){echo"<ul>\n";$o=true;}echo"<li><a href='".h(ME."select=".urlencode($S)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$D</a>\n";}}}echo($o?"</ul>":"<p class='message'>".'No tables.')."\n";}function
dump_headers($pc,$fd=false){global$b;$J=$b->dumpHeaders($pc,$fd);$Hd=$_POST["output"];if($Hd!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($pc).".$J".($Hd!="file"&&!ereg('[^0-9a-z]',$Hd)?".$Hd":""));session_write_close();return$J;}function
dump_csv($K){foreach($K
as$y=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$K[$y]='"'.str_replace('"','""',$X).'"';}echo
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$K)."\r\n";}function
apply_sql_function($p,$Na){return($p?($p=="unixepoch"?"DATETIME($Na, '$p')":($p=="count distinct"?"COUNT(DISTINCT ":strtoupper("$p("))."$Na)"):$Na);}function
password_file(){$mb=ini_get("upload_tmp_dir");if(!$mb){if(function_exists('sys_get_temp_dir'))$mb=sys_get_temp_dir();else{$Vb=@tempnam("","");if(!$Vb)return
false;$mb=dirname($Vb);unlink($Vb);}}$Vb="$mb/adminer.key";$J=@file_get_contents($Vb);if($J)return$J;$dc=@fopen($Vb,"w");if($dc){$J=md5(uniqid(mt_rand(),true));fwrite($dc,$J);fclose($dc);}return$J;}function
is_mail($yb){$sa='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$ob='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$F="$sa+(\\.$sa+)*@($ob?\\.)+$ob";return
preg_match("(^$F(,\\s*$F)*\$)i",$yb);}function
is_url($Q){$ob='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return(preg_match("~^(https?)://($ob?\\.)+$ob(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$Q,$B)?strtolower($B[1]):"");}global$b,$f,$qb,$wb,$Eb,$j,$q,$jc,$ba,$vc,$x,$ca,$Ec,$sd,$Pe,$U,$sf,$yf,$Ef,$ga;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],'?')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";$ba=$_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off");@ini_set("session.use_trans_sid",false);if(!defined("SID")){session_name("adminer_sid");$Kd=array(0,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$Kd[]=true;call_user_func_array('session_set_cookie_params',$Kd);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Wb);if(function_exists("set_magic_quotes_runtime"))set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",20);function
get_lang(){return'en';}function
lang($rf,$ld){$Ud=($ld==1?0:1);$rf=str_replace("%d","%s",$rf[$Ud]);$ld=number_format($ld,0,".",',');return
sprintf($rf,$ld);}if(extension_loaded('pdo')){class
Min_PDO
extends
PDO{var$_result,$server_info,$affected_rows,$error;function
__construct(){global$b;$Ud=array_search("",$b->operators);if($Ud!==false)unset($b->operators[$Ud]);}function
dsn($tb,$If,$Rd,$Lb='auth_error'){set_exception_handler($Lb);parent::__construct($tb,$If,$Rd);restore_exception_handler();$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=$this->getAttribute(4);}function
query($H,$zf=false){$I=parent::query($H);if(!$I){$Fb=$this->errorInfo();$this->error=$Fb[2];return
false;}$this->store_result($I);return$I;}function
multi_query($H){return$this->_result=$this->query($H);}function
store_result($I=null){if(!$I)$I=$this->_result;if($I->columnCount()){$I->num_rows=$I->rowCount();return$I;}$this->affected_rows=$I->rowCount();return
true;}function
next_result(){$this->_result->_offset=0;return@$this->_result->nextRowset();}function
result($H,$k=0){$I=$this->query($H);if(!$I)return
false;$K=$I->fetch();return$K[$k];}}class
Min_PDOStatement
extends
PDOStatement{var$_offset=0,$num_rows;function
fetch_assoc(){return$this->fetch(2);}function
fetch_row(){return$this->fetch(3);}function
fetch_field(){$K=(object)$this->getColumnMeta($this->_offset++);$K->orgtable=$K->table;$K->orgname=$K->name;$K->charsetnr=(in_array("blob",(array)$K->flags)?63:0);return$K;}}}$qb=array();$qb=array("server"=>"MySQL")+$qb;if(!defined("DRIVER")){$Xd=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
Min_DB
extends
MySQLi{var$extension="MySQLi";function
Min_DB(){parent::init();}function
connect($O,$If,$Rd){mysqli_report(MYSQLI_REPORT_OFF);list($nc,$Td)=explode(":",$O,2);$J=@$this->real_connect(($O!=""?$nc:ini_get("mysqli.default_host")),($O.$If!=""?$If:ini_get("mysqli.default_user")),($O.$If.$Rd!=""?$Rd:ini_get("mysqli.default_pw")),null,(is_numeric($Td)?$Td:ini_get("mysqli.default_port")),(!is_numeric($Td)?$Td:null));if($J){if(method_exists($this,'set_charset'))$this->set_charset("utf8");else$this->query("SET NAMES utf8");}return$J;}function
result($H,$k=0){$I=$this->query($H);if(!$I)return
false;$K=$I->fetch_array();return$K[$k];}function
quote($Q){return"'".$this->escape_string($Q)."'";}}}elseif(extension_loaded("mysql")&&!(ini_get("sql.safe_mode")&&extension_loaded("pdo_mysql"))){class
Min_DB{var$extension="MySQL",$server_info,$affected_rows,$error,$_link,$_result;function
connect($O,$If,$Rd){$this->_link=@mysql_connect(($O!=""?$O:ini_get("mysql.default_host")),("$O$If"!=""?$If:ini_get("mysql.default_user")),("$O$If$Rd"!=""?$Rd:ini_get("mysql.default_password")),true,131072);if($this->_link){$this->server_info=mysql_get_server_info($this->_link);if(function_exists('mysql_set_charset'))mysql_set_charset("utf8",$this->_link);else$this->query("SET NAMES utf8");}else$this->error=mysql_error();return(bool)$this->_link;}function
quote($Q){return"'".mysql_real_escape_string($Q,$this->_link)."'";}function
select_db($gb){return
mysql_select_db($gb,$this->_link);}function
query($H,$zf=false){$I=@($zf?mysql_unbuffered_query($H,$this->_link):mysql_query($H,$this->_link));if(!$I){$this->error=mysql_error($this->_link);return
false;}if($I===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
true;}return
new
Min_Result($I);}function
multi_query($H){return$this->_result=$this->query($H);}function
store_result(){return$this->_result;}function
next_result(){return
false;}function
result($H,$k=0){$I=$this->query($H);if(!$I||!$I->num_rows)return
false;return
mysql_result($I->_result,0,$k);}}class
Min_Result{var$num_rows,$_result,$_offset=0;function
Min_Result($I){$this->_result=$I;$this->num_rows=mysql_num_rows($I);}function
fetch_assoc(){return
mysql_fetch_assoc($this->_result);}function
fetch_row(){return
mysql_fetch_row($this->_result);}function
fetch_field(){$J=mysql_fetch_field($this->_result,$this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=($J->blob?63:0);return$J;}function
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
Min_DB
extends
Min_PDO{var$extension="PDO_MySQL";function
connect($O,$If,$Rd){$this->dsn("mysql:host=".str_replace(":",";unix_socket=",preg_replace('~:(\\d)~',';port=\\1',$O)),$If,$Rd);$this->query("SET NAMES utf8");return
true;}function
select_db($gb){return$this->query("USE ".idf_escape($gb));}function
query($H,$zf=false){$this->setAttribute(1000,!$zf);return
parent::query($H,$zf);}}}function
idf_escape($qc){return"`".str_replace("`","``",$qc)."`";}function
table($qc){return
idf_escape($qc);}function
connect(){global$b;$f=new
Min_DB;$cb=$b->credentials();if($f->connect($cb[0],$cb[1],$cb[2])){$f->query("SET sql_quote_show_create = 1, autocommit = 1");return$f;}$J=$f->error;if(function_exists('iconv')&&!is_utf8($J)&&strlen($M=iconv("windows-1250","utf-8",$J))>strlen($J))$J=$M;return$J;}function
get_databases($Yb=true){global$f;$J=&get_session("dbs");if($J===null){if($Yb){restart_session();ob_flush();flush();}$J=get_vals($f->server_info>=5?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA":"SHOW DATABASES");}return$J;}function
limit($H,$Z,$z,$nd=0,$Ee=" "){return" $H$Z".($z!==null?$Ee."LIMIT $z".($nd?" OFFSET $nd":""):"");}function
limit1($H,$Z){return
limit($H,$Z,1);}function
db_collation($i,$d){global$f;$J=null;$Za=$f->result("SHOW CREATE DATABASE ".idf_escape($i),1);if(preg_match('~ COLLATE ([^ ]+)~',$Za,$B))$J=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$Za,$B))$J=$d[$B[1]][-1];return$J;}function
engines(){$J=array();foreach(get_rows("SHOW ENGINES")as$K){if(ereg("YES|DEFAULT",$K["Support"]))$J[]=$K["Engine"];}return$J;}function
logged_user(){global$f;return$f->result("SELECT USER()");}function
tables_list(){global$f;return
get_key_vals("SHOW".($f->server_info>=5?" FULL":"")." TABLES");}function
count_tables($h){$J=array();foreach($h
as$i)$J[$i]=count(get_vals("SHOW TABLES IN ".idf_escape($i)));return$J;}function
table_status($D=""){$J=array();foreach(get_rows("SHOW TABLE STATUS".($D!=""?" LIKE ".q(addcslashes($D,"%_")):""))as$K){if($K["Engine"]=="InnoDB")$K["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$K["Comment"]);if(!isset($K["Rows"]))$K["Comment"]="";if($D!="")return$K;$J[$K["Name"]]=$K;}return$J;}function
is_view($T){return!isset($T["Rows"]);}function
fk_support($T){return
eregi("InnoDB|IBMDB2I",$T["Engine"]);}function
fields($S){$J=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($S))as$K){preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~',$K["Type"],$B);$J[$K["Field"]]=array("field"=>$K["Field"],"full_type"=>$K["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($K["Default"]!=""||ereg("char",$B[1])?$K["Default"]:null),"null"=>($K["Null"]=="YES"),"auto_increment"=>($K["Extra"]=="auto_increment"),"on_update"=>(eregi('^on update (.+)',$K["Extra"],$B)?$B[1]:""),"collation"=>$K["Collation"],"privileges"=>array_flip(explode(",",$K["Privileges"])),"comment"=>$K["Comment"],"primary"=>($K["Key"]=="PRI"),);}return$J;}function
indexes($S,$g=null){$J=array();foreach(get_rows("SHOW INDEX FROM ".table($S),$g)as$K){$J[$K["Key_name"]]["type"]=($K["Key_name"]=="PRIMARY"?"PRIMARY":($K["Index_type"]=="FULLTEXT"?"FULLTEXT":($K["Non_unique"]?"INDEX":"UNIQUE")));$J[$K["Key_name"]]["columns"][]=$K["Column_name"];$J[$K["Key_name"]]["lengths"][]=$K["Sub_part"];}return$J;}function
foreign_keys($S){global$f,$sd;static$F='`(?:[^`]|``)+`';$J=array();$ab=$f->result("SHOW CREATE TABLE ".table($S),1);if($ab){preg_match_all("~CONSTRAINT ($F) FOREIGN KEY \\(((?:$F,? ?)+)\\) REFERENCES ($F)(?:\\.($F))? \\(((?:$F,? ?)+)\\)(?: ON DELETE ($sd))?(?: ON UPDATE ($sd))?~",$ab,$Rc,PREG_SET_ORDER);foreach($Rc
as$B){preg_match_all("~$F~",$B[2],$Ie);preg_match_all("~$F~",$B[5],$ef);$J[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$Ie[0]),"target"=>array_map('idf_unescape',$ef[0]),"on_delete"=>($B[6]?$B[6]:"RESTRICT"),"on_update"=>($B[7]?$B[7]:"RESTRICT"),);}}return$J;}function
view($D){global$f;return
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$f->result("SHOW CREATE VIEW ".table($D),1)));}function
collations(){$J=array();foreach(get_rows("SHOW COLLATION")as$K){if($K["Default"])$J[$K["Charset"]][-1]=$K["Collation"];else$J[$K["Charset"]][]=$K["Collation"];}ksort($J);foreach($J
as$y=>$X)asort($J[$y]);return$J;}function
information_schema($i){global$f;return($f->server_info>=5&&$i=="information_schema");}function
error(){global$f;return
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$f->error));}function
error_line(){global$f;if(ereg(' at line ([0-9]+)$',$f->error,$qe))return$qe[1]-1;}function
exact_value($X){return
q($X)." COLLATE utf8_bin";}function
create_database($i,$La){set_session("dbs",null);return
queries("CREATE DATABASE ".idf_escape($i).($La?" COLLATE ".q($La):""));}function
drop_databases($h){set_session("dbs",null);return
apply_queries("DROP DATABASE",$h,'idf_escape');}function
rename_database($D,$La){if(create_database($D,$La)){$re=array();foreach(tables_list()as$S=>$V)$re[]=table($S)." TO ".idf_escape($D).".".table($S);if(!$re||queries("RENAME TABLE ".implode(", ",$re))){queries("DROP DATABASE ".idf_escape(DB));return
true;}}return
false;}function
auto_increment(){$va=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$u){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$u["columns"],true)){$va="";break;}if($u["type"]=="PRIMARY")$va=" UNIQUE";}}return" AUTO_INCREMENT$va";}function
alter_table($S,$D,$l,$Zb,$Qa,$Cb,$La,$ua,$Od){$ra=array();foreach($l
as$k)$ra[]=($k[1]?($S!=""?($k[0]!=""?"CHANGE ".idf_escape($k[0]):"ADD"):" ")." ".implode($k[1]).($S!=""?" $k[2]":""):"DROP ".idf_escape($k[0]));$ra=array_merge($ra,$Zb);$Me="COMMENT=".q($Qa).($Cb?" ENGINE=".q($Cb):"").($La?" COLLATE ".q($La):"").($ua!=""?" AUTO_INCREMENT=$ua":"").$Od;if($S=="")return
queries("CREATE TABLE ".table($D)." (\n".implode(",\n",$ra)."\n) $Me");if($S!=$D)$ra[]="RENAME TO ".table($D);$ra[]=$Me;return
queries("ALTER TABLE ".table($S)."\n".implode(",\n",$ra));}function
alter_indexes($S,$ra){foreach($ra
as$y=>$X)$ra[$y]=($X[2]=="DROP"?"\nDROP INDEX ".idf_escape($X[1]):"\nADD $X[0] ".($X[0]=="PRIMARY"?"KEY ":"").($X[1]!=""?idf_escape($X[1])." ":"").$X[2]);return
queries("ALTER TABLE ".table($S).implode(",",$ra));}function
truncate_tables($bf){return
apply_queries("TRUNCATE TABLE",$bf);}function
drop_views($Mf){return
queries("DROP VIEW ".implode(", ",array_map('table',$Mf)));}function
drop_tables($bf){return
queries("DROP TABLE ".implode(", ",array_map('table',$bf)));}function
move_tables($bf,$Mf,$ef){$re=array();foreach(array_merge($bf,$Mf)as$S)$re[]=table($S)." TO ".idf_escape($ef).".".table($S);return
queries("RENAME TABLE ".implode(", ",$re));}function
copy_tables($bf,$Mf,$ef){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($bf
as$S){$D=($ef==DB?table("copy_$S"):idf_escape($ef).".".table($S));if(!queries("DROP TABLE IF EXISTS $D")||!queries("CREATE TABLE $D LIKE ".table($S))||!queries("INSERT INTO $D SELECT * FROM ".table($S)))return
false;}foreach($Mf
as$S){$D=($ef==DB?table("copy_$S"):idf_escape($ef).".".table($S));$Lf=view($S);if(!queries("DROP VIEW IF EXISTS $D")||!queries("CREATE VIEW $D AS $Lf[select]"))return
false;}return
true;}function
trigger($D){if($D=="")return
array();$L=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($D));return
reset($L);}function
triggers($S){$J=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($S,"%_")))as$K)$J[$K["Trigger"]]=array($K["Timing"],$K["Event"]);return$J;}function
trigger_options(){return
array("Timing"=>array("BEFORE","AFTER"),"Type"=>array("FOR EACH ROW"),);}function
routine($D,$V){global$f,$Eb,$vc,$yf;$pa=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$xf="((".implode("|",array_merge(array_keys($yf),$pa)).")\\b(?:\\s*\\(((?:[^'\")]*|$Eb)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";$F="\\s*(".($V=="FUNCTION"?"":$vc).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$xf";$Za=$f->result("SHOW CREATE $V ".idf_escape($D),2);preg_match("~\\(((?:$F\\s*,?)*)\\)\\s*".($V=="FUNCTION"?"RETURNS\\s+$xf\\s+":"")."(.*)~is",$Za,$B);$l=array();preg_match_all("~$F\\s*,?~is",$B[1],$Rc,PREG_SET_ORDER);foreach($Rc
as$Jd){$D=str_replace("``","`",$Jd[2]).$Jd[3];$l[]=array("field"=>$D,"type"=>strtolower($Jd[5]),"length"=>preg_replace_callback("~$Eb~s",'normalize_enum',$Jd[6]),"unsigned"=>strtolower(preg_replace('~\\s+~',' ',trim("$Jd[8] $Jd[7]"))),"full_type"=>$Jd[4],"inout"=>strtoupper($Jd[1]),"collation"=>strtolower($Jd[9]),);}if($V!="FUNCTION")return
array("fields"=>$l,"definition"=>$B[11]);return
array("fields"=>$l,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[17],"language"=>"SQL",);}function
routines(){return
get_rows("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = ".q(DB));}function
routine_languages(){return
array();}function
begin(){return
queries("BEGIN");}function
insert_into($S,$P){return
queries("INSERT INTO ".table($S)." (".implode(", ",array_keys($P)).")\nVALUES (".implode(", ",$P).")");}function
insert_update($S,$P,$ae){foreach($P
as$y=>$X)$P[$y]="$y = $X";$Ff=implode(", ",$P);return
queries("INSERT INTO ".table($S)." SET $Ff ON DUPLICATE KEY UPDATE $Ff");}function
last_id(){global$f;return$f->result("SELECT LAST_INSERT_ID()");}function
explain($f,$H){return$f->query("EXPLAIN $H");}function
found_rows($T,$Z){return($Z||$T["Engine"]!="InnoDB"?null:$T["Rows"]);}function
types(){return
array();}function
schemas(){return
array();}function
get_schema(){return"";}function
set_schema($Ae){return
true;}function
create_sql($S,$ua){global$f;$J=$f->result("SHOW CREATE TABLE ".table($S),1);if(!$ua)$J=preg_replace('~ AUTO_INCREMENT=\\d+~','',$J);return$J;}function
truncate_sql($S){return"TRUNCATE ".table($S);}function
use_sql($gb){return"USE ".idf_escape($gb);}function
trigger_sql($S,$R){$J="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($S,"%_")),null,"-- ")as$K)$J.="\n".($R=='CREATE+ALTER'?"DROP TRIGGER IF EXISTS ".idf_escape($K["Trigger"]).";;\n":"")."CREATE TRIGGER ".idf_escape($K["Trigger"])." $K[Timing] $K[Event] ON ".table($K["Table"])." FOR EACH ROW\n$K[Statement];;\n";return$J;}function
show_variables(){return
get_key_vals("SHOW VARIABLES");}function
process_list(){return
get_rows("SHOW FULL PROCESSLIST");}function
show_status(){return
get_key_vals("SHOW STATUS");}function
support($Tb){global$f;return!ereg("scheme|sequence|type".($f->server_info<5.1?"|event|partitioning".($f->server_info<5?"|view|routine|trigger":""):""),$Tb);}$x="sql";$yf=array();$Pe=array();foreach(array('Numbers'=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),'Date and time'=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),'Strings'=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),'Binary'=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),'Lists'=>array("enum"=>65535,"set"=>64),)as$y=>$X){$yf+=$X;$Pe[$y]=array_keys($X);}$Ef=array("unsigned","zerofill","unsigned zerofill");$wd=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","");$q=array("char_length","date","from_unixtime","hex","lower","round","sec_to_time","time_to_sec","upper");$jc=array("avg","count","count distinct","group_concat","max","min","sum");$wb=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1/hex","date|time"=>"now",),array("int|float|double|decimal"=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",preg_replace('~^[^?]*/([^?]*).*~','\\1',$_SERVER["REQUEST_URI"]).'?'.(sid()?SID.'&':'').(SERVER!==null?DRIVER."=".urlencode(SERVER).'&':'').(isset($_GET["username"])?"username=".urlencode($_GET["username"]).'&':'').(DB!=""?'db='.urlencode(DB).'&'.(isset($_GET["ns"])?"ns=".urlencode($_GET["ns"])."&":""):''));$ga="3.4.0";class
Adminer{var$operators;function
name(){return"<a href='http://www.adminer.org/' id='h1'>Adminer</a>";}function
credentials(){return
array(SERVER,$_GET["username"],get_session("pwds"));}function
permanentLogin(){return
password_file();}function
database(){return
DB;}function
databases($Yb=true){return
get_databases($Yb);}function
headers(){return
true;}function
head(){return
true;}function
loginForm(){global$qb;echo'<table cellspacing="0">
<tr><th>System<td>',html_select("auth[driver]",$qb,DRIVER,"loginDriver(this);"),'<tr><th>Server<td><input name="auth[server]" value="',h(SERVER),'" title="hostname[:port]">
<tr><th>Username<td><input id="username" name="auth[username]" value="',h($_GET["username"]),'">
<tr><th>Password<td><input type="password" name="auth[password]">
<tr><th>Database<td><input name="auth[db]" value="',h($_GET["db"]);?>">
</table>
<script type="text/javascript">
var username = document.getElementById('username');
username.focus();
username.form['auth[driver]'].onchange();
</script>
<?php
echo"<p><input type='submit' value='".'Login'."'>\n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],'Permanent login')."\n";}function
login($Pc,$Rd){return
true;}function
tableName($We){return
h($We["Name"]);}function
fieldName($k,$zd=0){return'<span title="'.h($k["full_type"]).'">'.h($k["field"]).'</span>';}function
selectLinks($We,$P=""){echo'<p class="tabs">';$Oc=array("select"=>'Select data',"table"=>'Show structure');if(is_view($We))$Oc["view"]='Alter view';else$Oc["create"]='Alter table';if($P!==null)$Oc["edit"]='New item';foreach($Oc
as$y=>$X)echo" <a href='".h(ME)."$y=".urlencode($We["Name"]).($y=="edit"?$P:"")."'".bold(isset($_GET[$y])).">$X</a>";echo"\n";}function
foreignKeys($S){return
foreign_keys($S);}function
backwardKeys($S,$Ve){return
array();}function
backwardKeysPrint($xa,$K){}function
selectQuery($H){global$x;return"<p><a href='".h(remove_from_uri("page"))."&amp;page=last' title='".'Last page'."'>&gt;&gt;</a> <code class='jush-$x'>".h(str_replace("\n"," ",$H))."</code> <a href='".h(ME)."sql=".urlencode($H)."'>".'Edit'."</a></p>\n";}function
rowDescription($S){return"";}function
rowDescriptions($L,$ac){return$L;}function
selectVal($X,$_,$k){$J=($X===null?"<i>NULL</i>":(ereg("char|binary",$k["type"])&&!ereg("var",$k["type"])?"<code>$X</code>":$X));if(ereg('blob|bytea|raw|file',$k["type"])&&!is_utf8($X))$J=lang(array('%d byte','%d bytes'),strlen($X));return($_?"<a href='$_'>$J</a>":$J);}function
editVal($X,$k){return(ereg("binary",$k["type"])?reset(unpack("H*",$X)):$X);}function
selectColumnsPrint($N,$e){global$q,$jc;print_fieldset("select",'Select',$N);$s=0;$fc=array('Functions'=>$q,'Aggregation'=>$jc);foreach($N
as$y=>$X){$X=$_GET["columns"][$y];echo"<div>".html_select("columns[$s][fun]",array(-1=>"")+$fc,$X["fun"]),"(<select name='columns[$s][col]'><option>".optionlist($e,$X["col"],true)."</select>)</div>\n";$s++;}echo"<div>".html_select("columns[$s][fun]",array(-1=>"")+$fc,"","this.nextSibling.nextSibling.onchange();"),"(<select name='columns[$s][col]' onchange='selectAddRow(this);'><option>".optionlist($e,null,true)."</select>)</div>\n","</div></fieldset>\n";}function
selectSearchPrint($Z,$e,$v){print_fieldset("search",'Search',$Z);foreach($v
as$s=>$u){if($u["type"]=="FULLTEXT"){echo"(<i>".implode("</i>, <i>",array_map('h',$u["columns"]))."</i>) AGAINST"," <input name='fulltext[$s]' value='".h($_GET["fulltext"][$s])."' onchange='selectFieldChange(this.form);'>",checkbox("boolean[$s]",1,isset($_GET["boolean"][$s]),"BOOL"),"<br>\n";}}$_GET["where"]=(array)$_GET["where"];reset($_GET["where"]);$Ea="this.nextSibling.onchange();";for($s=0;$s<=count($_GET["where"]);$s++){list(,$X)=each($_GET["where"]);if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div><select name='where[$s][col]' onchange='$Ea'><option value=''>(".'anywhere'.")".optionlist($e,$X["col"],true)."</select>",html_select("where[$s][op]",$this->operators,$X["op"],$Ea),"<input name='where[$s][val]' value='".h($X["val"])."' onchange='".($X?"selectFieldChange(this.form)":"selectAddRow(this)").";'></div>\n";}}echo"</div></fieldset>\n";}function
selectOrderPrint($zd,$e,$v){print_fieldset("sort",'Sort',$zd);$s=0;foreach((array)$_GET["order"]as$y=>$X){if(isset($e[$X])){echo"<div><select name='order[$s]' onchange='selectFieldChange(this.form);'><option>".optionlist($e,$X,true)."</select>",checkbox("desc[$s]",1,isset($_GET["desc"][$y]),'descending')."</div>\n";$s++;}}echo"<div><select name='order[$s]' onchange='selectAddRow(this);'><option>".optionlist($e,null,true)."</select>","<label><input type='checkbox' name='desc[$s]' value='1'>".'descending'."</label></div>\n";echo"</div></fieldset>\n";}function
selectLimitPrint($z){echo"<fieldset><legend>".'Limit'."</legend><div>";echo"<input name='limit' size='3' value='".h($z)."'>","</div></fieldset>\n";}function
selectLengthPrint($hf){if($hf!==null){echo"<fieldset><legend>".'Text length'."</legend><div>",'<input name="text_length" size="3" value="'.h($hf).'">',"</div></fieldset>\n";}}function
selectActionPrint($v){echo"<fieldset><legend>".'Action'."</legend><div>","<input type='submit' value='".'Select'."'>"," <span id='noindex' title='".'Full table scan'."'></span>","<script type='text/javascript'>\n","var indexColumns = ";$e=array();foreach($v
as$u){if($u["type"]!="FULLTEXT")$e[reset($u["columns"])]=1;}$e[""]=1;foreach($e
as$y=>$X)json_row($y);echo";\n","selectFieldChange(document.getElementById('form'));\n","</script>\n","</div></fieldset>\n";}function
selectCommandPrint(){return!information_schema(DB);}function
selectImportPrint(){return
true;}function
selectEmailPrint($zb,$e){}function
selectColumnsProcess($e,$v){global$q,$jc;$N=array();$hc=array();foreach((array)$_GET["columns"]as$y=>$X){if($X["fun"]=="count"||(isset($e[$X["col"]])&&(!$X["fun"]||in_array($X["fun"],$q)||in_array($X["fun"],$jc)))){$N[$y]=apply_sql_function($X["fun"],(isset($e[$X["col"]])?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$jc))$hc[]=$N[$y];}}return
array($N,$hc);}function
selectSearchProcess($l,$v){global$x;$J=array();foreach($v
as$s=>$u){if($u["type"]=="FULLTEXT"&&$_GET["fulltext"][$s]!="")$J[]="MATCH (".implode(", ",array_map('idf_escape',$u["columns"])).") AGAINST (".q($_GET["fulltext"][$s]).(isset($_GET["boolean"][$s])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$Ta=" $X[op]";if(ereg('IN$',$X["op"])){$sc=process_length($X["val"]);$Ta.=" (".($sc!=""?$sc:"NULL").")";}elseif(!$X["op"])$Ta.=$X["val"];elseif($X["op"]=="LIKE %%")$Ta=" LIKE ".$this->processInput($l[$X["col"]],"%$X[val]%");elseif(!ereg('NULL$',$X["op"]))$Ta.=" ".$this->processInput($l[$X["col"]],$X["val"]);if($X["col"]!="")$J[]=idf_escape($X["col"]).$Ta;else{$Ma=array();foreach($l
as$D=>$k){if(is_numeric($X["val"])||!ereg('int|float|double|decimal',$k["type"])){$D=idf_escape($D);$Ma[]=($x=="sql"&&ereg('char|text|enum|set',$k["type"])&&!ereg('^utf8',$k["collation"])?"CONVERT($D USING utf8)":$D);}}$J[]=($Ma?"(".implode("$Ta OR ",$Ma)."$Ta)":"0");}}}return$J;}function
selectOrderProcess($l,$v){$J=array();foreach((array)$_GET["order"]as$y=>$X){if(isset($l[$X])||preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~',$X))$J[]=(isset($l[$X])?idf_escape($X):$X).(isset($_GET["desc"][$y])?" DESC":"");}return$J;}function
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"30");}function
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
selectEmailProcess($Z,$ac){return
false;}function
messageQuery($H){global$x;static$Ya=0;restart_session();$t="sql-".($Ya++);$lc=&get_session("queries");if(strlen($H)>1e6)$H=ereg_replace('[\x80-\xFF]+$','',substr($H,0,1e6))."\n...";$lc[$_GET["db"]][]=array($H,time());return" <span class='time'>".@date("H:i:s")."</span> <a href='#$t' onclick=\"return !toggle('$t');\">".'SQL command'."</a><div id='$t' class='hidden'><pre><code class='jush-$x'>".shorten_utf8($H,1000).'</code></pre><p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($lc[$_GET["db"]])-1)).'">'.'Edit'.'</a></div>';}function
editFunctions($k){global$wb;$J=($k["null"]?"NULL/":"");foreach($wb
as$y=>$q){if(!$y||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($q
as$F=>$X){if(!$F||ereg($F,$k["type"]))$J.="/$X";}if($y&&!ereg('set|blob|bytea|raw|file',$k["type"]))$J.="/=";}}return
explode("/",$J);}function
editInput($S,$k,$ta,$Y){if($k["type"]=="enum")return(isset($_GET["select"])?"<label><input type='radio'$ta value='-1' checked><i>".'original'."</i></label> ":"").($k["null"]?"<label><input type='radio'$ta value=''".($Y!==null||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$ta,$k,$Y,0);return"";}function
processInput($k,$Y,$p=""){if($p=="=")return$Y;$D=$k["field"];$J=($k["type"]=="bit"&&ereg("^([0-9]+|b'[0-1]+')\$",$Y)?$Y:q($Y));if(ereg('^(now|getdate|uuid)$',$p))$J="$p()";elseif(ereg('^current_(date|timestamp)$',$p))$J=$p;elseif(ereg('^([+-]|\\|\\|)$',$p))$J=idf_escape($D)." $p $J";elseif(ereg('^[+-] interval$',$p))$J=idf_escape($D)." $p ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i",$Y)?$Y:$J);elseif(ereg('^(addtime|subtime|concat)$',$p))$J="$p(".idf_escape($D).", $J)";elseif(ereg('^(md5|sha1|password|encrypt|hex)$',$p))$J="$p($J)";if(ereg("binary",$k["type"]))$J="unhex($J)";return$J;}function
dumpOutput(){$J=array('text'=>'open','file'=>'save');if(function_exists('gzencode'))$J['gz']='gzip';if(function_exists('bzcompress'))$J['bz2']='bzip2';return$J;}function
dumpFormat(){return
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
dumpTable($S,$R,$_c=false){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($R)dump_csv(array_keys(fields($S)));}elseif($R){$Za=create_sql($S,$_POST["auto_increment"]);if($Za){if($R=="DROP+CREATE")echo"DROP ".($_c?"VIEW":"TABLE")." IF EXISTS ".table($S).";\n";if($_c)$Za=preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\\1)',logged_user()).'`~','\\1',$Za);echo($R!="CREATE+ALTER"?$Za:($_c?substr_replace($Za," OR REPLACE",6,0):substr_replace($Za," IF NOT EXISTS",12,0))).";\n\n";}if($R=="CREATE+ALTER"&&!$_c){$H="SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ".q($S)." ORDER BY ORDINAL_POSITION";echo"DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
DECLARE _column_type, _column_default text;
DECLARE _is_nullable char(3);
DECLARE _extra varchar(30);
DECLARE _column_comment varchar(255);
DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '";$l=array();$oa="";foreach(get_rows($H)as$K){$jb=$K["COLUMN_DEFAULT"];$K["default"]=($jb!==null?q($jb):"NULL");$K["after"]=q($oa);$K["alter"]=escape_string(idf_escape($K["COLUMN_NAME"])." $K[COLUMN_TYPE]".($K["COLLATION_NAME"]?" COLLATE $K[COLLATION_NAME]":"").($jb!==null?" DEFAULT ".($jb=="CURRENT_TIMESTAMP"?$jb:$K["default"]):"").($K["IS_NULLABLE"]=="YES"?"":" NOT NULL").($K["EXTRA"]?" $K[EXTRA]":"").($K["COLUMN_COMMENT"]?" COMMENT ".q($K["COLUMN_COMMENT"]):"").($oa?" AFTER ".idf_escape($oa):" FIRST"));echo", ADD $K[alter]";$l[]=$K;$oa=$K["COLUMN_NAME"];}echo"';
DECLARE columns CURSOR FOR $H;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET @alter_table = '';
OPEN columns;
REPEAT
FETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;
IF NOT done THEN
SET set_after = 1;
CASE _column_name";foreach($l
as$K)echo"
WHEN ".q($K["COLUMN_NAME"])." THEN
SET add_columns = REPLACE(add_columns, ', ADD $K[alter]', IF(
_column_default <=> $K[default] AND _is_nullable = '$K[IS_NULLABLE]' AND _collation_name <=> ".(isset($K["COLLATION_NAME"])?"'$K[COLLATION_NAME]'":"NULL")." AND _column_type = ".q($K["COLUMN_TYPE"])." AND _extra = '$K[EXTRA]' AND _column_comment = ".q($K["COLUMN_COMMENT"])." AND after = $K[after]
, '', ', MODIFY $K[alter]'));";echo"
ELSE
SET @alter_table = CONCAT(@alter_table, ', DROP ', _column_name);
SET set_after = 0;
END CASE;
IF set_after THEN
SET after = _column_name;
END IF;
END IF;
UNTIL done END REPEAT;
CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN
SET alter_command = CONCAT(alter_command, 'ALTER TABLE ".table($S)."', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');
END IF;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";}}}function
dumpData($S,$R,$H){global$f,$x;$Tc=($x=="sqlite"?0:1048576);if($R){if($_POST["format"]=="sql"&&$R=="TRUNCATE+INSERT")echo
truncate_sql($S).";\n";if($_POST["format"]=="sql")$l=fields($S);$I=$f->query($H,1);if($I){$xc="";$Ca="";while($K=$I->fetch_assoc()){if($_POST["format"]!="sql"){if($R=="table"){dump_csv(array_keys($K));$R="INSERT";}dump_csv($K);}else{if(!$xc)$xc="INSERT INTO ".table($S)." (".implode(", ",array_map('idf_escape',array_keys($K))).") VALUES";foreach($K
as$y=>$X)$K[$y]=($X!==null?(ereg('int|float|double|decimal|bit',$l[$y]["type"])?$X:q($X)):"NULL");$M=implode(",\t",$K);if($R=="INSERT+UPDATE"){$P=array();foreach($K
as$y=>$X)$P[]=idf_escape($y)." = $X";echo"$xc ($M) ON DUPLICATE KEY UPDATE ".implode(", ",$P).";\n";}else{$M=($Tc?"\n":" ")."($M)";if(!$Ca)$Ca=$xc.$M;elseif(strlen($Ca)+4+strlen($M)<$Tc)$Ca.=",$M";else{echo"$Ca;\n";$Ca=$xc.$M;}}}}if($_POST["format"]=="sql"&&$R!="INSERT+UPDATE"&&$Ca){$Ca.=";\n";echo$Ca;}}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$f->error)."\n";}}function
dumpFilename($pc){return
friendly_url($pc!=""?$pc:(SERVER!=""?SERVER:"localhost"));}function
dumpHeaders($pc,$fd=false){$Hd=$_POST["output"];$Qb=($_POST["format"]=="sql"?"sql":($fd?"tar":"csv"));header("Content-Type: ".($Hd=="bz2"?"application/x-bzip":($Hd=="gz"?"application/x-gzip":($Qb=="tar"?"application/x-tar":($Qb=="sql"||$Hd!="file"?"text/plain":"text/csv")."; charset=utf-8"))));if($Hd=="bz2")ob_start('bzcompress',1e6);if($Hd=="gz")ob_start('gzencode',1e6);return$Qb;}function
homepage(){echo'<p>'.($_GET["ns"]==""?'<a href="'.h(ME).'database=">'.'Alter database'."</a>\n":""),(support("scheme")?"<a href='".h(ME)."scheme='>".($_GET["ns"]!=""?'Alter schema':'Create schema')."</a>\n":""),($_GET["ns"]!==""?'<a href="'.h(ME).'schema=">'.'Database schema'."</a>\n":""),(support("privileges")?"<a href='".h(ME)."privileges='>".'Privileges'."</a>\n":"");return
true;}function
navigation($ed){global$ga,$f,$U,$x,$qb;echo'<h1>
',$this->name(),' <span class="version">',$ga,'</span>
<a href="http://www.adminer.org/#download" id="version">',(version_compare($ga,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
</h1>
';if($ed=="auth"){$Xb=true;foreach((array)$_SESSION["pwds"]as$pb=>$Ge){foreach($Ge
as$O=>$Jf){foreach($Jf
as$If=>$Rd){if($Rd!==null){if($Xb){echo"<p>\n";$Xb=false;}echo"<a href='".h(auth_url($pb,$O,$If))."'>($qb[$pb]) ".h($If.($O!=""?"@$O":""))."</a><br>\n";}}}}}else{$h=$this->databases();echo'<form action="" method="post">
<p class="logout">
';if(DB==""||!$ed){echo"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])).">".'SQL command'."</a>\n";if(support("dump"))echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".'Dump'."</a>\n";}echo'<input type="submit" name="logout" value="Logout">
<input type="hidden" name="token" value="',$U,'">
</p>
</form>
<form action="">
<p>
';hidden_fields_get();echo($h?html_select("db",array(""=>"(".'database'.")")+$h,DB,"this.form.submit();"):'<input name="db" value="'.h(DB).'">'),'<input type="submit" value="Use"',($h?" class='hidden'":""),'>
';if($ed!="db"&&DB!=""&&$f->select_db(DB)){if($_GET["ns"]!==""&&!$ed){echo'<p><a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".'Create new table'."</a>\n";$bf=tables_list();if(!$bf)echo"<p class='message'>".'No tables.'."\n";else{$this->tablesPrint($bf);$Oc=array();foreach($bf
as$S=>$V)$Oc[]=preg_quote($S,'/');echo"<script type='text/javascript'>\n","var jushLinks = { $x: [ '".js_escape(ME)."table=\$&', /\\b(".implode("|",$Oc).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$x;\n";echo"</script>\n";}}}echo(isset($_GET["sql"])?'<input type="hidden" name="sql" value="">':(isset($_GET["schema"])?'<input type="hidden" name="schema" value="">':(isset($_GET["dump"])?'<input type="hidden" name="dump" value="">':""))),"</p></form>\n";}}function
tablesPrint($bf){echo"<p id='tables'>\n";foreach($bf
as$S=>$V){echo'<a href="'.h(ME).'select='.urlencode($S).'"'.bold($_GET["select"]==$S).">".'select'."</a> ",'<a href="'.h(ME).'table='.urlencode($S).'"'.bold($_GET["table"]==$S)." title='".'Show structure'."'>".$this->tableName(array("Name"=>$S))."</a><br>\n";}}}$b=(function_exists('adminer_object')?adminer_object():new
Adminer);if($b->operators===null)$b->operators=$wd;function
page_header($kf,$j="",$Ba=array(),$lf=""){global$ca,$b,$f,$qb;header("Content-Type: text/html; charset=utf-8");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}$mf=$kf.($lf!=""?": ".h($lf):"");$nf=strip_tags($mf.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<title>',$nf,'</title>
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME))."?file=default.css&amp;version=3.4.0",'">
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&amp;version=3.4.0",'"></script>
';if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=3.4.0",'" id="favicon">
';if(file_exists("adminer.css")){echo'<link rel="stylesheet" type="text/css" href="adminer.css">
';}}echo'
<body class="ltr nojs" onkeydown="bodyKeydown(event);" onload="bodyLoad(\'',(is_object($f)?substr($f->server_info,0,3):""),'\');',(isset($_COOKIE["adminer_version"])?"":" verifyVersion();"),'">
<script type="text/javascript">
document.body.className = document.body.className.replace(/ nojs/, \' js\');
</script>
<div id="content">
';if($Ba!==null){$_=substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$qb[DRIVER].'</a> &raquo; ';$_=substr(preg_replace('~(db|ns)=[^&]*&~','',ME),0,-1);$O=(SERVER!=""?h(SERVER):'Server');if($Ba===false)echo"$O\n";else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$O</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ba)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';if(is_array($Ba)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';foreach($Ba
as$y=>$X){$lb=(is_array($X)?$X[1]:$X);if($lb!="")echo'<a href="'.h(ME."$y=").urlencode(is_array($X)?$X[0]:$X).'">'.h($lb).'</a> &raquo; ';}}echo"$kf\n";}}echo"<h2>$mf</h2>\n";restart_session();$Gf=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$cd=$_SESSION["messages"][$Gf];if($cd){echo"<div class='message'>".implode("</div>\n<div class='message'>",$cd)."</div>\n";unset($_SESSION["messages"][$Gf]);}$h=&get_session("dbs");if(DB!=""&&$h&&!in_array(DB,$h,true))$h=null;if($j)echo"<div class='error'>$j</div>\n";define("PAGE_HEADER",1);}function
page_footer($ed=""){global$b;echo'</div>
<div id="menu">
';$b->navigation($ed);echo'</div>
';}function
int32($C){while($C>=2147483648)$C-=4294967296;while($C<=-2147483649)$C+=4294967296;return(int)$C;}function
long2str($W,$Of){$M='';foreach($W
as$X)$M.=pack('V',$X);if($Of)return
substr($M,0,end($W));return$M;}function
str2long($M,$Of){$W=array_values(unpack('V*',str_pad($M,4*ceil(strlen($M)/4),"\0")));if($Of)$W[]=strlen($M);return$W;}function
xxtea_mx($Sf,$Rf,$Te,$Bc){return
int32((($Sf>>5&0x7FFFFFF)^$Rf<<2)+(($Rf>>3&0x1FFFFFFF)^$Sf<<4))^int32(($Te^$Rf)+($Bc^$Sf));}function
encrypt_string($Oe,$y){if($Oe=="")return"";$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Oe,true);$C=count($W)-1;$Sf=$W[$C];$Rf=$W[0];$G=floor(6+52/($C+1));$Te=0;while($G-->0){$Te=int32($Te+0x9E3779B9);$vb=$Te>>2&3;for($Id=0;$Id<$C;$Id++){$Rf=$W[$Id+1];$gd=xxtea_mx($Sf,$Rf,$Te,$y[$Id&3^$vb]);$Sf=int32($W[$Id]+$gd);$W[$Id]=$Sf;}$Rf=$W[0];$gd=xxtea_mx($Sf,$Rf,$Te,$y[$Id&3^$vb]);$Sf=int32($W[$C]+$gd);$W[$C]=$Sf;}return
long2str($W,false);}function
decrypt_string($Oe,$y){if($Oe=="")return"";$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Oe,false);$C=count($W)-1;$Sf=$W[$C];$Rf=$W[0];$G=floor(6+52/($C+1));$Te=int32($G*0x9E3779B9);while($Te){$vb=$Te>>2&3;for($Id=$C;$Id>0;$Id--){$Sf=$W[$Id-1];$gd=xxtea_mx($Sf,$Rf,$Te,$y[$Id&3^$vb]);$Rf=int32($W[$Id]-$gd);$W[$Id]=$Rf;}$Sf=$W[$C];$gd=xxtea_mx($Sf,$Rf,$Te,$y[$Id&3^$vb]);$Rf=int32($W[0]-$gd);$W[0]=$Rf;$Te=int32($Te-0x9E3779B9);}return
long2str($W,true);}$f='';$U=$_SESSION["token"];if(!$_SESSION["token"])$_SESSION["token"]=rand(1,1e6);$Sd=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($y)=explode(":",$X);$Sd[$y]=$X;}}$c=$_POST["auth"];if($c){session_regenerate_id();$_SESSION["pwds"][$c["driver"]][$c["server"]][$c["username"]]=$c["password"];if($c["permanent"]){$y=base64_encode($c["driver"])."-".base64_encode($c["server"])."-".base64_encode($c["username"]);$ce=$b->permanentLogin();$Sd[$y]="$y:".base64_encode($ce?encrypt_string($c["password"],$ce):"");cookie("adminer_permanent",implode(" ",$Sd));}if(count($_POST)==1||DRIVER!=$c["driver"]||SERVER!=$c["server"]||$_GET["username"]!==$c["username"]||DB!=$c["db"])redirect(auth_url($c["driver"],$c["server"],$c["username"],$c["db"]));}elseif($_POST["logout"]){if($U&&$_POST["token"]!=$U){page_header('Logout','Invalid CSRF token. Send the form again.');page_footer("db");exit;}else{foreach(array("pwds","dbs","queries")as$y)set_session($y,null);$y=base64_encode(DRIVER)."-".base64_encode(SERVER)."-".base64_encode($_GET["username"]);if($Sd[$y]){unset($Sd[$y]);cookie("adminer_permanent",implode(" ",$Sd));}redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1),'Logout successful.');}}elseif($Sd&&!$_SESSION["pwds"]){session_regenerate_id();$ce=$b->permanentLogin();foreach($Sd
as$y=>$X){list(,$Ia)=explode(":",$X);list($pb,$O,$If)=array_map('base64_decode',explode("-",$y));$_SESSION["pwds"][$pb][$O][$If]=decrypt_string(base64_decode($Ia),$ce);}}function
auth_error($Kb=null){global$f,$b,$U;$He=session_name();$j="";if(!$_COOKIE[$He]&&$_GET[$He]&&ini_bool("session.use_only_cookies"))$j='Session support must be enabled.';elseif(isset($_GET["username"])){if(($_COOKIE[$He]||$_GET[$He])&&!$U)$j='Session expired, please login again.';else{$Rd=&get_session("pwds");if($Rd!==null){$j=h($Kb?$Kb->getMessage():(is_string($f)?$f:'Invalid credentials.'));$Rd=null;}}}page_header('Login',$j,null);echo"<form action='' method='post'>\n";$b->loginForm();echo"<div>";hidden_fields($_POST,array("auth"));echo"</div>\n","</form>\n";page_footer("auth");}if(isset($_GET["username"])){if(!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);page_header('No extension',sprintf('None of the supported PHP extensions (%s) are available.',implode(", ",$Xd)),false);page_footer("auth");exit;}$f=connect();}if(is_string($f)||!$b->login($_GET["username"],get_session("pwds"))){auth_error();exit;}$U=$_SESSION["token"];if($c&&$_POST["token"])$_POST["token"]=$U;$j=($_POST?($_POST["token"]==$U?"":'Invalid CSRF token. Send the form again.'):($_SERVER["REQUEST_METHOD"]!="POST"?"":sprintf('Too big POST data. Reduce the data or increase the %s configuration directive.','"post_max_size"')));function
connect_error(){global$b,$f,$U,$j,$qb;$h=array();if(DB!="")page_header('Database'.": ".h(DB),'Invalid database.',true);else{if($_POST["db"]&&!$j)queries_redirect(substr(ME,0,-1),'Databases have been dropped.',drop_databases($_POST["db"]));page_header('Select database',$j,false);echo"<p><a href='".h(ME)."database='>".'Create new database'."</a>\n";foreach(array('privileges'=>'Privileges','processlist'=>'Process list','variables'=>'Variables','status'=>'Status',)as$y=>$X){if(support($y))echo"<a href='".h(ME)."$y='>$X</a>\n";}echo"<p>".sprintf('%s version: %s through PHP extension %s',$qb[DRIVER],"<b>$f->server_info</b>","<b>$f->extension</b>")."\n","<p>".sprintf('Logged as: %s',"<b>".h(logged_user())."</b>")."\n";if($_GET["refresh"])set_session("dbs",null);$h=$b->databases();if($h){$Be=support("scheme");$d=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n","<thead><tr><td>&nbsp;<th>".'Database'."<td>".'Collation'."<td>".'Tables'."</thead>\n";foreach($h
as$i){$ve=h(ME)."db=".urlencode($i);echo"<tr".odd()."><td>".checkbox("db[]",$i,in_array($i,(array)$_POST["db"])),"<th><a href='$ve'>".h($i)."</a>","<td><a href='$ve".($Be?"&amp;ns=":"")."&amp;database=' title='".'Alter database'."'>".nbsp(db_collation($i,$d))."</a>","<td align='right'><a href='$ve&amp;schema=' id='tables-".h($i)."' title='".'Database schema'."'>?</a>","\n";}echo"</table>\n","<script type='text/javascript'>tableCheck();</script>\n","<p><input type='submit' name='drop' value='".'Drop'."'".confirm("formChecked(this, /db/)").">\n","<input type='hidden' name='token' value='$U'>\n","<a href='".h(ME)."refresh=1'>".'Refresh'."</a>\n","</form>\n";}}page_footer("db");if($h)echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=connect');</script>\n";}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(!(DB!=""?$f->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect")){if(DB!="")set_session("dbs",null);connect_error();exit;}function
select($I,$g=null,$oc="",$Bd=array()){$Oc=array();$v=array();$e=array();$_a=array();$yf=array();$J=array();odd('');for($s=0;$K=$I->fetch_row();$s++){if(!$s){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($w=0;$w<count($K);$w++){$k=$I->fetch_field();$D=$k->name;$Ad=$k->orgtable;$_d=$k->orgname;$J[$k->table]=$Ad;if($oc)$Oc[$w]=($D=="table"?"table=":($D=="possible_keys"?"indexes=":null));elseif($Ad!=""){if(!isset($v[$Ad])){$v[$Ad]=array();foreach(indexes($Ad,$g)as$u){if($u["type"]=="PRIMARY"){$v[$Ad]=array_flip($u["columns"]);break;}}$e[$Ad]=$v[$Ad];}if(isset($e[$Ad][$_d])){unset($e[$Ad][$_d]);$v[$Ad][$_d]=$w;$Oc[$w]=$Ad;}}if($k->charsetnr==63)$_a[$w]=true;$yf[$w]=$k->type;$D=h($D);echo"<th".($Ad!=""||$k->name!=$_d?" title='".h(($Ad!=""?"$Ad.":"").$_d)."'":"").">".($oc?"<a href='$oc".strtolower($D)."' target='_blank' rel='noreferrer'>$D</a>":$D);}echo"</thead>\n";}echo"<tr".odd().">";foreach($K
as$y=>$X){if($X===null)$X="<i>NULL</i>";elseif($_a[$y]&&!is_utf8($X))$X="<i>".lang(array('%d byte','%d bytes'),strlen($X))."</i>";elseif(!strlen($X))$X="&nbsp;";else{$X=h($X);if($yf[$y]==254)$X="<code>$X</code>";}if(isset($Oc[$y])&&!$e[$Oc[$y]]){if($oc){$S=$K[array_search("table=",$Oc)];$_=$Oc[$y].urlencode($Bd[$S]!=""?$Bd[$S]:$S);}else{$_="edit=".urlencode($Oc[$y]);foreach($v[$Oc[$y]]as$Ja=>$w)$_.="&where".urlencode("[".bracket_escape($Ja)."]")."=".urlencode($K[$w]);}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($s?"</table>":"<p class='message'>".'No rows.')."\n";return$J;}function
referencable_primary($De){$J=array();foreach(table_status()as$Xe=>$S){if($Xe!=$De&&fk_support($S)){foreach(fields($Xe)as$k){if($k["primary"]){if($J[$Xe]){unset($J[$Xe]);break;}$J[$Xe]=$k;}}}}return$J;}function
textarea($D,$Y,$L=10,$Ma=80){echo"<textarea name='$D' rows='$L' cols='$Ma' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>";if(is_array($Y)){foreach($Y
as$X)echo
h($X[0])."\n\n\n";}else
echo
h($Y);echo"</textarea>";}function
format_time($Le,$Bb){return" <span class='time'>(".sprintf('%.3f s',max(0,array_sum(explode(" ",$Bb))-array_sum(explode(" ",$Le)))).")</span>";}function
edit_type($y,$k,$d,$n=array()){global$Pe,$yf,$Ef,$sd;echo'<td><select name="',$y,'[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);">',optionlist((!$k["type"]||isset($yf[$k["type"]])?array():array($k["type"]))+$Pe+($n?array('Foreign keys'=>$n):array()),$k["type"]),'</select>
<td><input name="',$y,'[length]" value="',h($k["length"]),'" size="3" onfocus="editingLengthFocus(this);"><td class="options">',"<select name='$y"."[collation]'".(ereg('(char|text|enum|set)$',$k["type"])?"":" class='hidden'").'><option value="">('.'collation'.')'.optionlist($d,$k["collation"]).'</select>',($Ef?"<select name='$y"."[unsigned]'".(!$k["type"]||ereg('(int|float|double|decimal)$',$k["type"])?"":" class='hidden'").'><option>'.optionlist($Ef,$k["unsigned"]).'</select>':''),($n?"<select name='$y"."[on_delete]'".(ereg("`",$k["type"])?"":" class='hidden'")."><option value=''>(".'ON DELETE'.")".optionlist(explode("|",$sd),$k["on_delete"])."</select> ":" ");}function
process_length($Lc){global$Eb;return(preg_match("~^\\s*(?:$Eb)(?:\\s*,\\s*(?:$Eb))*\\s*\$~",$Lc)&&preg_match_all("~$Eb~",$Lc,$Rc)?implode(",",$Rc[0]):preg_replace('~[^0-9,+-]~','',$Lc));}function
process_type($k,$Ka="COLLATE"){global$Ef;return" $k[type]".($k["length"]!=""?"(".process_length($k["length"]).")":"").(ereg('int|float|double|decimal',$k["type"])&&in_array($k["unsigned"],$Ef)?" $k[unsigned]":"").(ereg('char|text|enum|set',$k["type"])&&$k["collation"]?" $Ka ".q($k["collation"]):"");}function
process_field($k,$wf){return
array(idf_escape(trim($k["field"])),process_type($wf),($k["null"]?" NULL":" NOT NULL"),(isset($k["default"])?" DEFAULT ".(($k["type"]=="timestamp"&&eregi('^CURRENT_TIMESTAMP$',$k["default"]))||($k["type"]=="bit"&&ereg("^([0-9]+|b'[0-1]+')\$",$k["default"]))?$k["default"]:q($k["default"])):""),($k["on_update"]?" ON UPDATE $k[on_update]":""),(support("comment")&&$k["comment"]!=""?" COMMENT ".q($k["comment"]):""),($k["auto_increment"]?auto_increment():null),);}function
type_class($V){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$y=>$X){if(ereg("$y|$X",$V))return" class='$y'";}}function
edit_fields($l,$d,$V="TABLE",$qa=0,$n=array(),$Ra=false){global$vc;echo'<thead><tr class="wrap">
';if($V=="PROCEDURE"){echo'<td>&nbsp;';}echo'<th>',($V=="TABLE"?'Column name':'Parameter name'),'<td>Type<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
<td>Length
<td>Options
';if($V=="TABLE"){echo'<td>NULL
<td><input type="radio" name="auto_increment_col" value=""><acronym title="Auto Increment">AI</acronym>
<td',($_POST["defaults"]?"":" class='hidden'"),'>Default values
',(support("comment")?"<td".($Ra?"":" class='hidden'").">".'Comment':"");}echo'<td>',"<input type='image' name='add[".(support("move_col")?0:count($l))."]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.4.0' alt='+' title='".'Add next'."'>",'<script type="text/javascript">row_count = ',count($l),';</script>
</thead>
<tbody onkeydown="return editingKeydown(event);">
';foreach($l
as$s=>$k){$s++;$Cd=$k[($_POST?"orig":"field")];$nb=(isset($_POST["add"][$s-1])||(isset($k["field"])&&!$_POST["drop_col"][$s]))&&(support("drop_col")||$Cd=="");echo'<tr',($nb?"":" style='display: none;'"),'>
',($V=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$vc),$k["inout"]):""),'<th>';if($nb){echo'<input name="fields[',$s,'][field]" value="',h($k["field"]),'" onchange="',($k["field"]!=""||count($l)>1?"":"editingAddRow(this, $qa); "),'editingNameChange(this);" maxlength="64">';}echo'<input type="hidden" name="fields[',$s,'][orig]" value="',h($Cd),'">
';edit_type("fields[$s]",$k,$d,$n);if($V=="TABLE"){echo'<td>',checkbox("fields[$s][null]",1,$k["null"]),'<td><input type="radio" name="auto_increment_col" value="',$s,'"';if($k["auto_increment"]){echo' checked';}?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }">
<td<?php echo($_POST["defaults"]?"":" class='hidden'"),'>',checkbox("fields[$s][has_default]",1,$k["has_default"]),'<input name="fields[',$s,'][default]" value="',h($k["default"]),'" onchange="this.previousSibling.checked = true;">
',(support("comment")?"<td".($Ra?"":" class='hidden'")."><input name='fields[$s][comment]' value='".h($k["comment"])."' maxlength='255'>":"");}echo"<td>",(support("move_col")?"<input type='image' name='add[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.4.0' alt='+' title='".'Add next'."' onclick='return !editingAddRow(this, $qa, 1);'>&nbsp;"."<input type='image' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=up.gif&amp;version=3.4.0' alt='^' title='".'Move up'."'>&nbsp;"."<input type='image' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=down.gif&amp;version=3.4.0' alt='v' title='".'Move down'."'>&nbsp;":""),($Cd==""||support("drop_col")?"<input type='image' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=cross.gif&amp;version=3.4.0' alt='x' title='".'Remove'."' onclick='return !editingRemoveRow(this);'>":""),"\n";}}function
process_fields(&$l){ksort($l);$nd=0;if($_POST["up"]){$Fc=0;foreach($l
as$y=>$k){if(key($_POST["up"])==$y){unset($l[$y]);array_splice($l,$Fc,0,array($k));break;}if(isset($k["field"]))$Fc=$nd;$nd++;}}if($_POST["down"]){$o=false;foreach($l
as$y=>$k){if(isset($k["field"])&&$o){unset($l[key($_POST["down"])]);array_splice($l,$nd,0,array($o));break;}if(key($_POST["down"])==$y)$o=$k;$nd++;}}$l=array_values($l);if($_POST["add"])array_splice($l,key($_POST["add"]),0,array(array()));}function
normalize_enum($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
grant($r,$ee,$e,$rd){if(!$ee)return
true;if($ee==array("ALL PRIVILEGES","GRANT OPTION"))return($r=="GRANT"?queries("$r ALL PRIVILEGES$rd WITH GRANT OPTION"):queries("$r ALL PRIVILEGES$rd")&&queries("$r GRANT OPTION$rd"));return
queries("$r ".preg_replace('~(GRANT OPTION)\\([^)]*\\)~','\\1',implode("$e, ",$ee).$e).$rd);}function
drop_create($rb,$Za,$A,$bd,$Zc,$ad,$D){if($_POST["drop"])return
query_redirect($rb,$A,$bd,true,!$_POST["dropped"]);$sb=$D!=""&&($_POST["dropped"]||queries($rb));$bb=queries($Za);if(!queries_redirect($A,($D!=""?$Zc:$ad),$bb)&&$sb)redirect(null,$bd);return$sb;}function
tar_file($Vb,$Va){$J=pack("a100a8a8a8a12a12",$Vb,644,0,0,decoct(strlen($Va)),decoct(time()));$Ha=8*32;for($s=0;$s<strlen($J);$s++)$Ha+=ord($J[$s]);$J.=sprintf("%06o",$Ha)."\0 ";return$J.str_repeat("\0",512-strlen($J)).$Va.str_repeat("\0",511-(strlen($Va)+511)%
512);}function
ini_bytes($uc){$X=ini_get($uc);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}session_cache_limiter("");if(!ini_bool("session.use_cookies")||@ini_set("session.use_cookies",false)!==false)session_write_close();$sd="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";$Eb="'(?:''|[^'\\\\]|\\\\.)*+'";$vc="IN|OUT|INOUT";if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"])$_GET["edit"]=$_GET["select"];if(isset($_GET["callf"]))$_GET["call"]=$_GET["callf"];if(isset($_GET["function"]))$_GET["procedure"]=$_GET["function"];if(isset($_GET["download"])){$a=$_GET["download"];header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));echo$f->result("SELECT".limit(idf_escape($_GET["field"])." FROM ".table($a)," WHERE ".where($_GET),1));exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$l=fields($a);if(!$l)$j=error();$T=($l?table_status($a):array());page_header(($l&&is_view($T)?'View':'Table').": ".h($a),$j);$b->selectLinks($T);$Qa=$T["Comment"];if($Qa!="")echo"<p>".'Comment'.": ".h($Qa)."\n";if($l){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Column'."<td>".'Type'.(support("comment")?"<td>".'Comment':"")."</thead>\n";foreach($l
as$k){echo"<tr".odd()."><th>".h($k["field"]),"<td title='".h($k["collation"])."'>".h($k["full_type"]).($k["null"]?" <i>NULL</i>":"").($k["auto_increment"]?" <i>".'Auto Increment'."</i>":""),(isset($k["default"])?" [<b>".h($k["default"])."</b>]":""),(support("comment")?"<td>".nbsp($k["comment"]):""),"\n";}echo"</table>\n";if(!is_view($T)){echo"<h3>".'Indexes'."</h3>\n";$v=indexes($a);if($v){echo"<table cellspacing='0'>\n";foreach($v
as$D=>$u){ksort($u["columns"]);$be=array();foreach($u["columns"]as$y=>$X)$be[]="<i>".h($X)."</i>".($u["lengths"][$y]?"(".$u["lengths"][$y].")":"");echo"<tr title='".h($D)."'><th>$u[type]<td>".implode(", ",$be)."\n";}echo"</table>\n";}echo'<p><a href="'.h(ME).'indexes='.urlencode($a).'">'.'Alter indexes'."</a>\n";if(fk_support($T)){echo"<h3>".'Foreign keys'."</h3>\n";$n=foreign_keys($a);if($n){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Source'."<td>".'Target'."<td>".'ON DELETE'."<td>".'ON UPDATE'.($x!="sqlite"?"<td>&nbsp;":"")."</thead>\n";foreach($n
as$D=>$m){echo"<tr title='".h($D)."'>","<th><i>".implode("</i>, <i>",array_map('h',$m["source"]))."</i>","<td><a href='".h($m["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($m["db"]),ME):($m["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($m["ns"]),ME):ME))."table=".urlencode($m["table"])."'>".($m["db"]!=""?"<b>".h($m["db"])."</b>.":"").($m["ns"]!=""?"<b>".h($m["ns"])."</b>.":"").h($m["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$m["target"]))."</i>)","<td>".nbsp($m["on_delete"])."\n","<td>".nbsp($m["on_update"])."\n";if($x!="sqlite")echo'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($D)).'">'.'Alter'.'</a>';}echo"</table>\n";}if($x!="sqlite")echo'<p><a href="'.h(ME).'foreign='.urlencode($a).'">'.'Add foreign key'."</a>\n";}if(support("trigger")){echo"<h3>".'Triggers'."</h3>\n";$vf=triggers($a);if($vf){echo"<table cellspacing='0'>\n";foreach($vf
as$y=>$X)echo"<tr valign='top'><td>$X[0]<td>$X[1]<th>".h($y)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($y))."'>".'Alter'."</a>\n";echo"</table>\n";}echo'<p><a href="'.h(ME).'trigger='.urlencode($a).'">'.'Add trigger'."</a>\n";}}}}elseif(isset($_GET["schema"])){page_header('Database schema',"",array(),DB.($_GET["ns"]?".$_GET[ns]":""));$Ye=array();$Ze=array();$D="adminer_schema";$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE[($_COOKIE["$D-".DB]?"$D-".DB:$D)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$Rc,PREG_SET_ORDER);foreach($Rc
as$s=>$B){$Ye[$B[1]]=array($B[2],$B[3]);$Ze[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$of=0;$za=-1;$Ae=array();$oe=array();$Jc=array();foreach(table_status()as$T){if(!isset($T["Engine"]))continue;$Ud=0;$Ae[$T["Name"]]["fields"]=array();foreach(fields($T["Name"])as$D=>$k){$Ud+=1.25;$k["pos"]=$Ud;$Ae[$T["Name"]]["fields"][$D]=$k;}$Ae[$T["Name"]]["pos"]=($Ye[$T["Name"]]?$Ye[$T["Name"]]:array($of,0));foreach($b->foreignKeys($T["Name"])as$X){if(!$X["db"]){$Hc=$za;if($Ye[$T["Name"]][1]||$Ye[$X["table"]][1])$Hc=min(floatval($Ye[$T["Name"]][1]),floatval($Ye[$X["table"]][1]))-1;else$za-=.1;while($Jc[(string)$Hc])$Hc-=.0001;$Ae[$T["Name"]]["references"][$X["table"]][(string)$Hc]=array($X["source"],$X["target"]);$oe[$X["table"]][$T["Name"]][(string)$Hc]=$X["target"];$Jc[(string)$Hc]=true;}}$of=max($of,$Ae[$T["Name"]]["pos"][0]+2.5+$Ud);}echo'<div id="schema" style="height: ',$of,'em;" onselectstart="return false;">
<script type="text/javascript">
var tablePos = {',implode(",",$Ze)."\n",'};
var em = document.getElementById(\'schema\').offsetHeight / ',$of,';
document.onmousemove = schemaMousemove;
document.onmouseup = function (ev) {
schemaMouseup(ev, \'',js_escape(DB),'\');
};
</script>
';foreach($Ae
as$D=>$S){echo"<div class='table' style='top: ".$S["pos"][0]."em; left: ".$S["pos"][1]."em;' onmousedown='schemaMousedown(this, event);'>",'<a href="'.h(ME).'table='.urlencode($D).'"><b>'.h($D)."</b></a>";foreach($S["fields"]as$k){$X='<span'.type_class($k["type"]).' title="'.h($k["full_type"].($k["null"]?" NULL":'')).'">'.h($k["field"]).'</span>';echo"<br>".($k["primary"]?"<i>$X</i>":$X);}foreach((array)$S["references"]as$ff=>$pe){foreach($pe
as$Hc=>$le){$Ic=$Hc-$Ye[$D][1];$s=0;foreach($le[0]as$Ie)echo"\n<div class='references' title='".h($ff)."' id='refs$Hc-".($s++)."' style='left: $Ic"."em; top: ".$S["fields"][$Ie]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$Ic)."em;'></div></div>";}}foreach((array)$oe[$D]as$ff=>$pe){foreach($pe
as$Hc=>$e){$Ic=$Hc-$Ye[$D][1];$s=0;foreach($e
as$ef)echo"\n<div class='references' title='".h($ff)."' id='refd$Hc-".($s++)."' style='left: $Ic"."em; top: ".$S["fields"][$ef]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME))."?file=arrow.gif) no-repeat right center;&amp;version=3.4.0'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$Ic)."em;'></div></div>";}}echo"\n</div>\n";}foreach($Ae
as$D=>$S){foreach((array)$S["references"]as$ff=>$pe){foreach($pe
as$Hc=>$le){$dd=$of;$Vc=-10;foreach($le[0]as$y=>$Ie){$Vd=$S["pos"][0]+$S["fields"][$Ie]["pos"];$Wd=$Ae[$ff]["pos"][0]+$Ae[$ff]["fields"][$le[1][$y]]["pos"];$dd=min($dd,$Vd,$Wd);$Vc=max($Vc,$Vd,$Wd);}echo"<div class='references' id='refl$Hc' style='left: $Hc"."em; top: $dd"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Vc-$dd)."em;'></div></div>\n";}}}echo'</div>
<p><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">Permanent link</a>
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST){$Xa="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y)$Xa.="&$y=".urlencode($_POST[$y]);cookie("adminer_export",substr($Xa,1));$Qb=dump_headers(($a!=""?$a:DB),(DB==""||count((array)$_POST["tables"]+(array)$_POST["data"])>1));$zc=($_POST["format"]=="sql");if($zc)echo"-- Adminer $ga ".$qb[DRIVER]." dump
".($x!="sql"?"":"SET NAMES utf8;
SET foreign_key_checks = 0;
SET time_zone = ".q($f->result("SELECT @@time_zone")).";
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
");$R=$_POST["db_style"];$h=array(DB);if(DB==""){$h=$_POST["databases"];if(is_string($h))$h=explode("\n",rtrim(str_replace("\r","",$h),"\n"));}foreach((array)$h
as$i){if($f->select_db($i)){if($zc&&ereg('CREATE',$R)&&($Za=$f->result("SHOW CREATE DATABASE ".idf_escape($i),1))){if($R=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($i).";\n";echo($R=="CREATE+ALTER"?preg_replace('~^CREATE DATABASE ~','\\0IF NOT EXISTS ',$Za):$Za).";\n";}if($zc){if($R)echo
use_sql($i).";\n\n";if(in_array("CREATE+ALTER",array($R,$_POST["table_style"])))echo"SET @adminer_alter = '';\n\n";$Gd="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$we){foreach(get_rows("SHOW $we STATUS WHERE Db = ".q($i),null,"-- ")as$K)$Gd.=($R!='DROP+CREATE'?"DROP $we IF EXISTS ".idf_escape($K["Name"]).";;\n":"").$f->result("SHOW CREATE $we ".idf_escape($K["Name"]),2).";;\n\n";}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$K)$Gd.=($R!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($K["Name"]).";;\n":"").$f->result("SHOW CREATE EVENT ".idf_escape($K["Name"]),3).";;\n\n";}if($Gd)echo"DELIMITER ;;\n\n$Gd"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Mf=array();foreach(table_status()as$T){$S=(DB==""||in_array($T["Name"],(array)$_POST["tables"]));$eb=(DB==""||in_array($T["Name"],(array)$_POST["data"]));if($S||$eb){if(!is_view($T)){if($Qb=="tar")ob_start();$b->dumpTable($T["Name"],($S?$_POST["table_style"]:""));if($eb)$b->dumpData($T["Name"],$_POST["data_style"],"SELECT * FROM ".table($T["Name"]));if($zc&&$_POST["triggers"]&&$S&&($vf=trigger_sql($T["Name"],$_POST["table_style"])))echo"\nDELIMITER ;;\n$vf\nDELIMITER ;\n";if($Qb=="tar")echo
tar_file((DB!=""?"":"$i/")."$T[Name].csv",ob_get_clean());elseif($zc)echo"\n";}elseif($zc)$Mf[]=$T["Name"];}}foreach($Mf
as$Lf)$b->dumpTable($Lf,$_POST["table_style"],true);if($Qb=="tar")echo
pack("x512");}if($R=="CREATE+ALTER"&&$zc){$H="SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";echo"DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _table_name, _engine, _table_collation varchar(64);
DECLARE _table_comment varchar(64);
DECLARE done bool DEFAULT 0;
DECLARE tables CURSOR FOR $H;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN tables;
REPEAT
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN
CASE _table_name";foreach(get_rows($H)as$K){$Qa=q($K["ENGINE"]=="InnoDB"?preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$K["TABLE_COMMENT"]):$K["TABLE_COMMENT"]);echo"
WHEN ".q($K["TABLE_NAME"])." THEN
".(isset($K["ENGINE"])?"IF _engine != '$K[ENGINE]' OR _table_collation != '$K[TABLE_COLLATION]' OR _table_comment != $Qa THEN
ALTER TABLE ".idf_escape($K["TABLE_NAME"])." ENGINE=$K[ENGINE] COLLATE=$K[TABLE_COLLATION] COMMENT=$Qa;
END IF":"BEGIN END").";";}echo"
ELSE
SET alter_command = CONCAT(alter_command, 'DROP TABLE `', REPLACE(_table_name, '`', '``'), '`;\\n');
END CASE;
END IF;
UNTIL done END REPEAT;
CLOSE tables;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";}if(in_array("CREATE+ALTER",array($R,$_POST["table_style"]))&&$zc)echo"SELECT @adminer_alter;\n";}}if($zc)echo"-- ".$f->result("SELECT NOW()")."\n";exit;}page_header('Export',"",($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),DB);echo'
<form action="" method="post">
<table cellspacing="0">
';$hb=array('','USE','DROP+CREATE','CREATE');$af=array('','DROP+CREATE','CREATE');$fb=array('','TRUNCATE+INSERT','INSERT');if($x=="sql"){$hb[]='CREATE+ALTER';$af[]='CREATE+ALTER';$fb[]='INSERT+UPDATE';}parse_str($_COOKIE["adminer_export"],$K);if(!$K)$K=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($K["events"])){$K["routines"]=$K["events"]=($_GET["dump"]=="");$K["triggers"]=$K["table_style"];}echo"<tr><th>".'Output'."<td>".html_select("output",$b->dumpOutput(),$K["output"],0)."\n";echo"<tr><th>".'Format'."<td>".html_select("format",$b->dumpFormat(),$K["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".'Database'."<td>".html_select('db_style',$hb,$K["db_style"]).(support("routine")?checkbox("routines",1,$K["routines"],'Routines'):"").(support("event")?checkbox("events",1,$K["events"],'Events'):"")),"<tr><th>".'Tables'."<td>".html_select('table_style',$af,$K["table_style"]).checkbox("auto_increment",1,$K["auto_increment"],'Auto Increment').(support("trigger")?checkbox("triggers",1,$K["triggers"],'Triggers'):""),"<tr><th>".'Data'."<td>".html_select('data_style',$fb,$K["data_style"]),'</table>
<p><input type="submit" value="Export">
<table cellspacing="0">
';$Zd=array();if(DB!=""){$Ga=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$Ga onclick='formCheck(this, /^tables\\[/);'>".'Tables'."</label>","<th style='text-align: right;'><label>".'Data'."<input type='checkbox' id='check-data'$Ga onclick='formCheck(this, /^data\\[/);'></label>","</thead>\n";$Mf="";foreach(table_status()as$T){$D=$T["Name"];$Yd=ereg_replace("_.*","",$D);$Ga=($a==""||$a==(substr($a,-1)=="%"?"$Yd%":$D));$be="<tr><td>".checkbox("tables[]",$D,$Ga,$D,"formUncheck('check-tables');");if(is_view($T))$Mf.="$be\n";else
echo"$be<td align='right'><label>".($T["Engine"]=="InnoDB"&&$T["Rows"]?"~ ":"").$T["Rows"].checkbox("data[]",$D,$Ga,"","formUncheck('check-data');")."</label>\n";$Zd[$Yd]++;}echo$Mf;}else{echo"<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'".($a==""?" checked":"")." onclick='formCheck(this, /^databases\\[/);'>".'Database'."</label></thead>\n";$h=$b->databases();if($h){foreach($h
as$i){if(!information_schema($i)){$Yd=ereg_replace("_.*","",$i);echo"<tr><td>".checkbox("databases[]",$i,$a==""||$a=="$Yd%",$i,"formUncheck('check-databases');")."</label>\n";$Zd[$Yd]++;}}}else
echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
</form>
';$Xb=true;foreach($Zd
as$y=>$X){if($y!=""&&$X>1){echo($Xb?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$y%")."'>".h($y)."</a>";$Xb=false;}}}elseif(isset($_GET["privileges"])){page_header('Privileges');$I=$f->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$r=$I;if(!$I)$I=$f->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($r?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".'Username'."<th>".'Server'."<th>&nbsp;</thead>\n";while($K=$I->fetch_assoc())echo'<tr'.odd().'><td>'.h($K["User"])."<td>".h($K["Host"]).'<td><a href="'.h(ME.'user='.urlencode($K["User"]).'&host='.urlencode($K["Host"])).'">'.'Edit'."</a>\n";if(!$r||DB!="")echo"<tr".odd()."><td><input name='user'><td><input name='host' value='localhost'><td><input type='submit' value='".'Edit'."'>\n";echo"</table>\n","</form>\n",'<p><a href="'.h(ME).'user=">'.'Create user'."</a>";}elseif(isset($_GET["sql"])){if(!$j&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$mc=&get_session("queries");$lc=&$mc[DB];if(!$j&&$_POST["clear"]){$lc=array();redirect(remove_from_uri("history"));}page_header('SQL command',$j);if(!$j&&$_POST){$dc=false;$H=$_POST["query"];if($_POST["webfile"]){$dc=@fopen((file_exists("adminer.sql")?"adminer.sql":(file_exists("adminer.sql.gz")?"compress.zlib://adminer.sql.gz":"compress.bzip2://adminer.sql.bz2")),"rb");$H=($dc?fread($dc,1e6):false);}elseif($_FILES&&$_FILES["sql_file"]["error"]!=UPLOAD_ERR_NO_FILE)$H=get_file("sql_file",true);if(is_string($H)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($H)+memory_get_usage()+8e6));if($H!=""&&strlen($H)<1e6){$G=$H.(ereg(";[ \t\r\n]*\$",$H)?"":";");if(!$lc||reset(end($lc))!=$G)$lc[]=array($G,time());}$Je="(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";if(!ini_bool("session.use_cookies"))session_write_close();$kb=";";$nd=0;$Ab=true;$g=connect();if(is_object($g)&&DB!="")$g->select_db(DB);$Pa=0;$Gb=array();$Nc=0;$Ld='[\'"'.($x=="sql"?'`#':($x=="sqlite"?'`[':($x=="mssql"?'[':''))).']|/\\*|-- |$'.($x=="pgsql"?'|\\$[^$]*\\$':'');$pf=microtime();parse_str($_COOKIE["adminer_export"],$ka);$ub=$b->dumpFormat();unset($ub["sql"]);while($H!=""){if(!$nd&&preg_match("~^$Je*DELIMITER\\s+(.+)~i",$H,$B)){$kb=$B[1];$H=substr($H,strlen($B[0]));}else{preg_match('('.preg_quote($kb)."\\s*|$Ld)",$H,$B,PREG_OFFSET_CAPTURE,$nd);list($o,$Ud)=$B[0];if(!$o&&$dc&&!feof($dc))$H.=fread($dc,1e5);else{if(!$o&&rtrim($H)=="")break;$nd=$Ud+strlen($o);if($o&&rtrim($o)!=$kb){while(preg_match('('.($o=='/*'?'\\*/':($o=='['?']':(ereg('^-- |^#',$o)?"\n":preg_quote($o)."|\\\\."))).'|$)s',$H,$B,PREG_OFFSET_CAPTURE,$nd)){$M=$B[0][0];if(!$M&&$dc&&!feof($dc))$H.=fread($dc,1e5);else{$nd=$B[0][1]+strlen($M);if($M[0]!="\\")break;}}}else{$Ab=false;$G=substr($H,0,$Ud);$Pa++;$be="<pre id='sql-$Pa'><code class='jush-$x'>".shorten_utf8(trim($G),1000)."</code></pre>\n";if(!$_POST["only_errors"]){echo$be;ob_flush();flush();}$Le=microtime();if($f->multi_query($G)&&is_object($g)&&preg_match("~^$Je*USE\\b~isU",$G))$g->query($G);do{$I=$f->store_result();$Bb=microtime();$if=format_time($Le,$Bb).(strlen($G)<1000?" <a href='".h(ME)."sql=".urlencode(trim($G))."'>".'Edit'."</a>":"");if($f->error){echo($_POST["only_errors"]?$be:""),"<p class='error'>".'Error in query'.": ".error()."\n";$Gb[]=" <a href='#sql-$Pa'>$Pa</a>";if($_POST["error_stops"])break
2;}elseif(is_object($I)){$Bd=select($I,$g);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n","<p>".($I->num_rows?lang(array('%d row','%d rows'),$I->num_rows):"").$if;$t="export-$Pa";$Pb=", <a href='#$t' onclick=\"return !toggle('$t');\">".'Export'."</a><span id='$t' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ka["output"])." ".html_select("format",$ub,$ka["format"])."<input type='hidden' name='query' value='".h($G)."'>"." <input type='submit' name='export' value='".'Export'."'><input type='hidden' name='token' value='$U'></span>\n";if($g&&preg_match("~^($Je|\\()*SELECT\\b~isU",$G)&&($Ob=explain($g,$G))){$t="explain-$Pa";echo", <a href='#$t' onclick=\"return !toggle('$t');\">EXPLAIN</a>$Pb","<div id='$t' class='hidden'>\n";select($Ob,$g,($x=="sql"?"http://dev.mysql.com/doc/refman/".substr($f->server_info,0,3)."/en/explain-output.html#explain_":""),$Bd);echo"</div>\n";}else
echo$Pb;echo"</form>\n";}}else{if(preg_match("~^$Je*(CREATE|DROP|ALTER)$Je+(DATABASE|SCHEMA)\\b~isU",$G)){restart_session();set_session("dbs",null);session_write_close();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($f->info)."'>".lang(array('Query executed OK, %d row affected.','Query executed OK, %d rows affected.'),$f->affected_rows)."$if\n";}$Le=$Bb;}while($f->next_result());$Nc+=substr_count($G.$o,"\n");$H=substr($H,$nd);$nd=0;}}}}if($Ab)echo"<p class='message'>".'No commands to execute.'."\n";elseif($_POST["only_errors"])echo"<p class='message'>".lang(array('%d query executed OK.','%d queries executed OK.'),$Pa-count($Gb)).format_time($pf,microtime())."\n";elseif($Gb&&$Pa>1)echo"<p class='error'>".'Error in query'.": ".implode("",$Gb)."\n";}else
echo"<p class='error'>".upload_error($H)."\n";}echo'
<form action="" method="post" enctype="multipart/form-data" id="form">
<p>';$G=$_GET["sql"];if($_POST)$G=$_POST["query"];elseif($_GET["history"]=="all")$G=$lc;elseif($_GET["history"]!="")$G=$lc[$_GET["history"]][0];textarea("query",$G,20);echo($_POST?"":"<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n"),"<p>".(ini_bool("file_uploads")?'File upload'.': <input type="file" name="sql_file"'.($_FILES&&$_FILES["sql_file"]["error"]!=4?'':' onchange="this.form[\'only_errors\'].checked = true;"').'> (&lt; '.ini_get("upload_max_filesize").'B)':'File uploads are disabled.'),'<p>
<input type="submit" value="Execute" title="Ctrl+Enter">
<input type="hidden" name="token" value="',$U,'">
',checkbox("error_stops",1,$_POST["error_stops"],'Stop on error')."\n",checkbox("only_errors",1,$_POST["only_errors"],'Show only errors')."\n";print_fieldset("webfile",'From server',$_POST["webfile"],"document.getElementById('form')['only_errors'].checked = true; ");$Sa=array();foreach(array("gz"=>"zlib","bz2"=>"bz2")as$y=>$X){if(extension_loaded($X))$Sa[]=".$y";}echo
sprintf('Webserver file %s',"<code>adminer.sql".($Sa?"[".implode("|",$Sa)."]":"")."</code>"),' <input type="submit" name="webfile" value="'.'Run file'.'">',"</div></fieldset>\n";if($lc){print_fieldset("history",'History',$_GET["history"]!="");foreach($lc
as$y=>$X){list($G,$if)=$X;echo'<a href="'.h(ME."sql=&history=$y").'">'.'Edit'."</a> <span class='time'>".@date("H:i:s",$if)."</span> <code class='jush-$x'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$G)))),80,"</code>")."<br>\n";}echo"<input type='submit' name='clear' value='".'Clear'."'>\n","<a href='".h(ME."sql=&history=all")."'>".'Edit all'."</a>\n","</div></fieldset>\n";}echo'
</form>
';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$Z=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0]):""):where($_GET));$Ff=(isset($_GET["select"])?$_POST["edit"]:$Z);$l=fields($a);foreach($l
as$D=>$k){if(!isset($k["privileges"][$Ff?"update":"insert"])||$b->fieldName($k)=="")unset($l[$D]);}if($_POST&&!$j&&!isset($_GET["select"])){$A=$_POST["referer"];if($_POST["insert"])$A=($Ff?null:$_SERVER["REQUEST_URI"]);elseif(!ereg('^.+&select=.+$',$A))$A=ME."select=".urlencode($a);if(isset($_POST["delete"]))query_redirect("DELETE".limit1("FROM ".table($a)," WHERE $Z"),$A,'Item has been deleted.');else{$P=array();foreach($l
as$D=>$k){$X=process_input($k);if($X!==false&&$X!==null)$P[idf_escape($D)]=($Ff?"\n".idf_escape($D)." = $X":$X);}if($Ff){if(!$P)redirect($A);query_redirect("UPDATE".limit1(table($a)." SET".implode(",",$P),"\nWHERE $Z"),$A,'Item has been updated.');}else{$I=insert_into($a,$P);$Gc=($I?last_id():0);queries_redirect($A,sprintf('Item%s has been inserted.',($Gc?" $Gc":"")),$I);}}}$Xe=$b->tableName(table_status($a));page_header(($Ff?'Edit':'Insert'),$j,array("select"=>array($a,$Xe)),$Xe);$K=null;if($_POST["save"])$K=(array)$_POST["fields"];elseif($Z){$N=array();foreach($l
as$D=>$k){if(isset($k["privileges"]["select"]))$N[]=($_POST["clone"]&&$k["auto_increment"]?"'' AS ":(ereg("enum|set",$k["type"])?"1*".idf_escape($D)." AS ":"")).idf_escape($D);}$K=array();if($N){$L=get_rows("SELECT".limit(implode(", ",$N)." FROM ".table($a)," WHERE $Z",(isset($_GET["select"])?2:1)));$K=(isset($_GET["select"])&&count($L)!=1?null:reset($L));}}if($K===false)echo"<p class='error'>".'No rows.'."\n";echo'
<form action="" method="post" enctype="multipart/form-data" id="form">
';if($l){echo"<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";foreach($l
as$D=>$k){echo"<tr><th>".$b->fieldName($k);$jb=$_GET["set"][bracket_escape($D)];$Y=($K!==null?($K[$D]!=""&&ereg("enum|set",$k["type"])?(is_array($K[$D])?array_sum($K[$D]):+$K[$D]):$K[$D]):(!$Ff&&$k["auto_increment"]?"":(isset($_GET["select"])?false:($jb!==null?$jb:$k["default"]))));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$k);$p=($_POST["save"]?(string)$_POST["function"][$D]:($Ff&&$k["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if($k["type"]=="timestamp"&&$Y=="CURRENT_TIMESTAMP"){$Y="";$p="now";}input($k,$Y,$p);echo"\n";}echo"</table>\n";}echo'<p>
';if($l){echo"<input type='submit' value='".'Save'."'>\n";if(!isset($_GET["select"]))echo"<input type='submit' name='insert' value='".($Ff?'Save and continue edit':'Save and insert next')."' title='Ctrl+Shift+Enter'>\n";}echo($Ff?"<input type='submit' name='delete' value='".'Delete'."' onclick=\"return confirm('".'Are you sure?'."');\">\n":($_POST||!$l?"":"<script type='text/javascript'>document.getElementById('form').getElementsByTagName('td')[1].firstChild.focus();</script>\n"));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
<input type="hidden" name="save" value="1">
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["create"])){$a=$_GET["create"];$Md=array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST');$ne=referencable_primary($a);$n=array();foreach($ne
as$Xe=>$k)$n[str_replace("`","``",$Xe)."`".str_replace("`","``",$k["field"])]=$Xe;$Ed=array();$Fd=array();if($a!=""){$Ed=fields($a);$Fd=table_status($a);}if($_POST&&!$_POST["fields"])$_POST["fields"]=array();if($_POST&&!$j&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){if($_POST["drop"])query_redirect("DROP TABLE ".table($a),substr(ME,0,-1),'Table has been dropped.');else{$l=array();$Zb=array();ksort($_POST["fields"]);$Dd=reset($Ed);$oa="FIRST";foreach($_POST["fields"]as$y=>$k){$m=$n[$k["type"]];$wf=($m!==null?$ne[$m]:$k);if($k["field"]!=""){if(!$k["has_default"])$k["default"]=null;$jb=eregi_replace(" *on update CURRENT_TIMESTAMP","",$k["default"]);if($jb!=$k["default"]){$k["on_update"]="CURRENT_TIMESTAMP";$k["default"]=$jb;}if($y==$_POST["auto_increment_col"])$k["auto_increment"]=true;$ge=process_field($k,$wf);if($ge!=process_field($Dd,$Dd))$l[]=array($k["orig"],$ge,$oa);if($m!==null)$Zb[idf_escape($k["field"])]=($a!=""?"ADD":" ")." FOREIGN KEY (".idf_escape($k["field"]).") REFERENCES ".table($n[$k["type"]])." (".idf_escape($wf["field"]).")".(ereg("^($sd)\$",$k["on_delete"])?" ON DELETE $k[on_delete]":"");$oa="AFTER ".idf_escape($k["field"]);}elseif($k["orig"]!="")$l[]=array($k["orig"]);if($k["orig"]!="")$Dd=next($Ed);}$Od="";if(in_array($_POST["partition_by"],$Md)){$Pd=array();if($_POST["partition_by"]=='RANGE'||$_POST["partition_by"]=='LIST'){foreach(array_filter($_POST["partition_names"])as$y=>$X){$Y=$_POST["partition_values"][$y];$Pd[]="\nPARTITION ".idf_escape($X)." VALUES ".($_POST["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Od.="\nPARTITION BY $_POST[partition_by]($_POST[partition])".($Pd?" (".implode(",",$Pd)."\n)":($_POST["partitions"]?" PARTITIONS ".(+$_POST["partitions"]):""));}elseif($a!=""&&support("partitioning"))$Od.="\nREMOVE PARTITIONING";$Yc='Table has been altered.';if($a==""){cookie("adminer_engine",$_POST["Engine"]);$Yc='Table has been created.';}$D=trim($_POST["name"]);queries_redirect(ME."table=".urlencode($D),$Yc,alter_table($a,$D,$l,$Zb,$_POST["Comment"],($_POST["Engine"]&&$_POST["Engine"]!=$Fd["Engine"]?$_POST["Engine"]:""),($_POST["Collation"]&&$_POST["Collation"]!=$Fd["Collation"]?$_POST["Collation"]:""),($_POST["Auto_increment"]!=""?+$_POST["Auto_increment"]:""),$Od));}}page_header(($a!=""?'Alter table':'Create table'),$j,array("table"=>$a),$a);$K=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($yf["int"])?"int":(isset($yf["integer"])?"integer":"")))),"partition_names"=>array(""),);if($_POST){$K=$_POST;if($K["auto_increment_col"])$K["fields"][$K["auto_increment_col"]]["auto_increment"]=true;process_fields($K["fields"]);}elseif($a!=""){$K=$Fd;$K["name"]=$a;$K["fields"]=array();if(!$_GET["auto_increment"])$K["Auto_increment"]="";foreach($Ed
as$k){$k["has_default"]=isset($k["default"]);if($k["on_update"])$k["default"].=" ON UPDATE $k[on_update]";$K["fields"][]=$k;}if(support("partitioning")){$ec="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$I=$f->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $ec ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($K["partition_by"],$K["partitions"],$K["partition"])=$I->fetch_row();$K["partition_names"]=array();$K["partition_values"]=array();foreach(get_rows("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $ec AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION")as$ze){$K["partition_names"][]=$ze["PARTITION_NAME"];$K["partition_values"][]=$ze["PARTITION_DESCRIPTION"];}$K["partition_names"][]="";}}$d=collations();$Se=floor(extension_loaded("suhosin")?(min(ini_get("suhosin.request.max_vars"),ini_get("suhosin.post.max_vars"))-13)/10:0);if($Se&&count($K["fields"])>$Se)echo"<p class='error'>".h(sprintf('Maximum number of allowed fields exceeded. Please increase %s and %s.','suhosin.post.max_vars','suhosin.request.max_vars'))."\n";$Db=engines();foreach($Db
as$Cb){if(!strcasecmp($Cb,$K["Engine"])){$K["Engine"]=$Cb;break;}}echo'
<form action="" method="post" id="form">
<p>
Table name: <input name="name" maxlength="64" value="',h($K["name"]),'">
';if($a==""&&!$_POST){?><script type='text/javascript'>document.getElementById('form')['name'].focus();</script><?php }echo($Db?html_select("Engine",array(""=>"(".'engine'.")")+$Db,$K["Engine"]):""),' ',($d&&!ereg("sqlite|mssql",$x)?html_select("Collation",array(""=>"(".'collation'.")")+$d,$K["Collation"]):""),' <input type="submit" value="Save">
<table cellspacing="0" id="edit-fields" class="nowrap">
';$Ra=($_POST?$_POST["comments"]:$K["Comment"]!="");if(!$_POST&&!$Ra){foreach($K["fields"]as$k){if($k["comment"]!=""){$Ra=true;break;}}}edit_fields($K["fields"],$d,"TABLE",$Se,$n,$Ra);echo'</table>
<p>
Auto Increment: <input name="Auto_increment" size="6" value="',h($K["Auto_increment"]),'">
<label class="jsonly"><input type="checkbox" name="defaults" value="1"',($_POST["defaults"]?" checked":""),' onclick="columnShow(this.checked, 5);">Default values</label>
',(support("comment")?checkbox("comments",1,$Ra,'Comment',"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();",true).' <input id="Comment" name="Comment" value="'.h($K["Comment"]).'" maxlength="60"'.($Ra?'':' class="hidden"').'>':''),'<p>
<input type="submit" value="Save">
';if($_GET["create"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
';if(support("partitioning")){$Nd=ereg('RANGE|LIST',$K["partition_by"]);print_fieldset("partition",'Partition by',$K["partition_by"]);echo'<p>
',html_select("partition_by",array(-1=>"")+$Md,$K["partition_by"],"partitionByChange(this);"),'(<input name="partition" value="',h($K["partition"]),'">)
Partitions: <input name="partitions" size="2" value="',h($K["partitions"]),'"',($Nd||!$K["partition_by"]?" class='hidden'":""),'>
<table cellspacing="0" id="partition-table"',($Nd?"":" class='hidden'"),'>
<thead><tr><th>Partition name<th>Values</thead>
';foreach($K["partition_names"]as$y=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'"'.($y==count($K["partition_names"])-1?' onchange="partitionNameChange(this);"':'').'>','<td><input name="partition_values[]" value="'.h($K["partition_values"][$y]).'">';}echo'</table>
</div></fieldset>
';}echo'</form>
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$tc=array("PRIMARY","UNIQUE","INDEX");$T=table_status($a);if(eregi("MyISAM|M?aria",$T["Engine"]))$tc[]="FULLTEXT";$v=indexes($a);if($x=="sqlite"){unset($tc[0]);unset($v[""]);}if($_POST&&!$j&&!$_POST["add"]){$ra=array();foreach($_POST["indexes"]as$u){$D=$u["name"];if(in_array($u["type"],$tc)){$e=array();$Mc=array();$P=array();ksort($u["columns"]);foreach($u["columns"]as$y=>$Na){if($Na!=""){$Lc=$u["lengths"][$y];$P[]=idf_escape($Na).($Lc?"(".(+$Lc).")":"");$e[]=$Na;$Mc[]=($Lc?$Lc:null);}}if($e){$Nb=$v[$D];if($Nb){ksort($Nb["columns"]);ksort($Nb["lengths"]);if($u["type"]==$Nb["type"]&&array_values($Nb["columns"])===$e&&(!$Nb["lengths"]||array_values($Nb["lengths"])===$Mc)){unset($v[$D]);continue;}}$ra[]=array($u["type"],$D,"(".implode(", ",$P).")");}}}foreach($v
as$D=>$Nb)$ra[]=array($Nb["type"],$D,"DROP");if(!$ra)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),'Indexes have been altered.',alter_indexes($a,$ra));}page_header('Indexes',$j,array("table"=>$a),$a);$l=array_keys(fields($a));$K=array("indexes"=>$v);if($_POST){$K=$_POST;if($_POST["add"]){foreach($K["indexes"]as$y=>$u){if($u["columns"][count($u["columns"])]!="")$K["indexes"][$y]["columns"][]="";}$u=end($K["indexes"]);if($u["type"]||array_filter($u["columns"],'strlen')||array_filter($u["lengths"],'strlen'))$K["indexes"][]=array("columns"=>array(1=>""));}}else{foreach($K["indexes"]as$y=>$u){$K["indexes"][$y]["name"]=$y;$K["indexes"][$y]["columns"][]="";}$K["indexes"][]=array("columns"=>array(1=>""));}echo'
<form action="" method="post">
<table cellspacing="0" class="nowrap">
<thead><tr><th>Index Type<th>Column (length)<th>Name</thead>
';$w=1;foreach($K["indexes"]as$u){echo"<tr><td>".html_select("indexes[$w][type]",array(-1=>"")+$tc,$u["type"],($w==count($K["indexes"])?"indexesAddRow(this);":1))."<td>";ksort($u["columns"]);$s=1;foreach($u["columns"]as$y=>$Na){echo"<span>".html_select("indexes[$w][columns][$s]",array(-1=>"")+$l,$Na,($s==count($u["columns"])?"indexesAddColumn":"indexesChangeColumn")."(this, '".js_escape($x=="sql"?"":$_GET["indexes"]."_")."');"),"<input name='indexes[$w][lengths][$s]' size='2' value='".h($u["lengths"][$y])."'> </span>";$s++;}echo"<td><input name='indexes[$w][name]' value='".h($u["name"])."'>\n";$w++;}echo'</table>
<p>
<input type="submit" value="Save">
<noscript><p><input type="submit" name="add" value="Add next"></noscript>
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["database"])){if($_POST&&!$j&&!isset($_POST["add_x"])){restart_session();$D=trim($_POST["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),'Database has been dropped.',drop_databases(array(DB)));}elseif(DB!==$D){if(DB!=""){$_GET["db"]=$D;queries_redirect(preg_replace('~db=[^&]*&~','',ME)."db=".urlencode($D),'Database has been renamed.',rename_database($D,$_POST["collation"]));}else{$h=explode("\n",str_replace("\r","",$D));$Qe=true;$Fc="";foreach($h
as$i){if(count($h)==1||$i!=""){if(!create_database($i,$_POST["collation"]))$Qe=false;$Fc=$i;}}queries_redirect(ME."db=".urlencode($Fc),'Database has been created.',$Qe);}}else{if(!$_POST["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($D).(eregi('^[a-z0-9_]+$',$_POST["collation"])?" COLLATE $_POST[collation]":""),substr(ME,0,-1),'Database has been altered.');}}page_header(DB!=""?'Alter database':'Create database',$j,array(),DB);$d=collations();$D=DB;$Ka=null;if($_POST){$D=$_POST["name"];$Ka=$_POST["collation"];}elseif(DB!="")$Ka=db_collation(DB,$d);elseif($x=="sql"){foreach(get_vals("SHOW GRANTS")as$r){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~',$r,$B)&&$B[1]){$D=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
<form action="" method="post">
<p>
',($_POST["add_x"]||strpos($D,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($D).'</textarea><br>':'<input id="name" name="name" value="'.h($D).'" maxlength="64">')."\n".($d?html_select("collation",array(""=>"(".'collation'.")")+$d,$Ka):"");?>
<script type='text/javascript'>document.getElementById('name').focus();</script>
<input type="submit" value="Save">
<?php
if(DB!="")echo"<input type='submit' name='drop' value='".'Drop'."'".confirm().">\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type='image' name='add' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&amp;version=3.4.0' alt='+' title='".'Add next'."'>\n";echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header('Call'.": ".h($da),$j);$we=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$sc=array();$Gd=array();foreach($we["fields"]as$s=>$k){if(substr($k["inout"],-3)=="OUT")$Gd[$s]="@".idf_escape($k["field"])." AS ".idf_escape($k["field"]);if(!$k["inout"]||substr($k["inout"],0,2)=="IN")$sc[]=$s;}if(!$j&&$_POST){$Da=array();foreach($we["fields"]as$y=>$k){if(in_array($y,$sc)){$X=process_input($k);if($X===false)$X="''";if(isset($Gd[$y]))$f->query("SET @".idf_escape($k["field"])." = $X");}$Da[]=(isset($Gd[$y])?"@".idf_escape($k["field"]):$X);}$H=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Da).")";echo"<p><code class='jush-$x'>".h($H)."</code> <a href='".h(ME)."sql=".urlencode($H)."'>".'Edit'."</a>\n";if(!$f->multi_query($H))echo"<p class='error'>".error()."\n";else{$g=connect();if(is_object($g))$g->select_db(DB);do{$I=$f->store_result();if(is_object($I))select($I,$g);else
echo"<p class='message'>".lang(array('Routine has been called, %d row affected.','Routine has been called, %d rows affected.'),$f->affected_rows)."\n";}while($f->next_result());if($Gd)select($f->query("SELECT ".implode(", ",$Gd)));}}echo'
<form action="" method="post">
';if($sc){echo"<table cellspacing='0'>\n";foreach($sc
as$y){$k=$we["fields"][$y];$D=$k["field"];echo"<tr><th>".$b->fieldName($k);$Y=$_POST["fields"][$D];if($Y!=""){if($k["type"]=="enum")$Y=+$Y;if($k["type"]=="set")$Y=array_sum($Y);}input($k,$Y,(string)$_POST["function"][$D]);echo"\n";}echo"</table>\n";}echo'<p>
<input type="submit" value="Call">
<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];if($_POST&&!$j&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){if($_POST["drop"])query_redirect("ALTER TABLE ".table($a)."\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($_GET["name"]),ME."table=".urlencode($a),'Foreign key has been dropped.');else{$Ie=array_filter($_POST["source"],'strlen');ksort($Ie);$ef=array();foreach($Ie
as$y=>$X)$ef[$y]=$_POST["target"][$y];query_redirect("ALTER TABLE ".table($a).($_GET["name"]!=""?"\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($_GET["name"]).",":"")."\nADD FOREIGN KEY (".implode(", ",array_map('idf_escape',$Ie)).") REFERENCES ".table($_POST["table"])." (".implode(", ",array_map('idf_escape',$ef)).")".(ereg("^($sd)\$",$_POST["on_delete"])?" ON DELETE $_POST[on_delete]":"").(ereg("^($sd)\$",$_POST["on_update"])?" ON UPDATE $_POST[on_update]":""),ME."table=".urlencode($a),($_GET["name"]!=""?'Foreign key has been altered.':'Foreign key has been created.'));$j='Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.'."<br>$j";}}page_header('Foreign key',$j,array("table"=>$a),$a);$K=array("table"=>$a,"source"=>array(""));if($_POST){$K=$_POST;ksort($K["source"]);if($_POST["add"])$K["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$K["target"]=array();}elseif($_GET["name"]!=""){$n=foreign_keys($a);$K=$n[$_GET["name"]];$K["source"][]="";}$Ie=array_keys(fields($a));$ef=($a===$K["table"]?$Ie:array_keys(fields($K["table"])));$me=array();foreach(table_status()as$D=>$T){if(fk_support($T))$me[]=$D;}echo'
<form action="" method="post">
<p>
';if($K["db"]==""&&$K["ns"]==""){echo'Target table:
',html_select("table",$me,$K["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'<input type="hidden" name="change-js" value="">
<noscript><p><input type="submit" name="change" value="Change"></noscript>
<table cellspacing="0">
<thead><tr><th>Source<th>Target</thead>
';$w=0;foreach($K["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$Ie,$X,($w==count($K["source"])-1?"foreignAddRow(this);":1)),"<td>".html_select("target[".(+$y)."]",$ef,$K["target"][$y]);$w++;}echo'</table>
<p>
ON DELETE: ',html_select("on_delete",array(-1=>"")+explode("|",$sd),$K["on_delete"]),' ON UPDATE: ',html_select("on_update",array(-1=>"")+explode("|",$sd),$K["on_update"]),'<p>
<input type="submit" value="Save">
<noscript><p><input type="submit" name="add" value="Add column"></noscript>
';}if($_GET["name"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$sb=false;if($_POST&&!$j){$D=trim($_POST["name"]);$sb=drop_create("DROP VIEW ".table($a),"CREATE VIEW ".table($D)." AS\n$_POST[select]",($_POST["drop"]?substr(ME,0,-1):ME."table=".urlencode($D)),'View has been dropped.','View has been altered.','View has been created.',$a);}page_header(($a!=""?'Alter view':'Create view'),$j,array("table"=>$a),$a);$K=$_POST;if(!$K&&$a!=""){$K=view($a);$K["name"]=$a;}echo'
<form action="" method="post">
<p>Name: <input name="name" value="',h($K["name"]),'" maxlength="64">
<p>';textarea("select",$K["select"]);echo'<p>
';if($sb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="submit" value="Save">
';if($_GET["view"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$yc=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Ne=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");if($_POST&&!$j){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),'Event has been dropped.');elseif(in_array($_POST["INTERVAL_FIELD"],$yc)&&isset($Ne[$_POST["STATUS"]])){$_e="\nON SCHEDULE ".($_POST["INTERVAL_VALUE"]?"EVERY ".q($_POST["INTERVAL_VALUE"])." $_POST[INTERVAL_FIELD]".($_POST["STARTS"]?" STARTS ".q($_POST["STARTS"]):"").($_POST["ENDS"]?" ENDS ".q($_POST["ENDS"]):""):"AT ".q($_POST["STARTS"]))." ON COMPLETION".($_POST["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?'Event has been altered.':'Event has been created.'),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$_e.($aa!=$_POST["EVENT_NAME"]?"\nRENAME TO ".idf_escape($_POST["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($_POST["EVENT_NAME"]).$_e)."\n".$Ne[$_POST["STATUS"]]." COMMENT ".q($_POST["EVENT_COMMENT"]).rtrim(" DO\n$_POST[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?'Alter event'.": ".h($aa):'Create event'),$j);$K=$_POST;if(!$K&&$aa!=""){$L=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$K=reset($L);}echo'
<form action="" method="post">
<table cellspacing="0">
<tr><th>Name<td><input name="EVENT_NAME" value="',h($K["EVENT_NAME"]),'" maxlength="64">
<tr><th>Start<td><input name="STARTS" value="',h("$K[EXECUTE_AT]$K[STARTS]"),'">
<tr><th>End<td><input name="ENDS" value="',h($K["ENDS"]),'">
<tr><th>Every<td><input name="INTERVAL_VALUE" value="',h($K["INTERVAL_VALUE"]),'" size="6"> ',html_select("INTERVAL_FIELD",$yc,$K["INTERVAL_FIELD"]),'<tr><th>Status<td>',html_select("STATUS",$Ne,$K["STATUS"]),'<tr><th>Comment<td><input name="EVENT_COMMENT" value="',h($K["EVENT_COMMENT"]),'" maxlength="64">
<tr><th>&nbsp;<td>',checkbox("ON_COMPLETION","PRESERVE",$K["ON_COMPLETION"]=="PRESERVE",'On completion preserve'),'</table>
<p>';textarea("EVENT_DEFINITION",$K["EVENT_DEFINITION"]);echo'<p>
<input type="submit" value="Save">
';if($aa!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$we=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$xe=routine_languages();$sb=false;if($_POST&&!$j&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){$P=array();$l=(array)$_POST["fields"];ksort($l);foreach($l
as$k){if($k["field"]!="")$P[]=(ereg("^($vc)\$",$k["inout"])?"$k[inout] ":"").idf_escape($k["field"]).process_type($k,"CHARACTER SET");}$sb=drop_create("DROP $we ".idf_escape($da),"CREATE $we ".idf_escape(trim($_POST["name"]))." (".implode(", ",$P).")".(isset($_GET["function"])?" RETURNS".process_type($_POST["returns"],"CHARACTER SET"):"").(in_array($_POST["language"],$xe)?" LANGUAGE $_POST[language]":"").rtrim("\n$_POST[definition]",";").";",substr(ME,0,-1),'Routine has been dropped.','Routine has been altered.','Routine has been created.',$da);}page_header(($da!=""?(isset($_GET["function"])?'Alter function':'Alter procedure').": ".h($da):(isset($_GET["function"])?'Create function':'Create procedure')),$j);$d=get_vals("SHOW CHARACTER SET");sort($d);$K=array("fields"=>array());if($_POST){$K=$_POST;$K["fields"]=(array)$K["fields"];process_fields($K["fields"]);}elseif($da!=""){$K=routine($da,$we);$K["name"]=$da;}echo'
<form action="" method="post" id="form">
<p>Name: <input name="name" value="',h($K["name"]),'" maxlength="64">
',($xe?'Language'.": ".html_select("language",$xe,$K["language"]):""),'<table cellspacing="0" class="nowrap">
';edit_fields($K["fields"],$d,$we);if(isset($_GET["function"])){echo"<tr><td>".'Return type';edit_type("returns",$K["returns"],$d);}echo'</table>
<p>';textarea("definition",$K["definition"]);echo'<p>
<input type="submit" value="Save">
';if($da!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}if($sb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$uf=trigger_options();$tf=array("INSERT","UPDATE","DELETE");$sb=false;if($_POST&&!$j&&in_array($_POST["Timing"],$uf["Timing"])&&in_array($_POST["Event"],$tf)&&in_array($_POST["Type"],$uf["Type"])){$jf=" $_POST[Timing] $_POST[Event]";$rd=" ON ".table($a);$sb=drop_create("DROP TRIGGER ".idf_escape($_GET["name"]).($x=="pgsql"?$rd:""),"CREATE TRIGGER ".idf_escape($_POST["Trigger"]).($x=="mssql"?$rd.$jf:$jf.$rd).rtrim(" $_POST[Type]\n$_POST[Statement]",";").";",ME."table=".urlencode($a),'Trigger has been dropped.','Trigger has been altered.','Trigger has been created.',$_GET["name"]);}page_header(($_GET["name"]!=""?'Alter trigger'.": ".h($_GET["name"]):'Create trigger'),$j,array("table"=>$a));$K=$_POST;if(!$K)$K=trigger($_GET["name"])+array("Trigger"=>$a."_bi");echo'
<form action="" method="post" id="form">
<table cellspacing="0">
<tr><th>Time<td>',html_select("Timing",$uf["Timing"],$K["Timing"],"if (/^".preg_quote($a,"/")."_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '".js_escape($a)."_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"),'<tr><th>Event<td>',html_select("Event",$tf,$K["Event"],"this.form['Timing'].onchange();"),'<tr><th>Type<td>',html_select("Type",$uf["Type"],$K["Type"]),'</table>
<p>Name: <input name="Trigger" value="',h($K["Trigger"]),'" maxlength="64">
<p>';textarea("Statement",$K["Statement"]);echo'<p>
<input type="submit" value="Save">
';if($_GET["name"]!=""){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}if($sb){echo'<input type="hidden" name="dropped" value="1">';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["user"])){$fa=$_GET["user"];$ee=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$K){foreach(explode(",",($K["Privilege"]=="Grant option"?"":$K["Context"]))as$Wa)$ee[$Wa][$K["Privilege"]]=$K["Comment"];}$ee["Server Admin"]+=$ee["File access on server"];$ee["Databases"]["Create routine"]=$ee["Procedures"]["Create routine"];unset($ee["Procedures"]["Create routine"]);$ee["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$ee["Columns"][$X]=$ee["Tables"][$X];unset($ee["Server Admin"]["Usage"]);foreach($ee["Tables"]as$y=>$X)unset($ee["Databases"][$y]);$id=array();if($_POST){foreach($_POST["objects"]as$y=>$X)$id[$X]=(array)$id[$X]+(array)$_POST["grants"][$y];}$gc=array();$pd="";if(isset($_GET["host"])&&($I=$f->query("SHOW GRANTS FOR ".q($fa)."@".q($_GET["host"])))){while($K=$I->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$K[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$B[1],$Rc,PREG_SET_ORDER)){foreach($Rc
as$X){if($X[1]!="USAGE")$gc["$B[2]$X[2]"][$X[1]]=true;if(ereg(' WITH GRANT OPTION',$K[0]))$gc["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$K[0],$B))$pd=$B[1];}}if($_POST&&!$j){$qd=(isset($_GET["host"])?q($fa)."@".q($_GET["host"]):"''");$jd=q($_POST["user"])."@".q($_POST["host"]);$Qd=q($_POST["pass"]);if($_POST["drop"])query_redirect("DROP USER $qd",ME."privileges=",'User has been dropped.');else{$bb=false;if($qd!=$jd){$bb=queries(($f->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." $jd IDENTIFIED BY".($_POST["hashed"]?" PASSWORD":"")." $Qd");$j=!$bb;}elseif($_POST["pass"]!=$pd||!$_POST["hashed"])queries("SET PASSWORD FOR $jd = ".($_POST["hashed"]?$Qd:"PASSWORD($Qd)"));if(!$j){$te=array();foreach($id
as$md=>$r){if(isset($_GET["grant"]))$r=array_filter($r);$r=array_keys($r);if(isset($_GET["grant"]))$te=array_diff(array_keys(array_filter($id[$md],'strlen')),$r);elseif($qd==$jd){$od=array_keys((array)$gc[$md]);$te=array_diff($od,$r);$r=array_diff($r,$od);unset($gc[$md]);}if(preg_match('~^(.+)\\s*(\\(.*\\))?$~U',$md,$B)&&(!grant("REVOKE",$te,$B[2]," ON $B[1] FROM $jd")||!grant("GRANT",$r,$B[2]," ON $B[1] TO $jd"))){$j=true;break;}}}if(!$j&&isset($_GET["host"])){if($qd!=$jd)queries("DROP USER $qd");elseif(!isset($_GET["grant"])){foreach($gc
as$md=>$te){if(preg_match('~^(.+)(\\(.*\\))?$~U',$md,$B))grant("REVOKE",array_keys($te),$B[2]," ON $B[1] FROM $jd");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?'User has been altered.':'User has been created.'),!$j);if($bb)$f->query("DROP USER $jd");}}page_header((isset($_GET["host"])?'Username'.": ".h("$fa@$_GET[host]"):'Create user'),$j,array("privileges"=>array('','Privileges')));if($_POST){$K=$_POST;$gc=$id;}else{$K=$_GET+array("host"=>$f->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$K["pass"]=$pd;if($pd!="")$K["hashed"]=true;$gc[(DB!=""&&!isset($_GET["host"])?idf_escape(addcslashes(DB,"%_")):"").".*"]=array();}echo'<form action="" method="post">
<table cellspacing="0">
<tr><th>Server<td><input name="host" maxlength="60" value="',h($K["host"]),'">
<tr><th>Username<td><input name="user" maxlength="16" value="',h($K["user"]),'">
<tr><th>Password<td><input id="pass" name="pass" value="',h($K["pass"]),'">
';if(!$K["hashed"]){echo'<script type="text/javascript">typePassword(document.getElementById(\'pass\'));</script>';}echo
checkbox("hashed",1,$K["hashed"],'Hashed',"typePassword(this.form['pass'], this.checked);"),'</table>
';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'><a href='http://dev.mysql.com/doc/refman/".substr($f->server_info,0,3)."/en/grant.html#priv_level' target='_blank' rel='noreferrer'>".'Privileges'."</a>";$s=0;foreach($gc
as$md=>$r){echo'<th>'.($md!="*.*"?"<input name='objects[$s]' value='".h($md)."' size='10'>":"<input type='hidden' name='objects[$s]' value='*.*' size='10'>*.*");$s++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>'Server',"Databases"=>'Database',"Tables"=>'Table',"Columns"=>'Column',"Procedures"=>'Routine',)as$Wa=>$lb){foreach((array)$ee[$Wa]as$de=>$Qa){echo"<tr".odd()."><td".($lb?">$lb<td":" colspan='2'").' lang="en" title="'.h($Qa).'">'.h($de);$s=0;foreach($gc
as$md=>$r){$D="'grants[$s][".h(strtoupper($de))."]'";$Y=$r[strtoupper($de)];if($Wa=="Server Admin"&&$md!=(isset($gc["*.*"])?"*.*":".*"))echo"<td>&nbsp;";elseif(isset($_GET["grant"]))echo"<td><select name=$D><option><option value='1'".($Y?" selected":"").">".'Grant'."<option value='0'".($Y=="0"?" selected":"").">".'Revoke'."</select>";else
echo"<td align='center'><input type='checkbox' name=$D value='1'".($Y?" checked":"").($de=="All privileges"?" id='grants-$s-all'":($de=="Grant option"?"":" onclick=\"if (this.checked) formUncheck('grants-$s-all');\"")).">";$s++;}}}echo"</table>\n",'<p>
<input type="submit" value="Save">
';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="Drop"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$j){$Cc=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".(+$X)))$Cc++;}queries_redirect(ME."processlist=",lang(array('%d process has been killed.','%d processes have been killed.'),$Cc),$Cc||!$_POST["kill"]);}page_header('Process list',$j);echo'
<form action="" method="post">
<table cellspacing="0" onclick="tableClick(event);" class="nowrap checkable">
';$s=-1;foreach(process_list()as$s=>$K){if(!$s)echo"<thead><tr lang='en'>".(support("kill")?"<th>&nbsp;":"")."<th>".implode("<th>",array_keys($K))."</thead>\n";echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$K["Id"],0):"");foreach($K
as$y=>$X)echo"<td>".(($x=="sql"&&$y=="Info"&&$K["Command"]=="Query"&&$X!="")||($x=="pgsql"&&$y=="current_query"&&$X!="<IDLE>")||($x=="oracle"&&$y=="sql_text"&&$X!="")?"<code class='jush-$x'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($K["db"]!=""?"db=".urlencode($K["db"])."&":"")."sql=".urlencode($X)).'">'.'Edit'.'</a>':nbsp($X));echo"\n";}echo'</table>
<script type=\'text/javascript\'>tableCheck();</script>
<p>
';if(support("kill")){echo($s+1)."/".sprintf('%d in total',$f->result("SELECT @@max_connections")),"<p><input type='submit' value='".'Kill'."'>\n";}echo'<input type="hidden" name="token" value="',$U,'">
</form>
';}elseif(isset($_GET["select"])){$a=$_GET["select"];$T=table_status($a);$v=indexes($a);$l=fields($a);$n=column_foreign_keys($a);if($T["Oid"]=="t")$v[]=array("type"=>"PRIMARY","columns"=>array("oid"));parse_str($_COOKIE["adminer_import"],$la);$ue=array();$e=array();$hf=null;foreach($l
as$y=>$k){$D=$b->fieldName($k);if(isset($k["privileges"]["select"])&&$D!=""){$e[$y]=html_entity_decode(strip_tags($D));if(ereg('text|lob',$k["type"]))$hf=$b->selectLengthProcess();}$ue+=$k["privileges"];}list($N,$hc)=$b->selectColumnsProcess($e,$v);$Z=$b->selectSearchProcess($l,$v);$zd=$b->selectOrderProcess($l,$v);$z=$b->selectLimitProcess();$ec=($N?implode(", ",$N):($T["Oid"]=="t"?"oid, ":"")."*")."\nFROM ".table($a);$ic=($hc&&count($hc)<count($N)?"\nGROUP BY ".implode(", ",$hc):"").($zd?"\nORDER BY ".implode(", ",$zd):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Bf=>$K)echo$f->result("SELECT".limit(idf_escape(key($K))." FROM ".table($a)," WHERE ".where_check($Bf).($Z?" AND ".implode(" AND ",$Z):"").($zd?" ORDER BY ".implode(", ",$zd):""),1));exit;}if($_POST&&!$j){$Qf="(".implode(") OR (",array_map('where_check',(array)$_POST["check"])).")";$ae=$Df=null;foreach($v
as$u){if($u["type"]=="PRIMARY"){$ae=array_flip($u["columns"]);$Df=($N?$ae:array());break;}}foreach((array)$Df
as$y=>$X){if(in_array(idf_escape($y),$N))unset($Df[$y]);}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$Df===array()){$Pf=$Z;if(is_array($_POST["check"]))$Pf[]="($Qf)";$H="SELECT $ec".($Pf?"\nWHERE ".implode(" AND ",$Pf):"").$ic;}else{$_f=array();foreach($_POST["check"]as$X)$_f[]="(SELECT".limit($ec,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X).$ic,1).")";$H=implode(" UNION ALL ",$_f);}$b->dumpData($a,"table",$H);exit;}if(!$b->selectEmailProcess($Z,$n)){if($_POST["save"]||$_POST["delete"]){$I=true;$ma=0;$H=table($a);$P=array();if(!$_POST["delete"]){foreach($e
as$D=>$X){$X=process_input($l[$D]);if($X!==null){if($_POST["clone"])$P[idf_escape($D)]=($X!==false?$X:idf_escape($D));elseif($X!==false)$P[]=idf_escape($D)." = $X";}}$H.=($_POST["clone"]?" (".implode(", ",array_keys($P)).")\nSELECT ".implode(", ",$P)."\nFROM ".table($a):" SET\n".implode(",\n",$P));}if($_POST["delete"]||$P){$Oa="UPDATE";if($_POST["delete"]){$Oa="DELETE";$H="FROM $H";}if($_POST["clone"]){$Oa="INSERT";$H="INTO $H";}if($_POST["all"]||($Df===array()&&$_POST["check"])||count($hc)<count($N)){$I=queries($Oa." $H".($_POST["all"]?($Z?"\nWHERE ".implode(" AND ",$Z):""):"\nWHERE $Qf"));$ma=$f->affected_rows;}else{foreach((array)$_POST["check"]as$X){$I=queries($Oa.limit1($H,"\nWHERE ".where_check($X)));if(!$I)break;$ma+=$f->affected_rows;}}}queries_redirect(remove_from_uri("page"),lang(array('%d item has been affected.','%d items have been affected.'),$ma),$I);}elseif(!$_POST["import"]){if(!$_POST["val"])$j='Double click on a value to modify it.';else{$I=true;$ma=0;foreach($_POST["val"]as$Bf=>$K){$P=array();foreach($K
as$y=>$X){$y=bracket_escape($y,1);$P[]=idf_escape($y)." = ".(ereg('char|text',$l[$y]["type"])||$X!=""?$b->processInput($l[$y],$X):"NULL");}$H=table($a)." SET ".implode(", ",$P);$Pf=" WHERE ".where_check($Bf).($Z?" AND ".implode(" AND ",$Z):"");$I=queries("UPDATE".(count($hc)<count($N)?" $H$Pf":limit1($H,$Pf)));if(!$I)break;$ma+=$f->affected_rows;}queries_redirect(remove_from_uri(),lang(array('%d item has been affected.','%d items have been affected.'),$ma),$I);}}elseif(is_string($Ub=get_file("csv_file",true))){cookie("adminer_import","output=".urlencode($la["output"])."&format=".urlencode($_POST["separator"]));$I=true;$Ma=array_keys($l);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$Ub,$Rc);$ma=count($Rc[0]);begin();$Ee=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));foreach($Rc[0]as$y=>$X){preg_match_all("~((\"[^\"]*\")+|[^$Ee]*)$Ee~",$X.$Ee,$Sc);if(!$y&&!array_diff($Sc[1],$Ma)){$Ma=$Sc[1];$ma--;}else{$P=array();foreach($Sc[1]as$s=>$Ja)$P[idf_escape($Ma[$s])]=($Ja==""&&$l[$Ma[$s]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$Ja))));$I=insert_update($a,$P,$ae);if(!$I)break;}}if($I)queries("COMMIT");queries_redirect(remove_from_uri("page"),lang(array('%d row has been imported.','%d rows have been imported.'),$ma),$I);queries("ROLLBACK");}else$j=upload_error($Ub);}}$Xe=$b->tableName($T);page_header('Select'.": $Xe",$j);session_write_close();$P=null;if(isset($ue["insert"])){$P="";foreach((array)$_GET["where"]as$X){if(count($n[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!ereg('[_%]',$X["val"]))))$P.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($T,$P);if(!$e)echo"<p class='error'>".'Unable to select the table'.($l?".":": ".error())."\n";else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($N,$e);$b->selectSearchPrint($Z,$e,$v);$b->selectOrderPrint($zd,$e,$v);$b->selectLimitPrint($z);$b->selectLengthPrint($hf);$b->selectActionPrint($v);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$cc=$f->result("SELECT COUNT(*) FROM ".table($a).($Z?" WHERE ".implode(" AND ",$Z):""));$E=floor(max(0,$cc-1)/$z);}$H="SELECT".limit((+$z&&$hc&&count($hc)<count($N)&&$x=="sql"?"SQL_CALC_FOUND_ROWS ":"").$ec,($Z?"\nWHERE ".implode(" AND ",$Z):"").$ic,($z!=""?+$z:null),($E?$z*$E:0),"\n");echo$b->selectQuery($H);$I=$f->query($H);if(!$I)echo"<p class='error'>".error()."\n";else{if($x=="mssql")$I->seek($z*$E);$_b=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$L=array();while($K=$I->fetch_assoc()){if($E&&$x=="oracle")unset($K["RNUM"]);$L[]=$K;}if($_GET["page"]!="last")$cc=(+$z&&$hc&&count($hc)<count($N)?($x=="sql"?$f->result(" SELECT FOUND_ROWS()"):$f->result("SELECT COUNT(*) FROM ($H) x")):count($L));if(!$L)echo"<p class='message'>".'No rows.'."\n";else{$ya=$b->backwardKeys($a,$Xe);echo"<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n","<thead><tr>".(!$hc&&$N?"":"<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".'edit'."</a>");$hd=array();$q=array();reset($N);$je=1;foreach($L[0]as$y=>$X){if($T["Oid"]!="t"||$y!="oid"){$X=$_GET["columns"][key($N)];$k=$l[$N?($X?$X["col"]:current($N)):$y];$D=($k?$b->fieldName($k,$je):"*");if($D!=""){$je++;$hd[$y]=$D;$Na=idf_escape($y);$oc=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($y);echo'<th><a href="'.h($oc).'">'.(!$N||$X?apply_sql_function($X["fun"],$D):h(current($N)))."</a>";echo"<a href='".h("$oc&desc%5B0%5D=1")."' title='".'descending'."' class='text'> ↓</a>";}$q[$y]=$X["fun"];next($N);}}$Mc=array();if($_GET["modify"]){foreach($L
as$K){foreach($K
as$y=>$X)$Mc[$y]=max($Mc[$y],min(40,strlen(utf8_decode($X))));}}echo($ya?"<th>".'Relations':"")."</thead>\n";foreach($b->rowDescriptions($L,$n)as$C=>$K){$Af=unique_array($L[$C],$v);$Bf="";foreach($Af
as$y=>$X)$Bf.="&".($X!==null?urlencode("where[".bracket_escape($y)."]")."=".urlencode($X):"null%5B%5D=".urlencode($y));echo"<tr".odd().">".(!$hc&&$N?"":"<td>".checkbox("check[]",substr($Bf,1),in_array(substr($Bf,1),(array)$_POST["check"]),"","this.form['all'].checked = false; formUncheck('all-page');").(count($hc)<count($N)||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Bf)."'>".'edit'."</a>"));foreach($K
as$y=>$X){if(isset($hd[$y])){$k=$l[$y];if($X!=""&&(!isset($_b[$y])||$_b[$y]!=""))$_b[$y]=(is_mail($X)?$hd[$y]:"");$_="";$X=$b->editVal($X,$k);if($X!==null){if(ereg('blob|bytea|raw|file',$k["type"])&&$X!="")$_=h(ME.'download='.urlencode($a).'&field='.urlencode($y).$Bf);if($X==="")$X="&nbsp;";elseif(is_utf8($X)){if($hf!=""&&ereg('text|blob',$k["type"]))$X=shorten_utf8($X,max(0,+$hf));else$X=h($X);}if(!$_){foreach((array)$n[$y]as$m){if(count($n[$y])==1||end($m["source"])==$y){$_="";foreach($m["source"]as$s=>$Ie)$_.=where_link($s,$m["target"][$s],$L[$C][$Ie]);$_=h(($m["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($m["db"]),ME):ME).'select='.urlencode($m["table"]).$_);if(count($m["source"])==1)break;}}}if($y=="COUNT(*)"){$_=h(ME."select=".urlencode($a));$s=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Af))$_.=h(where_link($s++,$W["col"],$W["val"],$W["op"]));}foreach($Af
as$Bc=>$W)$_.=h(where_link($s++,$Bc,$W));}}if(!$_){if(is_mail($X))$_="mailto:$X";if($he=is_url($K[$y]))$_=($he=="http"&&$ba?$K[$y]:"$he://www.adminer.org/redirect/?url=".urlencode($K[$y]));}$t=h("val[$Bf][".bracket_escape($y)."]");$Y=$_POST["val"][$Bf][bracket_escape($y)];$kc=h($Y!==null?$Y:$K[$y]);$Qc=strpos($X,"<i>...</i>");$xb=is_utf8($X)&&$L[$C][$y]==$K[$y]&&!$q[$y];$gf=ereg('text|lob',$k["type"]);echo(($_GET["modify"]&&$xb)||$Y!==null?"<td>".($gf?"<textarea name='$t' cols='30' rows='".(substr_count($K[$y],"\n")+1)."'>$kc</textarea>":"<input name='$t' value='$kc' size='$Mc[$y]'>"):"<td id='$t' ondblclick=\"".($xb?"selectDblClick(this, event".($Qc?", 2":($gf?", 1":"")).")":"alert('".h('Use edit link to modify this value.')."')").";\">".$b->selectVal($X,$_,$k));}}if($ya)echo"<td>";$b->backwardKeysPrint($ya,$L[$C]);echo"</tr>\n";}echo"</table>\n",(!$hc&&$N?"":"<script type='text/javascript'>tableCheck();</script>\n");}if($L||$E){$Jb=true;if($_GET["page"]!="last"&&+$z&&count($hc)>=count($N)&&($cc>=$z||$E)){$cc=found_rows($T,$Z);if($cc<max(1e4,2*($E+1)*$z)){ob_flush();flush();$cc=$f->result("SELECT COUNT(*) FROM ".table($a).($Z?" WHERE ".implode(" AND ",$Z):""));}else$Jb=false;}echo"<p class='pages'>";if(+$z&&$cc>$z){$Uc=floor(($cc-1)/$z);echo'<a href="'.h(remove_from_uri("page"))."\" onclick=\"pageClick(this.href, +prompt('".'Page'."', '".($E+1)."'), event); return false;\">".'Page'."</a>:",pagination(0,$E).($E>5?" ...":"");for($s=max(1,$E-4);$s<min($Uc,$E+5);$s++)echo
pagination($s,$E);echo($E+5<$Uc?" ...":"").($Jb?pagination($Uc,$E):' <a href="'.h(remove_from_uri()."&page=last").'">'.'last'."</a>");}echo" (".($Jb?"":"~ ").lang(array('%d row','%d rows'),$cc).") ".checkbox("all",1,0,'whole result')."\n";if($b->selectCommandPrint()){echo'<fieldset><legend>Edit</legend><div>
<input type="submit" value="Save"',($_GET["modify"]?'':' title="'.'Double click on a value to modify it.'.'" class="jsonly"');?>>
<input type="submit" name="edit" value="Edit">
<input type="submit" name="clone" value="Clone">
<input type="submit" name="delete" value="Delete" onclick="return confirm('Are you sure? (' + (this.form['all'].checked ? <?php echo$cc,' : formChecked(this, /check/)) + \')\');">
</div></fieldset>
';}$bc=$b->dumpFormat();if($bc){print_fieldset("export",'Export');$Hd=$b->dumpOutput();echo($Hd?html_select("output",$Hd,$la["output"])." ":""),html_select("format",$bc,$la["format"])," <input type='submit' name='export' value='".'Export'."'>\n","</div></fieldset>\n";}}if($b->selectImportPrint()){print_fieldset("import",'Import',!$L);echo"<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$la["format"],1);echo" <input type='submit' name='import' value='".'Import'."'>","<input type='hidden' name='token' value='$U'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($_b,'strlen'),$e);echo"</form>\n";}}}elseif(isset($_GET["variables"])){$Me=isset($_GET["status"]);page_header($Me?'Status':'Variables');$Kf=($Me?show_status():show_variables());if(!$Kf)echo"<p class='message'>".'No rows.'."\n";else{echo"<table cellspacing='0'>\n";foreach($Kf
as$y=>$X){echo"<tr>","<th><code class='jush-".$x.($Me?"status":"set")."'>".h($y)."</code>","<td>".nbsp($X);}echo"</table>\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Ue=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$T){$t=js_escape($T["Name"]);json_row("Comment-$t",nbsp($T["Comment"]));if(!is_view($T)){foreach(array("Engine","Collation")as$y)json_row("$y-$t",nbsp($T[$y]));foreach($Ue+array("Auto_increment"=>0,"Rows"=>0)as$y=>$X){if($T[$y]!=""){$X=number_format($T[$y],0,'.',',');json_row("$y-$t",($y=="Rows"&&$X&&($T["Engine"]=="InnoDB"||$T["Engine"]=="table")?"~ $X":$X));if(isset($Ue[$y]))$Ue[$y]+=($T["Engine"]!="InnoDB"||$y!="Data_free"?$T[$y]:0);}elseif(array_key_exists($y,$T))json_row("$y-$t");}}}foreach($Ue
as$y=>$X)json_row("sum-$y",number_format($X,0,'.',','));json_row("");}else{foreach(count_tables($b->databases())as$i=>$X)json_row("tables-".js_escape($i),$X);json_row("");}exit;}else{$df=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($df&&!$j&&!$_POST["search"]){$I=true;$Yc="";if($x=="sql"&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"]))queries("SET foreign_key_checks = 0");if($_POST["truncate"]){if($_POST["tables"])$I=truncate_tables($_POST["tables"]);$Yc='Tables have been truncated.';}elseif($_POST["move"]){$I=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Yc='Tables have been moved.';}elseif($_POST["copy"]){$I=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Yc='Tables have been copied.';}elseif($_POST["drop"]){if($_POST["views"])$I=drop_views($_POST["views"]);if($I&&$_POST["tables"])$I=drop_tables($_POST["tables"]);$Yc='Tables have been dropped.';}elseif($x!="sql"){$I=($x=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Yc='Tables have been optimized.';}elseif($_POST["tables"]&&($I=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"]))))){while($K=$I->fetch_assoc())$Yc.="<b>".h($K["Table"])."</b>: ".h($K["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Yc,$I);}page_header(($_GET["ns"]==""?'Database'.": ".h(DB):'Schema'.": ".h($_GET["ns"])),$j,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3>".'Tables and views'."</h3>\n";$cf=tables_list();if(!$cf)echo"<p class='message'>".'No tables.'."\n";else{echo"<form action='' method='post'>\n","<p>".'Search data in tables'.": <input name='query' value='".h($_POST["query"])."'> <input type='submit' name='search' value='".'Search'."'>\n";if($_POST["search"]&&$_POST["query"]!="")search_tables();echo"<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n",'<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">','<th>'.'Table','<td>'.'Engine','<td>'.'Collation','<td>'.'Data Length','<td>'.'Index Length','<td>'.'Data Free','<td>'.'Auto Increment','<td>'.'Rows',(support("comment")?'<td>'.'Comment':''),"</thead>\n";foreach($cf
as$D=>$V){$Lf=($V!==null&&!eregi("table",$V));echo'<tr'.odd().'><td>'.checkbox(($Lf?"views[]":"tables[]"),$D,in_array($D,$df,true),"","formUncheck('check-all');"),'<th><a href="'.h(ME).'table='.urlencode($D).'" title="'.'Show structure'.'">'.h($D).'</a>';if($Lf){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($D).'" title="'.'Alter view'.'">'.'View'.'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($D).'" title="'.'Select data'.'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",'Alter table'),"Index_length"=>array("indexes",'Alter indexes'),"Data_free"=>array("edit",'New item'),"Auto_increment"=>array("auto_increment=1&create",'Alter table'),"Rows"=>array("select",'Select data'),)as$y=>$_)echo($_?"<td align='right'><a href='".h(ME."$_[0]=").urlencode($D)."' id='$y-".h($D)."' title='$_[1]'>?</a>":"<td id='$y-".h($D)."'>&nbsp;");}echo(support("comment")?"<td id='Comment-".h($D)."'>&nbsp;":"");}echo"<tr><td>&nbsp;<th>".sprintf('%d in total',count($cf)),"<td>".nbsp($x=="sql"?$f->result("SELECT @@storage_engine"):""),"<td>".nbsp(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$y)echo"<td align='right' id='sum-$y'>&nbsp;";echo"</table>\n","<script type='text/javascript'>tableCheck();</script>\n";if(!information_schema(DB)){echo"<p>".(ereg('^(sql|sqlite|pgsql)$',$x)?($x!="sqlite"?"<input type='submit' value='".'Analyze'."'> ":"")."<input type='submit' name='optimize' value='".'Optimize'."'> ":"").($x=="sql"?"<input type='submit' name='check' value='".'Check'."'> <input type='submit' name='repair' value='".'Repair'."'> ":"")."<input type='submit' name='truncate' value='".'Truncate'."'".confirm("formChecked(this, /tables/)")."> <input type='submit' name='drop' value='".'Drop'."'".confirm("formChecked(this, /tables|views/)").">\n";$h=(support("scheme")?schemas():$b->databases());if(count($h)!=1&&$x!="sqlite"){$i=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".'Move to other database'.": ",($h?html_select("target",$h,$i):'<input name="target" value="'.h($i).'">')," <input type='submit' name='move' value='".'Move'."'>",(support("copy")?" <input type='submit' name='copy' value='".'Copy'."'>":""),"\n";}echo"<input type='hidden' name='token' value='$U'>\n";}echo"</form>\n";}echo'<p><a href="'.h(ME).'create=">'.'Create table'."</a>\n";if(support("view"))echo'<a href="'.h(ME).'view=">'.'Create view'."</a>\n";if(support("routine")){echo"<h3>".'Routines'."</h3>\n";$ye=routines();if($ye){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.'Name'.'<td>'.'Type'.'<td>'.'Return type'."<td>&nbsp;</thead>\n";odd('');foreach($ye
as$K){echo'<tr'.odd().'>','<th><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($K["ROUTINE_NAME"]).'">'.h($K["ROUTINE_NAME"]).'</a>','<td>'.h($K["ROUTINE_TYPE"]),'<td>'.h($K["DTD_IDENTIFIER"]),'<td><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($K["ROUTINE_NAME"]).'">'.'Alter'."</a>";}echo"</table>\n";}echo'<p>'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.'Create procedure'.'</a> ':'').'<a href="'.h(ME).'function=">'.'Create function'."</a>\n";}if(support("event")){echo"<h3>".'Events'."</h3>\n";$L=get_rows("SHOW EVENTS");if($L){echo"<table cellspacing='0'>\n","<thead><tr><th>".'Name'."<td>".'Schedule'."<td>".'Start'."<td>".'End'."</thead>\n";foreach($L
as$K){echo"<tr>",'<th><a href="'.h(ME).'event='.urlencode($K["Name"]).'">'.h($K["Name"])."</a>","<td>".($K["Execute at"]?'At given time'."<td>".$K["Execute at"]:'Every'." ".$K["Interval value"]." ".$K["Interval field"]."<td>$K[Starts]"),"<td>$K[Ends]";}echo"</table>\n";$Ib=$f->result("SELECT @@event_scheduler");if($Ib&&$Ib!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($Ib)."\n";}echo'<p><a href="'.h(ME).'event=">'.'Create event'."</a>\n";}if($cf)echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=db');</script>\n";}}}page_footer();

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
plugins/dochub/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

304
plugins/emmet/emmet.min.js vendored Normal file
View File

@@ -0,0 +1,304 @@
var _=function(){function h(a,b,c){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual&&k.isFunction(a.isEqual))return a.isEqual(b);if(b.isEqual&&k.isFunction(b.isEqual))return b.isEqual(a);var e=g.call(a);if(e!=g.call(b))return!1;switch(e){case "[object String]":return a==String(b);case "[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case "[object Date]":case "[object Boolean]":return+a==+b;case "[object RegExp]":return a.source==
b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;for(var d=c.length;d--;)if(c[d]==a)return!0;c.push(a);var d=0,j=!0;if(e=="[object Array]"){if(d=a.length,j=d==b.length)for(;d--;)if(!(j=d in a==d in b&&h(a[d],b[d],c)))break}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return!1;for(var f in a)if(k.has(a,f)&&(d++,!(j=k.has(b,f)&&h(a[f],b[f],c))))break;if(j){for(f in b)if(k.has(b,f)&&!d--)break;
j=!d}}c.pop();return j}var d=this,f=d._,i={},b=Array.prototype,c=Object.prototype,a=b.slice,e=b.unshift,g=c.toString,j=c.hasOwnProperty,l=b.forEach,m=b.map,n=b.reduce,o=b.reduceRight,q=b.filter,s=b.every,r=b.some,u=b.indexOf,p=b.lastIndexOf,c=Array.isArray,v=Object.keys,w=Function.prototype.bind,k=function(a){return new y(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=k;exports._=k}else d._=k;k.VERSION="1.3.3";var t=k.each=k.forEach=function(a,
b,c){if(a!=null)if(l&&a.forEach===l)a.forEach(b,c);else if(a.length===+a.length)for(var g=0,e=a.length;g<e;g++){if(g in a&&b.call(c,a[g],g,a)===i)break}else for(g in a)if(k.has(a,g)&&b.call(c,a[g],g,a)===i)break};k.map=k.collect=function(a,b,c){var g=[];if(a==null)return g;if(m&&a.map===m)return a.map(b,c);t(a,function(a,e,d){g[g.length]=b.call(c,a,e,d)});if(a.length===+a.length)g.length=a.length;return g};k.reduce=k.foldl=k.inject=function(a,b,c,g){var e=arguments.length>2;a==null&&(a=[]);if(n&&
a.reduce===n)return g&&(b=k.bind(b,g)),e?a.reduce(b,c):a.reduce(b);t(a,function(a,d,j){e?c=b.call(g,c,a,d,j):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c};k.reduceRight=k.foldr=function(a,b,c,g){var e=arguments.length>2;a==null&&(a=[]);if(o&&a.reduceRight===o)return g&&(b=k.bind(b,g)),e?a.reduceRight(b,c):a.reduceRight(b);var d=k.toArray(a).reverse();g&&!e&&(b=k.bind(b,g));return e?k.reduce(d,b,c,g):k.reduce(d,b)};k.find=k.detect=function(a,b,c){var g;
z(a,function(a,e,d){if(b.call(c,a,e,d))return g=a,!0});return g};k.filter=k.select=function(a,b,c){var g=[];if(a==null)return g;if(q&&a.filter===q)return a.filter(b,c);t(a,function(a,e,d){b.call(c,a,e,d)&&(g[g.length]=a)});return g};k.reject=function(a,b,c){var g=[];if(a==null)return g;t(a,function(a,e,d){b.call(c,a,e,d)||(g[g.length]=a)});return g};k.every=k.all=function(a,b,c){var g=!0;if(a==null)return g;if(s&&a.every===s)return a.every(b,c);t(a,function(a,e,d){if(!(g=g&&b.call(c,a,e,d)))return i});
return!!g};var z=k.some=k.any=function(a,b,c){b||(b=k.identity);var g=!1;if(a==null)return g;if(r&&a.some===r)return a.some(b,c);t(a,function(a,e,d){if(g||(g=b.call(c,a,e,d)))return i});return!!g};k.include=k.contains=function(a,b){var c=!1;return a==null?c:u&&a.indexOf===u?a.indexOf(b)!=-1:c=z(a,function(a){return a===b})};k.invoke=function(b,c){var g=a.call(arguments,2);return k.map(b,function(a){return(k.isFunction(c)?c||a:a[c]).apply(a,g)})};k.pluck=function(a,b){return k.map(a,function(a){return a[b]})};
k.max=function(a,b,c){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!b&&k.isEmpty(a))return-Infinity;var g={computed:-Infinity};t(a,function(a,e,d){e=b?b.call(c,a,e,d):a;e>=g.computed&&(g={value:a,computed:e})});return g.value};k.min=function(a,b,c){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!b&&k.isEmpty(a))return Infinity;var g={computed:Infinity};t(a,function(a,e,d){e=b?b.call(c,a,e,d):a;e<g.computed&&(g={value:a,computed:e})});return g.value};k.shuffle=
function(a){var b=[],c;t(a,function(a,g){c=Math.floor(Math.random()*(g+1));b[g]=b[c];b[c]=a});return b};k.sortBy=function(a,b,c){var g=k.isFunction(b)?b:function(a){return a[b]};return k.pluck(k.map(a,function(a,b,e){return{value:a,criteria:g.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,g=b.criteria;return c===void 0?1:g===void 0?-1:c<g?-1:c>g?1:0}),"value")};k.groupBy=function(a,b){var c={},g=k.isFunction(b)?b:function(a){return a[b]};t(a,function(a,b){var e=g(a,b);(c[e]||(c[e]=[])).push(a)});
return c};k.sortedIndex=function(a,b,c){c||(c=k.identity);for(var g=0,e=a.length;g<e;){var d=g+e>>1;c(a[d])<c(b)?g=d+1:e=d}return g};k.toArray=function(b){return!b?[]:k.isArray(b)?a.call(b):k.isArguments(b)?a.call(b):b.toArray&&k.isFunction(b.toArray)?b.toArray():k.values(b)};k.size=function(a){return k.isArray(a)?a.length:k.keys(a).length};k.first=k.head=k.take=function(b,c,g){return c!=null&&!g?a.call(b,0,c):b[0]};k.initial=function(b,c,g){return a.call(b,0,b.length-(c==null||g?1:c))};k.last=function(b,
c,g){return c!=null&&!g?a.call(b,Math.max(b.length-c,0)):b[b.length-1]};k.rest=k.tail=function(b,c,g){return a.call(b,c==null||g?1:c)};k.compact=function(a){return k.filter(a,function(a){return!!a})};k.flatten=function(a,b){return k.reduce(a,function(a,c){if(k.isArray(c))return a.concat(b?c:k.flatten(c));a[a.length]=c;return a},[])};k.without=function(b){return k.difference(b,a.call(arguments,1))};k.uniq=k.unique=function(a,b,c){var c=c?k.map(a,c):a,g=[];a.length<3&&(b=!0);k.reduce(c,function(c,e,
d){if(b?k.last(c)!==e||!c.length:!k.include(c,e))c.push(e),g.push(a[d]);return c},[]);return g};k.union=function(){return k.uniq(k.flatten(arguments,!0))};k.intersection=k.intersect=function(b){var c=a.call(arguments,1);return k.filter(k.uniq(b),function(a){return k.every(c,function(b){return k.indexOf(b,a)>=0})})};k.difference=function(b){var c=k.flatten(a.call(arguments,1),!0);return k.filter(b,function(a){return!k.include(c,a)})};k.zip=function(){for(var b=a.call(arguments),c=k.max(k.pluck(b,"length")),
g=Array(c),e=0;e<c;e++)g[e]=k.pluck(b,""+e);return g};k.indexOf=function(a,b,c){if(a==null)return-1;var g;if(c)return c=k.sortedIndex(a,b),a[c]===b?c:-1;if(u&&a.indexOf===u)return a.indexOf(b);c=0;for(g=a.length;c<g;c++)if(c in a&&a[c]===b)return c;return-1};k.lastIndexOf=function(a,b){if(a==null)return-1;if(p&&a.lastIndexOf===p)return a.lastIndexOf(b);for(var c=a.length;c--;)if(c in a&&a[c]===b)return c;return-1};k.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0);for(var c=arguments[2]||1,
g=Math.max(Math.ceil((b-a)/c),0),e=0,d=Array(g);e<g;)d[e++]=a,a+=c;return d};var x=function(){};k.bind=function(b,c){var g,e;if(b.bind===w&&w)return w.apply(b,a.call(arguments,1));if(!k.isFunction(b))throw new TypeError;e=a.call(arguments,2);return g=function(){if(!(this instanceof g))return b.apply(c,e.concat(a.call(arguments)));x.prototype=b.prototype;var d=new x,j=b.apply(d,e.concat(a.call(arguments)));return Object(j)===j?j:d}};k.bindAll=function(b){var c=a.call(arguments,1);c.length==0&&(c=k.functions(b));
t(c,function(a){b[a]=k.bind(b[a],b)});return b};k.memoize=function(a,b){var c={};b||(b=k.identity);return function(){var g=b.apply(this,arguments);return k.has(c,g)?c[g]:c[g]=a.apply(this,arguments)}};k.delay=function(b,c){var g=a.call(arguments,2);return setTimeout(function(){return b.apply(null,g)},c)};k.defer=function(b){return k.delay.apply(k,[b,1].concat(a.call(arguments,1)))};k.throttle=function(a,b){var c,g,e,d,j,f,h=k.debounce(function(){j=d=!1},b);return function(){c=this;g=arguments;var k;
e||(e=setTimeout(function(){e=null;j&&a.apply(c,g);h()},b));d?j=!0:f=a.apply(c,g);h();d=!0;return f}};k.debounce=function(a,b,c){var g;return function(){var e=this,d=arguments;c&&!g&&a.apply(e,d);clearTimeout(g);g=setTimeout(function(){g=null;c||a.apply(e,d)},b)}};k.once=function(a){var b=!1,c;return function(){if(b)return c;b=!0;return c=a.apply(this,arguments)}};k.wrap=function(b,c){return function(){var g=[b].concat(a.call(arguments,0));return c.apply(this,g)}};k.compose=function(){var a=arguments;
return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}};k.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};k.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],c;for(c in a)k.has(a,c)&&(b[b.length]=c);return b};k.values=function(a){return k.map(a,k.identity)};k.functions=k.methods=function(a){var b=[],c;for(c in a)k.isFunction(a[c])&&b.push(c);return b.sort()};k.extend=function(b){t(a.call(arguments,
1),function(a){for(var c in a)b[c]=a[c]});return b};k.pick=function(b){var c={};t(k.flatten(a.call(arguments,1)),function(a){a in b&&(c[a]=b[a])});return c};k.defaults=function(b){t(a.call(arguments,1),function(a){for(var c in a)b[c]==null&&(b[c]=a[c])});return b};k.clone=function(a){return!k.isObject(a)?a:k.isArray(a)?a.slice():k.extend({},a)};k.tap=function(a,b){b(a);return a};k.isEqual=function(a,b){return h(a,b,[])};k.isEmpty=function(a){if(a==null)return!0;if(k.isArray(a)||k.isString(a))return a.length===
0;for(var b in a)if(k.has(a,b))return!1;return!0};k.isElement=function(a){return!!(a&&a.nodeType==1)};k.isArray=c||function(a){return g.call(a)=="[object Array]"};k.isObject=function(a){return a===Object(a)};k.isArguments=function(a){return g.call(a)=="[object Arguments]"};if(!k.isArguments(arguments))k.isArguments=function(a){return!(!a||!k.has(a,"callee"))};k.isFunction=function(a){return g.call(a)=="[object Function]"};k.isString=function(a){return g.call(a)=="[object String]"};k.isNumber=function(a){return g.call(a)==
"[object Number]"};k.isFinite=function(a){return k.isNumber(a)&&isFinite(a)};k.isNaN=function(a){return a!==a};k.isBoolean=function(a){return a===!0||a===!1||g.call(a)=="[object Boolean]"};k.isDate=function(a){return g.call(a)=="[object Date]"};k.isRegExp=function(a){return g.call(a)=="[object RegExp]"};k.isNull=function(a){return a===null};k.isUndefined=function(a){return a===void 0};k.has=function(a,b){return j.call(a,b)};k.noConflict=function(){d._=f;return this};k.identity=function(a){return a};
k.times=function(a,b,c){for(var g=0;g<a;g++)b.call(c,g)};k.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};k.result=function(a,b){if(a==null)return null;var c=a[b];return k.isFunction(c)?c.call(a):c};k.mixin=function(a){t(k.functions(a),function(b){F(b,k[b]=a[b])})};var G=0;k.uniqueId=function(a){var b=G++;return a?a+b:b};k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,
escape:/<%-([\s\S]+?)%>/g};var B=/.^/,A={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},C;for(C in A)A[A[C]]=C;var H=/\\|'|\r|\n|\t|\u2028|\u2029/g,I=/\\(\\|'|r|n|t|u2028|u2029)/g,D=function(a){return a.replace(I,function(a,b){return A[b]})};k.template=function(a,b,c){c=k.defaults(c||{},k.templateSettings);a="__p+='"+a.replace(H,function(a){return"\\"+A[a]}).replace(c.escape||B,function(a,b){return"'+\n_.escape("+D(b)+")+\n'"}).replace(c.interpolate||B,function(a,b){return"'+\n("+
D(b)+")+\n'"}).replace(c.evaluate||B,function(a,b){return"';\n"+D(b)+"\n;__p+='"})+"';\n";c.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",g=new Function(c.variable||"obj","_",a);if(b)return g(b,k);b=function(a){return g.call(this,a,k)};b.source="function("+(c.variable||"obj")+"){\n"+a+"}";return b};k.chain=function(a){return k(a).chain()};var y=function(a){this._wrapped=a};k.prototype=y.prototype;
var E=function(a,b){return b?k(a).chain():a},F=function(b,c){y.prototype[b]=function(){var b=a.call(arguments);e.call(b,this._wrapped);return E(c.apply(k,b),this._chain)}};k.mixin(k);t(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=b[a];y.prototype[a]=function(){var b=this._wrapped;c.apply(b,arguments);var g=b.length;(a=="shift"||a=="splice")&&g===0&&delete b[0];return E(b,this._chain)}});t(["concat","join","slice"],function(a){var c=b[a];y.prototype[a]=function(){return E(c.apply(this._wrapped,
arguments),this._chain)}});y.prototype.chain=function(){this._chain=!0;return this};y.prototype.value=function(){return this._wrapped};return k}.call({}),emmet=function(h){function d(a,b,d){var f;f=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)};_.extend(f,a);c.prototype=a.prototype;f.prototype=new c;b&&_.extend(f.prototype,b);d&&_.extend(f,d);f.prototype.constructor=f;f.__super__=a.prototype;return f}function f(c){!(c in b)&&a&&a(c);return b[c]}if(typeof _=="undefined")try{_=
h.require("underscore")}catch(i){}if(typeof _=="undefined")throw"Cannot access to Underscore.js lib";var b={_:_},c=function(){},a=null;return{define:function(a,c){a in b||(b[a]=_.isFunction(c)?this.exec(c):c)},require:f,exec:function(a,b){return a.call(b||h,_.bind(f,this),_,this)},extend:function(a,b){var c=d(this,a,b);c.extend=this.extend;if(a.hasOwnProperty("toString"))c.prototype.toString=a.toString;return c},expandAbbreviation:function(a,b,c,d){if(!a)return"";var b=b||"html",h=f("filters"),i=
f("abbreviationParser"),c=f("profile").get(c,b);f("tabStops").resetTabstopIndex();a=h.extractFromAbbreviation(a);d=i.parse(a[0],{syntax:b,contextNode:d});b=h.composeList(b,c,a[1]);h.apply(d,b,c);return d.toString()},defaultSyntax:function(){return"html"},defaultProfile:function(){return"plain"},log:function(){h.console&&h.console.log&&h.console.log.apply(h.console,arguments)},setModuleLoader:function(b){a=b}}}(this);
if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=emmet;exports.emmet=emmet}
emmet.define("abbreviationParser",function(h,d){function f(){this.parent=null;this.children=[];this._attributes=[];this.abbreviation="";this.counter=1;this._name=null;this._text="";this.repeatCount=1;this.hasImplicitRepeat=!1;this._data={};this.padding=this.content=this.end=this.start=""}function i(a){return a.substring(1,a.length-1)}function b(a){for(var a=h("utils").trim(a),c=new f,g=c.addChild(),e,j=h("stringStream").create(a),a=1E3,l;!j.eol()&&--a>0;)switch(e=j.peek(),e){case "(":j.start=j.pos;
if(j.skipToPair("(",")"))e=b(i(j.current())),(l=j.match(/^\*(\d+)?/,!0))&&g._setRepeat(l[1]),d.each(e.children,function(a){g.addChild(a)});else throw'Invalid abbreviation: mo matching ")" found for character at '+j.pos;break;case ">":g=g.addChild();j.next();break;case "+":g=g.parent.addChild();j.next();break;case "^":e=g.parent||g;g=(e.parent||e).addChild();j.next();break;default:j.start=j.pos,j.eatWhile(function(a){if(a=="["||a=="{"){if(j.skipToPair(a,q[a]))return j.backUp(1),!0;throw'Invalid abbreviation: mo matching "'+
q[a]+'" found for character at '+j.pos;}return a=="+"?(j.next(),a=j.eol()||~"+>^*".indexOf(j.peek()),j.backUp(1),a):a!="("&&m(a)}),g.setAbbreviation(j.current()),j.start=j.pos}if(a<1)throw"Endless loop detected";return c}function c(a){var a=h("utils").trim(a),b=[],a=h("stringStream").create(a);for(a.eatSpace();!a.eol();)if(a.start=a.pos,a.eatWhile(o)){var c=a.current(),g="";if(a.peek()=="="){a.next();a.start=a.pos;var e=a.peek();if(e=='"'||e=="'"){a.next();a:{for(var g=a,d=void 0;d=g.next();)if(d===
e){g=!0;break a}g=!1}if(g)g=a.current(),g=g.substring(1,g.length-1);else throw"Invalid attribute value";}else if(a.eatWhile(/[^\s\]]/))g=a.current();else throw"Invalid attribute value";}b.push({name:c,value:g});a.eatSpace()}else break;return b}function a(a){for(var b=[],g={"#":"id",".":"class"},d=null,j=h("stringStream").create(a);!j.eol();)switch(j.peek()){case "#":case ".":if(d===null)d=j.pos;var f=g[j.peek()];j.next();j.start=j.pos;j.eatWhile(o);b.push({name:f,value:j.current()});break;case "[":if(d===
null)d=j.pos;j.start=j.pos;if(!j.skipToPair("[","]"))throw"Invalid attribute set definition";b=b.concat(c(i(j.current())));break;default:j.next()}return!b.length?null:{element:a.substring(0,d),attributes:e(b)}}function e(a){var a=d.map(a,function(a){return d.clone(a)}),b={};return d.filter(a,function(a){if(!(a.name in b))return b[a.name]=a;var c=b[a.name];a.name.toLowerCase()=="class"?c.value+=(c.value.length?" ":"")+a.value:c.value=a.value;return!1})}function g(a){if(!~a.indexOf("{"))return null;
for(var b=h("stringStream").create(a);!b.eol();)switch(b.peek()){case "[":case "(":b.skipToPair(b.peek(),q[b.peek()]);break;case "{":return b.start=b.pos,b.skipToPair("{","}"),{element:a.substring(0,b.start),text:i(b.current())};default:b.next()}}function j(a){for(var b=a.children.length-1,c,g;b>=0;b--)if(g=a.children[b],g.isRepeating()){c=g.repeatCount;g.repeatCount=1;for(g.updateProperty("counter",1);--c>0;)g.parent.addChild(g.clone(),b+1).updateProperty("counter",c+1)}d.each(a.children,j);return a}
function l(a){for(var b=a.children.length-1;b>=0;b--){var c=a.children[b];c.isGroup()?c.replace(l(c).children):c.isEmpty()&&c.remove()}d.each(a.children,l);return a}function m(a){var b=a.charCodeAt(0);return b>64&&b<91||b>96&&b<123||b>47&&b<58||"#.*:$-_!@|%".indexOf(a)!=-1}var n=/^[\w\-\$\:@\!%]+\+?$/i,o=/[\w\-:\$]/,q={"[":"]","(":")","{":"}"},s=Array.prototype.splice,r=[],u=[],p=[];f.prototype={addChild:function(a,b){a=a||new f;a.parent=this;d.isUndefined(b)?this.children.push(a):this.children.splice(b,
0,a);return a},clone:function(){var a=new f;d.each(["abbreviation","counter","_name","_text","repeatCount","hasImplicitRepeat","start","end","content","padding"],function(b){a[b]=this[b]},this);a._attributes=d.map(this._attributes,function(a){return d.clone(a)});a._data=d.clone(this._data);a.children=d.map(this.children,function(b){b=b.clone();b.parent=a;return b});return a},remove:function(){if(this.parent)this.parent.children=d.without(this.parent.children,this);return this},replace:function(){var a=
this.parent,b=d.indexOf(a.children,this),c=d.flatten(arguments);s.apply(a.children,[b,1].concat(c));d.each(c,function(b){b.parent=a})},updateProperty:function(a,b){this[a]=b;d.each(this.children,function(c){c.updateProperty(a,b)})},find:function(a){return this.findAll(a)[0]},findAll:function(a){if(!d.isFunction(a))var b=a.toLowerCase(),a=function(a){return a.name().toLowerCase()==b};var c=[];d.each(this.children,function(b){a(b)&&c.push(b);c=c.concat(b.findAll(a))});return d.compact(c)},data:function(a,
b){if(arguments.length==2&&(this._data[a]=b,a=="resource"&&h("elements").is(b,"snippet")&&(this.content=b.data,this._text)))this.content=h("abbreviationUtils").insertChildContent(b.data,this._text);return this._data[a]},name:function(){var a=this.matchedResource();return h("elements").is(a,"element")?a.name:this._name},attributeList:function(){var a=[],b=this.matchedResource();h("elements").is(b,"element")&&d.isArray(b.attributes)&&(a=a.concat(b.attributes));return e(a.concat(this._attributes))},
attribute:function(a,b){if(arguments.length==2){var c=d.indexOf(d.pluck(this._attributes,"name"),a.toLowerCase());~c?this._attributes[c].value=b:this._attributes.push({name:a,value:b})}return(d.find(this.attributeList(),function(b){return b.name==a})||{}).value},matchedResource:function(){return this.data("resource")},index:function(){return this.parent?d.indexOf(this.parent.children,this):-1},_setRepeat:function(a){a?this.repeatCount=parseInt(a,10)||1:this.hasImplicitRepeat=!0},setAbbreviation:function(b){var c=
this;this.abbreviation=b=(b||"").replace(/\*(\d+)?$/,function(a,b){c._setRepeat(b);return""});var e=g(b);if(e)b=e.element,this.content=this._text=e.text;if(e=a(b))b=e.element,this._attributes=e.attributes;if((this._name=b)&&!n.test(this._name))throw"Invalid abbreviation";},toString:function(){var a=h("utils"),b=this.start,c=this.end,g=this.content,e=this;d.each(p,function(a){b=a(b,e,"start");g=a(g,e,"content");c=a(c,e,"end")});var j=d.map(this.children,function(a){return a.toString()}).join(""),g=
h("abbreviationUtils").insertChildContent(g,j,{keepVariable:!1});return b+a.padString(g,this.padding)+c},hasEmptyChildren:function(){return!!d.find(this.children,function(a){return a.isEmpty()})},hasImplicitName:function(){return!this._name&&!this.isTextNode()},isGroup:function(){return!this.abbreviation},isEmpty:function(){return!this.abbreviation&&!this.children.length},isRepeating:function(){return this.repeatCount>1||this.hasImplicitRepeat},isTextNode:function(){return!this.name()&&!this.attributeList().length},
isElement:function(){return!this.isEmpty()&&!this.isTextNode()},deepestChild:function(){if(!this.children.length)return null;for(var a=this;a.children.length;)a=d.last(a.children);return a}};p.push(function(a,b){return h("utils").replaceCounter(a,b.counter)});return{parse:function(a,c){var c=c||{},g=b(a);if(c.contextNode){g._name=c.contextNode.name;var e={};d.each(g._attributes,function(a){e[a.name]=a});d.each(c.contextNode.attributes,function(a){a.name in e?e[a.name].value=a.value:(a=d.clone(a),
g._attributes.push(a),e[a.name]=a)})}d.each(r,function(a){a(g,c)});g=l(j(g));d.each(u,function(a){a(g,c)});return g},AbbreviationNode:f,addPreprocessor:function(a){d.include(r,a)||r.push(a)},removeFilter:function(a){preprocessor=d.without(r,a)},addPostprocessor:function(a){d.include(u,a)||u.push(a)},removePostprocessor:function(a){u=d.without(u,a)},addOutputProcessor:function(a){d.include(p,a)||p.push(a)},removeOutputProcessor:function(a){p=d.without(p,a)},isAllowedChar:function(a){a=String(a);return m(a)||
~">+^[](){}".indexOf(a)}}});
emmet.exec(function(h,d){function f(i,b){var c=h("resources"),a=h("elements"),e=h("abbreviationParser");d.each(d.clone(i.children),function(g){var j=c.getMatchedResource(g,b);if(d.isString(j))g.data("resource",a.create("snippet",j));else if(a.is(j,"reference")){j=e.parse(j.data,{syntax:b});if(g.repeatCount>1){var h=j.findAll(function(a){return a.hasImplicitRepeat});d.each(h,function(a){a.repeatCount=g.repeatCount;a.hasImplicitRepeat=!1})}var i=j.deepestChild();i&&d.each(g.children,function(a){i.addChild(a)});
d.each(j.children,function(a){d.each(g.attributeList(),function(b){a.attribute(b.name,b.value)})});g.replace(j.children)}else g.data("resource",j);f(g,b)})}h("abbreviationParser").addPreprocessor(function(d,b){var c=b.syntax||emmet.defaultSyntax();f(d,c)})});
emmet.exec(function(h,d){function f(a){for(var b=h("range"),c=[],a=h("stringStream").create(a);!a.eol();){if(a.peek()=="\\")a.next();else if(a.start=a.pos,a.match(e,!0)){c.push(b.create(a.start,e));continue}a.next()}return c}function i(a,b){var c=h("utils"),e=f(a);e.reverse();d.each(e,function(e){a=c.replaceSubstring(a,b,e)});return a}function b(a){return f(a.content).length?!0:!!d.find(a.attributeList(),function(a){return!!f(a.value).length})}function c(a,c,e){var f=a.findAll(function(a){return b(a)});
b(a)&&f.unshift(a);f.length?d.each(f,function(a){a.content=i(a.content,c);d.each(a._attributes,function(a){a.value=i(a.value,c)})}):(a=a.deepestChild()||a,a.content=e?c:h("abbreviationUtils").insertChildContent(a.content,c))}var a=h("abbreviationParser"),e="$#";a.addPreprocessor(function(a,b){if(b.pastedContent){var c=h("utils"),e=d.map(c.splitByLines(b.pastedContent,!0),c.trim);a.findAll(function(a){if(a.hasImplicitRepeat)return a.data("paste",e),a.repeatCount=e.length})}});a.addPostprocessor(function(a,
b){!a.findAll(function(a){var b=a.data("paste"),g="";d.isArray(b)?g=b[a.counter-1]:d.isFunction(b)?g=b(a.counter-1,a.content):b&&(g=b);g&&c(a,g,!!a.data("pasteOverwrites"));a.data("paste",null);return!!b}).length&&b.pastedContent&&c(a,b.pastedContent)})});emmet.exec(function(h,d){function f(i){var b=h("tagName");d.each(i.children,function(c){if(c.hasImplicitName()||c.data("forceNameResolving"))c._name=b.resolve(c.parent.name());f(c)});return i}h("abbreviationParser").addPostprocessor(f)});
emmet.define("cssParser",function(h,d){function f(a){return typeof a!=="undefined"}function i(){return{"char":g.chnum,line:g.linenum}}function b(a,b,c){var e=g,c=c||{};j.push({charstart:f(c["char"])?c["char"]:e.chnum,charend:f(c.charend)?c.charend:e.chnum,linestart:f(c.line)?c.line:e.linenum,lineend:f(c.lineend)?c.lineend:e.linenum,value:a,type:b||a})}function c(a,b){var c=g,e=b||{},d=f(e["char"])?e["char"]:c.chnum,e=f(e.line)?e.line:c.linenum;return{name:"ParseError",message:a+" at line "+(e+1)+
" char "+(d+1),walker:c,tokens:j}}function a(a){var c=g,e=c.ch,d=i(),j=a?a+e:e,e=c.nextChar();for(a&&(d["char"]-=a.length);m(e)||n(e);)j+=e,e=c.nextChar();b(j,"identifier",d)}function e(){var e=g.ch;if(e===" "||e==="\t"){for(var d=g.ch,j="",f=i();d===" "||d==="\t";)j+=d,d=g.nextChar();b(j,"white",f)}else{if(e==="/"){var d=g,e=f=d.ch,h,p=i();h=d.nextChar();if(h!=="*")p.charend=p["char"],p.lineend=p.line,j=b(e,e,p);else{for(;!(f==="*"&&h==="/");)e+=h,f=h,h=d.nextChar();e+=h;d.nextChar();b(e,"comment",
p)}return j}if(e==='"'||e==="'"){d=g;e=f=j=d.ch;p=i();for(j=d.nextChar();j!==f;){if(j==="\n")if(h=d.nextChar(),h==="\\")e+=j+h;else throw c("Unterminated string",p);else e+=j==="\\"?j+d.nextChar():j;j=d.nextChar()}e+=j;d.nextChar();b(e,"string",p)}else if(e==="("){d=g;j=d.ch;f=0;e=j;h=i();for(j=d.nextChar();j!==")"&&!f;){if(j==="(")f++;else if(j===")")f--;else if(j===!1)throw c("Unterminated brace",h);e+=j;j=d.nextChar()}e+=j;d.nextChar();b(e,"brace",h)}else{if(e==="-"||e==="."||n(e)){j=g;f=j.ch;
e=i();h=f;var p=h===".",v,f=j.nextChar();v=!n(f);if(p&&v)e.charend=e["char"],e.lineend=e.line,d=b(h,".",e);else if(h==="-"&&v)d=a("-");else{for(;f!==!1&&(n(f)||!p&&f===".");)f==="."&&(p=!0),h+=f,f=j.nextChar();b(h,"number",e)}return d}if(m(e))return a();if(l(e))return d=g,e=d.ch,j=i(),h=d.nextChar(),h==="="&&l(e,!0)?(e+=h,b(e,"match",j),d.nextChar(),f=void 0):(j.charend=j["char"]+1,j.lineend=j.line,b(e,e,j)),f;if(e==="\n")b("line"),g.nextChar();else throw c("Unrecognized character");}}}var g,j=[],
l,m,n;g={lines:null,total_lines:0,linenum:-1,line:"",ch:"",chnum:-1,init:function(a){var b=g;b.lines=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n");b.total_lines=b.lines.length;b.chnum=-1;b.linenum=-1;b.ch="";b.line="";b.nextLine();b.nextChar()},nextLine:function(){this.linenum+=1;this.line=this.total_lines<=this.linenum?!1:this.lines[this.linenum];if(this.chnum!==-1)this.chnum=0;return this.line},nextChar:function(){for(this.chnum+=1;this.line.charAt(this.chnum)==="";){if(this.nextLine()===
!1)return this.ch=!1;this.chnum=-1;return this.ch="\n"}return this.ch=this.line.charAt(this.chnum)},peek:function(){return this.line.charAt(this.chnum+1)}};m=function(a){return a=="&"||a==="_"||a==="-"||a>="a"&&a<="z"||a>="A"&&a<="Z"};n=function(a){return a!==!1&&a>="0"&&a<="9"};l=function(){for(var a="{}[]()+*=.,;:>~|\\%$#@^!".split(""),b="*^|$~".split(""),c={},e={},g=0;g<a.length;g+=1)c[a[g]]=!0;for(g=0;g<b.length;g+=1)e[b[g]]=!0;return function(a,b){return b?!!e[a]:!!c[a]}}();return{lex:function(a){g.init(a);
for(j=[];g.ch!==!1;)e();return j},parse:function(a){var b=0;return d.map(this.lex(a),function(c){if(c.type=="line")c.value=a.charAt(b)=="\r"&&a.charAt(b+1)=="\n"?"\r\n":a.charAt(b);return{type:c.type,start:b,end:b+=c.value.length}})},toSource:function(a){for(var b=0,c=a.length,e,g="";b<c;b+=1)e=a[b],g+=e.type==="line"?"\n":e.value;return g}}});
emmet.define("xmlParser",function(h){function d(a,e){function g(b){e.tokenize=b;return b(a,e)}var d=a.next();if(d=="<")if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?g(b("atom","]]\>")):null:a.match("--")?g(b("comment","--\>")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(c(1))):null;else if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),e.tokenize=b("meta","?>"),"meta";else{w=a.eat("/")?"closeTag":"openTag";a.eatSpace();for(v="";d=a.eat(/[^\s\u00a0=<>\"\'\/?]/);)v+=d;e.tokenize=f;return"tag"}else return d==
"&"?(a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"))?"atom":"error":(a.eatWhile(/[^&<]/),"text")}function f(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=d,w=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(w="equals",null):/[\'\"]/.test(c)?(b.tokenize=i(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function i(a){return function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=f;break}return"string"}}
function b(a,b){return function(c,e){for(;!c.eol();){if(c.match(b)){e.tokenize=d;break}c.next()}return a}}function c(a){return function(b,e){for(var g;(g=b.next())!=null;)if(g=="<")return e.tokenize=c(a+1),e.tokenize(b,e);else if(g==">")if(a==1){e.tokenize=d;break}else return e.tokenize=c(a-1),e.tokenize(b,e);return"meta"}}function a(){for(var a=arguments.length-1;a>=0;a--)k.cc.push(arguments[a])}function e(){a.apply(null,arguments);return!0}function g(){if(k.context)k.context=k.context.prev}function j(a){if(a==
"openTag")return k.tagName=v,e(o,l(k.startOfLine));else if(a=="closeTag")return a=!1,k.context?k.context.tagName!=v&&(p.implicitlyClosed.hasOwnProperty(k.context.tagName.toLowerCase())&&g(),a=!k.context||k.context.tagName!=v):a=!0,a&&(t="error"),e(m(a));return e()}function l(a){return function(b){if(b=="selfcloseTag"||b=="endTag"&&p.autoSelfClosers.hasOwnProperty(k.tagName.toLowerCase()))return n(k.tagName.toLowerCase()),e();if(b=="endTag"){n(k.tagName.toLowerCase());var b=k.tagName,c=p.doNotIndent.hasOwnProperty(b)||
k.context&&k.context.noIndent;k.context={prev:k.context,tagName:b,indent:k.indented,startOfLine:a,noIndent:c}}return e()}}function m(a){return function(b){a&&(t="error");if(b=="endTag")return g(),e();t="error";return e(arguments.callee)}}function n(a){for(var b;;){if(!k.context)break;b=k.context.tagName.toLowerCase();if(!p.contextGrabbers.hasOwnProperty(b)||!p.contextGrabbers[b].hasOwnProperty(a))break;g()}}function o(b){if(b=="word")return t="attribute",e(q,o);if(b=="endTag"||b=="selfcloseTag")return a();
t="error";return e(o)}function q(b){if(b=="equals")return e(s,o);p.allowMissing||(t="error");return b=="endTag"||b=="selfcloseTag"?a():e()}function s(b){if(b=="string")return e(r);if(b=="word"&&p.allowUnquoted)return t="string",e();t="error";return b=="endTag"||b=="selfCloseTag"?a():e()}function r(b){return b=="string"?e(r):a()}function u(a,b){if(a.sol())b.startOfLine=!0,b.indented=0;if(a.eatSpace())return null;t=w=v=null;var c=b.tokenize(a,b);b.type=w;if((c||w)&&c!="comment")for(k=b;;)if((b.cc.pop()||
j)(w||c))break;b.startOfLine=!1;return t||c}var p={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!0,allowMissing:!0},v=null,w=null,k=null,t;return{parse:function(a,b){for(var b=b||0,c={tokenize:d,cc:[],indented:0,startOfLine:!0,tagName:null,context:null},e=h("stringStream").create(a),g=[];!e.eol();)g.push({type:u(e,c),start:e.start+b,end:e.pos+b}),e.start=e.pos;return g}}});
emmet.define("string-score",function(){return{score:function(h,d,f){if(h==d)return 1;if(d=="")return 0;for(var i=0,b=d.length,c=h.length,a,e=1,g=0,j,l,m,n;g<b;++g){m=d.charAt(g);j=h.indexOf(m.toLowerCase());l=h.indexOf(m.toUpperCase());n=Math.min(j,l);l=n>-1?n:Math.max(j,l);if(l===-1)if(f){e+=1-f;continue}else return 0;else j=0.1;h[l]===m&&(j+=0.1);l===0?(j+=0.6,g===0&&(a=1)):h.charAt(l-1)===" "&&(j+=0.8);h=h.substring(l+1,c);i+=j}h=i/b;b=(h*(b/c)+h)/2;b/=e;a&&b+0.15<1&&(b+=0.15);return b}}});
emmet.define("utils",function(h,d){function f(b){this._data=[];this.length=0;b&&this.append(b)}var i="${0}";f.prototype={append:function(b){this._data.push(b);this.length+=b.length},toString:function(){return this._data.join("")},valueOf:function(){return this.toString()}};return{reTag:/<\/?[\w:\-]+(?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*\s*(\/?)>$/,endsWithTag:function(b){return this.reTag.test(b)},isNumeric:function(b){typeof b=="string"&&(b=b.charCodeAt(0));return b&&b>47&&
b<58},trim:function(b){return(b||"").replace(/^\s+|\s+$/g,"")},getNewline:function(){var b=h("resources");if(!b)return"\n";b=b.getVariable("newline");return d.isString(b)?b:"\n"},setNewline:function(b){var c=h("resources");c.setVariable("newline",b);c.setVariable("nl",b)},splitByLines:function(b,c){var a=this.getNewline(),a=(b||"").replace(/\r\n/g,"\n").replace(/\n\r/g,"\n").replace(/\r/g,"\n").replace(/\n/g,a).split(a);c&&(a=d.filter(a,function(a){return a.length&&!!this.trim(a)},this));return a},
normalizeNewline:function(b){return this.splitByLines(b).join(this.getNewline())},repeatString:function(b,c){for(var a=[],e=0;e<c;e++)a.push(b);return a.join("")},padString:function(b,c){var a=d.isNumber(c)?this.repeatString(h("resources").getVariable("indentation")||"\t",c):c,e=[],g=this.splitByLines(b),j=this.getNewline();e.push(g[0]);for(var f=1;f<g.length;f++)e.push(j+a+g[f]);return e.join("")},zeroPadString:function(b,c){for(var a="",e=b.length;c>e++;)a+="0";return a+b},unindentString:function(b,
c){for(var a=this.splitByLines(b),e=0;e<a.length;e++)a[e].search(c)==0&&(a[e]=a[e].substr(c.length));return a.join(this.getNewline())},replaceUnescapedSymbol:function(b,c,a){for(var e=0,g=b.length,j=c.length,f=0;e<g;)if(b.charAt(e)=="\\")e+=j+1;else if(b.substr(e,j)==c){var h=j;f++;var i=a;if(d.isFunction(a))(i=a(b,c,e,f))?(h=i[0].length,i=i[1]):i=!1;i===!1?e++:(b=b.substring(0,e)+i+b.substring(e+h),g=b.length,e+=i.length)}else e++;return b},replaceVariables:function(b,c){var c=c||{},a=d.isFunction(c)?
c:function(a,b){return b in c?c[b]:null},e=h("resources");return h("tabStops").processText(b,{variable:function(b){var c=a(b.token,b.name,b);c===null&&(c=e.getVariable(b.name));if(c===null||d.isUndefined(c))c=b.token;return c}})},replaceCounter:function(b,c){var c=String(c),a=this;return this.replaceUnescapedSymbol(String(b),"$",function(b,g,d){if(b.charAt(d+1)=="{"||a.isNumeric(b.charAt(d+1)))return!1;for(g=d+1;b.charAt(g)=="$"&&b.charAt(g+1)!="{";)g++;return[b.substring(d,g),a.zeroPadString(c,g-
d)]})},matchesTag:function(b){return this.reTag.test(b||"")},escapeText:function(b){return b.replace(/([\$\\])/g,"\\$1")},unescapeText:function(b){return b.replace(/\\(.)/g,"$1")},getCaretPlaceholder:function(){return d.isFunction(i)?i.apply(this,arguments):i},setCaretPlaceholder:function(b){i=b},getLinePadding:function(b){return(b.match(/^(\s+)/)||[""])[0]},getLinePaddingFromPosition:function(b,c){return this.getLinePadding(this.findNewlineBounds(b,c).substring(b))},escapeForRegexp:function(b){return b.replace(RegExp("[.*+?|()\\[\\]{}\\\\]",
"g"),"\\$&")},prettifyNumber:function(b,c){return b.toFixed(typeof c=="undefined"?2:c).replace(/\.?0+$/,"")},stringBuilder:function(b){return new f(b)},replaceSubstring:function(b,c,a,e){if(d.isObject(a)&&"end"in a)e=a.end,a=a.start;d.isString(e)&&(e=a+e.length);d.isUndefined(e)&&(e=a);return a<0||a>b.length?b:b.substring(0,a)+c+b.substring(e)},narrowToNonSpace:function(b,c,a){c=h("range").create(c,a);for(a=/[\s\n\r\u00a0]/;c.start<c.end;){if(!a.test(b.charAt(c.start)))break;c.start++}for(;c.end>
c.start;)if(c.end--,!a.test(b.charAt(c.end))){c.end++;break}return c},findNewlineBounds:function(b,c){for(var a=b.length,e=0,g=a-1,d=c-1;d>0;d--){var f=b.charAt(d);if(f=="\n"||f=="\r"){e=d+1;break}}for(d=c;d<a;d++)if(f=b.charAt(d),f=="\n"||f=="\r"){g=d;break}return h("range").create(e,g-e)},deepMerge:function(){var b,c,a,e,g,j=arguments[0]||{},f=1,h=arguments.length;for(!d.isObject(j)&&!d.isFunction(j)&&(j={});f<h;f++)if((b=arguments[f])!=null)for(c in b)a=j[c],e=b[c],j!==e&&(e&&(d.isObject(e)||(g=
d.isArray(e)))?(g?(g=!1,a=a&&d.isArray(a)?a:[]):a=a&&d.isObject(a)?a:{},j[c]=this.deepMerge(a,e)):e!==void 0&&(j[c]=e));return j}}});
emmet.define("range",function(h,d){function f(b,c,a){switch(a){case "eq":case "==":return b===c;case "lt":case "<":return b<c;case "lte":case "<=":return b<=c;case "gt":case ">":return b>c;case "gte":case ">=":return b>=c}}function i(b,c){d.isObject(b)&&"start"in b?(this.start=Math.min(b.start,b.end),this.end=Math.max(b.start,b.end)):d.isArray(b)?(this.start=b[0],this.end=b[1]):(c=d.isString(c)?c.length:+c,this.start=b,this.end=b+c)}i.prototype={length:function(){return Math.abs(this.end-this.start)},
equal:function(b){return this.cmp(b,"eq","eq")},shift:function(b){this.start+=b;this.end+=b;return this},overlap:function(b){return b.start<=this.end&&b.end>=this.start},intersection:function(b){if(this.overlap(b)){var c=Math.max(b.start,this.start);return new i(c,Math.min(b.end,this.end)-c)}return null},union:function(b){if(this.overlap(b)){var c=Math.min(b.start,this.start);return new i(c,Math.max(b.end,this.end)-c)}return null},inside:function(b){return this.cmp(b,"lte","gt")},contains:function(b){return this.cmp(b,
"lt","gt")},include:function(){return this.cmp(loc,"lte","gte")},cmp:function(b,c,a){var e;b instanceof i?(e=b.start,b=b.end):e=b;return f(this.start,e,c||"<=")&&f(this.end,b,a||">")},substring:function(b){return this.length()>0?b.substring(this.start,this.end):""},clone:function(){return new i(this.start,this.length())},toArray:function(){return[this.start,this.end]},toString:function(){return"{"+this.start+", "+this.length()+"}"}};return{create:function(b,c){if(d.isUndefined(b)||b===null)return null;
if(b instanceof i)return b;if(d.isObject(b)&&"start"in b&&"end"in b)c=b.end-b.start,b=b.start;return new i(b,c)},create2:function(b,c){d.isNumber(b)&&d.isNumber(c)&&(c-=b);return this.create(b,c)}}});
emmet.define("handlerList",function(h,d){function f(){this._list=[]}f.prototype={add:function(f,b){this._list.push(d.extend({order:0},b||{},{fn:f}))},remove:function(f){this._list=d.without(this._list,d.find(this._list,function(b){return b.fn===f}))},list:function(){return d.sortBy(this._list,"order").reverse()},listFn:function(){return d.pluck(this.list(),"fn")},exec:function(f,b){var b=b||[],c=null;d.find(this.list(),function(a){c=a.fn.apply(a,b);if(c!==f)return!0});return c}};return{create:function(){return new f}}});
emmet.define("tokenIterator",function(h,d){function f(d){this.tokens=d;this._position=0;this.reset()}f.prototype={next:function(){if(this.hasNext()){var d=this.tokens[++this._i];this._position=d.start;return d}return null},current:function(){return this.tokens[this._i]},position:function(){return this._position},hasNext:function(){return this._i<this._il-1},reset:function(){this._i=-1;this._il=this.tokens.length},item:function(){return this.tokens[this._i]},itemNext:function(){return this.tokens[this._i+
1]},itemPrev:function(){return this.tokens[this._i-1]},nextUntil:function(f,b){for(var c,a=d.isString(f)?function(a){return a.type==f}:f;c=this.next();)if(b&&b.call(this,c),a.call(this,c))break}};return{create:function(d){return new f(d)}}});
emmet.define("stringStream",function(){function h(d){this.pos=this.start=0;this.string=d}h.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(d){var f=this.string.charAt(this.pos);if(typeof d=="string"?f==d:f&&(d.test?d.test(f):d(f)))return++this.pos,f},eatWhile:function(d){for(var f=this.pos;this.eat(d););
return this.pos>f},eatSpace:function(){for(var d=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>d},skipToEnd:function(){this.pos=this.string.length},skipTo:function(d){d=this.string.indexOf(d,this.pos);if(d>-1)return this.pos=d,!0},skipToPair:function(d,f){for(var h=0,b,c=this.pos,a=this.string.length;c<a;)if(b=this.string.charAt(c++),b==d)h++;else if(b==f&&(h--,h<1))return this.pos=c,!0;return!1},backUp:function(d){this.pos-=d},match:function(d,f,h){if(typeof d==
"string"){if(h=h?function(b){return b.toLowerCase()}:function(b){return b},h(this.string).indexOf(h(d),this.pos)==this.pos)return f!==!1&&(this.pos+=d.length),!0}else return(d=this.string.slice(this.pos).match(d))&&f!==!1&&(this.pos+=d[0].length),d},current:function(){return this.string.slice(this.start,this.pos)}};return{create:function(d){return new h(d)}}});
emmet.define("resources",function(h,d){function f(a,c,e){var d=h("utils"),c=d.replaceUnescapedSymbol(c,"|",d.getCaretPlaceholder());if(e=="snippets")return h("elements").create("snippet",c);if(e=="abbreviations"){e=c;h("utils").trim(a);var a=h("elements"),f;return(f=b.exec(e))?a.create("element",f[1],f[2],f[4]=="/"):a.create("reference",e)}}var i={},b=/^<(\w+\:?[\w\-]*)((?:\s+[\w\:\-]+\s*=\s*(['"]).*?\3)*)\s*(\/?)>/,c={},a={},e=h("handlerList").create();return{setVocabulary:function(b,e){i={};e==
"system"?c=b:a=b},getVocabulary:function(b){return b=="system"?c:a},getMatchedResource:function(a,b){return e.exec(null,d.toArray(arguments))||this.findSnippet(b,a.name())},getVariable:function(a){return(this.getSection("variables")||{})[a]},setVariable:function(a,b){var c=this.getVocabulary("user")||{};if(!("variables"in c))c.variables={};c.variables[a]=b;this.setVocabulary(c,"user")},hasSyntax:function(a){return a in this.getVocabulary("user")||a in this.getVocabulary("system")},addResolver:function(a,
b){e.add(a,b)},removeResolver:function(a){e.remove(a)},getSection:function(b){if(!b)return null;b in i||(i[b]=h("utils").deepMerge({},c[b],a[b]));for(var e=i[b],f=d.rest(arguments),m;e&&(m=f.shift());)if(m in e)e=e[m];else return null;return e},findItem:function(a,b){for(var c=this.getSection(a);c;){if(b in c)return c[b];c=this.getSection(c["extends"])}},findSnippet:function(a,b,c){if(!a||!b)return null;var c=c||[],e=[b];~b.indexOf("-")&&e.push(b.replace(/\-/g,":"));var h=this.getSection(a),i=null;
d.find(["snippets","abbreviations"],function(b){var c=this.getSection(a,b);if(c)return d.find(e,function(a){if(c[a])return i=f(a,c[a],b)})},this);c.push(a);return!i&&h["extends"]&&!d.include(c,h["extends"])?this.findSnippet(h["extends"],b,c):i},fuzzyFindSnippet:function(a,b,c){var c=c||0.3,a=this.getAllSnippets(a),e=h("string-score"),b=b.replace(/:$/,"").replace(/:/g,"-"),f=d.map(a,function(a,c){return{key:c,score:e.score(a.nk,b,0.1)}});if((f=d.last(d.sortBy(f,"score")))&&f.score>=c)return a[f.key].parsedValue},
getAllSnippets:function(a){var b="all-"+a;if(!i[b]){var c=[],e=[];do{var h=this.getSection(a);if(!h)break;d.each(["snippets","abbreviations"],function(a){var b={};d.each(h[a]||null,function(c,e){b[e]={nk:e.replace(/:$/,"").replace(/:/g,"-"),value:c,parsedValue:f(e,c,a),type:a}});c.push(b)});e.push(a);a=h["extends"]}while(a&&!d.include(e,a));i[b]=d.extend.apply(d,c.reverse())}return i[b]}}});
emmet.define("actions",function(h,d){function f(b){return h("utils").trim(b.charAt(0).toUpperCase()+b.substring(1).replace(/_[a-z]/g,function(b){return" "+b.charAt(1).toUpperCase()}))}var i={};return{add:function(b,c,a){b=b.toLowerCase();a=a||{};if(!a.label)a.label=f(b);i[b]={name:b,fn:c,options:a}},get:function(b){return i[b.toLowerCase()]},run:function(b,c){d.isArray(c)||(c=d.rest(arguments));var a=this.get(b);return a?a.fn.apply(emmet,c):(emmet.log('Action "%s" is not defined',b),!1)},getAll:function(){return i},
getList:function(){return d.values(this.getAll())},getMenu:function(b){var c=[],b=b||[];d.each(this.getList(),function(a){if(!a.options.hidden&&!d.include(b,a.name)){var e=f(a.name),g=c;if(a.options.label)for(var j=a.options.label.split("/"),e=j.pop(),h,i;h=j.shift();)i=d.find(g,function(a){return a.type=="submenu"&&a.name==h}),i||(i={name:h,type:"submenu",items:[]},g.push(i)),g=i.items;g.push({type:"action",name:a.name,label:e})}});return c},getActionNameForMenuTitle:function(b,c){var a=null;d.find(c||
this.getMenu(),function(c){if(c.type=="action"){if(c.label==b||c.name==b)return a=c.name}else return a=this.getActionNameForMenuTitle(b,c.items)},this);return a||null}}});
emmet.define("profile",function(h,d){function f(a){d.extend(this,e,a)}function i(a,b){switch(String(b||"").toLowerCase()){case "lower":return a.toLowerCase();case "upper":return a.toUpperCase()}return a}function b(b,c){return a[b.toLowerCase()]=new f(c)}function c(){b("xhtml");b("html",{self_closing_tag:!1});b("xml",{self_closing_tag:!0,tag_nl:!0});b("plain",{tag_nl:!1,indent:!1,place_cursor:!1});b("line",{tag_nl:!1,indent:!1,extraFilters:"s"})}var a={},e={tag_case:"asis",attr_case:"asis",attr_quotes:"double",
tag_nl:"decide",tag_nl_leaf:!1,place_cursor:!0,indent:!0,inline_break:3,self_closing_tag:"xhtml",filters:"",extraFilters:""};f.prototype={tagName:function(a){return i(a,this.tag_case)},attributeName:function(a){return i(a,this.attr_case)},attributeQuote:function(){return this.attr_quotes=="single"?"'":'"'},selfClosing:function(){return this.self_closing_tag=="xhtml"?" /":this.self_closing_tag===!0?"/":""},cursor:function(){return this.place_cursor?h("utils").getCaretPlaceholder():""}};c();return{create:function(a,
c){return arguments.length==2?b(a,c):new f(d.defaults(a||{},e))},get:function(b,c){if(!b&&c){var e=h("resources").findItem(c,"profile");e&&(b=e)}return!b?a.plain:b instanceof f?b:d.isString(b)&&b.toLowerCase()in a?a[b.toLowerCase()]:this.create(b)},remove:function(b){b=(b||"").toLowerCase();b in a&&delete a[b]},reset:function(){a={};c()},stringCase:i}});
emmet.define("editorUtils",function(h){return{isInsideTag:function(d,f){for(var h=/^<\/?\w[\w\:\-]*.*?>/,b=f;b>-1;){if(d.charAt(b)=="<")break;b--}return b!=-1&&(h=h.exec(d.substring(b)))&&f>b&&f<b+h[0].length?!0:!1},outputInfo:function(d,f,h){h=h||d.getProfileName();return{syntax:String(f||d.getSyntax()),profile:h?String(h):null,content:String(d.getContent())}},unindent:function(d,f){return h("utils").unindentString(f,this.getCurrentLinePadding(d))},getCurrentLinePadding:function(d){return h("utils").getLinePadding(d.getCurrentLine())}}});
emmet.define("actionUtils",function(h){return{mimeTypes:{gif:"image/gif",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",svg:"image/svg+xml",html:"text/html",htm:"text/html"},extractAbbreviation:function(d){for(var f=d.length,i=-1,b=0,c=0,a=0,e=h("utils"),g=h("abbreviationParser");;){f--;if(f<0){i=0;break}var j=d.charAt(f);if(j=="]")c++;else if(j=="["){if(!c){i=f+1;break}c--}else if(j=="}")a++;else if(j=="{"){if(!a){i=f+1;break}a--}else if(j==")")b++;else if(j=="("){if(!b){i=f+1;break}b--}else if(!c&&
!a&&(!g.isAllowedChar(j)||j==">"&&e.endsWithTag(d.substring(0,f+1)))){i=f+1;break}}return i!=-1&&!a&&!c&&!b?d.substring(i).replace(/^[\*\+\>\^]+/,""):""},getImageSize:function(d){var f=function(){return d.charCodeAt(h++)};if(d.substr(0,8)==="\u0089PNG\r\n\u001a\n"){var h=d.indexOf("IHDR")+4;return{width:f()<<24|f()<<16|f()<<8|f(),height:f()<<24|f()<<16|f()<<8|f()}}else if(d.substr(0,4)==="GIF8")return h=6,{width:f()|f()<<8,height:f()|f()<<8};else if(d.substr(0,2)==="\u00ff\u00d8")for(var h=2,b=d.length;h<
b;){if(f()!=255)break;var c=f();if(c==218)break;var a=f()<<8|f();if(c>=192&&c<=207&&!(c&4)&&!(c&8))return h+=1,{height:f()<<8|f(),width:f()<<8|f()};else h+=a-2}},captureContext:function(d){if(String(d.getSyntax())in{html:1,xml:1,xsl:1}){var f=String(d.getContent()),i=h("htmlMatcher").find(f,d.getCaretPos());if(i&&i.type=="tag"){for(var d=/([\w\-:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,i=i.open,f=i.range.substring(f).replace(/^<[\w\-\:]+/,""),i={name:i.name,attributes:[]},
b;b=d.exec(f);)i.attributes.push({name:b[1],value:b[2]});return i}}return null},findExpressionBounds:function(d,f){for(var i=String(d.getContent()),b=i.length,c=d.getCaretPos()-1,a=c+1;c>=0&&f(i.charAt(c),c,i);)c--;for(;a<b&&f(i.charAt(a),a,i);)a++;if(a>c)return h("range").create([++c,a])},compoundUpdate:function(d,f){if(f){var h=d.getSelectionRange();d.replaceContent(f.data,f.start,f.end,!0);d.createSelection(f.caret,f.caret+h.end-h.start);return!0}return!1},detectSyntax:function(d,f){var i=f||"html";
h("resources").hasSyntax(i)||(i="html");if(i=="html"&&(this.isStyle(d)||this.isInlineCSS(d)))i="css";return i},detectProfile:function(d){var f=d.getSyntax(),i=h("resources").findItem(f,"profile");if(i)return i;switch(f){case "xml":case "xsl":return"xml";case "css":if(this.isInlineCSS(d))return"line";break;case "html":return(i=h("resources").getVariable("profile"))||(i=this.isXHTML(d)?"xhtml":"html"),i}return"xhtml"},isXHTML:function(d){return d.getContent().search(/<!DOCTYPE[^>]+XHTML/i)!=-1},isStyle:function(d){var f=
String(d.getContent()),d=d.getCaretPos();return(f=h("htmlMatcher").tag(f,d))&&f.open.name.toLowerCase()=="style"&&f.innerRange.cmp(d,"lte","gte")},isInlineCSS:function(d){var f=String(d.getContent()),d=d.getCaretPos();return(f=h("xmlEditTree").parseFromPosition(f,d,!0))?(f=f.itemFromPosition(d,!0))&&f.name().toLowerCase()=="style"&&f.valueRange(!0).cmp(d,"lte","gte"):!1}}});
emmet.define("abbreviationUtils",function(h,d){return{isSnippet:function(d){return h("elements").is(d.matchedResource(),"snippet")},isUnary:function(d){var i=d.matchedResource();return d.children.length||this.isSnippet(d)?!1:i&&i.is_empty||h("tagName").isEmptyElement(d.name())},isInline:function(d){return d.isTextNode()||!d.name()||h("tagName").isInlineLevel(d.name())},isBlock:function(d){return this.isSnippet(d)||!this.isInline(d)},isSnippet:function(d){return h("elements").is(d.matchedResource(),
"snippet")},hasTagsInContent:function(d){return h("utils").matchesTag(d.content)},hasBlockChildren:function(h){return this.hasTagsInContent(h)&&this.isBlock(h)||d.any(h.children,function(d){return this.isBlock(d)},this)},insertChildContent:function(f,i,b){var b=d.extend({keepVariable:!0,appendIfNoChild:!0},b||{}),c=!1,a=h("utils"),f=a.replaceVariables(f,function(e,d,h){var l=e;d=="child"&&(l=a.padString(i,a.getLinePaddingFromPosition(f,h.start)),c=!0,b.keepVariable&&(l+=e));return l});!c&&b.appendIfNoChild&&
(f+=i);return f}}});
emmet.define("base64",function(){return{encode:function(h){for(var d=[],f,i,b,c,a,e,g=0,j=h.length;g<j;)c=h.charCodeAt(g++),a=h.charCodeAt(g++),e=h.charCodeAt(g++),f=c&255,i=a&255,b=e&255,c=f>>2,f=(f&3)<<4|i>>4,i=(i&15)<<2|b>>6,b&=63,isNaN(a)?i=b=64:isNaN(e)&&(b=64),d.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(i)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b));
return d.join("")},decode:function(h){var d,f,i,b,c,a=0,e=0,g=[],j=h.length;if(!h)return h;h+="";do d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),i=d<<18|f<<12|b<<6|c,d=i>>16&
255,f=i>>8&255,i&=255,b==64?g[e++]=String.fromCharCode(d):c==64?g[e++]=String.fromCharCode(d,f):g[e++]=String.fromCharCode(d,f,i);while(a<j);return g.join("")}}});
emmet.define("htmlMatcher",function(h,d){function f(b){var d={},j;return{open:function(a){return(a=this.matches(a))&&a.type=="open"?a:null},close:function(a){return(a=this.matches(a))&&a.type=="close"?a:null},matches:function(f){var i="p"+f;if(!(i in d)&&b.charAt(f)=="<"){var n=b.slice(f);d[i]=(j=n.match(c))?{name:j[1],selfClose:!!j[3],range:h("range").create(f,j[0]),type:"open"}:(j=n.match(a))?{name:j[1],range:h("range").create(f,j[0]),type:"close"}:!1}return d[i]},text:function(){return b}}}function i(a,
b,c){return a.substring(b,b+c.length)==c}function b(a,b){for(var c=[],h=null,f=b.text(),n=a.range.end,o=f.length;n<o;n++){if(i(f,n,"<\!--"))for(h=n;h<o;h++)if(i(f,h,"--\>")){n=h+3;break}if(h=b.matches(n))if(h.type=="open"&&!h.selfClose)c.push(h.name);else if(h.type=="close"){if(!c.length)return h.name==a.name?h:null;if(d.last(c)==h.name)c.pop();else{for(var q=!1;c.length&&!q;)c.pop()==h.name&&(q=!0);if(!c.length&&!q)return h.name==a.name?h:null}}}}var c=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
a=/^<\/([\w\:\-]+)[^>]*>/;return{find:function(a,c){for(var j=h("range"),l=f(a),m=null,n=null,o=c;o>=0;o--)if(m=l.open(o)){if(m.selfClose&&m.range.cmp(c,"lt","gt"))break;if(n=b(m,l)){if(j.create2(m.range.start,n.range.end).contains(c))break}else if(m.range.contains(c))break;m=null}else if(i(a,o,"--\>"))for(var q=o-1;q>=0;q--)if(i(a,q,"--\>"))break;else{if(i(a,q,"<\!--")){o=q;break}}else if(i(a,o,"<\!--")){q=o+4;for(m=a.length;q<m;q++)if(i(a,q,"--\>")){q+=3;break}m={range:h("range").create(o,d.isNumber(q)?
q-o:q[0]),type:"comment"};break}if(m)return q=o=null,n?(o=j.create2(m.range.start,n.range.end),q=j.create2(m.range.end,n.range.start)):o=q=j.create2(m.range.start,m.range.end),m.type=="comment"&&(j=o.substring(a),q.start+=j.length-j.replace(/^<\!--\s*/,"").length,q.end-=j.length-j.replace(/\s*--\>$/,"").length),{open:m,close:n,type:m.type=="comment"?"comment":"tag",innerRange:q,innerContent:function(){return this.innerRange.substring(a)},outerRange:o,outerContent:function(){return this.outerRange.substring(a)},
range:!q.length()||!q.cmp(c,"lte","gte")?o:q,content:function(){return this.range.substring(a)},source:a}},tag:function(a,b){var c=this.find(a,b);if(c&&c.type=="tag")return c}}});
emmet.define("tabStops",function(h,d){var f=100,i=0,b={replaceCarets:!1,escape:function(b){return"\\"+b},tabstop:function(b){return b.token},variable:function(b){return b.token}};h("abbreviationParser").addOutputProcessor(function(b,a){var e=0,d=h("tabStops"),f=h("utils"),l={tabstop:function(a){var b=parseInt(a.group);if(b==0)return"${0}";b>e&&(e=b);return a.placeholder?(b+=i,a=d.processText(a.placeholder,l),"${"+b+":"+a+"}"):"${"+(b+i)+"}"}},b=d.processText(b,l),b=f.replaceVariables(b,d.variablesResolver(a));
i+=e+1;return b});return{extract:function(c,a){var e=h("utils"),g={carets:""},f=[],a=d.extend({},b,a,{tabstop:function(a){var b=a.token,c="";if(a.placeholder=="cursor")f.push({start:a.start,end:a.start+b.length,group:"carets",value:""});else{if("placeholder"in a)g[a.group]=a.placeholder;a.group in g&&(c=g[a.group]);f.push({start:a.start,end:a.start+b.length,group:a.group,value:c})}return b}});a.replaceCarets&&(c=c.replace(RegExp(e.escapeForRegexp(e.getCaretPlaceholder()),"g"),"${0:cursor}"));var c=
this.processText(c,a),i=e.stringBuilder(),m=0,e=d.map(f,function(a){i.append(c.substring(m,a.start));var b=i.length,e=g[a.group]||"";i.append(e);m=a.end;return{group:a.group,start:b,end:b+e.length}});i.append(c.substring(m));return{text:i.toString(),tabstops:d.sortBy(e,"start")}},processText:function(c,a){for(var a=d.extend({},b,a),e=h("utils").stringBuilder(),g=h("stringStream").create(c),f,i;f=g.next();)if(f=="\\"&&!g.eol())e.append(a.escape(g.next()));else{i=f;if(f=="$")if(g.start=g.pos-1,g.match(/^[0-9]+/))i=
a.tabstop({start:e.length,group:g.current().substr(1),token:g.current()});else if(f=g.match(/^\{([a-z_\-][\w\-]*)\}/))i=a.variable({start:e.length,name:f[1],token:g.current()});else if(f=g.match(/^\{([0-9]+)(:.+?)?\}/,!1)){g.skipToPair("{","}");i={start:e.length,group:f[1],token:g.current()};if(f=i.token.substring(i.group.length+2,i.token.length-1))i.placeholder=f.substr(1);i=a.tabstop(i)}e.append(i)}return e.toString()},upgrade:function(b,a){var e=0,g={tabstop:function(b){var c=parseInt(b.group);
c>e&&(e=c);return b.placeholder?"${"+(c+a)+":"+b.placeholder+"}":"${"+(c+a)+"}"}};d.each(["start","end","content"],function(a){b[a]=this.processText(b[a],g)},this);return e},variablesResolver:function(b){var a={},e=h("resources");return function(g,j){if(j=="child")return g;if(j=="cursor")return h("utils").getCaretPlaceholder();var i=b.attribute(j);if(!d.isUndefined(i))return i;if(i=e.getVariable(j))return i;a[j]||(a[j]=f++);return"${"+a[j]+":"+j+"}"}},resetPlaceholderCounter:function(){console.log("deprecated");
f=100},resetTabstopIndex:function(){i=0;f=100}}});
emmet.define("preferences",function(h,d){var f={},i={},b=null,c=null;return{define:function(a,b,c){var h=a;d.isString(a)&&(h={},h[a]={value:b,description:c});d.each(h,function(a,b){i[b]=d.isObject(a)&&"value"in a&&d.keys(a).length<3?a:{value:a}})},set:function(a,b){var c=a;d.isString(a)&&(c={},c[a]=b);d.each(c,function(a,b){if(!(b in i))throw'Property "'+b+'" is not defined. You should define it first with `define` method of current module';if(a!==i[b].value){switch(typeof i[b].value){case "boolean":var c=
a;d.isString(c)?(c=c.toLowerCase(),a=c=="yes"||c=="true"||c=="1"):a=!!c;break;case "number":a=parseInt(a+"",10)||0;break;default:a+=""}f[b]=a}else b in f&&delete f[b]})},get:function(a){if(a in f)return f[a];if(a in i)return i[a].value},getArray:function(a){a=this.get(a);d.isUndefined(a)||(a=d.map(a.split(","),h("utils").trim),a.length||(a=null));return a},getDict:function(a){var b={};d.each(this.getArray(a),function(a){a=a.split(":");b[a[0]]=a[1]});return b},description:function(a){return a in i?
i[a].description:void 0},remove:function(a){d.isArray(a)||(a=[a]);d.each(a,function(a){a in f&&delete f[a];a in i&&delete i[a]})},list:function(){return d.map(d.keys(i).sort(),function(a){return{name:a,value:this.get(a),type:typeof i[a].value,description:i[a].description}},this)},load:function(a){d.each(a,function(a,b){this.set(b,a)},this)},exportModified:function(){return d.clone(f)},reset:function(){f={}},_startTest:function(){b=i;c=f;i={};f={}},_stopTest:function(){i=b;f=c}}});
emmet.define("filters",function(h,d){function f(b){return!b?[]:d.isString(b)?b.split(/[\|,]/g):b}var i={};return{add:function(b,c){i[b]=c},apply:function(b,c,a){var e=h("utils"),a=h("profile").get(a);d.each(f(c),function(c){(c=e.trim(c.toLowerCase()))&&c in i&&(b=i[c](b,a))});return b},composeList:function(b,c,a){c=h("profile").get(c);b=f(c.filters||h("resources").findItem(b,"filters")||"html");c.extraFilters&&(b=b.concat(f(c.extraFilters)));a&&(b=b.concat(f(a)));if(!b||!b.length)b=f("html");return b},
extractFromAbbreviation:function(b){var c="",b=b.replace(/\|([\w\|\-]+)$/,function(a,b){c=b;return""});return[b,f(c)]}}});
emmet.define("elements",function(h,d){function f(a){return{data:a}}var i={},b=/([\w\-]+)\s*=\s*(['"])(.*?)\2/g,c={add:function(a,b){var c=this;i[a]=function(){var d=b.apply(c,arguments);if(d)d.type=a;return d}},get:function(a){return i[a]},create:function(a){var b=[].slice.call(arguments,1),c=this.get(a);return c?c.apply(this,b):null},is:function(a,b){return a&&a.type===b}};c.add("element",function(a,c,g){var h={name:a,is_empty:!!g};if(c)if(h.attributes=[],d.isArray(c))h.attributes=c;else if(d.isString(c))for(;a=
b.exec(c);)h.attributes.push({name:a[1],value:a[3]});else d.each(c,function(a,b){h.attributes.push({name:b,value:a})});return h});c.add("snippet",f);c.add("reference",f);c.add("empty",function(){return{}});return c});
emmet.define("editTree",function(h,d,f){function i(a,b){this.options=d.extend({offset:0},b);this.source=a;this._children=[];this._positions={name:0};this.initialize.apply(this,arguments)}function b(a,b,c){this.parent=a;this._name=b.value;this._value=c?c.value:"";this._positions={name:b.start,value:c?c.start:-1};this.initialize.apply(this,arguments)}var c=h("range").create;i.extend=f.extend;i.prototype={initialize:function(){},_updateSource:function(a,b,g){var f=c(b,d.isUndefined(g)?0:g-b),i=a.length-
f.length(),m=function(a){d.each(a,function(b,c){b>=f.end&&(a[c]+=i)})};m(this._positions);d.each(this.list(),function(a){m(a._positions)});this.source=h("utils").replaceSubstring(this.source,a,f)},add:function(a,c){var d=new b(a,c);this._children.push(d);return d},get:function(a){return d.isNumber(a)?this.list()[a]:d.isString(a)?d.find(this.list(),function(b){return b.name()===a}):a},getAll:function(a){d.isArray(a)||(a=[a]);var b=[],c=[];d.each(a,function(a){d.isString(a)?b.push(a):d.isNumber(a)&&
c.push(a)});return d.filter(this.list(),function(a,h){return d.include(c,h)||d.include(b,a.name())})},value:function(a,b,c){var h=this.get(a);if(h)return h.value(b);if(!d.isUndefined(b))return this.add(a,b,c)},values:function(a){return d.map(this.getAll(a),function(a){return a.value()})},remove:function(a){if(a=this.get(a))this._updateSource("",a.fullRange()),this._children=d.without(this._children,a)},list:function(){return this._children},indexOf:function(a){return d.indexOf(this.list(),this.get(a))},
name:function(a){if(!d.isUndefined(a)&&this._name!==(a=String(a)))this._updateSource(a,this._positions.name,this._positions.name+this._name.length),this._name=a;return this._name},nameRange:function(a){return c(this._positions.name+(a?this.options.offset:0),this.name())},range:function(a){return c(a?this.options.offset:0,this.toString())},itemFromPosition:function(a,b){return d.find(this.list(),function(c){return c.range(b).inside(a)})},toString:function(){return this.source}};b.extend=f.extend;b.prototype=
{initialize:function(){},_pos:function(a,b){return a+(b?this.parent.options.offset:0)},value:function(a){if(!d.isUndefined(a)&&this._value!==(a=String(a)))this.parent._updateSource(a,this.valueRange()),this._value=a;return this._value},name:function(a){if(!d.isUndefined(a)&&this._name!==(a=String(a)))this.parent._updateSource(a,this.nameRange()),this._name=a;return this._name},namePosition:function(a){return this._pos(this._positions.name,a)},valuePosition:function(a){return this._pos(this._positions.value,
a)},range:function(a){return c(this.namePosition(a),this.toString())},fullRange:function(a){return this.range(a)},nameRange:function(a){return c(this.namePosition(a),this.name())},valueRange:function(a){return c(this.valuePosition(a),this.value())},toString:function(){return this.name()+this.value()},valueOf:function(){return this.toString()}};return{EditContainer:i,EditElement:b,createToken:function(a,b,c){a={start:a||0,value:b||"",type:c};a.end=a.start+a.value.length;return a}}});
emmet.define("cssEditTree",function(h,d){function f(a,b){return h("range").create(a,b)}function i(a,b){var b=b||e|g,c=["white","line"];if((b&g)==g)for(;a.length&&d.include(c,d.last(a).type);)a.pop();if((b&e)==e)for(;a.length&&d.include(c,a[0].type);)a.shift();return a}function b(a){var b=["white","line",":"],c=[],h,j;a.nextUntil(function(){return!d.include(b,this.itemNext().type)});for(j=a.current().end;h=a.next();){if(h.type=="}"||h.type==";")return i(c,e|(h.type=="}"?g:0)),c.length?(j=c[0].start,
a=d.last(c).end):a=j,f(j,a-j);c.push(h)}if(c.length)return f(c[0].start,d.last(c).end-c[0].start)}function c(a){var b=h("stringStream").create(a),c=[],e=/[\s\u00a0,]/,g=function(){b.next();c.push(f(b.start,b.current()));b.start=b.pos};b.eatSpace();for(b.start=b.pos;a=b.next();)if(a=='"'||a=="'"){b.next();if(!b.skipTo(a))break;g()}else if(a=="("){b.backUp(1);if(!b.skipToPair("(",")"))break;b.backUp(1);g()}else if(e.test(a))c.push(f(b.start,b.current().length-1)),b.eatWhile(e),b.start=b.pos;g();return d.chain(c).filter(function(a){return!!a.length()}).uniq(!1,
function(a){return a.toString()}).value()}var a={styleBefore:"\n\t",styleSeparator:": ",offset:0},e=1,g=2,j=h("editTree").EditContainer.extend({initialize:function(c){d.defaults(this.options,a);var e=h("editTree"),g=h("tokenIterator").create(h("cssParser").parse(c)),j,s=[],r;for(j=g.position();r=g.next();){if(r.type=="{")break;s.push(r)}i(s);s.length?(j=s[0].start,s=d.last(s).end):s=j;j=f(j,s-j);this._positions.name=j.start;this._name=j.substring(c);if(!g.current()||g.current().type!="{")throw"Invalid CSS rule";
for(this._positions.contentStart=g.position()+1;j=g.next();){if(s=j.type=="identifier")a:{s=g.tokens;r=g._i+1;for(var u=s.length;r<u;r++){if(s[r].type==":"){s=!0;break a}if(s[r].type=="identifier"||s[r].type=="line"){s=!1;break a}}s=!1}s&&(j=f(j),s=b(g),r=g.current()&&g.current().type==";"?f(g.current()):f(s.end,0),this._children.push(new l(this,e.createToken(j.start,j.substring(c)),e.createToken(s.start,s.substring(c)),e.createToken(r.start,r.substring(c)))))}this._saveStyle()},_saveStyle:function(){var a=
this._positions.contentStart,b=this.source,c=h("utils");d.each(this.list(),function(e){e.styleBefore=b.substring(a,e.namePosition());var g=c.splitByLines(e.styleBefore);if(g.length>1)e.styleBefore="\n"+d.last(g);e.styleSeparator=b.substring(e.nameRange().end,e.valuePosition());e.styleBefore=d.last(e.styleBefore.split("*/"));e.styleSeparator=e.styleSeparator.replace(/\/\*.*?\*\//g,"");a=e.range().end})},add:function(a,b,c){var e=this.list(),g=this._positions.contentStart,f=d.pick(this.options,"styleBefore",
"styleSeparator"),j=h("editTree");if(d.isUndefined(c))c=e.length;var i=e[c];if(i)g=i.fullRange().start;else if(i=e[c-1])i.end(";"),g=i.range().end;i&&(f=d.pick(i,"styleBefore","styleSeparator"));a=j.createToken(g+f.styleBefore.length,a);b=j.createToken(a.end+f.styleSeparator.length,b);j=new l(this,a,b,j.createToken(b.end,";"));d.extend(j,f);this._updateSource(j.styleBefore+j.toString(),g);this._children.splice(c,0,j);return j}}),l=h("editTree").EditElement.extend({initialize:function(a,b,c,d){this.styleBefore=
a.options.styleBefore;this.styleSeparator=a.options.styleSeparator;this._end=d.value;this._positions.end=d.start},valueParts:function(a){var b=c(this.value());if(a){var e=this.valuePosition(!0);d.each(b,function(a){a.shift(e)})}return b},end:function(a){if(!d.isUndefined(a)&&this._end!==a)this.parent._updateSource(a,this._positions.end,this._positions.end+this._end.length),this._end=a;return this._end},fullRange:function(a){a=this.range(a);a.start-=this.styleBefore.length;return a},toString:function(){return this.name()+
this.styleSeparator+this.value()+this.end()}});return{parse:function(a,b){return new j(a,b)},parseFromPosition:function(a,b,c){c=this.extractRule(a,b,c);return!c||!c.inside(b)?null:this.parse(c.substring(a),{offset:c.start})},extractRule:function(a,b,c){for(var d="",e=a.length,g=-1,f;b>=0;){f=a.charAt(b);if(f=="{"){g=b;break}else if(f=="}"&&!c){b++;break}b--}for(;b<e;){f=a.charAt(b);if(f=="{")g=b;else if(f=="}"){g!=-1&&(d=a.substring(g,b+1));break}b++}if(d){b=g-1;for(c="";b>=0;){f=a.charAt(b);if("{}/\\<>\n\r".indexOf(f)!=
-1)break;b--}c=a.substring(b+1,g).replace(/^[\s\n\r]+/m,"");return h("range").create(g-c.length,d.length+c.length)}return null},baseName:function(a){return a.replace(/^\s*\-\w+\-/,"")},findParts:c}});
emmet.define("xmlEditTree",function(h,d){var f={styleBefore:" ",styleSeparator:"=",styleQuote:'"',offset:0},i=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/m,b=h("editTree").EditContainer.extend({initialize:function(a){d.defaults(this.options,f);this._positions.name=1;var b=null,g=h("xmlParser").parse(a),j=h("range");d.each(g,function(d){d.value=j.create(d).substring(a);switch(d.type){case "tag":if(/^<[^\/]+/.test(d.value))this._name=d.value.substring(1);
break;case "attribute":b&&this._children.push(new c(this,b));b=d;break;case "string":this._children.push(new c(this,b,d)),b=null}},this);b&&this._children.push(new c(this,b));this._saveStyle()},_saveStyle:function(){var a=this.nameRange().end,b=this.source;d.each(this.list(),function(c){c.styleBefore=b.substring(a,c.namePosition());if(c.valuePosition()!==-1)c.styleSeparator=b.substring(c.namePosition()+c.name().length,c.valuePosition()-c.styleQuote.length);a=c.range().end})},add:function(a,b,g){var f=
this.list(),i=this.nameRange().end,m=h("editTree"),n=d.pick(this.options,"styleBefore","styleSeparator","styleQuote");if(d.isUndefined(g))g=f.length;var o=f[g];if(o)i=o.fullRange().start;else if(o=f[g-1])i=o.range().end;o&&(n=d.pick(o,"styleBefore","styleSeparator","styleQuote"));b=n.styleQuote+b+n.styleQuote;a=new c(this,m.createToken(i+n.styleBefore.length,a),m.createToken(i+n.styleBefore.length+a.length+n.styleSeparator.length,b));d.extend(a,n);this._updateSource(a.styleBefore+a.toString(),i);
this._children.splice(g,0,a);return a}}),c=h("editTree").EditElement.extend({initialize:function(a,b,c){this.styleBefore=a.options.styleBefore;this.styleSeparator=a.options.styleSeparator;b="";a=a.options.styleQuote;if(c)b=c.value,a=b.charAt(0),a=='"'||a=="'"?b=b.substring(1):a="",a&&b.charAt(b.length-1)==a&&(b=b.substring(0,b.length-1));this.styleQuote=a;this._value=b;this._positions.value=c?c.start+a.length:-1},fullRange:function(a){a=this.range(a);a.start-=this.styleBefore.length;return a},toString:function(){return this.name()+
this.styleSeparator+this.styleQuote+this.value()+this.styleQuote}});return{parse:function(a,c){return new b(a,c)},parseFromPosition:function(a,b,c){c=this.extractTag(a,b,c);return!c||!c.inside(b)?null:this.parse(c.substring(a),{offset:c.start})},extractTag:function(a,b,c){var d=a.length,f,m=h("range"),n=Math.min(2E3,d),o=null,q=function(b){var c;if(a.charAt(b)=="<"&&(c=a.substr(b,n).match(i)))return m.create(b,c[0])};for(f=b;f>=0;f--)if(o=q(f))break;if(o&&(o.inside(b)||c))return o;if(!o&&c)return null;
for(f=b;f<d;f++)if(o=q(f))return o}}});
emmet.define("expandAbbreviation",function(h,d){var f=h("handlerList").create(),i=null,b=h("actions");b.add("expand_abbreviation",function(b,a,e){var g=d.toArray(arguments),j=h("editorUtils").outputInfo(b,a,e);g[1]=j.syntax;g[2]=j.profile;return f.exec(!1,g)});b.add("expand_abbreviation_with_tab",function(c,a,d){var g=c.getSelection(),f=h("resources").getVariable("indentation");if(g)return d=h("utils"),a=h("range").create(c.getSelectionRange()),g=d.padString(g,f),c.replaceContent(f+"${0}",c.getCaretPos()),
f=h("range").create(c.getCaretPos(),a.length()),c.replaceContent(g,f.start,f.end,!0),c.createSelection(f.start,f.start+g.length),!0;b.run("expand_abbreviation",c,a,d)||c.replaceContent(f,c.getCaretPos());return!0},{hidden:!0});f.add(function(b,a,d){var g=b.getSelectionRange().end,f=i.findAbbreviation(b);return f&&(a=emmet.expandAbbreviation(f,a,d,h("actionUtils").captureContext(b)))?(b.replaceContent(a,g-f.length,g),!0):!1},{order:-1});return i={addHandler:function(b,a){f.add(b,a)},removeHandler:function(b){f.remove(b,
options)},findAbbreviation:function(b){var a=h("range").create(b.getSelectionRange()),d=String(b.getContent());if(a.length())return a.substring(d);b=b.getCurrentLineRange();return h("actionUtils").extractAbbreviation(d.substring(b.start,a.start))}}});
emmet.define("wrapWithAbbreviation",function(h){var d=null;h("actions").add("wrap_with_abbreviation",function(f,i,b,c){var b=h("editorUtils").outputInfo(f,b,c),a=h("utils"),c=h("editorUtils"),i=i||f.prompt("Enter abbreviation");if(!i)return null;var i=String(i),e=h("range").create(f.getSelectionRange());if(!e.length()){e=h("htmlMatcher").tag(b.content,e.start);if(!e)return!1;e=a.narrowToNonSpace(b.content,e.range)}a=a.escapeText(e.substring(b.content));return(i=d.wrap(i,c.unindent(f,a),b.syntax,b.profile,
h("actionUtils").captureContext(f)))?(f.replaceContent(i,e.start,e.end),!0):!1});return d={wrap:function(d,i,b,c,a){var e=h("filters"),g=h("utils"),b=b||emmet.defaultSyntax(),c=h("profile").get(c,b);h("tabStops").resetTabstopIndex();d=e.extractFromAbbreviation(d);return(i=h("abbreviationParser").parse(d[0],{syntax:b,pastedContent:i,contextNode:a}))?(b=e.composeList(b,c,d[1]),e.apply(i,b,c),g.replaceVariables(i.toString())):null}}});
emmet.exec(function(h,d){function f(b,a){var e=a-(b.options.offset||0),g=/^[\s\n\r]/;return d.find(b.list(),function(a){return a.range().end===e?g.test(b.source.charAt(e)):a.range().inside(e)})}function i(b,a,d,g){for(var f=-1,i=-1;a--;)if(b.substr(a,d.length)==d){f=a;break}if(f!=-1){a=f;for(d=b.length;d>=a++;)if(b.substr(a,g.length)==g){i=a+g.length;break}}return f!=-1&&i!=-1?h("range").create(f,i-f):null}function b(b,a,d,g){function f(b){return b.replace(RegExp("^"+q.escapeForRegexp(a)+"\\s*"),
function(a){n-=a.length;return""}).replace(RegExp("\\s*"+q.escapeForRegexp(d)+"$"),"")}var l=h("editorUtils"),m=l.outputInfo(b).content,n=b.getCaretPos(),o=null,q=h("utils");(o=i(m,n,a,d))&&o.overlap(g)?(g=o,o=f(g.substring(m))):(o=a+" "+g.substring(m).replace(RegExp(q.escapeForRegexp(a)+"\\s*|\\s*"+q.escapeForRegexp(d),"g"),"")+" "+d,n+=a.length+1);return o!==null?(o=q.escapeText(o),b.setCaretPos(g.start),b.replaceContent(l.unindent(b,o),g.start,g.end),b.setCaretPos(n),!0):!1}h("actions").add("toggle_comment",
function(c){var a=h("editorUtils").outputInfo(c);if(a.syntax=="css"){var d=c.getCaretPos(),g=h("htmlMatcher").tag(a.content,d);if(g&&g.open.range.inside(d))a.syntax="html"}if(a.syntax=="css"){g=h("range").create(c.getSelectionRange());a=h("editorUtils").outputInfo(c);if(!g.length()&&(d=h("cssEditTree").parseFromPosition(a.content,c.getCaretPos())))g=(g=f(d,c.getCaretPos()))?g.range(!0):h("range").create(d.nameRange(!0).start,d.source);g.length()||(g=h("range").create(c.getCurrentLineRange()),h("utils").narrowToNonSpace(a.content,
g));c=b(c,"/*","*/",g)}else{a=h("range").create(c.getSelectionRange());d=h("editorUtils").outputInfo(c);if(!a.length()&&(d=h("htmlMatcher").tag(d.content,c.getCaretPos())))a=d.outerRange;c=b(c,"<\!--","--\>",a)}return c})});
emmet.exec(function(h){function d(d,h,b){function c(b){for(var c=b;c>=0;){var d=a.charAt(c);if(d=="\n"||d=="\r")break;c--}return a.substring(c,b)}for(var h=h||1,b=d.getCaretPos()+(b||0),a=String(d.getContent()),d=a.length,e=-1,g=/^\s+$/;b<=d&&b>=0;){b+=h;var j=a.charAt(b),l=a.charAt(b+1),m=a.charAt(b-1);switch(j){case '"':case "'":l==j&&m=="="&&(e=b+1);break;case ">":l=="<"&&(e=b+1);break;case "\n":case "\r":g.test(c(b-1))&&(e=b)}if(e!=-1)break}return e}h=h("actions");h.add("prev_edit_point",function(f){var h=
f.getCaretPos(),b=d(f,-1);b==h&&(b=d(f,-1,-2));return b!=-1?(f.setCaretPos(b),!0):!1},{label:"Previous Edit Point"});h.add("next_edit_point",function(f){var h=d(f,1);return h!=-1?(f.setCaretPos(h),!0):!1})});
emmet.exec(function(h,d){function f(a,b,c,d){var e=h("range"),g=h("editorUtils").outputInfo(a).content,f=g.length,j,i=e.create(-1,0),l=e.create(a.getSelectionRange());j=l.start;for(var o=1E5;j>=0&&j<f&&--o>0;){if(e=c(g,j,b)){if(i.equal(e))break;i=e.clone();if(j=d(e.substring(g),e.start,l.clone()))return a.createSelection(j.start,j.end),!0;else j=b?e.start:e.end-1}j+=b?-1:1}return!1}function i(a){var b=!0;return f(a,!1,function(a,c){if(b){b=!1;var d;a:{d=c;for(var e;d>=0;){if(e=g(a,d)){d=e;break a}d--}d=
null}return d}else return g(a,c)},function(a,b,c){return e(a,b,c,!1)})}function b(a){return f(a,!0,g,function(a,b,c){return e(a,b,c,!0)})}function c(b,c,e){var e=e||0,g=h("range"),f=[],i=-1,l="",z="",x,o;d.each(c,function(c){switch(c.type){case "tag":o=b.substring(c.start,c.end);/^<[\w\:\-]/.test(o)&&f.push(g.create({start:c.start+1,end:c.end}));break;case "attribute":i=c.start;l=b.substring(c.start,c.end);break;case "string":f.push(g.create(i,c.end-i)),x=g.create(c),z=x.substring(b),j(z.charAt(0))&&
x.start++,j(z.charAt(z.length-1))&&x.end--,f.push(x),l=="class"&&(f=f.concat(a(x.substring(b),x.start)))}});d.each(f,function(a){a.shift(e)});return d.chain(f).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}function a(a,b){var b=b||0,c=[],d=h("stringStream").create(a),e=h("range");d.eatSpace();d.start=d.pos;for(var g;g=d.next();)if(/[\s\u00a0]/.test(g))c.push(e.create(d.start+b,d.pos-d.start-1)),d.eatSpace(),d.start=d.pos;c.push(e.create(d.start+b,d.pos-
d.start));return c}function e(a,b,e,g){a=c(a,h("xmlParser").parse(a),b);g&&a.reverse();return(b=d.find(a,function(a){return a.equal(e)}))?(g=d.indexOf(a,b),g<a.length-1?a[g+1]:null):g?d.find(a,function(a){return a.start<e.start}):!b&&(g=d.filter(a,function(a){return a.inside(e.end)}),g.length>1)?g[1]:d.find(a,function(a){return a.end>e.end})}function g(a,b){var c;if(a.charAt(b)=="<"&&(c=a.substring(b,a.length).match(q)))return h("range").create(b,c[0])}function j(a){return a=='"'||a=="'"}function l(a){var b=
a.valueRange(!0),c=[a.range(!0),b],e=h("stringStream"),g=h("cssEditTree"),f=h("range"),j=a.value();d.each(a.valueParts(),function(a){var h=a.clone();c.push(h.shift(b.start));var i=e.create(a.substring(j));if(i.match(/^[\w\-]+\(/,!0)){i.start=i.pos;i.skipToPair("(",")");var l=i.current();c.push(f.create(h.start+i.start,l));d.each(g.findParts(l),function(a){c.push(f.create(h.start+i.start+a.start,a.substring(l)))})}});return d.chain(c).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}
function m(a,b,c){var e=null,g=null,f=a.list(),h,j;c?(f.reverse(),h=function(a){return a.range(!0).start<=b.start},j=function(a){return a.start<b.start}):(h=function(a){return a.range(!0).end>=b.end},j=function(a){return a.end>b.start});for(;e=d.find(f,h);){a=l(e);c&&a.reverse();if(g=d.find(a,function(a){return a.equal(b)})){if(g=d.indexOf(a,g),g!=a.length-1){g=a[g+1];break}}else{g=d.filter(a,function(a){return a.inside(b.end)});if(g.length>1){g=g[1];break}if(g=d.find(a,j))break}g=null;b.start=b.end=
c?e.range(!0).start-1:e.range(!0).end+1}return g}function n(a,b,c){a=h("cssEditTree").parse(a,{offset:b});b=a.nameRange(!0);return c.end<b.end?b:m(a,c,!1)}function o(a,b,c){b=h("cssEditTree").parse(a,{offset:b});a=m(b,c,!0);return!a&&(b=b.nameRange(!0),c.start>b.start)?b:a}var q=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,s=h("actions");s.add("select_next_item",function(a){return a.getSyntax()=="css"?f(a,!1,h("cssEditTree").extractRule,n):i(a)});s.add("select_previous_item",
function(a){return a.getSyntax()=="css"?f(a,!0,h("cssEditTree").extractRule,o):b(a)})});
emmet.exec(function(h){function d(c,a){var a=String((a||"out").toLowerCase()),d=h("editorUtils").outputInfo(c),g=h("range").create(c.getSelectionRange()),d=d.content;b&&!b.range.equal(g)&&(b=null);if(b&&g.length())if(a=="in")if(b.type=="tag"&&!b.close)return!1;else if(b.range.equal(b.outerRange))b.range=b.innerRange;else{var f=h("utils").narrowToNonSpace(d,b.innerRange);if((b=i.find(d,f.start+1))&&b.range.equal(g)&&b.outerRange.equal(g))b.range=b.innerRange}else if(!b.innerRange.equal(b.outerRange)&&
b.range.equal(b.innerRange)&&g.equal(b.range))b.range=b.outerRange;else{if((b=i.find(d,g.start))&&b.range.equal(g)&&b.innerRange.equal(g))b.range=b.outerRange}else b=i.find(d,g.start);if(b&&!b.range.equal(g))return c.createSelection(b.range.start,b.range.end),!0;b=null;return!1}var f=h("actions"),i=h("htmlMatcher"),b=null;f.add("match_pair",d,{hidden:!0});f.add("match_pair_inward",function(b){return d(b,"in")},{label:"HTML/Match Pair Tag (inward)"});f.add("match_pair_outward",function(b){return d(b,
"out")},{label:"HTML/Match Pair Tag (outward)"});f.add("matching_pair",function(b){var a=String(b.getContent()),d=b.getCaretPos();a.charAt(d)=="<"&&d++;return(a=i.tag(a,d))&&a.close?(a.open.range.inside(d)?b.setCaretPos(a.close.range.start):b.setCaretPos(a.open.range.start),!0):!1},{label:"HTML/Go To Matching Tag Pair"})});
emmet.exec(function(h){h("actions").add("remove_tag",function(d){var f=h("utils"),i=h("editorUtils").outputInfo(d),b=h("htmlMatcher").tag(i.content,d.getCaretPos());if(b){if(b.close){var c=f.narrowToNonSpace(i.content,b.innerRange),a=f.findNewlineBounds(i.content,c.start),a=f.getLinePadding(a.substring(i.content)),i=c.substring(i.content),i=f.unindentString(i,a);d.replaceContent(f.getCaretPlaceholder()+f.escapeText(i),b.outerRange.start,b.outerRange.end)}else d.replaceContent(f.getCaretPlaceholder(),
b.range.start,b.range.end);return!0}return!1},{label:"HTML/Remove Tag"})});
emmet.exec(function(h){h("actions").add("split_join_tag",function(d,f){var i=h("htmlMatcher"),b=h("editorUtils").outputInfo(d,null,f),c=h("profile").get(b.profile);if(i=i.tag(b.content,d.getCaretPos())){if(i.close){var b=h("utils"),c=c.selfClosing()||" /",c=i.open.range.substring(i.source).replace(/\s*>$/,c+">"),a=d.getCaretPos();c.length+i.outerRange.start<a&&(a=c.length+i.outerRange.start);c=b.escapeText(c);d.replaceContent(c,i.outerRange.start,i.outerRange.end)}else{var b=h("utils"),e=b.getNewline(),
g=h("resources").getVariable("indentation"),a=d.getCaretPos(),c=c.tag_nl===!0?e+g+e:"",e=i.outerContent().replace(/\s*\/>$/,">"),a=i.outerRange.start+e.length;e+=c+"</"+i.open.name+">";e=b.escapeText(e);d.replaceContent(e,i.outerRange.start,i.outerRange.end)}d.setCaretPos(a);i=!0}else i=!1;return i},{label:"HTML/Split\\Join Tag Declaration"})});
emmet.define("reflectCSSValue",function(h,d){function f(c){var a=h("cssEditTree"),d=h("editorUtils").outputInfo(c),c=c.getCaretPos();if(a=a.parseFromPosition(d.content,c))if(d=a.itemFromPosition(c,!0)){var g=a.source,f=a.options.offset,c=c-f-d.range().start;b.exec(!1,[d]);if(g!==a.source)return{data:a.source,start:f,end:f+g.length,caret:f+d.range().start+c}}}function i(b){var b=h("cssEditTree").baseName(b),a;if(b=="opacity"||b=="filter")return/^(?:\-\w+\-)?(?:opacity|filter)$/;else if(a=b.match(/^border-radius-(top|bottom)(left|right)/))return RegExp("^(?:\\-\\w+\\-)?(?:"+
b+"|border-"+a[1]+"-"+a[2]+"-radius)$");else if(a=b.match(/^border-(top|bottom)-(left|right)-radius/))return RegExp("^(?:\\-\\w+\\-)?(?:"+b+"|border-radius-"+a[1]+a[2]+")$");return RegExp("^(?:\\-\\w+\\-)?"+b+"$")}var b=h("handlerList").create();h("actions").add("reflect_css_value",function(b){return b.getSyntax()!="css"?!1:h("actionUtils").compoundUpdate(b,f(b))},{label:"CSS/Reflect Value"});b.add(function(b){var a=i(b.name());d.each(b.parent.list(),function(d){if(a.test(d.name())){var g;var f=b.name(),
i=b.value(),m=d.name();g=d.value();var n=h("cssEditTree"),o=h("utils"),f=n.baseName(f),m=n.baseName(m);g=f=="opacity"&&m=="filter"?g.replace(/opacity=[^)]*/i,"opacity="+Math.floor(parseFloat(i)*100)):f=="filter"&&m=="opacity"?(f=i.match(/opacity=([^)]*)/i))?o.prettifyNumber(parseInt(f[1])/100):g:i;d.value(g)}})},{order:-1});return{addHandler:function(c,a){b.add(c,a)},removeHandler:function(c){b.remove(c,options)}}});
emmet.exec(function(h){h("actions").add("evaluate_math_expression",function(d){var f=h("actionUtils"),i=h("utils"),b=String(d.getContent()),c=h("range").create(d.getSelectionRange());c.length()||(c=f.findExpressionBounds(d,function(a){return i.isNumeric(a)||".+-*/\\".indexOf(a)!=-1}));if(c&&c.length()){f=c.substring(b);f=f.replace(/([\d\.\-]+)\\([\d\.\-]+)/g,"Math.round($1/$2)");try{var a=i.prettifyNumber((new Function("return "+f))());d.replaceContent(a,c.start,c.end);d.setCaretPos(c.start+a.length);
return!0}catch(e){}}return!1},{label:"Numbers/Evaluate Math Expression"})});
emmet.exec(function(h,d){function f(b,a){var e=h("utils"),g=!1,f=!1,l=h("actionUtils").findExpressionBounds(b,function(a,b,c){return e.isNumeric(a)?!0:a=="."?!e.isNumeric(c.charAt(b+1))?!1:f?!1:f=!0:a=="-"?g?!1:g=!0:!1});if(l&&l.length()){var m=l.substring(String(b.getContent())),n=parseFloat(m);if(!d.isNaN(n)){n=e.prettifyNumber(n+a);if(/^(\-?)0+[1-9]/.test(m)){var o="";RegExp.$1&&(o="-",n=n.substring(1));n=n.split(".");n[0]=e.zeroPadString(n[0],i(m));n=o+n.join(".")}b.replaceContent(n,l.start,l.end);
b.createSelection(l.start,l.start+n.length);return!0}}return!1}function i(b){b=b.replace(/^\-/,"");return~b.indexOf(".")?b.split(".")[0].length:b.length}var b=h("actions");d.each([1,-1,10,-10,0.1,-0.1],function(c){var a=c>0?"increment":"decrement";b.add(a+"_number_by_"+String(Math.abs(c)).replace(".","").substring(0,2),function(a){return f(a,c)},{label:"Numbers/"+a.charAt(0).toUpperCase()+a.substring(1)+" number by "+Math.abs(c)})})});
emmet.exec(function(h,d){var f=h("actions"),i=h("preferences");i.define("css.closeBraceIndentation","\n","Indentation before closing brace of CSS rule. Some users prefere indented closing brace of CSS rule for better readability. This preference\u2019s value will be automatically inserted before closing brace when user adds newline in newly created CSS rule (e.g. when \u201cInsert formatted linebreak\u201d action will be performed in CSS file). If you\u2019re such user, you may want to write put a value like <code>\\n\\t</code> in this preference.");
f.add("insert_formatted_line_break_only",function(b){var c=h("utils"),a=h("resources"),e=h("editorUtils").outputInfo(b),g=b.getCaretPos(),f=c.getNewline();if(d.include(["html","xml","xsl"],e.syntax)){if(a=a.getVariable("indentation"),(e=h("htmlMatcher").tag(e.content,g))&&!e.innerRange.length())return b.replaceContent(f+a+c.getCaretPlaceholder()+f,g),!0}else if(e.syntax=="css"&&(e=e.content,g&&e.charAt(g-1)=="{")){var l=i.get("css.closeBraceIndentation"),a=a.getVariable("indentation"),m=e.charAt(g)==
"}";if(!m)for(var n=g,o=e.length,q;n<o;n++){q=e.charAt(n);if(q=="{")break;if(q=="}"){l="";m=!0;break}}m||(l+="}");c=f+a+c.getCaretPlaceholder()+l;b.replaceContent(c,g);return!0}return!1},{hidden:!0});f.add("insert_formatted_line_break",function(b){if(!f.run("insert_formatted_line_break_only",b)){for(var c=h("utils"),a=h("editorUtils").getCurrentLinePadding(b),d=String(b.getContent()),g=b.getCaretPos(),i=d.length,c=c.getNewline(),l="",m=b.getCurrentLineRange().end+1,n;m<i;m++)if(n=d.charAt(m),n==" "||
n=="\t")l+=n;else break;l.length>a.length?b.replaceContent(c+l,g,g,!0):b.replaceContent(c,g)}return!0},{hidden:!0})});
emmet.exec(function(h){h("actions").add("merge_lines",function(d){var f=h("htmlMatcher"),i=h("utils"),b=h("editorUtils").outputInfo(d),c=h("range").create(d.getSelectionRange());if(!c.length()&&(f=f.find(b.content,d.getCaretPos())))c=f.outerRange;if(c.length()){b=c.substring(b.content);b=i.splitByLines(b);for(f=1;f<b.length;f++)b[f]=b[f].replace(/^\s+/,"");b=b.join("").replace(/\s{2,}/," ");f=b.length;b=i.escapeText(b);d.replaceContent(b,c.start,c.end);d.createSelection(c.start,c.start+f);return!0}return!1})});
emmet.exec(function(h){function d(d,h,b){b=b||0;return h.charAt(b)==d.charAt(0)&&h.substr(b,d.length)==d}h("actions").add("encode_decode_data_url",function(f){var i=String(f.getSelection()),b=f.getCaretPos();if(!i)for(var c=String(f.getContent());b-- >=0;)if(d("src=",c,b)){if(c=c.substr(b).match(/^(src=(["'])?)([^'"<>\s]+)\1?/))i=c[3],b+=c[1].length;break}else if(d("url(",c,b)){if(c=c.substr(b).match(/^(url\((['"])?)([^'"\)\s]+)\1?/))i=c[3],b+=c[1].length;break}if(i)if(d("data:",i))if(c=String(f.prompt("Enter path to file (absolute or relative)"))){var a=
h("file"),e=a.createPath(f.getFilePath(),c);if(!e)throw"Can't save file";a.save(e,h("base64").decode(i.replace(/^data\:.+?;.+?,/,"")));f.replaceContent("$0"+c,b,b+i.length);f=!0}else f=!1;else{c=h("file");a=h("actionUtils");e=f.getFilePath();if(e===null)throw"You should save your file before using this action";e=c.locateFile(e,i);if(e===null)throw"Can't find "+i+" file";var g=h("base64").encode(String(c.read(e)));if(!g)throw"Can't encode file content to base64";g="data:"+(a.mimeTypes[String(c.getExt(e))]||
"application/octet-stream")+";base64,"+g;f.replaceContent("$0"+g,b,b+i.length);f=!0}else f=!1;return f},{label:"Encode\\Decode data:URL image"})});
emmet.exec(function(h,d){function f(d,b){var c;if(b){if(/^data:/.test(b))c=h("base64").decode(b.replace(/^data\:.+?;.+?,/,""));else{c=h("file");var a=c.locateFile(d.getFilePath(),b);if(a===null)throw"Can't find "+b+" file";c=String(c.read(a))}return h("actionUtils").getImageSize(c)}}h("actions").add("update_image_size",function(i){var b;if(String(i.getSyntax())=="css")a:{b=i.getCaretPos();var c=h("editorUtils").outputInfo(i);if(c=h("cssEditTree").parseFromPosition(c.content,b,!0)){var a=c.itemFromPosition(b,
!0),e;if(a&&(e=/url\((["']?)(.+?)\1\)/i.exec(a.value()||"")))if(e=f(i,e[2])){a=c.range(!0);c.value("width",e.width+"px");c.value("height",e.height+"px",c.indexOf("width")+1);b=d.extend(a,{data:c.toString(),caret:b});break a}}b=null}else a:{b=i.getCaretPos();c=h("editorUtils").outputInfo(i);if((c=h("xmlEditTree").parseFromPosition(c.content,b,!0))&&(c.name()||"").toLowerCase()=="img")if(e=f(i,c.value("src"))){a=c.range(!0);c.value("width",e.width);c.value("height",e.height,c.indexOf("width")+1);b=
d.extend(a,{data:c.toString(),caret:b});break a}b=null}return h("actionUtils").compoundUpdate(i,b)})});
emmet.define("cssResolver",function(h,d){function f(a){var b=a&&a.charCodeAt(0);return a&&a=="."||b>47&&b<58}function i(a){a=h("utils").trim(a);if(~a.indexOf("/*")||/[\n\r]/.test(a))return!1;if(!/^[a-z0-9\-]+\s*\:/i.test(a))return!1;a=h("tabStops").processText(a,{replaceCarets:!0,tabstop:function(){return"value"}});return a.split(":").length==2}function b(a){a.charAt(0);if(a.charAt(0)=="#"){var b=a.replace(/^#+/,"")||"0",d=h("utils").repeatString,a=null;switch(b.length){case 1:a=d(b,6);break;case 2:a=
d(b,3);break;case 3:a=b.charAt(0)+b.charAt(0)+b.charAt(1)+b.charAt(1)+b.charAt(2)+b.charAt(2);break;case 4:a=b+b.substr(0,2);break;case 5:a=b+b.charAt(0);break;default:a=b.substr(0,6)}p.get("css.color.short")&&(b=a.split(""),b[0]==b[1]&&b[2]==b[3]&&b[4]==b[5]&&(a=b[0]+b[2]+b[4]));switch(p.get("css.color.case")){case "upper":a=a.toUpperCase();break;case "lower":a=a.toLowerCase()}a="#"+a}else a=c(a);return a}function c(a){var b=p.getDict("css.keywordAliases");return a in b?b[a]:a}function a(a){return d.include(p.getArray("css.keywords"),
c(a))}function e(a){var b=h("utils"),a=b.trim(a);if(a.indexOf(":")==-1)return{name:a,value:u};a=a.split(":");return{name:b.trim(a.shift()),value:b.trim(a.join(":")).replace(/^(\$\{0\}|\$0)(\s*;?)$/,"${1}$2")}}function g(a,b){var c=r[b];c||(c=d.find(r,function(a){return a.prefix==b}));return c&&c.supports(a)}function j(a,b){var c=[];d.each(r,function(b,d){g(a,d)&&c.push(d)});!c.length&&!b&&d.each(r,function(a,b){a.obsolete||c.push(b)});return c}function l(a,b){d.isString(b)&&(b={prefix:b});r[a]=d.extend({},
s,b)}function m(a,b){if(b){var c=p.get(b+"."+a);if(!d.isUndefined(c))return c}return p.get("css."+a)}function n(a,b,c){if(!d.isString(a))a=a.data;if(!i(a))return a;b&&(~a.indexOf(";")?a=a.split(";").join(" !important;"):a+=" !important");b=a.indexOf(":");a=a.substring(0,b).replace(/\s+$/,"")+m("valueSeparator",c)+h("utils").trim(a.substring(b+1));return a.replace(/\s*;\s*$/,m("propertyEnd",c))}function o(a){var b=p.getArray(a);d.each(p.getArray(a+"Addon"),function(a){a.charAt(0)=="-"?b=d.without(b,
a.substr(1)):(a.charAt(0)=="+"&&(a=a.substr(1)),b.push(a))});return b}var q=null,s={prefix:"emmet",obsolete:!1,transformName:function(a){return"-"+this.prefix+"-"+a},properties:function(){return o("css."+this.prefix+"Properties")||[]},supports:function(a){return d.include(this.properties(),a)}},r={},u="${1};",p=h("preferences");p.define("css.valueSeparator",": ","Defines a symbol that should be placed between CSS property and value when expanding CSS abbreviations.");p.define("css.propertyEnd",";",
"Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations.");p.define("stylus.valueSeparator"," ","Defines a symbol that should be placed between CSS property and value when expanding CSS abbreviations in Stylus dialect.");p.define("stylus.propertyEnd","","Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations in Stylus dialect.");p.define("sass.propertyEnd","","Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations in SASS dialect.");
p.define("css.autoInsertVendorPrefixes",!0,"Automatically generate vendor-prefixed copies of expanded CSS property. By default, Emmet will generate vendor-prefixed properties only when you put dash before abbreviation (e.g. <code>-bxsh</code>). With this option enabled, you don\u2019t need dashes before abbreviations: Emmet will produce vendor-prefixed properties for you.");var v=d.template("A comma-separated list of CSS properties that may have <code><%= vendor %></code> vendor prefix. This list is used to generate a list of prefixed properties when expanding <code>-property</code> abbreviations. Empty list means that all possible CSS values may have <code><%= vendor %></code> prefix."),
w=d.template("A comma-separated list of <em>additional</em> CSS properties for <code>css.<%= vendor %>Preperties</code> preference. You should use this list if you want to add or remove a few CSS properties to original set. To add a new property, simply write its name, to remove it, precede property with hyphen.<br>For example, to add <em>foo</em> property and remove <em>border-radius</em> one, the preference value will look like this: <code>foo, -border-radius</code>.");d.each({webkit:"animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-clip, background-composite, background-origin, background-size, border-fit, border-horizontal-spacing, border-image, border-vertical-spacing, box-align, box-direction, box-flex, box-flex-group, box-lines, box-ordinal-group, box-orient, box-pack, box-reflect, box-shadow, color-correction, column-break-after, column-break-before, column-break-inside, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, dashboard-region, font-smoothing, highlight, hyphenate-character, hyphenate-limit-after, hyphenate-limit-before, hyphens, line-box-contain, line-break, line-clamp, locale, margin-before-collapse, margin-after-collapse, marquee-direction, marquee-increment, marquee-repetition, marquee-style, mask-attachment, mask-box-image, mask-box-image-outset, mask-box-image-repeat, mask-box-image-slice, mask-box-image-source, mask-box-image-width, mask-clip, mask-composite, mask-image, mask-origin, mask-position, mask-repeat, mask-size, nbsp-mode, perspective, perspective-origin, rtl-ordering, text-combine, text-decorations-in-effect, text-emphasis-color, text-emphasis-position, text-emphasis-style, text-fill-color, text-orientation, text-security, text-stroke-color, text-stroke-width, transform, transition, transform-origin, transform-style, transition-delay, transition-duration, transition-property, transition-timing-function, user-drag, user-modify, user-select, writing-mode, svg-shadow, box-sizing, border-radius",
moz:"animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-inline-policy, binding, border-bottom-colors, border-image, border-left-colors, border-right-colors, border-top-colors, box-align, box-direction, box-flex, box-ordinal-group, box-orient, box-pack, box-shadow, box-sizing, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-width, float-edge, font-feature-settings, font-language-override, force-broken-image-icon, hyphens, image-region, orient, outline-radius-bottomleft, outline-radius-bottomright, outline-radius-topleft, outline-radius-topright, perspective, perspective-origin, stack-sizing, tab-size, text-blink, text-decoration-color, text-decoration-line, text-decoration-style, text-size-adjust, transform, transform-origin, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-focus, user-input, user-modify, user-select, window-shadow, background-clip, border-radius",
ms:"accelerator, backface-visibility, background-position-x, background-position-y, behavior, block-progression, box-align, box-direction, box-flex, box-line-progression, box-lines, box-ordinal-group, box-orient, box-pack, content-zoom-boundary, content-zoom-boundary-max, content-zoom-boundary-min, content-zoom-chaining, content-zoom-snap, content-zoom-snap-points, content-zoom-snap-type, content-zooming, filter, flow-from, flow-into, font-feature-settings, grid-column, grid-column-align, grid-column-span, grid-columns, grid-layer, grid-row, grid-row-align, grid-row-span, grid-rows, high-contrast-adjust, hyphenate-limit-chars, hyphenate-limit-lines, hyphenate-limit-zone, hyphens, ime-mode, interpolation-mode, layout-flow, layout-grid, layout-grid-char, layout-grid-line, layout-grid-mode, layout-grid-type, line-break, overflow-style, perspective, perspective-origin, perspective-origin-x, perspective-origin-y, scroll-boundary, scroll-boundary-bottom, scroll-boundary-left, scroll-boundary-right, scroll-boundary-top, scroll-chaining, scroll-rails, scroll-snap-points-x, scroll-snap-points-y, scroll-snap-type, scroll-snap-x, scroll-snap-y, scrollbar-arrow-color, scrollbar-base-color, scrollbar-darkshadow-color, scrollbar-face-color, scrollbar-highlight-color, scrollbar-shadow-color, scrollbar-track-color, text-align-last, text-autospace, text-justify, text-kashida-space, text-overflow, text-size-adjust, text-underline-position, touch-action, transform, transform-origin, transform-origin-x, transform-origin-y, transform-origin-z, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-select, word-break, word-wrap, wrap-flow, wrap-margin, wrap-through, writing-mode",
o:"dashboard-region, animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, border-image, link, link-source, object-fit, object-position, tab-size, table-baseline, transform, transform-origin, transition, transition-delay, transition-duration, transition-property, transition-timing-function, accesskey, input-format, input-required, marquee-dir, marquee-loop, marquee-speed, marquee-style"},
function(a,b){p.define("css."+b+"Properties",a,v({vendor:b}));p.define("css."+b+"PropertiesAddon","",w({vendor:b}))});p.define("css.unitlessProperties","z-index, line-height, opacity, font-weight, zoom","The list of properties whose values \u200b\u200bmust not contain units.");p.define("css.intUnit","px","Default unit for integer values");p.define("css.floatUnit","em","Default unit for float values");p.define("css.keywords","auto, inherit","A comma-separated list of valid keywords that can be used in CSS abbreviations.");
p.define("css.keywordAliases","a:auto, i:inherit, s:solid, da:dashed, do:dotted","A comma-separated list of keyword aliases, used in CSS abbreviation. Each alias should be defined as <code>alias:keyword_name</code>.");p.define("css.unitAliases","e:em, p:%, x:ex, r:rem","A comma-separated list of unit aliases, used in CSS abbreviation. Each alias should be defined as <code>alias:unit_value</code>.");p.define("css.color.short",!0,"Should color values like <code>#ffffff</code> be shortened to <code>#fff</code> after abbreviation with color was expanded.");
p.define("css.color.case","keep","Letter case of color values generated by abbreviations with color (like <code>c#0</code>). Possible values are <code>upper</code>, <code>lower</code> and <code>keep</code>.");p.define("css.fuzzySearch",!0,"Enable fuzzy search among CSS snippet names. When enabled, every <em>unknown</em> snippet will be scored against available snippet names (not values or CSS properties!). The match with best score will be used to resolve snippet value. For example, with this preference enabled, the following abbreviations are equal: <code>ov:h</code> == <code>ov-h</code> == <code>o-h</code> == <code>oh</code>");
p.define("css.fuzzySearchMinScore",0.3,"The minium score (from 0 to 1) that fuzzy-matched abbreviation should achive. Lower values may produce many false-positive matches, higher values may reduce possible matches.");l("w",{prefix:"webkit"});l("m",{prefix:"moz"});l("s",{prefix:"ms"});l("o",{prefix:"o"});var k=["css","less","sass","scss","stylus"];h("resources").addResolver(function(a,b){return d.include(k,b)&&a.isElement()?q.expandToSnippet(a.abbreviation,b):null});var t=h("expandAbbreviation");t.addHandler(function(a,
b,c){if(!d.include(k,b))return!1;var e=a.getSelectionRange().end,g=t.findAbbreviation(a);return g&&(b=emmet.expandAbbreviation(g,b,c))?(g=e-g.length,c=e,a.getContent().charAt(e)==";"&&b.charAt(b.length-1)==";"&&c++,a.replaceContent(b,g,c),!0):!1});return q={addPrefix:l,supportsPrefix:g,prefixed:function(a,b){return g(a,b)?"-"+b+"-"+a:a},listPrefixes:function(){return d.map(r,function(a){return a.prefix})},getPrefix:function(a){return r[a]},removePrefix:function(a){a in r&&delete r[a]},extractPrefixes:function(a){if(a.charAt(0)!=
"-")return{property:a,prefixes:null};for(var b=1,c=a.length,d,e=[];b<c;){d=a.charAt(b);if(d=="-"){b++;break}if(d in r)e.push(d);else{e.length=0;b=1;break}b++}if(b==c-1)b=1,e.length=1;return{property:a.substring(b),prefixes:e.length?e:"all"}},findValuesInAbbreviation:function(b,c){for(var c=c||"css",d=0,e=b.length,g="",i;d<e;){i=b.charAt(d);if(f(i)||i=="#"||i=="-"&&f(b.charAt(d+1))){g=b.substring(d);break}d++}i=b.substring(0,b.length-g.length);d=h("resources");for(e=[];~i.indexOf("-")&&!d.findSnippet(c,
i);){i=i.split("-");var j=i.pop();if(!a(j))break;e.unshift(j);i=i.join("-")}return e.join("-")+g},parseValues:function(c){for(var e=h("stringStream").create(c),g=[],i=null;i=e.next();){if(i=="#")e.match(/^[0-9a-f]+/,!0);else if(i=="-"){if(a(d.last(g))||e.start&&f(c.charAt(e.start-1)))e.start=e.pos;e.match(/^\-?[0-9]*(\.[0-9]+)?[a-z%\.]*/,!0)}else e.match(/^[0-9]*(\.[0-9]*)?[a-z%]*/,!0);g.push(e.current());e.start=e.pos}return d.map(d.compact(g),b)},extractValues:function(a){var b=this.findValuesInAbbreviation(a);
return!b?{property:a,values:null}:{property:a.substring(0,a.length-b.length).replace(/-$/,""),values:this.parseValues(b)}},normalizeValue:function(a,b){var b=(b||"").toLowerCase(),c=p.getArray("css.unitlessProperties");return a.replace(/^(\-?[0-9\.]+)([a-z]*)$/,function(a,e,g){if(!g&&(e=="0"||d.include(c,b)))return e;g?(a=p.getDict("css.unitAliases"),e+=g in a?a[g]:g):e=e.replace(/\.$/,"")+p.get(~e.indexOf(".")?"css.floatUnit":"css.intUnit");return e})},expand:function(a,b,c){var c=c||"css",g=h("resources"),
f=p.get("css.autoInsertVendorPrefixes"),k;if(k=/^(.+)\!$/.test(a))a=RegExp.$1;var l=g.findSnippet(c,a);if(l&&!f)return n(l,k,c);l=this.extractPrefixes(a);a=this.extractValues(l.property);a=d.extend(l,a);l=g.findSnippet(c,a.property);!l&&p.get("css.fuzzySearch")&&(l=g.fuzzyFindSnippet(c,a.property,parseFloat(p.get("css.fuzzySearchMinScore"))));if(l){if(!d.isString(l))l=l.data}else l=a.property+":"+u;if(!i(l))return l;var o=e(l),m=[];!b&&a.values&&(b=d.map(a.values,function(a){return this.normalizeValue(a,
o.name)},this).join(" ")+";");o.value=b||o.value;b=a.prefixes=="all"||!a.prefixes&&f?j(o.name,f&&a.prefixes!="all"):a.prefixes;d.each(b,function(a){a in r&&m.push(n(r[a].transformName(o.name)+":"+o.value,k,c))});m.push(n(o.name+":"+o.value,k,c));return m},expandToSnippet:function(a,b){var c=this.expand(a,null,b);return d.isArray(c)?c.join("\n"):!d.isString(c)?c.data:String(c)},getSyntaxPreference:m,transformSnippet:n}});
emmet.define("cssGradient",function(h,d){function f(a){return h("utils").trim(a).replace(/\s+/g," ")}function i(a){var a=f(a),b=null,a=a.replace(/^(\w+\(.+?\))\s*/,function(a,c){b=c;return""});b||(a=a.split(" "),b=a[0],a=a[1]||"");var c={color:b};a&&a.replace(/^(\-?[\d\.]+)([a-z%]+)?$/,function(a,b,d){c.position=b;~b.indexOf(".")?d="":d||(d="%");if(d)c.unit=d});return c}function b(a){var b=0;d.each(a,function(c,e){if(!e)return c.position=c.position||0;if(e==a.length-1&&!("position"in c))c.position=
1;if("position"in c){var g=a[b].position||0,f=(c.position-g)/(e-b);d.each(a.slice(b,e),function(a,b){a.position=g+f*b});b=e}})}function c(a){var b=parseFloat(a);if(!d.isNaN(b))switch(b%360){case 0:return"left";case 90:return"bottom";case 180:return"right";case 240:return"top"}return a}function a(a){a=c(a);if(r.test(a))throw"The direction is an angle that can\u2019t be converted.";var b=function(b){return~a.indexOf(b)?"100%":"0"};return b("right")+" "+b("bottom")+", "+b("left")+" "+b("top")}function e(a){var b=
p.getArray("css.gradient.prefixes"),b=d.map(b,function(b){return"-"+b+"-"+a});b.push(a);return b}function g(a,b){var c=[],e=h("cssResolver");p.get("css.gradient.fallback")&&~b.toLowerCase().indexOf("background")&&c.push({name:"background-color",value:"${1:"+a.colorStops[0].color+"}"});d.each(p.getArray("css.gradient.prefixes"),function(d){var g=e.prefixed(b,d);if(d=="webkit"&&p.get("css.gradient.oldWebkit"))try{c.push({name:g,value:q.oldWebkitLinearGradient(a)})}catch(f){}c.push({name:g,value:q.toString(a,
d)})});return c.sort(function(a,b){return b.name.length-a.name.length})}function j(a,b,c){var f=a.parent,i=h("utils");d.each(f.getAll(e(a.name())),function(b){b!=a&&/gradient/i.test(b.value())&&f.remove(b)});var j=a.value();c||(c=h("range").create(0,a.value()));a.value(function(a){return i.replaceSubstring(j,a,c)}(q.toString(b))+"${2}");b=g(b,a.name());d.each(b,function(b){f.add(b.name,b.value,f.indexOf(a))})}function l(a){var b=a.value(),c=null;return(a=d.find(a.valueParts(),function(a){return c=
q.parse(a.substring(b))}))&&c?{gradient:c,valueRange:a}:null}function m(a,b){var c=p.get("css.gradient.defaultProperty");if(!c)return!1;var e=String(a.getContent()),f=h("range").create(a.getCurrentLineRange()),i=f.substring(e).replace(/^\s+/,function(a){f.start+=a.length;return""}).replace(/\s+$/,function(a){f.end-=a.length;return""}),e=h("cssResolver");if(i=q.parse(i)){var j=g(i,c);j.push({name:c,value:q.toString(i)+"${2}"});var l=e.getSyntaxPreference("valueSeparator",b),o=e.getSyntaxPreference("propertyEnd",
b),j=d.map(j,function(a){return a.name+l+a.value+o});a.replaceContent(j.join("\n"),f.start,f.end);return!0}return!1}function n(a,b){var c=null,e=h("cssEditTree").parseFromPosition(a,b,!0);e&&((c=e.itemFromPosition(b,!0))||(c=d.find(e.list(),function(a){return a.range(!0).end==b})));return{rule:e,property:c}}var o=["top","to bottom","0deg"],q=null,s=["css","less","sass","scss","stylus","styl"],r=/\d+deg/i,u=/top|bottom|left|right/i,p=h("preferences");p.define("css.gradient.prefixes","webkit, moz, o",
"A comma-separated list of vendor-prefixes for which values should be generated.");p.define("css.gradient.oldWebkit",!0,"Generate gradient definition for old Webkit implementations");p.define("css.gradient.omitDefaultDirection",!0,"Do not output default direction definition in generated gradients.");p.define("css.gradient.defaultProperty","background-image","When gradient expanded outside CSS value context, it will produce properties with this name.");p.define("css.gradient.fallback",!1,"With this option enabled, CSS gradient generator will produce <code>background-color</code> property with gradient first color as fallback for old browsers.");
h("expandAbbreviation").addHandler(function(a,b,c){var e=h("editorUtils").outputInfo(a,b,c);if(!d.include(s,e.syntax))return!1;var c=a.getCaretPos(),g=e.content,e=n(g,c);if(e.property){var f=l(e.property);if(f){var b=e.rule.options.offset||0,i=b+e.rule.toString().length;if(/[\n\r]/.test(e.property.value())){var o=e.property.valueRange(!0).start+f.valueRange.end,g=h("utils").replaceSubstring(g,";",o),c=n(g,c);c.property&&(f=l(c.property),e=c)}e.property.end(";");j(e.property,f.gradient,f.valueRange);
a.replaceContent(e.rule.toString(),b,i,!0);return!0}}return m(a,b)});h("reflectCSSValue").addHandler(function(a){var b=h("utils"),c=l(a);if(!c)return!1;var g=a.value(),f=function(a){return b.replaceSubstring(g,a,c.valueRange)};d.each(a.parent.getAll(e(a.name())),function(b){if(b!==a){var d=b.value().match(/^\s*(\-([a-z]+)\-)?linear\-gradient/);d?b.value(f(q.toString(c.gradient,d[2]||""))):b.value().match(/\s*\-webkit\-gradient/)&&b.value(f(q.oldWebkitLinearGradient(c.gradient)))}});return!0});return q=
{parse:function(a){var b=null;h("utils").trim(a).replace(/^([\w\-]+)\((.+?)\)$/,function(a,c,e){c=c.toLowerCase().replace(/^\-[a-z]+\-/,"");if(c=="linear-gradient"||c=="lg"){for(var a=o[0],e=h("stringStream").create(h("utils").trim(e)),c=[],g;g=e.next();)e.peek()==","?(c.push(e.current()),e.next(),e.eatSpace(),e.start=e.pos):g=="("&&e.skipTo(")");c.push(e.current());c=d.compact(d.map(c,f));if(c.length){if(r.test(c[0])||u.test(c[0]))a=c.shift();b={type:"linear",direction:a,colorStops:d.map(c,i)}}else b=
null;return""}return a});return b},oldWebkitLinearGradient:function(c){d.isString(c)&&(c=this.parse(c));if(!c)return null;var e=d.map(c.colorStops,d.clone);d.each(e,function(a){if("position"in a)if(~a.position.indexOf(".")||a.unit=="%")a.position=parseFloat(a.position)/(a.unit=="%"?100:1);else throw"Can't convert color stop '"+(a.position+(a.unit||""))+"'";});b(e);e=d.map(e,function(a,b){return!a.position&&!b?"from("+a.color+")":a.position==1&&b==e.length-1?"to("+a.color+")":"color-stop("+a.position.toFixed(2).replace(/\.?0+$/,
"")+", "+a.color+")"});return"-webkit-gradient(linear, "+a(c.direction)+", "+e.join(", ")+")"},toString:function(a,b){if(a.type=="linear"){var c=(b?"-"+b+"-":"")+"linear-gradient",e=d.map(a.colorStops,function(a){return a.color+("position"in a?" "+a.position+(a.unit||""):"")});a.direction&&(!p.get("css.gradient.omitDefaultDirection")||!d.include(o,a.direction))&&e.unshift(a.direction);return c+"("+e.join(", ")+")"}}}});
emmet.exec(function(h,d){var f=h("handlerList").create(),i=h("resources");d.extend(i,{addGenerator:function(b,c,a){d.isString(b)&&(b=RegExp(b));f.add(function(a,d){var f;return(f=b.exec(a.name()))?c(f,a,d):null},a)}});i.addResolver(function(b,c){return f.exec(null,d.toArray(arguments))})});
emmet.define("tagName",function(h,d){var f={empty:"area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,keygen,command".split(","),blockLevel:"address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,link,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul,h1,h2,h3,h4,h5,h6".split(","),inlineLevel:"a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var".split(",")},
i={p:"span",ul:"li",ol:"li",table:"tr",tr:"td",tbody:"tr",thead:"tr",tfoot:"tr",colgroup:"col",select:"option",optgroup:"option",audio:"source",video:"source",object:"param",map:"area"};return{resolve:function(b){b=(b||"").toLowerCase();return b in i?this.getMapping(b):this.isInlineLevel(b)?"span":"div"},getMapping:function(b){return i[b.toLowerCase()]},isInlineLevel:function(b){return this.isTypeOf(b,"inlineLevel")},isBlockLevel:function(b){return this.isTypeOf(b,"blockLevel")},isEmptyElement:function(b){return this.isTypeOf(b,
"empty")},isTypeOf:function(b,c){return d.include(f[c],b)},addMapping:function(b,c){i[b]=c},removeMapping:function(b){b in i&&delete i[b]},addElementToCollection:function(b,c){f[c]||(f[c]=[]);var a=this.getCollection(c);d.include(a,b)||a.push(b)},removeElementFromCollection:function(b,c){c in f&&(f[c]=d.without(this.getCollection(c),b))},getCollection:function(b){return f[b]}}});
emmet.exec(function(h,d){function f(){return{element:e.get("bem.elementSeparator"),modifier:e.get("bem.modifierSeparator")}}function i(a){if(h("abbreviationUtils").isSnippet(a))return a;a.__bem={block:"",element:"",modifier:""};var e=b(a.attribute("class")).split(" "),g=/^[a-z]\-/i;a.__bem.block=d.find(e,function(a){return g.test(a)});if(!a.__bem.block)g=/^[a-z]/i,a.__bem.block=d.find(e,function(a){return g.test(a)})||"";(e=d.chain(e).map(function(b){var d;d=c(b,a,"element");d=c(d,a,"modifier");var e=
"",g="",h="",b=f();~d.indexOf(b.element)?(e=d.split(b.element),h=e[1].split(b.modifier),e=e[0],g=h.shift(),h=h.join(b.modifier)):~d.indexOf(b.modifier)&&(h=d.split(b.modifier),e=h.shift(),h=h.join(b.modifier));if(e||g||h){if(!e)e=a.__bem.block;d=e;var i=[];g&&(d+=b.element+g);i.push(d);h&&i.push(d+b.modifier+h);a.__bem.block=e;a.__bem.element=g;a.__bem.modifier=h;b=i}else b=d;return b}).flatten().uniq().value().join(" "))&&a.attribute("class",e);return a}function b(a){var b=h("utils"),a=(" "+(a||
"")+" ").replace(/\s+/g," "),c=e.get("bem.shortElementPrefix");c&&(c=RegExp("\\s("+b.escapeForRegexp(c)+"+)","g"),a=a.replace(c,function(a,c){return" "+b.repeatString(f().element,c.length)}));return b.trim(a)}function c(a,b,c){var d=f(),e=RegExp("^("+d[c]+")+","g");if(e.test(a)){for(var g=0,e=a.replace(e,function(a){g=a.length/d[c].length;return""}),h=b;h.parent&&g--;)h=h.parent;if(!h||!h.__bem)h=b;if(h&&h.__bem)return a=h.__bem.block,c=="modifier"&&h.__bem.element&&(a+=d.element+h.__bem.element),
a+d[c]+e}return a}function a(b,c){b.name&&i(b,c);var e=h("abbreviationUtils");d.each(b.children,function(b){a(b,c);!e.isSnippet(b)&&b.start&&(g=!0)});return b}var e=h("preferences");e.define("bem.elementSeparator","__","Class name\u2019s element separator.");e.define("bem.modifierSeparator","_","Class name\u2019s modifier separator.");e.define("bem.shortElementPrefix","-","Symbol for describing short \u201cblock-element\u201d notation. Class names prefixed with this symbol will be treated as element name for parent\u2018s block name. Each symbol instance traverses one level up in parsed tree for block name lookup. Empty value will disable short notation.");
var g=!1;h("filters").add("bem",function(b,c){g=!1;b=a(b,c);g&&(b=h("filters").apply(b,"html",c));return b})});
emmet.exec(function(h,d){function f(c,a,e){var g=h("utils"),f=b.get("filter.commentTrigger");if(f=="*"||d.find(f.split(","),function(a){return!!c.attribute(g.trim(a))}))f={node:c,name:c.name(),padding:c.parent?c.parent.padding:"",attr:function(a,b,d){return(a=c.attribute(a))?(b||"")+a+(d||""):""}},a=g.normalizeNewline(a?a(f):""),e=g.normalizeNewline(e?e(f):""),c.start=c.start.replace(/</,a+"<"),c.end=c.end.replace(/>/,">"+e)}function i(b,a,e){var g=h("abbreviationUtils");d.each(b.children,function(b){g.isBlock(b)&&
f(b,a,e);i(b,a,e)});return b}var b=h("preferences");b.define("filter.commentAfter",'\n<\!-- /<%= attr("id", "#") %><%= attr("class", ".") %> --\>',"A definition of comment that should be placed <i>after</i> matched element when <code>comment</code> filter is applied. This definition is an ERB-style template passed to <code>_.template()</code> function (see Underscore.js docs for details). In template context, the following properties and functions are availabe:\n<ul><li><code>attr(name, before, after)</code> \u2013 a function that outputsspecified attribute value concatenated with <code>before</code> and <code>after</code> strings. If attribute doesn't exists, the empty string will be returned.</li><li><code>node</code> \u2013 current node (instance of <code>AbbreviationNode</code>)</li><li><code>name</code> \u2013 name of current tag</li><li><code>padding</code> \u2013 current string padding, can be used for formatting</li></ul>");
b.define("filter.commentBefore","","A definition of comment that should be placed <i>before</i> matched element when <code>comment</code> filter is applied. For more info, read description of <code>filter.commentAfter</code> property");b.define("filter.commentTrigger","id, class","A comma-separated list of attribute names that should exist in abbreviatoin where comment should be added. If you wish to add comment for every element, set this option to <code>*</code>");h("filters").add("c",function(c){var a=
d.template(b.get("filter.commentBefore")),e=d.template(b.get("filter.commentAfter"));return i(c,a,e)})});emmet.exec(function(h,d){function f(b){return b.replace(/([<>&])/g,function(b,a){return i[a]})}var i={"<":"&lt;",">":"&gt;","&":"&amp;"};h("filters").add("e",function c(a){d.each(a.children,function(a){a.start=f(a.start);a.end=f(a.end);a.content=f(a.content);c(a)});return a})});
emmet.exec(function(h,d){function f(){return h("resources").getVariable("indentation")}function i(a){return a.parent&&!a.parent.parent&&!a.index()}function b(a,b){var d=h("abbreviationUtils");return b.tag_nl===!0||d.isBlock(a)?!0:!a.parent||!b.inline_break?!1:c(a.parent,b)}function c(a,b){var c=0,f=h("abbreviationUtils");return!!d.find(a.children,function(a){a.isTextNode()||!f.isInline(a)?c=0:f.isInline(a)&&c++;if(c>=b.inline_break)return!0})}function a(a,b){var f=h("abbreviationUtils");return!d.any(a.children,
function(a){return f.isSnippet(a)?!1:!f.isInline(a)})?c(a,b):!0}h("filters").add("_format",function g(c,l,m){var m=m||0,n=h("abbreviationUtils");d.each(c.children,function(c){if(n.isSnippet(c)){if(c.start=c.end="",!i(c)&&l.tag_nl!==!1&&b(c,l)&&!h("abbreviationUtils").isInline(c.parent))c.start=h("utils").getNewline()+c.start}else{c.start=c.end="%s";var d=h("utils"),j=h("abbreviationUtils"),r=j.isUnary(c),d=d.getNewline();if(l.tag_nl!==!1){var u=l.tag_nl===!0&&(l.tag_nl_leaf||c.children.length);if(!c.isTextNode()){if(b(c,
l)){if(!i(c)&&(!j.isSnippet(c.parent)||c.index()))c.start=d+c.start;if(j.hasBlockChildren(c)||c.children.length&&b(c.children[0],l)||u&&!r)c.end=d+c.end;if(j.hasTagsInContent(c)||u&&!c.children.length&&!r)c.start+=d+f()}else if(j.isInline(c)&&c.parent&&h("abbreviationUtils").hasBlockChildren(c.parent)&&!i(c))c.start=d+c.start;else if(j.isInline(c)&&a(c,l))c.end=d+c.end;c.padding=f()}}}g(c,l,m+1)});return c})});
emmet.exec(function(h,d){function f(f,b){var c="",a=[],e=b.attributeQuote(),g=b.cursor();d.each(f.attributeList(),function(d){var f=b.attributeName(d.name);switch(f.toLowerCase()){case "id":c+="#"+(d.value||g);break;case "class":c+="."+h("utils").trim(d.value||g).replace(/\s+/g,".");break;default:a.push(":"+f+" => "+e+(d.value||g)+e)}});a.length&&(c+="{"+a.join(", ")+"}");return c}h("filters").add("haml",function b(c,a,e){var e=e||0,g=h("abbreviationUtils");e||(c=h("filters").apply(c,"_format",a));
d.each(c.children,function(c){if(!g.isSnippet(c)&&c.parent){var d=h("abbreviationUtils"),m=h("utils"),n=f(c,a),o=a.cursor(),d=d.isUnary(c),q=a.self_closing_tag&&d?"/":"",s="",s="%"+a.tagName(c.name());s.toLowerCase()=="%div"&&n&&n.indexOf("{")==-1&&(s="");c.end="";c.start=m.replaceSubstring(c.start,s+n+q+" ",c.start.indexOf("%s"),"%s");!c.children.length&&!d&&(c.start+=o)}b(c,a,e+1)});return c})});
emmet.exec(function(h,d){function f(f,b){var c=b.attributeQuote(),a=b.cursor();return d.map(f.attributeList(),function(d){return" "+b.attributeName(d.name)+"="+c+(d.value||a)+c}).join("")}h("filters").add("html",function b(c,a,e){var e=e||0,g=h("abbreviationUtils");e||(c=h("filters").apply(c,"_format",a));d.each(c.children,function(c){if(!g.isSnippet(c)&&c.parent){var d=h("abbreviationUtils"),m=h("utils"),n=f(c,a),o=a.cursor(),d=d.isUnary(c),q="",s="";if(!c.isTextNode()){var r=a.tagName(c.name());
d?(q="<"+r+n+a.selfClosing()+">",c.end=""):(q="<"+r+n+">",s="</"+r+">")}c.start=m.replaceSubstring(c.start,q,c.start.indexOf("%s"),"%s");c.end=m.replaceSubstring(c.end,s,c.end.indexOf("%s"),"%s");!c.children.length&&!d&&c.content.indexOf(o)==-1&&(c.start+=o)}b(c,a,e+1)});return c})});
emmet.exec(function(h,d){var f=/^\s+/,i=/[\n\r]/g;h("filters").add("s",function c(a){var e=h("abbreviationUtils");d.each(a.children,function(a){if(!e.isSnippet(a))a.start=a.start.replace(f,""),a.end=a.end.replace(f,"");a.start=a.start.replace(i,"");a.end=a.end.replace(i,"");a.content=a.content.replace(i,"");c(a)});return a})});
emmet.exec(function(h,d){function f(h,b){d.each(h.children,function(c){if(c.content)c.content=c.content.replace(b,"");f(c,b)});return h}h("preferences").define("filter.trimRegexp","[\\s|\\u00a0]*[\\d|#|\\-|*|\\u2022]+\\.?\\s*","Regular expression used to remove list markers (numbers, dashes, bullets, etc.) in <code>t</code> (trim) filter. The trim filter is useful for wrapping with abbreviation lists, pased from other documents (for example, Word documents).");h("filters").add("t",function(d){var b=
RegExp(h("preferences").get("filter.trimRegexp"));return f(d,b)})});emmet.exec(function(h,d){var f={"xsl:variable":1,"xsl:with-param":1};h("filters").add("xsl",function b(c){var a=h("abbreviationUtils");d.each(c.children,function(c){if(!a.isSnippet(c)&&(c.name()||"").toLowerCase()in f&&c.children.length)c.start=c.start.replace(/\s+select\s*=\s*(['"]).*?\1/,"");b(c)});return c})});
emmet.exec(function(h,d){function f(a,b){return Math.round(Math.random()*(b-a)+a)}function i(a,b){for(var c=a.length,e=Math.min(c,b),h=[];h.length<e;){var i=f(0,c-1);d.include(h,i)||h.push(i)}return d.map(h,function(b){return a[b]})}function b(a,b){a.length&&(a[0]=a[0].charAt(0).toUpperCase()+a[0].substring(1));return a.join(" ")+(b||(d.isString("?!...")?"?!...".charAt(f(0,4)):"?!..."[f(0,4)]))}function c(a){var b=a.length,c=0,c=b>3&&b<=6?f(0,1):b>6&&b<=12?f(0,2):f(1,4);d.each(i(d.range(c)),function(b){a[b]+=
","})}h("abbreviationParser").addPreprocessor(function(d){var h=/^(?:lorem|lipsum)(\d*)$/i,l;d.findAll(function(d){if(d._name&&(l=d._name.match(h))){var g=l[1]||30;d._name="";d.data("forceNameResolving",d.isRepeating()||d.attributeList().length);d.data("pasteOverwrites",!0);d.data("paste",function(d){var h=g,j=!d,d=[],l=0,h=parseInt(h,10);j&&(j=a.slice(0,h),j.length>5&&(j[4]+=","),l+=j.length,d.push(b(j,".")));for(;l<h;)j=i(e,Math.min(f(3,12)*f(1,5),h-l)),l+=j.length,c(j),d.push(b(j));return d.join(" ")})}})});
var a="lorem ipsum dolor sit amet consectetur adipisicing elit".split(" "),e=["exercitationem","perferendis","perspiciatis","laborum","eveniet","sunt","iure","nam","nobis","eum","cum","officiis","excepturi","odio","consectetur","quasi","aut","quisquam","vel","eligendi","itaque","non","odit","tempore","quaerat","dignissimos","facilis","neque","nihil","expedita","vitae","vero","ipsum","nisi","animi","cumque","pariatur","velit","modi","natus","iusto","eaque","sequi","illo","sed","ex","et","voluptatibus",
"tempora","veritatis","ratione","assumenda","incidunt","nostrum","placeat","aliquid","fuga","provident","praesentium","rem","necessitatibus","suscipit","adipisci","quidem","possimus","voluptas","debitis","sint","accusantium","unde","sapiente","voluptate","qui","aspernatur","laudantium","soluta","amet","quo","aliquam","saepe","culpa","libero","ipsa","dicta","reiciendis","nesciunt","doloribus","autem","impedit","minima","maiores","repudiandae","ipsam","obcaecati","ullam","enim","totam","delectus","ducimus",
"quis","voluptates","dolores","molestiae","harum","dolorem","quia","voluptatem","molestias","magni","distinctio","omnis","illum","dolorum","voluptatum","ea","quas","quam","corporis","quae","blanditiis","atque","deserunt","laboriosam","earum","consequuntur","hic","cupiditate","quibusdam","accusamus","ut","rerum","error","minus","eius","ab","ad","nemo","fugit","officia","at","in","id","quos","reprehenderit","numquam","iste","fugiat","sit","inventore","beatae","repellendus","magnam","recusandae","quod",
"explicabo","doloremque","aperiam","consequatur","asperiores","commodi","optio","dolor","labore","temporibus","repellat","veniam","architecto","est","esse","mollitia","nulla","a","similique","eos","alias","dolore","tenetur","deleniti","porro","facere","maxime","corrupti"]});emmet.exec(function(h){h("actions").add("select_line",function(d){var f=d.getCurrentLineRange();d.createSelection(f.start,f.end);return!0})});
emmet.exec(function(h){h("resources").setVocabulary({variables:{lang:"en",locale:"en-US",charset:"UTF-8",indentation:"\t",newline:"\n"},css:{filters:"html",snippets:{"@i":"@import url(|);","@m":"@media print {\n\t|\n}","@f":"@font-face {\n\tfont-family:|;\n\tsrc:url(|);\n}","@f+":"@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}",
"!":"!important",pos:"position:|;","pos:s":"position:static;","pos:a":"position:absolute;","pos:r":"position:relative;","pos:f":"position:fixed;",t:"top:|;","t:a":"top:auto;",r:"right:|;","r:a":"right:auto;",b:"bottom:|;","b:a":"bottom:auto;",l:"left:|;","l:a":"left:auto;",z:"z-index:|;","z:a":"z-index:auto;",fl:"float:|;","fl:n":"float:none;","fl:l":"float:left;","fl:r":"float:right;",cl:"clear:|;","cl:n":"clear:none;","cl:l":"clear:left;","cl:r":"clear:right;","cl:b":"clear:both;",d:"display:|;",
"d:n":"display:none;","d:b":"display:block;","d:i":"display:inline;","d:ib":"display:inline-block;","d:li":"display:list-item;","d:ri":"display:run-in;","d:cp":"display:compact;","d:tb":"display:table;","d:itb":"display:inline-table;","d:tbcp":"display:table-caption;","d:tbcl":"display:table-column;","d:tbclg":"display:table-column-group;","d:tbhg":"display:table-header-group;","d:tbfg":"display:table-footer-group;","d:tbr":"display:table-row;","d:tbrg":"display:table-row-group;","d:tbc":"display:table-cell;",
"d:rb":"display:ruby;","d:rbb":"display:ruby-base;","d:rbbg":"display:ruby-base-group;","d:rbt":"display:ruby-text;","d:rbtg":"display:ruby-text-group;",v:"visibility:|;","v:v":"visibility:visible;","v:h":"visibility:hidden;","v:c":"visibility:collapse;",ov:"overflow:|;","ov:v":"overflow:visible;","ov:h":"overflow:hidden;","ov:s":"overflow:scroll;","ov:a":"overflow:auto;",ovx:"overflow-x:|;","ovx:v":"overflow-x:visible;","ovx:h":"overflow-x:hidden;","ovx:s":"overflow-x:scroll;","ovx:a":"overflow-x:auto;",
ovy:"overflow-y:|;","ovy:v":"overflow-y:visible;","ovy:h":"overflow-y:hidden;","ovy:s":"overflow-y:scroll;","ovy:a":"overflow-y:auto;",ovs:"overflow-style:|;","ovs:a":"overflow-style:auto;","ovs:s":"overflow-style:scrollbar;","ovs:p":"overflow-style:panner;","ovs:m":"overflow-style:move;","ovs:mq":"overflow-style:marquee;",zoo:"zoom:1;",cp:"clip:|;","cp:a":"clip:auto;","cp:r":"clip:rect(|);",bxz:"box-sizing:|;","bxz:cb":"box-sizing:content-box;","bxz:bb":"box-sizing:border-box;",bxsh:"box-shadow:${1:hoff} ${2:voff} ${3:radius} ${4:color};",
"bxsh:n":"box-shadow:none;",m:"margin:|;","m:a":"margin:auto;",mt:"margin-top:|;","mt:a":"margin-top:auto;",mr:"margin-right:|;","mr:a":"margin-right:auto;",mb:"margin-bottom:|;","mb:a":"margin-bottom:auto;",ml:"margin-left:|;","ml:a":"margin-left:auto;",p:"padding:|;",pt:"padding-top:|;",pr:"padding-right:|;",pb:"padding-bottom:|;",pl:"padding-left:|;",w:"width:|;","w:a":"width:auto;",h:"height:|;","h:a":"height:auto;",maw:"max-width:|;","maw:n":"max-width:none;",mah:"max-height:|;","mah:n":"max-height:none;",
miw:"min-width:|;",mih:"min-height:|;",o:"outline:|;","o:n":"outline:none;",oo:"outline-offset:|;",ow:"outline-width:|;",os:"outline-style:|;",oc:"outline-color:#${1:000};","oc:i":"outline-color:invert;",bd:"border:|;","bd+":"border:${1:1px} ${2:solid} ${3:#000};","bd:n":"border:none;",bdbk:"border-break:|;","bdbk:c":"border-break:close;",bdcl:"border-collapse:|;","bdcl:c":"border-collapse:collapse;","bdcl:s":"border-collapse:separate;",bdc:"border-color:#${1:000};",bdi:"border-image:url(|);","bdi:n":"border-image:none;",
bdti:"border-top-image:url(|);","bdti:n":"border-top-image:none;",bdri:"border-right-image:url(|);","bdri:n":"border-right-image:none;",bdbi:"border-bottom-image:url(|);","bdbi:n":"border-bottom-image:none;",bdli:"border-left-image:url(|);","bdli:n":"border-left-image:none;",bdci:"border-corner-image:url(|);","bdci:n":"border-corner-image:none;","bdci:c":"border-corner-image:continue;",bdtli:"border-top-left-image:url(|);","bdtli:n":"border-top-left-image:none;","bdtli:c":"border-top-left-image:continue;",
bdtri:"border-top-right-image:url(|);","bdtri:n":"border-top-right-image:none;","bdtri:c":"border-top-right-image:continue;",bdbri:"border-bottom-right-image:url(|);","bdbri:n":"border-bottom-right-image:none;","bdbri:c":"border-bottom-right-image:continue;",bdbli:"border-bottom-left-image:url(|);","bdbli:n":"border-bottom-left-image:none;","bdbli:c":"border-bottom-left-image:continue;",bdf:"border-fit:|;","bdf:c":"border-fit:clip;","bdf:r":"border-fit:repeat;","bdf:sc":"border-fit:scale;","bdf:st":"border-fit:stretch;",
"bdf:ow":"border-fit:overwrite;","bdf:of":"border-fit:overflow;","bdf:sp":"border-fit:space;",bdl:"border-length:|;","bdl:a":"border-length:auto;",bdsp:"border-spacing:|;",bds:"border-style:|;","bds:n":"border-style:none;","bds:h":"border-style:hidden;","bds:dt":"border-style:dotted;","bds:ds":"border-style:dashed;","bds:s":"border-style:solid;","bds:db":"border-style:double;","bds:dtds":"border-style:dot-dash;","bds:dtdtds":"border-style:dot-dot-dash;","bds:w":"border-style:wave;","bds:g":"border-style:groove;",
"bds:r":"border-style:ridge;","bds:i":"border-style:inset;","bds:o":"border-style:outset;",bdw:"border-width:|;",bdt:"border-top:|;",bt:"border-top:|;","bdt+":"border-top:${1:1px} ${2:solid} ${3:#000};","bdt:n":"border-top:none;",bdtw:"border-top-width:|;",bdts:"border-top-style:|;","bdts:n":"border-top-style:none;",bdtc:"border-top-color:#${1:000};",bdr:"border-right:|;",br:"border-right:|;","bdr+":"border-right:${1:1px} ${2:solid} ${3:#000};","bdr:n":"border-right:none;",bdrw:"border-right-width:|;",
bdrs:"border-right-style:|;","bdrs:n":"border-right-style:none;",bdrc:"border-right-color:#${1:000};",bdb:"border-bottom:|;",bb:"border-bottom:|;","bdb+":"border-bottom:${1:1px} ${2:solid} ${3:#000};","bdb:n":"border-bottom:none;",bdbw:"border-bottom-width:|;",bdbs:"border-bottom-style:|;","bdbs:n":"border-bottom-style:none;",bdbc:"border-bottom-color:#${1:000};",bdl:"border-left:|;",bl:"border-left:|;","bdl+":"border-left:${1:1px} ${2:solid} ${3:#000};","bdl:n":"border-left:none;",bdlw:"border-left-width:|;",
bdls:"border-left-style:|;","bdls:n":"border-left-style:none;",bdlc:"border-left-color:#${1:000};",bdrs:"border-radius:|;",bdtrrs:"border-top-right-radius:|;",bdtlrs:"border-top-left-radius:|;",bdbrrs:"border-bottom-right-radius:|;",bdblrs:"border-bottom-left-radius:|;",bg:"background:|;","bg+":"background:${1:#fff} url(${2}) ${3:0} ${4:0} ${5:no-repeat};","bg:n":"background:none;","bg:ie":"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1:x}.png',sizingMethod='${2:crop}');",bgc:"background-color:#${1:fff};",
bgi:"background-image:url(|);","bgi:n":"background-image:none;",bgr:"background-repeat:|;","bgr:n":"background-repeat:no-repeat;","bgr:x":"background-repeat:repeat-x;","bgr:y":"background-repeat:repeat-y;",bga:"background-attachment:|;","bga:f":"background-attachment:fixed;","bga:s":"background-attachment:scroll;",bgp:"background-position:${1:0} ${2:0};",bgpx:"background-position-x:|;",bgpy:"background-position-y:|;",bgbk:"background-break:|;","bgbk:bb":"background-break:bounding-box;","bgbk:eb":"background-break:each-box;",
"bgbk:c":"background-break:continuous;",bgcp:"background-clip:|;","bgcp:bb":"background-clip:border-box;","bgcp:pb":"background-clip:padding-box;","bgcp:cb":"background-clip:content-box;","bgcp:nc":"background-clip:no-clip;",bgo:"background-origin:|;","bgo:pb":"background-origin:padding-box;","bgo:bb":"background-origin:border-box;","bgo:cb":"background-origin:content-box;",bgz:"background-size:|;","bgz:a":"background-size:auto;","bgz:ct":"background-size:contain;","bgz:cv":"background-size:cover;",
c:"color:#${1:000};",cm:"/* |${child} */",cn:"content:|;",tbl:"table-layout:|;","tbl:a":"table-layout:auto;","tbl:f":"table-layout:fixed;",cps:"caption-side:|;","cps:t":"caption-side:top;","cps:b":"caption-side:bottom;",ec:"empty-cells:|;","ec:s":"empty-cells:show;","ec:h":"empty-cells:hide;",lis:"list-style:|;","lis:n":"list-style:none;",lisp:"list-style-position:|;","lisp:i":"list-style-position:inside;","lisp:o":"list-style-position:outside;",list:"list-style-type:|;","list:n":"list-style-type:none;",
"list:d":"list-style-type:disc;","list:c":"list-style-type:circle;","list:s":"list-style-type:square;","list:dc":"list-style-type:decimal;","list:dclz":"list-style-type:decimal-leading-zero;","list:lr":"list-style-type:lower-roman;","list:ur":"list-style-type:upper-roman;",lisi:"list-style-image:|;","lisi:n":"list-style-image:none;",q:"quotes:|;","q:n":"quotes:none;","q:ru":"quotes:'\\00AB' '\\00BB' '\\201E' '\\201C';","q:en":"quotes:'\\201C' '\\201D' '\\2018' '\\2019';",ct:"content:|;","ct:n":"content:normal;",
"ct:oq":"content:open-quote;","ct:noq":"content:no-open-quote;","ct:cq":"content:close-quote;","ct:ncq":"content:no-close-quote;","ct:a":"content:attr(|);","ct:c":"content:counter(|);","ct:cs":"content:counters(|);",coi:"counter-increment:|;",cor:"counter-reset:|;",va:"vertical-align:|;","va:sup":"vertical-align:super;","va:t":"vertical-align:top;","va:tt":"vertical-align:text-top;","va:m":"vertical-align:middle;","va:bl":"vertical-align:baseline;","va:b":"vertical-align:bottom;","va:tb":"vertical-align:text-bottom;",
"va:sub":"vertical-align:sub;",ta:"text-align:|;","ta:l":"text-align:left;","ta:c":"text-align:center;","ta:r":"text-align:right;",tal:"text-align-last:|;","tal:a":"text-align-last:auto;","tal:l":"text-align-last:left;","tal:c":"text-align-last:center;","tal:r":"text-align-last:right;",td:"text-decoration:|;","td:n":"text-decoration:none;","td:u":"text-decoration:underline;","td:o":"text-decoration:overline;","td:l":"text-decoration:line-through;",te:"text-emphasis:|;","te:n":"text-emphasis:none;",
"te:ac":"text-emphasis:accent;","te:dt":"text-emphasis:dot;","te:c":"text-emphasis:circle;","te:ds":"text-emphasis:disc;","te:b":"text-emphasis:before;","te:a":"text-emphasis:after;",th:"text-height:|;","th:a":"text-height:auto;","th:f":"text-height:font-size;","th:t":"text-height:text-size;","th:m":"text-height:max-size;",ti:"text-indent:|;","ti:-":"text-indent:-9999px;",tj:"text-justify:|;","tj:a":"text-justify:auto;","tj:iw":"text-justify:inter-word;","tj:ii":"text-justify:inter-ideograph;","tj:ic":"text-justify:inter-cluster;",
"tj:d":"text-justify:distribute;","tj:k":"text-justify:kashida;","tj:t":"text-justify:tibetan;",to:"text-outline:|;","to+":"text-outline:${1:0} ${2:0} ${3:#000};","to:n":"text-outline:none;",tr:"text-replace:|;","tr:n":"text-replace:none;",tt:"text-transform:|;","tt:n":"text-transform:none;","tt:c":"text-transform:capitalize;","tt:u":"text-transform:uppercase;","tt:l":"text-transform:lowercase;",tw:"text-wrap:|;","tw:n":"text-wrap:normal;","tw:no":"text-wrap:none;","tw:u":"text-wrap:unrestricted;",
"tw:s":"text-wrap:suppress;",tsh:"text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000};","tsh+":"text-shadow:${1:0} ${2:0} ${3:0} ${4:#000};","tsh:n":"text-shadow:none;",trf:"transform:|;","trf:skx":"transform: skewX(${1:angle});","trf:sky":"transform: skewY(${1:angle});","trf:sc":"transform: scale(${1:x}, ${2:y});","trf:scx":"transform: scaleX(${1:x});","trf:scy":"transform: scaleY(${1:y});","trf:r":"transform: rotate(${1:angle});","trf:t":"transform: translate(${1:x}, ${2:y});","trf:tx":"transform: translateX(${1:x});",
"trf:ty":"transform: translateY(${1:y});",trs:"transition:${1:prop} ${2:time};",trsde:"transition-delay:${1:time};",trsdu:"transition-duration:${1:time};",trsp:"transition-property:${1:prop};",trstf:"transition-timing-function:${1:tfunc};",lh:"line-height:|;",whs:"white-space:|;","whs:n":"white-space:normal;","whs:p":"white-space:pre;","whs:nw":"white-space:nowrap;","whs:pw":"white-space:pre-wrap;","whs:pl":"white-space:pre-line;",whsc:"white-space-collapse:|;","whsc:n":"white-space-collapse:normal;",
"whsc:k":"white-space-collapse:keep-all;","whsc:l":"white-space-collapse:loose;","whsc:bs":"white-space-collapse:break-strict;","whsc:ba":"white-space-collapse:break-all;",wob:"word-break:|;","wob:n":"word-break:normal;","wob:k":"word-break:keep-all;","wob:l":"word-break:loose;","wob:bs":"word-break:break-strict;","wob:ba":"word-break:break-all;",wos:"word-spacing:|;",wow:"word-wrap:|;","wow:nm":"word-wrap:normal;","wow:n":"word-wrap:none;","wow:u":"word-wrap:unrestricted;","wow:s":"word-wrap:suppress;",
lts:"letter-spacing:|;",f:"font:|;","f+":"font:${1:1em} ${2:Arial,sans-serif};",fw:"font-weight:|;","fw:n":"font-weight:normal;","fw:b":"font-weight:bold;","fw:br":"font-weight:bolder;","fw:lr":"font-weight:lighter;",fs:"font-style:|;","fs:n":"font-style:normal;","fs:i":"font-style:italic;","fs:o":"font-style:oblique;",fv:"font-variant:|;","fv:n":"font-variant:normal;","fv:sc":"font-variant:small-caps;",fz:"font-size:|;",fza:"font-size-adjust:|;","fza:n":"font-size-adjust:none;",ff:"font-family:|;",
"ff:s":"font-family:serif;","ff:ss":"font-family:sans-serif;","ff:c":"font-family:cursive;","ff:f":"font-family:fantasy;","ff:m":"font-family:monospace;",fef:"font-effect:|;","fef:n":"font-effect:none;","fef:eg":"font-effect:engrave;","fef:eb":"font-effect:emboss;","fef:o":"font-effect:outline;",fem:"font-emphasize:|;",femp:"font-emphasize-position:|;","femp:b":"font-emphasize-position:before;","femp:a":"font-emphasize-position:after;",fems:"font-emphasize-style:|;","fems:n":"font-emphasize-style:none;",
"fems:ac":"font-emphasize-style:accent;","fems:dt":"font-emphasize-style:dot;","fems:c":"font-emphasize-style:circle;","fems:ds":"font-emphasize-style:disc;",fsm:"font-smooth:|;","fsm:a":"font-smooth:auto;","fsm:n":"font-smooth:never;","fsm:aw":"font-smooth:always;",fst:"font-stretch:|;","fst:n":"font-stretch:normal;","fst:uc":"font-stretch:ultra-condensed;","fst:ec":"font-stretch:extra-condensed;","fst:c":"font-stretch:condensed;","fst:sc":"font-stretch:semi-condensed;","fst:se":"font-stretch:semi-expanded;",
"fst:e":"font-stretch:expanded;","fst:ee":"font-stretch:extra-expanded;","fst:ue":"font-stretch:ultra-expanded;",op:"opacity:|;","op:ie":"filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);","op:ms":"-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';",rz:"resize:|;","rz:n":"resize:none;","rz:b":"resize:both;","rz:h":"resize:horizontal;","rz:v":"resize:vertical;",cur:"cursor:|;","cur:a":"cursor:auto;","cur:d":"cursor:default;","cur:c":"cursor:crosshair;","cur:ha":"cursor:hand;",
"cur:he":"cursor:help;","cur:m":"cursor:move;","cur:p":"cursor:pointer;","cur:t":"cursor:text;",pgbb:"page-break-before:|;","pgbb:au":"page-break-before:auto;","pgbb:al":"page-break-before:always;","pgbb:l":"page-break-before:left;","pgbb:r":"page-break-before:right;",pgbi:"page-break-inside:|;","pgbi:au":"page-break-inside:auto;","pgbi:av":"page-break-inside:avoid;",pgba:"page-break-after:|;","pgba:au":"page-break-after:auto;","pgba:al":"page-break-after:always;","pgba:l":"page-break-after:left;",
"pgba:r":"page-break-after:right;",orp:"orphans:|;",wid:"widows:|;"}},html:{filters:"html",profile:"html",snippets:{c:"<\!-- |${child} --\>","cc:ie6":"<\!--[if lte IE 6]>\n\t${child}|\n<![endif]--\>","cc:ie":"<\!--[if IE]>\n\t${child}|\n<![endif]--\>","cc:noie":"<\!--[if !IE]><\!--\>\n\t${child}|\n<\!--<![endif]--\>","html:4t":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}">\n\t<title>${1:Document}</title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>',
"html:4s":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}">\n\t<title>${1:Document}</title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>',"html:xt":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title></title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>',
"html:xs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title>${1:Document}</title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>',"html:xxs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title>${1:Document}</title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>',
"html:5":'<!doctype html>\n<html lang="${lang}">\n<head>\n\t<meta charset="${charset}">\n\t<title>${1:Document}</title>\n</head>\n<body>\n\t${child}${2}\n</body>\n</html>'},abbreviations:{"!":"html:5",a:'<a href="">',"a:link":'<a href="http://|">',"a:mail":'<a href="mailto:|">',abbr:'<abbr title="">',acronym:'<acronym title="">',base:'<base href="" />',bdo:'<bdo dir="">',"bdo:r":'<bdo dir="rtl">',"bdo:l":'<bdo dir="ltr">',link:'<link rel="stylesheet" href="" />',"link:css":'<link rel="stylesheet" href="${1:style}.css" media="all" />',
"link:print":'<link rel="stylesheet" href="${1:print}.css" media="print" />',"link:favicon":'<link rel="shortcut icon" type="image/x-icon" href="${1:favicon.ico}" />',"link:touch":'<link rel="apple-touch-icon" href="${1:favicon.png}" />',"link:rss":'<link rel="alternate" type="application/rss+xml" title="RSS" href="${1:rss.xml}" />',"link:atom":'<link rel="alternate" type="application/atom+xml" title="Atom" href="${1:atom.xml}" />',"meta:utf":'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />',
"meta:win":'<meta http-equiv="Content-Type" content="text/html;charset=windows-1251" />',"meta:compat":'<meta http-equiv="X-UA-Compatible" content="${1:IE=7}" />',style:"<style>",script:"<script>","script:src":'<script src="">',img:'<img src="" alt="" />',iframe:'<iframe src="" frameborder="0">',embed:'<embed src="" type="" />',object:'<object data="" type="">',param:'<param name="" value="" />',map:'<map name="">',area:'<area shape="" coords="" href="" alt="" />',"area:d":'<area shape="default" href="" alt="" />',
"area:c":'<area shape="circle" coords="" href="" alt="" />',"area:r":'<area shape="rect" coords="" href="" alt="" />',"area:p":'<area shape="poly" coords="" href="" alt="" />',form:'<form action="">',"form:get":'<form action="" method="get">',"form:post":'<form action="" method="post">',label:'<label for="">',input:'<input type="" />',"input:hidden":'<input type="hidden" name="" />',"input:h":'<input type="hidden" name="" />',"input:text":'<input type="text" name="" id="" />',"input:t":'<input type="text" name="" id="" />',
"input:search":'<input type="search" name="" id="" />',"input:email":'<input type="email" name="" id="" />',"input:url":'<input type="url" name="" id="" />',"input:password":'<input type="password" name="" id="" />',"input:p":'<input type="password" name="" id="" />',"input:datetime":'<input type="datetime" name="" id="" />',"input:date":'<input type="date" name="" id="" />',"input:datetime-local":'<input type="datetime-local" name="" id="" />',"input:month":'<input type="month" name="" id="" />',
"input:week":'<input type="week" name="" id="" />',"input:time":'<input type="time" name="" id="" />',"input:number":'<input type="number" name="" id="" />',"input:color":'<input type="color" name="" id="" />',"input:checkbox":'<input type="checkbox" name="" id="" />',"input:c":'<input type="checkbox" name="" id="" />',"input:radio":'<input type="radio" name="" id="" />',"input:r":'<input type="radio" name="" id="" />',"input:range":'<input type="range" name="" id="" />',"input:file":'<input type="file" name="" id="" />',
"input:f":'<input type="file" name="" id="" />',"input:submit":'<input type="submit" value="" />',"input:s":'<input type="submit" value="" />',"input:image":'<input type="image" src="" alt="" />',"input:i":'<input type="image" src="" alt="" />',"input:reset":'<input type="reset" value="" />',"input:button":'<input type="button" value="" />',"input:b":'<input type="button" value="" />',select:'<select name="" id=""></select>',option:'<option value=""></option>',textarea:'<textarea name="" id="" cols="${1:30}" rows="${2:10}">',
"menu:context":'<menu type="context">',"menu:c":'<menu type="context">',"menu:toolbar":'<menu type="toolbar">',"menu:t":'<menu type="toolbar">',video:'<video src="">',audio:'<audio src="">',"html:xml":'<html xmlns="http://www.w3.org/1999/xhtml">',bq:"blockquote",acr:"acronym",fig:"figure",figc:"figcaption",ifr:"iframe",emb:"embed",obj:"object",src:"source",cap:"caption",colg:"colgroup",fst:"fieldset",btn:"button",optg:"optgroup",opt:"option",tarea:"textarea",leg:"legend",sect:"section",art:"article",
hdr:"header",ftr:"footer",adr:"address",dlg:"dialog",str:"strong",prog:"progress",fset:"fieldset",datag:"datagrid",datal:"datalist",kg:"keygen",out:"output",det:"details",cmd:"command","ol+":"ol>li","ul+":"ul>li","dl+":"dl>dt+dd","map+":"map>area","table+":"table>tr>td","colgroup+":"colgroup>col","colg+":"colgroup>col","tr+":"tr>td","select+":"select>option","optgroup+":"optgroup>option","optg+":"optgroup>option"}},xml:{"extends":"html",profile:"xml",filters:"html"},xsl:{"extends":"html",profile:"xml",
filters:"html, xsl",abbreviations:{tm:'<xsl:template match="" mode="">',tmatch:"tm",tn:'<xsl:template name="">',tname:"tn",call:'<xsl:call-template name=""/>',ap:'<xsl:apply-templates select="" mode=""/>',api:"<xsl:apply-imports/>",imp:'<xsl:import href=""/>',inc:'<xsl:include href=""/>',ch:"<xsl:choose>","xsl:when":'<xsl:when test="">',wh:"xsl:when",ot:"<xsl:otherwise>","if":'<xsl:if test="">',par:'<xsl:param name="">',pare:'<xsl:param name="" select=""/>',"var":'<xsl:variable name="">',vare:'<xsl:variable name="" select=""/>',
wp:'<xsl:with-param name="" select=""/>',key:'<xsl:key name="" match="" use=""/>',elem:'<xsl:element name="">',attr:'<xsl:attribute name="">',attrs:'<xsl:attribute-set name="">',cp:'<xsl:copy select=""/>',co:'<xsl:copy-of select=""/>',val:'<xsl:value-of select=""/>',each:'<xsl:for-each select="">',"for":"each",tex:"<xsl:text></xsl:text>",com:"<xsl:comment>",msg:'<xsl:message terminate="no">',fall:"<xsl:fallback>",num:'<xsl:number value=""/>',nam:'<namespace-alias stylesheet-prefix="" result-prefix=""/>',
pres:'<xsl:preserve-space elements=""/>',strip:'<xsl:strip-space elements=""/>',proc:'<xsl:processing-instruction name="">',sort:'<xsl:sort select="" order=""/>',"choose+":"xsl:choose>xsl:when+xsl:otherwise"}},haml:{filters:"haml","extends":"html"},scss:{"extends":"css"},sass:{"extends":"css"},less:{"extends":"css"},stylus:{"extends":"css"}},"system")});
emmet.define("cm-editor-proxy",function(h,d){var f=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)||/Mac/.test(navigator.platform),i={"Cmd-E":"expand_abbreviation",Tab:"expand_abbreviation_with_tab","Cmd-D":"match_pair_outward","Shift-Cmd-D":"match_pair_inward","Cmd-T":"matching_pair","Shift-Cmd-A":"wrap_with_abbreviation","Ctrl-Alt-Right":"next_edit_point","Ctrl-Alt-Left":"prev_edit_point","Cmd-L":"select_line","Cmd-Shift-M":"merge_lines","Cmd-/":"toggle_comment",
"Cmd-J":"split_join_tag","Cmd-K":"remove_tag","Shift-Cmd-Y":"evaluate_math_expression","Ctrl-Up":"increment_number_by_1","Ctrl-Down":"decrement_number_by_1","Alt-Up":"increment_number_by_01","Alt-Down":"decrement_number_by_01","Ctrl-Alt-Up":"increment_number_by_10","Ctrl-Alt-Down":"decrement_number_by_10","Shift-Cmd-.":"select_next_item","Shift-Cmd-,":"select_previous_item","Cmd-B":"reflect_css_value",Enter:"insert_formatted_line_break_only"},b={"text/html":"html","application/xml":"xml","text/xsl":"xsl",
"text/css":"css","text/x-less":"less"};CodeMirror.defineOption?CodeMirror.defineOption("profile","html"):CodeMirror.defaults.profile="html";var c={context:null,getSelectionRange:function(){var a=this.getCaretPos();return{start:a,end:a+this.getSelection().length}},createSelection:function(a,b){a==b?this.context.setCursor(this.context.posFromIndex(a)):this.context.setSelection(this.context.posFromIndex(a),this.context.posFromIndex(b))},getCurrentLineRange:function(){var a=this.context.getCursor(!0);
return{start:this.context.indexFromPos({line:a.line,ch:0}),end:this.context.indexFromPos({line:a.line,ch:this.context.getLine(a.line).length})}},getCaretPos:function(){return this.context.indexFromPos(this.context.getCursor(!0))},setCaretPos:function(a){this.createSelection(a,a)},getCurrentLine:function(){return this.context.getLine(this.context.getCursor(!0).line)||""},replaceContent:function(a,b,c,f){d.isUndefined(c)&&(c=d.isUndefined(b)?content.length:b);d.isUndefined(b)&&(b=0);var i=h("utils");
f||(a=i.padString(a,i.getLinePaddingFromPosition(this.getContent(),b)));var f=h("tabStops").extract(a,{escape:function(a){return a}}),a=f.text,m=f.tabstops[0];m?(m.start+=b,m.end+=b):m={start:a.length+b,end:a.length+b};var n=this;(this.context.operation||this.context.compoundChange).call(this.context,function(){n.context.replaceRange(a,n.context.posFromIndex(b),n.context.posFromIndex(c));n.createSelection(m.start,m.end)})},getContent:function(){return this.context.getValue()},getSyntax:function(){var a=
this.context.getOption("mode");a in b&&(a=b[a]);return h("actionUtils").detectSyntax(this,a)},getProfileName:function(){return this.context.getOption("profile")?this.context.getOption("profile"):h("actionUtils").detectProfile(this)},prompt:function(a){return prompt(a)},getSelection:function(){return this.context.getSelection()||""},getFilePath:function(){return location.href},setupContext:function(a){this.context=a;var b="\t";a.getOption("indentWithTabs")||(b=h("utils").repeatString(" ",a.getOption("indentUnit")));
h("resources").setVariable("indentation",b)},addAction:function(a,b){var d="emmet."+a;CodeMirror.commands[d]||(CodeMirror.commands[d]=function(b){c.setupContext(b);var d;if(d=a=="expand_abbreviation_with_tab")if(!(d=c.getSelection()))d=c.getSyntax(),d=!h("resources").hasSyntax(d);if(d)throw CodeMirror.Pass;d=!0;try{var e=h("actions").run(a,c);(a=="next_edit_point"||a=="prev_edit_point")&&b.replaceSelection("");!e&&a=="insert_formatted_line_break_only"&&(d=!1)}catch(f){}if(!d)throw CodeMirror.Pass;
});if(b){if(!CodeMirror.defaults.extraKeys)CodeMirror.defaults.extraKeys={};f||(b=b.replace("Cmd","Ctrl"));CodeMirror.defaults.extraKeys[b]=d}}};typeof emmetKeymap!="undefined"&&(i=emmetKeymap);d.each(i,c.addAction);return c});

BIN
plugins/emmet/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,24 @@
Copyright (C) 2012 Matt Pass
Website: mattpass.com
Email: matt@mattpass.com
Twitter: @mattpass
#ICErepo License
##Standard Open Source Initiative MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,61 @@
ICErepo
=======
Show diffs, push, pull &amp; sync your site and Github repo's.
While Github has a fantastic website, mobile app, desktop app and of course bash system, there's no web based UI I can find to sync your website code with Github repo's or vice versa. That's what ICErepo provides.
Originally intended to be a plugin for ICEcoder (https://github.com/mattpass/ICEcoder), I have decided to make it a standalone lib so it can run by itself or easily be integrated into any existing system.
The aim is a simple UI to view diffs between your server dir's and related Github repo's. This list will consist of new files (those only on server), deleted files (those only on Github) and changed files (files that exist in both places but are different). Files that exist in both locations and the same are not shown to keep things minimalist.
Users can then to pick & choose the files & folder they'd like to commit, provide a title and message, then commit to Github. As each file is synced by the user to match the server it dissapears from the UI list. Alternatively you can pull files & folders from Github to sync your server dir's with the repo itself.
Cool huh?
**Current screnshot:**
<img src="http://www.icecoder.net/github/screenshot.jpg" alt="ICErepo screenshot">
This lib uses customised & minified versions of these brilliant and time tested repos:
Github API lib: https://github.com/michael/github
JS Diff lib: https://github.com/cemerick/jsdifflib
###Installation
####Step 1: Clone the repo
```
$ git clone git@github:mattpass/ICErepo
```
####Step 2: Enter your auth settings
```
Open index.php and enter either your Github oauth token or username & password
oauth is recommended here, view http://developer.github.com/v3/oauth/ for info
(If using oauth ensure you have repo scope & your app is granted the URL you'll run under)
```
####Step 3: Enter your repo & server dir settings
```
Also in index.php, enter the repo & corresponding server paths
Enter 'selected' as a 3rd param next to your default repo/server option to autoload that
Finally, set $_SESSION['userLevel'] to be > 0 with your own login system, or simply uncomment line 3
Upload ICErepo, visit in a web browser & enjoy
```
**Dev schedule:**
**v0.8**
Bug testing, refactoring & optimisation
**v0.9**
Alpha testing
**v0.95**
Beta testing
**v1.0**
Version 1 released

View File

@@ -0,0 +1,127 @@
<?php
session_start();
if (!$_SESSION['loggedIn']) {
die("Sorry, you need to be logged in to use ICErepo");
}
function strClean($var) {
// returns converted entities where there are HTML entity equivalents
return htmlentities($var, ENT_QUOTES, "UTF-8");
}
function numClean($var) {
// returns a number, whole or decimal or null
return is_numeric($var) ? floatval($var) : false;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ICErepo v<?php echo $version;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="lib/base64.js"></script>
<script src="lib/github.js"></script>
<script src="lib/difflib.js"></script>
<script src="ice-repo.js"></script>
<link rel="stylesheet" type="text/css" href="ice-repo.css">
</head>
<body>
<?php
// Function to sort given values alphabetically
function alphasort($a, $b) {
return strcmp($a->getPathname(), $b->getPathname());
}
// Class to put forward the values for sorting
class SortingIterator implements IteratorAggregate {
private $iterator = null;
public function __construct(Traversable $iterator, $callback) {
$array = iterator_to_array($iterator);
usort($array, $callback);
$this->iterator = new ArrayIterator($array);
}
public function getIterator() {
return $this->iterator;
}
}
// Get a full list of dirs & files and begin sorting using above class & function
$repoPath = explode("@",strClean($_POST['repo']));
$repo = $repoPath[0];
$path = $repoPath[1];
$objectList = new SortingIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST), 'alphasort');
// Finally, we have our ordered list, so display
$i=0;
$dirListArray = array();
$dirSHAArray = array();
$dirTypeArray = array();
$finfo = finfo_open(FILEINFO_MIME_TYPE);
foreach ($objectList as $objectRef) {
$fileFolderName = rtrim(substr($objectRef->getPathname(), strlen($path)),"..");
if ($objectRef->getFilename()!="." && $fileFolderName[strlen($fileFolderName)-1]!="/") {
$contents = file_get_contents($path.$fileFolderName);
if (strpos(finfo_file($finfo, $path.$fileFolderName),"text")===0) {
$contents = str_replace("\r","",$contents);
};
$store = "blob ".strlen($contents)."\000".$contents;
$i++;
array_push($dirListArray,ltrim($fileFolderName,"/"));
array_push($dirSHAArray,sha1($store));
$type = is_dir($path.$fileFolderName) ? "dir" : "file";
array_push($dirTypeArray,$type);
}
}
finfo_close($finfo);
?>
<script>
top.repo = '<?php echo $repo;?>';
top.path = '<?php echo $path;?>';
dirListArray = [<?php echo "'".implode("','", $dirListArray)."'";?>];
dirSHAArray = [<?php echo "'".implode("','", $dirSHAArray)."'";?>];
dirTypeArray = [<?php echo "'".implode("','", $dirTypeArray)."'";?>];
</script>
<div id="compareList" class="mainContainer"></div>
<div id="commitPane" class="commitPane">
<b style='font-size: 18px'>COMMIT CHANGES:</b><br><br>
<form name="fcForm" action="file-control.php" target="fileControl" method="POST">
<input type="text" name="title" value="Title..." style="width: 260px; border: 0; background: #f8f8f8; margin-bottom: 10px" onFocus="titleDefault='Title...'; if(this.value==titleDefault) {this.value=''}" onBlur="if(this.value=='') {this.value=titleDefault}"><br>
<textarea name="message" style="width: 260px; height: 180px; border: 0; background: #f8f8f8; margin-bottom: 5px" onFocus="messageDefault='Message...'; if(this.value==messageDefault) {this.value=''}" onBlur="if(this.value=='') {this.value=messageDefault}">Message...</textarea>
<input type="hidden" name="token" value="<?php echo strClean($_POST['token']);?>">
<input type="hidden" name="username" value="<?php echo strClean($_POST['username']);?>">
<input type="hidden" name="password" value="<?php echo strClean($_POST['password']);?>">
<input type="hidden" name="path" value="<?php echo $path; ?>">
<input type="hidden" name="rowID" value="">
<input type="hidden" name="gitRepo" value="<?php echo $repo; ?>">
<input type="hidden" name="repo" value="">
<input type="hidden" name="dir" value="">
<input type="hidden" name="action" value="">
<input type="submit" name="commit" value="Commit changes" onClick="return commitChanges()" style="border: 0; background: #555; color: #fff; cursor: pointer">
</form>
</div>
<div id="infoPane" class="infoPane"></div>
<script>
top.fcFormAlias = document.fcForm;
var github = new Github(<?php
if ($_POST['token']!="") {
echo '{token: "'.strClean($_POST['token']).'", auth: "oauth"}';
} else{
echo '{username: "'.strClean($_POST['username']).'", password: "'.strClean($_POST['password']).'", auth: "basic"}';
}?>);
repoListArray = [];
repoSHAArray = [];
window.onLoad=gitCommand('repo.show','<?php echo strClean($_POST['repo']);?>');
</script>
<iframe name="fileControl" style="display: none"></iframe>
</body>
</html>

View File

@@ -0,0 +1,144 @@
<?php
session_start();
if (!$_SESSION['loggedIn']) {
die("Sorry, you need to be logged in to use ICErepo");
}
// returns converted entities where there are HTML entity equivalents
function strClean($var) {
return htmlentities($var, ENT_QUOTES, "UTF-8");
}
// returns a number, whole or decimal or null
function numClean($var) {
return is_numeric($var) ? floatval($var) : false;
}
$repoPath = strClean($_POST['repoPath']);
$gitRepo = strClean($_POST['gitRepo']);
$path = strClean($_POST['path']);
$rowID = strClean($_POST['rowID']);
$repo = strClean($_POST['repo']);
$dir = strClean($_POST['dir']);
$action = str_replace("PULL:","",str_replace("SAVEPULLS:","",strClean($_POST['action'])));
$rowIDArray = explode(",",$rowID);
$repoArray = explode(",",$repo);
$dirArray = explode(",",$dir);
$actionArray = explode(",",$action);
?>
<!DOCTYPE html>
<html>
<head>
<title>ICErepo v<?php echo $version;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="lib/underscore-min.js"></script>
<script src="lib/base64.js"></script>
<script src="lib/github.js"></script>
<script src="lib/difflib.js"></script>
<script src="ice-repo.js"></script>
<link rel="stylesheet" type="text/css" href="ice-repo.css">
</head>
<body>
<script>
fullRepoPath='<?php echo $repo;?>';
gitRepo='<?php echo $gitRepo;?>';
var github = new Github(<?php
if ($_POST['token']!="") {
echo '{token: "'.strClean($_POST['token']).'", auth: "oauth"}';
} else{
echo '{username: "'.strClean($_POST['username']).'", password: "'.strClean($_POST['password']).'", auth: "basic"}';
}?>);
repoUser = gitRepo.split('/')[0];
repoName = gitRepo.split('/')[1];
filePath = fullRepoPath.replace(repoUser+"/"+repoName+"/","");
var repo = github.getRepo(repoUser,repoName);
</script>
<?php if ($_POST['action']=="view") {?>
<form name="fcForm">
<textarea name="fileContents"><?php echo htmlentities(file_get_contents($dir)); ?></textarea>
</form>
<script>
rowID = <?php echo $rowID; ?>;
baseTextName = "Server: <?php echo str_replace($_SERVER['DOCUMENT_ROOT']."/","",$dir);?> ";
newTextName = "Github: <?php echo $repo;?>";
window.onLoad = sendData(baseTextName,newTextName);
</script>
<?php } else if (substr($_POST['action'],0,5)=="PULL:") { ?>
<form name="fcForm" action="file-control.php" method="POST">
<?php
echo '<input type="hidden" name="rowID" value="'.$rowID.'">';
echo '<input type="hidden" name="repo" value="'.$repo.'">';
echo '<input type="hidden" name="dir" value="'.$dir.'">';
echo '<input type="hidden" name="action" value="SAVEPULLS:'.$action.'">';
echo '<input type="hidden" name="path" value="'.$path.'">';
for ($i=0;$i<count($rowIDArray);$i++) {
if ($repoArray[$i]!="") {
echo '<textarea name="repoContents'.$rowIDArray[$i].'"></textarea>';
}
}
?>
</form>
<script>
rowIDArray = [<?php echo implode(",", $rowIDArray);?>];
repoArray = [<?php echo "'".implode("','", $repoArray)."'";?>];
dirArray = [<?php echo "'".implode("','", $dirArray)."'";?>];
actionArray = [<?php echo "'".implode("','", $actionArray)."'";?>];
window.onLoad = getData();
</script>
<?php } else if (substr($_POST['action'],0,10)=="SAVEPULLS:") {?>
<script>
<?php
for ($i=0;$i<count($rowIDArray);$i++) {
if ($actionArray[$i]!="new") {
$dirs = explode("/",$repoArray[$i]);
$relDir = "";
for ($j=0;$j<count($dirs)-1;$j++) {
$relDir .= "/".$dirs[$j];
if (!is_dir($path.$relDir)) {
mkdir($path.$relDir, 0755);
}
}
$fh = fopen($path."/".$repoArray[$i], 'w') or die("alert('Sorry, there was a problem pulling ".$repoArray[$i].". Either the file is unavailable on Github or server permissions aren\'t allowing it to be created/updated.');get('blackMask','top').style.display='none';");
fwrite($fh, $_POST['repoContents'.$rowIDArray[$i]]);
fclose($fh);
echo "hideRow(".$rowIDArray[$i].");top.newCount--;";
} else {
is_dir($dir) ? $success = rmdir($dir) : $success = unlink($dir);
if (!$success) {
echo "alert('Sorry, couldn\'t delete ".$dir."\\n\\n";
echo "Maybe you need to give file permissions for it to be deleted?');";
} else {
echo "hideRow(".$rowIDArray[$i].");top.deletedCount--;";
}
}
}
echo "get('blackMask','top').style.display = 'none';";
?>
</script>
<?php } else { ?>
<form name="fcForm">
<?php
for ($i=0;$i<count($rowIDArray);$i++) {
if ($dirArray[$i]!="") {
echo '<textarea name="fileContents'.$rowIDArray[$i].'">';
echo htmlentities(file_get_contents($dirArray[$i]));
echo '</textarea>';
}
}
?>
</form>
<script>
rowIDArray = [<?php echo implode(",", $rowIDArray);?>];
repoArray = [<?php echo "'".implode("','", $repoArray)."'";?>];
dirArray = [<?php echo "'".implode("','", $dirArray)."'";?>];
actionArray = [<?php echo "'".implode("','", $actionArray)."'";?>];
window.onLoad = startProcess();
</script>
<?php } ?>
</body>
</html>

View File

@@ -0,0 +1,79 @@
/* First, reset everything to a standard */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
font-family: arial, verdana, helvetica, sans-serif;
border: 0px;
margin: 0px;
padding: 0px;
outline: 0px;
font-size: 12px;
vertical-align: top;
}
html, body {background-color: #fff; width: 100%}
p {color: #444}
textarea, input {font-family: arial, verdana, helvetica, sans-serif; padding: 4px}
.header {position: absolute; width: 100%; height: 60px; background: #444; z-index: 1}
.mainContainer {position: relative; display: block; width: 900px; padding: 20px}
.blackMask {position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 200}
.loadingMsgCenter {position: absolute; display: inline-block; left: 50%; top: 50%; width: 1px; height: 1px}
.loadingMsgContainer {position: absolute; display: inline-block; left: -30px; top: -7px; width: 60px; height: 14px; background-color: #bbb; color: #222; font-weight: bold; text-align: center; padding: 15px; z-index: 201;
-webkit-box-shadow: 8px 8px 8px 8px rgba(0,0,0,0.4);
-moz-box-shadow: 8px 8px 8px 8px rgba(0,0,0,0.4);
box-shadow: 4px 4px 8px 4px rgba(0,0,0,0.4)}
.repoFrame {position: absolute; width: 100%; height: 90%; left: 0px; margin-top: 60px}
.row {position: relative; display: inline-block; background: #ccc; color: #000; width: 880px; padding: 10px 7px; margin-bottom: 2px; cursor: pointer; padding-left: 35px}
.row:hover {background: #888; color: #fff}
.row .icon {display: inline-block; width: 16px; height: 16px; margin-right: 7px; background-image:url('../../images/file-folder-icons.png'); background-repeat: no-repeat}
.row .checkbox {position: absolute; display: inline-block; height: 38px; width: 30px; top: -4px; left: 0px}
.rowContent {position: relative; display: none; background: #eee; width: 100%; height: 300px; padding: 7px; margin-bottom: 10px; overflow: auto}
.pullGithub {position: absolute; display: inline-block; top: 7px; left: 822px; padding: 5px; background: #bbb; color: #444; font-size: 10px; cursor: pointer}
.pullGithubSel {position: absolute; display: inline-block; top: 7px; left: 822px; margin-top: 12px; margin-left: -22px; padding: 5px; background: #bbb; color: #444; font-size: 10px; cursor: pointer}
.version {position: absolute; display: inline-block; width: 100px; left: 1000px; top: 33px; font-size: 10px; color: #bbb; text-align: right}
.logo {position: absolute; left: 1107px; top: 12px}
.commitPane {position: fixed; background: #ccc; width: 270px; height: 300px; left: 960px; top: 0px; padding: 20px 10px 10px 10px; z-index: 100}
.infoPane {position: fixed; width: 270px; height: 100px; left: 960px; top: 340px; padding: 20px 10px 10px 10px; z-index: 100}
/* Folder */
.ext-folder {background-position: 0 0}
/* Additional file types */
.ext-coffee {background-position: -48px 0}
.ext-css {background-position: -64px 0}
.ext-gif {background-position: -80px 0}
.ext-htm {background-position: -96px 0}
.ext-html {background-position: -96px 0}
.ext-jpg {background-position: -112px 0}
.ext-jpeg {background-position: -112px 0}
.ext-js {background-position: -128px 0}
.ext-less {background-position: -144px 0}
.ext-php {background-position: -160px 0}
.ext-png {background-position: -176px 0}
.ext-rb {background-position: -192px 0}
.ext-rbx {background-position: -192px 0}
.ext-rhtml {background-position: -192px 0}
.ext-ruby {background-position: -192px 0}
.ext-txt {background-position: -208px 0}
.ext-zip {background-position: -224px 0}
.ext-file {background-position: -32px 0}
table.diff {color: #888; border: 0; white-space: pre-wrap}
table.diff tbody th {color:#888; font-size: 11px; font-weight: normal; padding: 2px; vertical-align:top}
table.diff thead th.texttitle {background: #444; color: #fff; text-align:left; padding: 2px}
table.diff tbody td {width: 100%; font-family: Courier, monospace; vertical-align: top}
table.diff .delete {background: #0b0; color: #fff}
table.diff .insert {background: #b00; color: #fff}
table.diff th.author {display: none}

View File

@@ -0,0 +1,336 @@
top.selRowArray = [];
top.selRepoDirArray = [];
top.selActionArray = [];
top.filetypesArray = ['coffee','css','gif','htm','html','jpg','jpeg','js','less','php','png','rb','rbx','rhtml','ruby','txt','zip'];
doRepo = function(repo) {
document.showRepo.repo.value = repo;
document.showRepo.submit();
}
updateSelection = function(elem,row,repoDir,action) {
if (elem.checked) {
top.selRowArray.push(row);
top.selRepoDirArray.push(repoDir);
top.selActionArray.push(action);
} else {
arrayIndex = top.selRowArray.indexOf(row);
top.selRowArray.splice(arrayIndex,1);
top.selRepoDirArray.splice(arrayIndex,1);
top.selActionArray.splice(arrayIndex,1);
};
}
getContent = function(thisRow,path) {
if("undefined" == typeof overOption || !overOption) {
if ("undefined" == typeof lastRow || lastRow!=thisRow || get('row'+thisRow+'Content').innerHTML=="") {
for (i=1;i<=rowID;i++) {
get('row'+i+'Content').innerHTML = "";
get('row'+i+'Content').style.display = "none";
}
repo = top.repo + "/" + path;
dir = top.path + "/" + path;
document.fcForm.rowID.value = thisRow;
document.fcForm.repo.value = repo;
document.fcForm.dir.value = dir;
document.fcForm.action.value = "view";
document.fcForm.submit();
} else {
get('row'+thisRow+'Content').innerHTML = "";
get('row'+thisRow+'Content').style.display = "none";
}
lastRow = thisRow;
}
}
commitChanges = function() {
if(top.selRowArray.length>0) {
if (document.fcForm.title.value!="Title..." && document.fcForm.message.value!="Message...") {
get('blackMask','top').style.display = "block";
top.selRowValue = "";
top.selDirValue = "";
top.selRepoValue = "";
top.selActionValue = "";
for (i=0;i<top.selRowArray.length;i++) {
top.selRowValue += top.selRowArray[i];
if (top.selActionArray[i]=="changed") {
top.selDirValue += top.selRepoDirArray[i].split('@')[0];
top.selRepoValue += top.selRepoDirArray[i].split('@')[1];
}
if (top.selActionArray[i]=="new") {
top.selDirValue += top.selRepoDirArray[i];
top.selRepoValue += "";
}
if (top.selActionArray[i]=="deleted") {
top.selDirValue += "";
top.selRepoValue += top.selRepoDirArray[i];
}
top.selActionValue += top.selActionArray[i];
if (i<top.selRowArray.length-1) {
top.selRowValue += ",";
top.selDirValue += ",";
top.selRepoValue += ",";
top.selActionValue += ",";
}
}
document.fcForm.rowID.value = top.selRowValue;
document.fcForm.dir.value = top.selDirValue;
document.fcForm.repo.value = top.selRepoValue;
document.fcForm.action.value = top.selActionValue;
document.fcForm.submit();
} else {
alert('Please enter a title & message for the commit');
}
} else {
alert('Please select some files/folders to commit');
}
return false;
}
pullContent = function(thisRow,thisPath,thisRepo,thisAction) {
get('blackMask','top').style.display = "block";
if (thisRow=="selected") {
top.selRowValue = "";
top.selDirValue = "";
top.selRepoValue = "";
top.selActionValue = "";
for (i=0;i<top.selRowArray.length;i++) {
top.selRowValue += top.selRowArray[i];
if (top.selActionArray[i]=="changed") {
repoUser = top.selRepoDirArray[i].split('@')[1].split('/')[0];
repoName = top.selRepoDirArray[i].split('@')[1].split('/')[1];
top.selDirValue += top.selRepoDirArray[i].split('@')[0];
top.selRepoValue += top.selRepoDirArray[i].split('@')[1].replace(repoUser+"/"+repoName+"/","");
}
if (top.selActionArray[i]=="new") {
top.selDirValue += top.selRepoDirArray[i];
top.selRepoValue += "";
}
if (top.selActionArray[i]=="deleted") {
repoUser = top.selRepoDirArray[i].split('/')[0];
repoName = top.selRepoDirArray[i].split('/')[1];
top.selDirValue += "";
top.selRepoValue += top.selRepoDirArray[i].replace(repoUser+"/"+repoName+"/","");
}
top.selActionValue += top.selActionArray[i];
if (i<top.selRowArray.length-1) {
top.selRowValue += ",";
top.selDirValue += ",";
top.selRepoValue += ",";
top.selActionValue += ",";
}
}
} else {
top.selRowValue = thisRow;
top.selDirValue = thisPath;
top.selRepoValue = thisRepo;
top.selActionValue = thisAction;
}
top.fcFormAlias.rowID.value = top.selRowValue;
top.fcFormAlias.dir.value = top.selDirValue;
top.fcFormAlias.repo.value = top.selRepoValue;
top.fcFormAlias.action.value = "PULL:"+top.selActionValue;
top.fcFormAlias.submit();
}
getData = function() {
if (actionArray[0]!="new") {
repo.read('master', repoArray[0], function(err, data) {
document.fcForm['repoContents'+rowIDArray[0]].innerHTML=data;
if(!err) {
removeFirstArrayItems();
rowIDArray.length>0 ? getData() : document.fcForm.submit();
} else {
alert('Sorry, there was an error reading '+repoArray[0]);
}
});
} else {
removeFirstArrayItems();
rowIDArray.length>0 ? getData() : document.fcForm.submit();
}
}
sendData = function(baseTextName,newTextName) {
repo.read('master', filePath, function(err, data) {
dirContent = document.fcForm.fileContents.value;
repoContent = data;
diffUsingJS(dirContent,repoContent,baseTextName,newTextName);
get("row"+rowID+"Content","parent").style.display = "inline-block";
});
}
removeFirstArrayItems = function() {
rowIDArray.splice(0,1);
repoArray.splice(0,1);
dirArray.splice(0,1);
actionArray.splice(0,1);
}
hideRow = function(row) {
top.rowCount--;
updateInfo('parent');
get('checkbox'+row,'parent').checked=false;
parent.updateSelection(get('checkbox'+row,'parent'));
get('row'+row,'parent').style.display = get('row'+row+'Content','parent').style.display = "none";
}
function diffUsingJS (dirContent,repoContent,baseTextName,newTextName) {
var base = difflib.stringAsLines(dirContent);
var newtxt = difflib.stringAsLines(repoContent);
var sm = new difflib.SequenceMatcher(base, newtxt);
var opcodes = sm.get_opcodes();
var diffoutputdiv = get("row"+rowID+"Content","parent");
while (diffoutputdiv.firstChild) diffoutputdiv.removeChild(diffoutputdiv.firstChild);
var contextSize = ""; // optional
contextSize = contextSize ? contextSize : null;
diffoutputdiv.appendChild(
diffview.buildView(
{
baseTextLines:base,
newTextLines:newtxt,
opcodes:opcodes,
baseTextName:baseTextName,
newTextName:newTextName,
contextSize:contextSize,
viewType: 1 // 0 = side by side, 1 = inline
}
)
)
}
// Add or Update files...
ffAddOrUpdate = function(row,gitRepo,action) {
repo.write('master', gitRepo, document.fcForm['fileContents'+row].value,parent.document.fcForm.title.value+ '\n\n'+parent.document.fcForm.message.value, function(err) {
if(!err) {
removeFirstArrayItems();
hideRow(row);
top.newCount--;
rowIDArray.length>0 ? startProcess() : get('blackMask','top').style.display = "none";
} else {
alert('Sorry, there was an error adding '+gitRepo);
}
});
}
// Delete files...
ffDelete = function(row,gitRepo,action) {
repo.remove('master', gitRepo, function(err) {
if(!err) {
removeFirstArrayItems();
hideRow(row);
top.deletedCount--;
rowIDArray.length>0 ? startProcess() : get('blackMask','top').style.display = "none";
} else {
alert('Sorry, there was an error deleting '+gitRepo);
}
});
}
startProcess = function() {
if(actionArray[0]=="changed"||actionArray[0]=="new") {
if(actionArray[0]=="changed") {repoLoc = repoArray[0].replace(repoUser+"/"+repoName+"/","")}
if(actionArray[0]=="new") {repoLoc = dirArray[0].replace(top.path,'')}
ffAddOrUpdate(rowIDArray[0],repoLoc,actionArray[0]);
}
if(actionArray[0]=="deleted") {
repoLoc = repoArray[0].replace(repoUser+"/"+repoName+"/","");
ffDelete(rowIDArray[0],repoLoc,actionArray[0]);
}
}
get = function(elem,context) {
return context ? window[context].document.getElementById(elem) : document.getElementById(elem);
}
updateInfo = function(context) {
get('infoPane',context).innerHTML = "<b style='font-size: 18px'>INFO:</b><br><br><b>"+top.rowCount+" files</b><br><br>"+top.changedCount+" changed<br>"+top.newCount+" new<br>"+top.deletedCount+" deleted";
}
gitCommand = function(comm,value) {
if (comm=="repo.show") {
userRepo = value.split("@")[0].split("/");
dir = value.split("@")[1];
var repo = github.getRepo(userRepo[0],userRepo[1]);
rowID = 0;
repo.getTree('master?recursive=true', function(err, tree) {
for (i=0;i<tree.length;i++) {
repoListArray.push(tree[i].path);
repoSHAArray.push(tree[i].sha);
}
var c = "", n = "", d = "";
top.rowCount=0, top.changedCount=0, top.newCount=0, top.deletedCount=0;
for (i=0;i<dirListArray.length;i++) {
repoArrayPos = repoListArray.indexOf(dirListArray[i]);
ext = dirTypeArray[i]=="dir"
? "folder"
: dirListArray[i].substr(dirListArray[i].lastIndexOf('.')+1);
if (repoArrayPos == "-1") {
rowID++;
sE = ext == 'folder' ? ' style="cursor: default"' : '';
cE = ext != 'folder' ? ' onClick="getContent('+rowID+',\''+dirListArray[i]+'\')"' : '';
gE = 'onClick="pullContent('+rowID+',\''+top.path+'/'+dirListArray[i]+'\',\''+dirListArray[i]+'\',\'new\')"';
n += "<div class='row' id='row"+rowID+"'"+cE+sE+">";
n += "<input type='checkbox' class='checkbox' id='checkbox"+rowID+"' onMouseOver='overOption=true' onMouseOut='overOption=false' onClick='updateSelection(this,"+rowID+",\""+top.path+"/"+dirListArray[i]+"\",\"new\")'>";
if (ext != 'folder' && top.filetypesArray.indexOf(ext)==-1) {ext = 'file'};
n += "<div class='icon ext-"+ext+"'></div>"+dirListArray[i];
n += "<div class='pullGithub' style='left: 815px' onMouseOver='overOption=true' onMouseOut='overOption=false' "+gE+">Delete from server</div><br>";
n += "</div>";
n += "<span class='rowContent' id='row"+rowID+"Content'></span>";
top.rowCount++;
top.newCount++;
} else if (dirTypeArray[i] == "file" && dirSHAArray[i] != repoSHAArray[repoArrayPos]) {
rowID++;
sE = ext == 'folder' ? ' style="cursor: default"' : '';
cE = ext != 'folder' ? ' onClick="getContent('+rowID+',\''+dirListArray[i]+'\')"' : '';
gE = 'onClick="pullContent('+rowID+',\''+top.path+'/'+dirListArray[i]+'\',\''+dirListArray[i]+'\',\'changed\')"';
c += "<div class='row' id='row"+rowID+"'"+cE+sE+">";
c += "<input type='checkbox' class='checkbox' id='checkbox"+rowID+"' onMouseOver='overOption=true' onMouseOut='overOption=false' onClick='updateSelection(this,"+rowID+",\""+top.path+"/"+dirListArray[i]+"@"+top.repo+"/"+dirListArray[i]+"\",\"changed\")'>";
if (ext != 'folder' && top.filetypesArray.indexOf(ext)==-1) {ext = 'file'};
c += "<div class='icon ext-"+ext+"'></div>"+dirListArray[i];
c += "<div class='pullGithub' onMouseOver='overOption=true' onMouseOut='overOption=false' "+gE+">Pull from Github</div><br>";
c += "</div>";
c += "<span class='rowContent' id='row"+rowID+"Content'></span>";
top.rowCount++;
top.changedCount++;
}
}
for (i=0;i<repoListArray.length;i++) {
dirArrayPos = dirListArray.indexOf(repoListArray[i]);
ext = repoListArray[i].lastIndexOf('/') > repoListArray[i].lastIndexOf('.')
? "folder"
: repoListArray[i].substr(repoListArray[i].lastIndexOf('.')+1);
if (dirArrayPos == "-1") {
rowID++;
sE = ext == 'folder' ? ' style="cursor: default"' : '';
cE = ext != 'folder' ? ' onClick="getContent('+rowID+',\''+repoListArray[i]+'\')"' : '';
gE = 'onClick="pullContent('+rowID+',\''+top.path+'/'+repoListArray[i]+'\',\''+repoListArray[i]+'\',\'deleted\')"';
d += "<div class='row' id='row"+rowID+"'"+cE+sE+">";
d += "<input type='checkbox' class='checkbox' id='checkbox"+rowID+"' onMouseOver='overOption=true' onMouseOut='overOption=false' onClick='updateSelection(this,"+rowID+",\""+top.repo+"/"+repoListArray[i]+"\",\"deleted\")'>";
if (ext != 'folder' && top.filetypesArray.indexOf(ext)==-1) {ext = 'file'};
d += "<div class='icon ext-"+ext+"'></div>"+repoListArray[i];
d += "<div class='pullGithub' onMouseOver='overOption=true' onMouseOut='overOption=false' "+gE+">Pull from Github</div><br>";
d += "</div>";
d += "<span class='rowContent' id='row"+rowID+"Content'></span>";
top.rowCount++;
top.deletedCount++;
}
}
c = "<b style='font-size: 18px'>CHANGED FILES:</b><br><br>"+c;
n = "<b style='font-size: 18px'>NEW FILES:</b><br><br>"+n;
d = "<b style='font-size: 18px'>DELETED FILES:</b><br><br>"+d
get('compareList').innerHTML = c+"<br><br>"+n+"<br><br>"+d;
updateInfo();
get('blackMask','top').style.display='none';
}
)
}
}

BIN
plugins/ice-repo/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,75 @@
<?php
session_start();
// $_SESSION['loggedIn'] = true;
if (!$_SESSION['loggedIn']) {
die("Sorry, you need to be logged in to use ICErepo");
}
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$version = "0.7.2";
// AUTHENTICATION
// Can either be done by oauth, or username & password.
// oauth
$token = "";
// Basic
$username = "username";
$password = "password";
// REPOS & SERVER DIRS
// Here you identify the repo location and related path on your server
// (the last param is to identify which dropdown option to select by default).
$repos = array(
"mattpass/dirTree",$docRoot."/dirTree","",
"mattpass/CodeMirror2",$docRoot."/CodeMirror2","selected"
);
?>
<!DOCTYPE html>
<html>
<head>
<title>ICErepo v<?php echo $version;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="lib/base64.js"></script>
<script src="lib/github.js"></script>
<script src="ice-repo.js"></script>
<link rel="stylesheet" type="text/css" href="ice-repo.css">
</head>
<body style="margin: 0; overflow: hidden" onLoad="doRepo(get('repos').value)">
<div class="blackMask" id="blackMask" style="display: block">
<div id="loadingMsgCenter" class="loadingMsgCenter">
<div id="loadingMsgContainer" class="loadingMsgContainer">
WORKING...
</div>
</div>
</div>
<div class="header">
<select name="repos" id="repos" onChange="doRepo(this.value)" style="margin: 20px 0 0 20px">
<?php
for ($i=0;$i<count($repos);$i+=3) {
echo '<option id="repo'.($i/3).'" value="'.$repos[$i].'@'.$repos[$i+1].'"';
echo $repos[$i+2]=="selected" ? ' selected' : '';
echo '>'.$repos[$i]."</option>\n";
}
?>
</select>
<div class="pullGithubSel" onClick="pullContent('selected')">Pull selected from Github</div>
<div class="version"><?php echo $version;?></div>
<img src="images/ice-repo.gif" alt="ICErepo" class="logo">
</div>
<form name="showRepo" action="contents.php" target="repo" method="POST">
<input type="hidden" name="token" value="<?php echo $token;?>">
<input type="hidden" name="username" value="<?php echo $username;?>">
<input type="hidden" name="password" value="<?php echo $password;?>">
<input type="hidden" name="repo" value="">
</form>
<iframe id="repo" class="repoFrame" frameborder="0"></iframe>
</body>
</html>

View File

@@ -0,0 +1,5 @@
// This code was written by Tyler Akins and has been placed in the
// public domain. It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
var Base64=function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t={encode:function(t){var n="",r,i,s,o,u,a,f,l=0;do r=t.charCodeAt(l++),i=t.charCodeAt(l++),s=t.charCodeAt(l++),o=r>>2,u=(r&3)<<4|i>>4,a=(i&15)<<2|s>>6,f=s&63,isNaN(i)?a=f=64:isNaN(s)&&(f=64),n=n+e.charAt(o)+e.charAt(u)+e.charAt(a)+e.charAt(f);while(l<t.length);return n},decode:function(t){var n="",r,i,s,o,u,a,f,l=0;t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");do o=e.indexOf(t.charAt(l++)),u=e.indexOf(t.charAt(l++)),a=e.indexOf(t.charAt(l++)),f=e.indexOf(t.charAt(l++)),r=o<<2|u>>4,i=(u&15)<<4|a>>2,s=(a&3)<<6|f,n+=String.fromCharCode(r),a!=64&&(n+=String.fromCharCode(i)),f!=64&&(n+=String.fromCharCode(s));while(l<t.length);return n}};return t}();window.Base64=Base64

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
// This file contains the HTTP Req Abs, Repo API and getRepo
// portions of Top Level API from github.com/michael/github.js
// ORIGINAL LIB:
// Github.js 0.7.0
// (c) 2012 Michael Aufreiter, Development Seed
// Github.js is freely distributable under the MIT license.
// For all details and documentation:
// http://substance.io/michael/github
(function(){var e,t="https://api.github.com";e=window.Github=function(n){function r(e,r,i,s,o){function u(){var e=t+r;return e+(/\?/.test(e)?"&":"?")+(new Date).getTime()}var a=new XMLHttpRequest;o||(a.dataType="json"),a.open(e,u()),a.onreadystatechange=function(){this.readyState==4&&(this.status>=200&&this.status<300||this.status===304?s(null,o?this.responseText:this.responseText?JSON.parse(this.responseText):!0):s({request:this,error:this.status}))},a.setRequestHeader("Accept","application/vnd.github.raw"),a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),(n.auth=="oauth"&&n.token||n.auth=="basic"&&n.username&&n.password)&&a.setRequestHeader("Authorization",n.auth=="oauth"?"token "+n.token:"Basic "+Base64.encode(n.username+":"+n.password)),i?a.send(JSON.stringify(i)):a.send()}e.Repository=function(e){function u(e,t){if(e===o.branch&&o.sha)return t(null,o.sha);i.getRef("heads/"+e,function(n,r){o.branch=e,o.sha=r,t(n,r)})}var t=e.name,n=e.user,i=this,s="/repos/"+n+"/"+t,o={branch:null,sha:null};this.getRef=function(e,t){r("GET",s+"/git/refs/"+e,null,function(e,n){if(e)return t(e);t(null,n.object.sha)})},this.createRef=function(e,t){r("POST",s+"/git/refs",e,t)},this.deleteRef=function(t,n){r("DELETE",s+"/git/refs/"+t,e,n)},this.listBranches=function(e){r("GET",s+"/git/refs/heads",null,function(t,n){if(t)return e(t);e(null,_.map(n,function(e){return _.last(e.ref.split("/"))}))})},this.getBlob=function(e,t){r("GET",s+"/git/blobs/"+e,null,t,"raw")},this.getSha=function(e,t,n){if(t==="")return i.getRef("heads/"+e,n);i.getTree(e+"?recursive=true",function(e,r){var i=_.select(r,function(e){return e.path===t})[0];n(null,i?i.sha:null)})},this.getTree=function(e,t){r("GET",s+"/git/trees/"+e,null,function(e,n){if(e)return t(e);t(null,n.tree)})},this.postBlob=function(e,t){typeof e=="string"&&(e={content:e,encoding:"utf-8"}),r("POST",s+"/git/blobs",e,function(e,n){if(e)return t(e);t(null,n.sha)})},this.updateTree=function(e,t,n,i){var o={base_tree:e,tree:[{path:t,mode:"100644",type:"blob",sha:n}]};r("POST",s+"/git/trees",o,function(e,t){if(e)return i(e);i(null,t.sha)})},this.postTree=function(e,t){r("POST",s+"/git/trees",{tree:e},function(e,n){if(e)return t(e);t(null,n.sha)})},this.commit=function(t,n,i,u){var a={message:i,author:{name:e.username},parents:[t],tree:n};r("POST",s+"/git/commits",a,function(e,t){o.sha=t.sha;if(e)return u(e);u(null,t.sha)})},this.updateHead=function(e,t,n){r("PATCH",s+"/git/refs/heads/"+e,{sha:t},function(e,t){n(e)})},this.show=function(e){r("GET",s,null,e)},this.contents=function(e,t){r("GET",s+"/contents",{path:e},t)},this.fork=function(e){r("POST",s+"/forks",null,e)},this.createPullRequest=function(e,t){r("POST",s+"/pulls",e,t)},this.read=function(e,t,n){i.getSha(e,t,function(e,t){if(!t)return n("not found",null);i.getBlob(t,function(e,r){n(e,r,t)})})},this.remove=function(e,t,n){u(e,function(r,s){i.getTree(s+"?recursive=true",function(r,o){var u=_.reject(o,function(e){return e.path===t});_.each(u,function(e){e.type==="tree"&&delete e.sha}),i.postTree(u,function(r,o){i.commit(s,o,"Deleted "+t,function(t,r){i.updateHead(e,r,function(e){n(e)})})})})})},this.move=function(e,t,n,r){u(e,function(s,o){i.getTree(o+"?recursive=true",function(s,u){_.each(u,function(e){e.path===t&&(e.path=n),e.type==="tree"&&delete e.sha}),i.postTree(u,function(n,s){i.commit(o,s,"Deleted "+t,function(t,n){i.updateHead(e,n,function(e){r(e)})})})})})},this.write=function(e,t,n,r,s){u(e,function(o,u){if(o)return s(o);i.postBlob(n,function(n,o){if(n)return s(n);i.updateTree(u,t,o,function(t,n){if(t)return s(t);i.commit(u,n,r,function(t,n){if(t)return s(t);i.updateHead(e,n,s)})})})})}},e.Gist=function(e){var t=e.id,n=this,i="/gists/"+t;this.read=function(e){r("GET",i,null,function(t,n){e(t,n)})},this.delete=function(e){r("DELETE",i,null,function(t,n){e(t,n)})},this.fork=function(e){r("POST",i+"/fork",null,function(t,n){e(t,n)})},this.update=function(e,t){r("PATCH",i,e,function(e,n){t(e,n)})}},this.getRepo=function(t,n){return new e.Repository({user:t,name:n})}}}).call(this)

12
plugins/ice-repo/lib/underscore-min.js vendored Normal file
View File

@@ -0,0 +1,12 @@
// This file contains the select, reject, forEach and has functions
// from underscore.js, then minified to make it extra tiny
// Underscore.js 1.3.3
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function(){var e=this,t=Array.prototype,n=Object.prototype,r=t.forEach,i=t.filter,s=n.hasOwnProperty,o={};_=function(obj) {return new wrapper(obj);};_.filter=_.select=function(e,t,n){var r=[];return e==null?r:i&&e.filter===i?e.filter(t,n):(u(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},_.reject=function(e,t,n){var r=[];return e==null?r:(u(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)};var u=_.each=_.forEach=function(e,t,n){if(e==null)return;if(r&&e.forEach===r)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===o)return}else for(var u in e)if(_.has(e,u)&&t.call(n,e[u],u,e)===o)return};_.has=function(e,t){return s.call(e,t)}}).call(this)

BIN
plugins/jshint/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

4832
plugins/jshint/jshint.js Normal file

File diff suppressed because it is too large Load Diff

BIN
plugins/jsregex/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

BIN
plugins/terminal/icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

201
plugins/terminal/index.php Normal file
View File

@@ -0,0 +1,201 @@
<?php
include("../../lib/settings.php");
if ($demoMode || !$_SESSION['loggedIn']) {
die("You must be logged in to access Terminal");
}
error_reporting(E_ALL);
@session_start();
if (isset($_SERVER['PHP_AUTH_USER'])) {
$_SESSION['user'] = $_SERVER['PHP_AUTH_USER'];
$_SESSION['pass'] = generateHash(strClean($_SERVER['PHP_AUTH_PW']),$ICEcoder["accountPassword"]);
}
$passwd = array($_SESSION['user'] => $ICEcoder["accountPassword"]);
$aliases = array('la' => 'ls -la',
'll' => 'ls -lvhF',
'dir' => 'ls' );
class phpTerm {
function phpTerm() {} // constructor
function formatPrompt() {
$user=shell_exec("whoami");
$host=explode(".", shell_exec("uname -n"));
$_SESSION['prompt'] = "".rtrim($user).""."@"."".rtrim($host[0])."";
}
function checkPassword($passwd) {
if( !isset($_SERVER['PHP_AUTH_USER'])||
!isset($_SERVER['PHP_AUTH_PW']) ||
!isset($passwd[$_SERVER['PHP_AUTH_USER']]) ||
$passwd[$_SERVER['PHP_AUTH_USER']] != $_SESSION['pass']) {
return false;
} else {
return true;
}
}
function logout() {
header('WWW-Authenticate: Basic realm="Terminal"');
header('HTTP/1.0 401 Unauthorized');
exit();
}
function initVars() {
if (empty($_SESSION['cwd']) || @!empty($_GET['reset'])) {
$_SESSION['cwd'] = getcwd();
$_SESSION['history'] = array();
$_SESSION['output'] = '';
$_REQUEST['command'] ='';
}
}
function buildCommandHistory() {
if(!empty($_REQUEST['command'])) {
if(get_magic_quotes_gpc()) {
$_REQUEST['command'] = stripslashes($_REQUEST['command']);
}
// drop old commands from list if exists
if (($i = array_search($_REQUEST['command'], $_SESSION['history'])) !== false) {
unset($_SESSION['history'][$i]);
}
array_unshift($_SESSION['history'], $_REQUEST['command']);
// append commmand */
$_SESSION['output'] .= "{$_SESSION['prompt']}".":>"."{$_REQUEST['command']}"."\n";
}
}
function buildJavaHistory() {
// build command history for use in the JavaScript
if (empty($_SESSION['history'])) {
$_SESSION['js_command_hist'] = '""';
} else {
$escaped = array_map('addslashes', $_SESSION['history']);
$_SESSION['js_command_hist'] = '"", "' . implode('", "', $escaped) . '"';
}
}
function outputHandle($aliases) {
if (preg_match('/^[[:blank:]]*cd[[:blank:]]*$/', @$_REQUEST['command']))
{
$_SESSION['cwd'] = getcwd(); //dirname(__FILE__);
}
elseif(preg_match('/^[[:blank:]]*cd[[:blank:]]+([^;]+)$/', @$_REQUEST['command'], $regs)) {
// The current command is 'cd', which we have to handle as an internal shell command.
// absolute/relative path ?"
($regs[1][0] == '/') ? $new_dir = $regs[1] : $new_dir = $_SESSION['cwd'] . '/' . $regs[1];
// cosmetics
while (strpos($new_dir, '/./') !== false) {
$new_dir = str_replace('/./', '/', $new_dir);
}
while (strpos($new_dir, '//') !== false) {
$new_dir = str_replace('//', '/', $new_dir);
}
while (preg_match('|/\.\.(?!\.)|', $new_dir)) {
$new_dir = preg_replace('|/?[^/]+/\.\.(?!\.)|', '', $new_dir);
}
if(empty($new_dir)): $new_dir = "/"; endif;
(@chdir($new_dir)) ? $_SESSION['cwd'] = $new_dir : $_SESSION['output'] .= "could not change to: $new_dir\n";
} else {
/* The command is not a 'cd' command, so we execute it after
changing the directory and save the output. */
chdir($_SESSION['cwd']);
/* Alias expansion. */
$length = strcspn(@$_REQUEST['command'], " \t");
$token = substr(@$_REQUEST['command'], 0, $length);
if (isset($aliases[$token]))
$_REQUEST['command'] = $aliases[$token] . substr($_REQUEST['command'], $length);
$p = proc_open(@$_REQUEST['command'],
array(1 => array('pipe', 'w'),
2 => array('pipe', 'w')), $io);
/* Read output sent to stdout. */
while (!feof($io[1])) {
$_SESSION['output'] .= htmlspecialchars(fgets($io[1]),ENT_COMPAT, 'UTF-8');
}
/* Read output sent to stderr. */
while (!feof($io[2])) {
$_SESSION['output'] .= htmlspecialchars(fgets($io[2]),ENT_COMPAT, 'UTF-8');
}
fclose($io[1]);
fclose($io[2]);
proc_close($p);
}
}
}
$terminal = new phpTerm;
if ($_REQUEST['command']=="logout") {
$terminal->logout();
}
if(!$terminal->checkPassword($passwd)) {
header('WWW-Authenticate: Basic realm="Terminal"');
header('HTTP/1.0 401 Unauthorized');
} else {
$terminal->initVars();
$terminal->buildCommandHistory();
$terminal->buildJavaHistory();
if(!isset($_SESSION['prompt'])):$terminal->formatPrompt(); endif;
$terminal->outputHandle($aliases);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHP Terminal</title>
<link rel="stylesheet" type="text/css" href="terminal.css" />
<script type="text/javascript" language="JavaScript">
var current_line = 0;
var command_hist = new Array(<?php echo $_SESSION['js_command_hist']; ?>);
var last = 0;
function key(e) {
if (!e) var e = window.event;
if (e.keyCode == 38 && current_line < command_hist.length-1) {
command_hist[current_line] = document.shell.command.value;
current_line++;
document.shell.command.value = command_hist[current_line];
}
if (e.keyCode == 40 && current_line > 0) {
command_hist[current_line] = document.shell.command.value;
current_line--;
document.shell.command.value = command_hist[current_line];
}
}
function init() {
document.shell.setAttribute("autocomplete", "off");
document.shell.output.scrollTop = document.shell.output.scrollHeight;
document.shell.command.focus();
}
</script>
</head>
<body onload="init()">
<div class="head"><?php echo $_SESSION['prompt'].":"."$_SESSION[cwd]"; ?></div>
<form name="shell" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<textarea name="output" readonly="readonly" rows="24"><?php
$lines = substr_count($_SESSION['output'], "\n");
$padding = str_repeat("\n", max(0, 25 - $lines));
echo "\n\n".trim($padding . $_SESSION['output'])."\n";
?>
</textarea>
<p class="commandLine">$&gt; <input class="command" name="command" type="text" size='50' onkeyup="key(event)" tabindex="1"></p>
</form>
</body>
</html>
<?php } ?>

View File

@@ -0,0 +1,28 @@
/* First, reset everything to a standard */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, input, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
font-family: verdana, arial, monospace, sans-serif;
border: 0;
margin: 0;
padding: 0;
outline: 0;
font-size: 12px;
vertical-align: top;
}
html, body {width: 100%; height: 100%; background: #000}
.head {position: fixed; top: 0; padding: 2px; background: rgba(124,124,124,0.8); color: #fff; font-weight: bold; z-index: 1}
textarea {position: absolute; display: block; top: 0; padding: 0; width: 100%; height: 100%; min-height: 100%; border: 0; background: #000; color: #0c0}
textarea:focus {outline: none}
p {color: #0c0}
.commandLine {position: fixed; width: 100%; bottom: 0; padding: 2px; background: rgba(32,32,32,0.9); z-index: 1}
.command {width: 95%; font-family: verdana, arial, monospace, sans-serif; border: none; background: transparent; color: #0c0}
.command:focus {outline: none}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More