Compare commits
403 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb30cb0cb6 | ||
|
|
b211fae85c | ||
|
|
93b4774903 | ||
|
|
236b55fce6 | ||
|
|
c34bf50c39 | ||
|
|
b8f921dab2 | ||
|
|
fc79be3010 | ||
|
|
63d08eeed2 | ||
|
|
7fa39f645d | ||
|
|
535677fc8e | ||
|
|
2dfff50031 | ||
|
|
c335b6b7fb | ||
|
|
a81c4c7a75 | ||
|
|
e2ada5e6b2 | ||
|
|
43ae4ac317 | ||
|
|
5f0ee6d95e | ||
|
|
0947172391 | ||
|
|
0fb9680f72 | ||
|
|
ba94a3bba0 | ||
|
|
11963e263d | ||
|
|
3f15cb8fff | ||
|
|
eca4f8e06d | ||
|
|
358be2ee92 | ||
|
|
acd8f949e7 | ||
|
|
a1574af5e0 | ||
|
|
525e73e179 | ||
|
|
abe1745642 | ||
|
|
eda925e617 | ||
|
|
5ab3f7ba16 | ||
|
|
cb12bdad2d | ||
|
|
2a6c2fc273 | ||
|
|
216c04b3f1 | ||
|
|
0ecb6ea1aa | ||
|
|
f3fff8543d | ||
|
|
2d75b57195 | ||
|
|
7ebd73916e | ||
|
|
cafa9d521a | ||
|
|
a5b395d888 | ||
|
|
c214640bb1 | ||
|
|
d7a8b35ded | ||
|
|
bcc86e160f | ||
|
|
5b14389c6e | ||
|
|
0ba4803154 | ||
|
|
e58f9cae28 | ||
|
|
1d5c049c01 | ||
|
|
0d01b4a2ea | ||
|
|
d43a758a37 | ||
|
|
d886372f11 | ||
|
|
838d44bd5c | ||
|
|
8f997eb4f3 | ||
|
|
65b3fc56ef | ||
|
|
6e061cbc30 | ||
|
|
9e44b76214 | ||
|
|
d1e928e068 | ||
|
|
2c2249d96b | ||
|
|
d87e932030 | ||
|
|
44cac8a7e1 | ||
|
|
736d3c8744 | ||
|
|
3104065437 | ||
|
|
444695a908 | ||
|
|
eba6f4eaf2 | ||
|
|
e3b4f0b159 | ||
|
|
5c55939765 | ||
|
|
bd69d00182 | ||
|
|
7312789e12 | ||
|
|
4e765e64ca | ||
|
|
660f86018a | ||
|
|
b5050acba0 | ||
|
|
2fa780236b | ||
|
|
831770e7d8 | ||
|
|
c50102e153 | ||
|
|
54088daa67 | ||
|
|
169312f021 | ||
|
|
62ab717772 | ||
|
|
6273bcdd3f | ||
|
|
5b894794dd | ||
|
|
b31c41fdda | ||
|
|
2c6bcacb25 | ||
|
|
ed9b9881b6 | ||
|
|
2d2945cc5c | ||
|
|
3b1a1fbbe2 | ||
|
|
be2f15f77b | ||
|
|
3c4872c231 | ||
|
|
8c605674f3 | ||
|
|
c1549faca1 | ||
|
|
f4b98cd4ff | ||
|
|
cbeac572f5 | ||
|
|
f94371f16c | ||
|
|
7111a2aee3 | ||
|
|
cc82304996 | ||
|
|
3d91b8ab13 | ||
|
|
9a4ae52df0 | ||
|
|
466b6bb1dd | ||
|
|
facf511621 | ||
|
|
c4cada924e | ||
|
|
99b8a02c0e | ||
|
|
b74ed1490a | ||
|
|
02f64e318d | ||
|
|
2938014b33 | ||
|
|
45040555f0 | ||
|
|
591ec57c49 | ||
|
|
d5626ab7df | ||
|
|
2a25efba1a | ||
|
|
9197d24fff | ||
|
|
9fa87c5141 | ||
|
|
dddf2e9ea1 | ||
|
|
69ea8838cd | ||
|
|
33ea31f1fa | ||
|
|
e2adcabc5b | ||
|
|
a33ded4409 | ||
|
|
6161518d8b | ||
|
|
bf40cb2009 | ||
|
|
12f8315a84 | ||
|
|
0f460483f3 | ||
|
|
bf22cd1638 | ||
|
|
e656c89ba1 | ||
|
|
b8416ed4c1 | ||
|
|
62b8e18c9e | ||
|
|
1e09ccbc0c | ||
|
|
76717f6141 | ||
|
|
33308688aa | ||
|
|
df481aaf07 | ||
|
|
82190b330b | ||
|
|
19d8103806 | ||
|
|
30b6120582 | ||
|
|
b7aa8bd56c | ||
|
|
4aad818888 | ||
|
|
68a51af239 | ||
|
|
80d64ae4e0 | ||
|
|
cd295e2315 | ||
|
|
80bdd6761b | ||
|
|
bf0798d397 | ||
|
|
e130a87e81 | ||
|
|
34e22c63a0 | ||
|
|
70db2a15f4 | ||
|
|
aaa7be7bff | ||
|
|
000fda848b | ||
|
|
c0f0595ad7 | ||
|
|
62ad6dde67 | ||
|
|
8750fe7a43 | ||
|
|
b0f0bb10ec | ||
|
|
e05f276b6a | ||
|
|
a075934168 | ||
|
|
5898ebb5f0 | ||
|
|
d122c83535 | ||
|
|
2025e8f10b | ||
|
|
3339a63268 | ||
|
|
3d2eef2a69 | ||
|
|
aa9f1074bd | ||
|
|
545ba36db4 | ||
|
|
53b8979861 | ||
|
|
0569a4b633 | ||
|
|
cc306475b2 | ||
|
|
3f0982dd7c | ||
|
|
017ef727ab | ||
|
|
1f1635ede3 | ||
|
|
f2f2e780b0 | ||
|
|
f32e7df86a | ||
|
|
030e219cbd | ||
|
|
111e8c82c4 | ||
|
|
d0aad8589d | ||
|
|
c7eb890ffe | ||
|
|
47a9bde70b | ||
|
|
7abadcc6c3 | ||
|
|
8a52bcfec2 | ||
|
|
81770d2182 | ||
|
|
0ed030fae3 | ||
|
|
a8dd0632f2 | ||
|
|
04f7e84642 | ||
|
|
efda17ecfa | ||
|
|
11c9bf39ff | ||
|
|
c41cfe5ae2 | ||
|
|
61c6270edd | ||
|
|
1fe5e6ad8e | ||
|
|
8c7fbcd7d4 | ||
|
|
6746fdb98e | ||
|
|
4cf48bb50f | ||
|
|
80a4e54802 | ||
|
|
c19a958629 | ||
|
|
9b969087a5 | ||
|
|
121de8090f | ||
|
|
ae18a10fd8 | ||
|
|
05b0ef75c9 | ||
|
|
8dfad0aa5d | ||
|
|
b07f2e9633 | ||
|
|
6ecc435b85 | ||
|
|
a0a70495f0 | ||
|
|
29981dfd52 | ||
|
|
86735ac3b7 | ||
|
|
e5a1a10101 | ||
|
|
f362a83cfa | ||
|
|
df902fb08e | ||
|
|
29de36f348 | ||
|
|
92e7603aa5 | ||
|
|
e3431f201c | ||
|
|
5c7a6bbf8f | ||
|
|
d6a82d1962 | ||
|
|
a7a5ada4d9 | ||
|
|
6ff50cb42d | ||
|
|
7ffc89f41b | ||
|
|
8c1131442b | ||
|
|
c49acc9084 | ||
|
|
f03cfcb0e3 | ||
|
|
460d7c5aea | ||
|
|
50fd681420 | ||
|
|
70c8ca3a55 | ||
|
|
1234f789a4 | ||
|
|
25fd009be3 | ||
|
|
9ffab47f83 | ||
|
|
38c46f3d5c | ||
|
|
3a0c33c5cf | ||
|
|
5d6b057361 | ||
|
|
8fcbdc8ea0 | ||
|
|
a774f9052d | ||
|
|
2d79b5a988 | ||
|
|
86ae5e14b4 | ||
|
|
8153d4a139 | ||
|
|
3e80d86628 | ||
|
|
a097330772 | ||
|
|
5545743bd8 | ||
|
|
ccd212f839 | ||
|
|
5697625a7d | ||
|
|
3d54005332 | ||
|
|
a5894dfae8 | ||
|
|
b3aa6e37b9 | ||
|
|
e4e7661a3d | ||
|
|
9fe38ad649 | ||
|
|
a8a03a831a | ||
|
|
0df4db9286 | ||
|
|
e4599e3076 | ||
|
|
1a0d8933dc | ||
|
|
00af30281c | ||
|
|
8c85b3098d | ||
|
|
000607f8e0 | ||
|
|
82e3698dd2 | ||
|
|
0dd9535a5b | ||
|
|
088b3f60ea | ||
|
|
c118159121 | ||
|
|
5fad745220 | ||
|
|
02b41bfbdc | ||
|
|
82ab3faca3 | ||
|
|
df74757e83 | ||
|
|
a21772f3c2 | ||
|
|
cbd930a340 | ||
|
|
9f129c9781 | ||
|
|
18931e94b0 | ||
|
|
1520828dff | ||
|
|
43223d1677 | ||
|
|
3fb9836fc8 | ||
|
|
8cd5a10ea8 | ||
|
|
da1850896b | ||
|
|
336ef01dee | ||
|
|
246bf189b5 | ||
|
|
825effadd9 | ||
|
|
51f53855f8 | ||
|
|
65fa29fbb8 | ||
|
|
5bcfa06e19 | ||
|
|
b01218958f | ||
|
|
7887f0e7a1 | ||
|
|
f522502938 | ||
|
|
c7f533cf0a | ||
|
|
a3107de33e | ||
|
|
e69a3249e5 | ||
|
|
f3c24f05e0 | ||
|
|
20364bb1d7 | ||
|
|
3d1c92dae4 | ||
|
|
4048895c6b | ||
|
|
991908bd8d | ||
|
|
8ff559dbef | ||
|
|
d7d483ef9c | ||
|
|
b11064e3a8 | ||
|
|
409d35b29b | ||
|
|
811cf40cd7 | ||
|
|
3aa9d23ac6 | ||
|
|
9c8bb08454 | ||
|
|
2c28af0dd7 | ||
|
|
cc6bd40b15 | ||
|
|
5221ba0959 | ||
|
|
61f132327d | ||
|
|
826730e88b | ||
|
|
5cdb08c35f | ||
|
|
9806d3705a | ||
|
|
55e6e66df6 | ||
|
|
0d38b23a60 | ||
|
|
07fd0ab6bf | ||
|
|
6036b0635d | ||
|
|
74f678076a | ||
|
|
ef157d71f2 | ||
|
|
0b718e0fbf | ||
|
|
809af86c16 | ||
|
|
449e8e2c4a | ||
|
|
01c8a10463 | ||
|
|
27da7ed0fe | ||
|
|
685116c555 | ||
|
|
0c4741c793 | ||
|
|
4da7024f91 | ||
|
|
b49a2cc52d | ||
|
|
c0fe50cd2f | ||
|
|
497efaabf0 | ||
|
|
2ee777739f | ||
|
|
deb3ad5359 | ||
|
|
3f1801ef2b | ||
|
|
ca8e92e443 | ||
|
|
c514e4a1ad | ||
|
|
ec28de40c9 | ||
|
|
14053fbfdd | ||
|
|
464030808c | ||
|
|
d2377bff34 | ||
|
|
d3f378f6bd | ||
|
|
09e1562fbc | ||
|
|
4e14ac6d9b | ||
|
|
97882f0c60 | ||
|
|
482a5cfb11 | ||
|
|
f73dee1103 | ||
|
|
9034e1ad45 | ||
|
|
7e35481b62 | ||
|
|
2f87f2adc3 | ||
|
|
6b345ac041 | ||
|
|
19e18f6a10 | ||
|
|
f181cef9e9 | ||
|
|
dd19c39cf8 | ||
|
|
5887a9c755 | ||
|
|
ca35084160 | ||
|
|
644eee0aca | ||
|
|
510a0c1087 | ||
|
|
4afbe4c2fc | ||
|
|
6cf36cc99c | ||
|
|
b98127e83a | ||
|
|
f7f195f083 | ||
|
|
22e6228a08 | ||
|
|
b757e42c88 | ||
|
|
fdf1ef1cb7 | ||
|
|
4797ff84d8 | ||
|
|
3937d733f0 | ||
|
|
0328643c7c | ||
|
|
80c73523e3 | ||
|
|
8c5747798d | ||
|
|
bdf6dbd096 | ||
|
|
0eaef469f9 | ||
|
|
f2d3615e26 | ||
|
|
24f05a1c03 | ||
|
|
570642d820 | ||
|
|
fd794f99d2 | ||
|
|
9a95bae6ba | ||
|
|
1b04504617 | ||
|
|
2a2cd81149 | ||
|
|
2bb961b7a8 | ||
|
|
01b035d7af | ||
|
|
8d0de398fd | ||
|
|
2ebec54476 | ||
|
|
b66d5fe8d3 | ||
|
|
0f989f249f | ||
|
|
6980bdcf7f | ||
|
|
975a016974 | ||
|
|
4be1b45896 | ||
|
|
8e10824189 | ||
|
|
1a881b4eaf | ||
|
|
2a9e91dd55 | ||
|
|
725ea8999a | ||
|
|
3427b736ec | ||
|
|
1dde9d0198 | ||
|
|
7577c3552d | ||
|
|
30de655fb2 | ||
|
|
09cf5589f5 | ||
|
|
b206f8ab78 | ||
|
|
f358cdea5b | ||
|
|
14fe45bda8 | ||
|
|
72ff461b45 | ||
|
|
96fe7d46ba | ||
|
|
d40cdeb65e | ||
|
|
4130df7bf9 | ||
|
|
6e176cdda7 | ||
|
|
bdb171dc6d | ||
|
|
801471a105 | ||
|
|
f86cb53bd9 | ||
|
|
435e1b3b4b | ||
|
|
4b17d76144 | ||
|
|
d96ebe4282 | ||
|
|
e5c5e7dc5e | ||
|
|
fe593dcb09 | ||
|
|
b1056a19a3 | ||
|
|
048c47f7f3 | ||
|
|
a4bb1605ce | ||
|
|
c4d24c0a4c | ||
|
|
99dedb61cb | ||
|
|
702c3d069f | ||
|
|
8ec8efe967 | ||
|
|
4aa0260399 | ||
|
|
f24aaf1396 | ||
|
|
00ddd056af | ||
|
|
2438fbb13d | ||
|
|
20832c3dcc | ||
|
|
725461f04e | ||
|
|
a3edd7bdf9 | ||
|
|
8d9d330678 | ||
|
|
d46fa3012b | ||
|
|
75e9f916ec | ||
|
|
f71277008f | ||
|
|
184a9d223b | ||
|
|
b4c45e33e9 | ||
|
|
eea960bcbd | ||
|
|
609e4397db | ||
|
|
b8bfbc5f6a |
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
error-log.txt
|
||||
backups/*.zip
|
||||
lib/config.php
|
||||
@@ -1,173 +0,0 @@
|
||||
.CodeMirror {
|
||||
line-height: 1em;
|
||||
font-family: monospace;
|
||||
|
||||
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
|
||||
position: relative;
|
||||
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
/* Vertical scrollbar */
|
||||
.CodeMirror-scrollbar {
|
||||
position: absolute;
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
z-index: 5;
|
||||
}
|
||||
.CodeMirror-scrollbar-inner {
|
||||
/* This needs to have a nonzero width in order for the scrollbar to appear
|
||||
in Firefox and IE9. */
|
||||
width: 1px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-overlap {
|
||||
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
|
||||
rather than sitting to the right of it. */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
float: none;
|
||||
right: 0;
|
||||
min-width: 12px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-nonoverlap {
|
||||
min-width: 12px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-ie7 {
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
.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;
|
||||
cursor: default;
|
||||
}
|
||||
.CodeMirror-lines {
|
||||
padding: .4em;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.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: #997;}
|
||||
.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;}
|
||||
|
||||
span.cm-invalidchar {color: #f00;}
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
|
||||
@media print {
|
||||
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror pre.CodeMirror-cursor {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
38
CodeMirror-3.12/addon/hint/show-hint.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.CodeMirror-hints {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
overflow: hidden;
|
||||
list-style: none;
|
||||
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
|
||||
-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);
|
||||
border-radius: 3px;
|
||||
border: 1px solid silver;
|
||||
|
||||
background: white;
|
||||
font-size: 90%;
|
||||
font-family: monospace;
|
||||
|
||||
max-height: 20em;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.CodeMirror-hint {
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
border-radius: 2px;
|
||||
max-width: 19em;
|
||||
overflow: hidden;
|
||||
white-space: pre;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.CodeMirror-hint-active {
|
||||
background: #08f;
|
||||
color: white;
|
||||
}
|
||||
7
CodeMirror-3.12/lib/codemirror-compressed.js
Normal file
246
CodeMirror-3.12/lib/codemirror.css
Normal file
@@ -0,0 +1,246 @@
|
||||
/* 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;
|
||||
z-index: 3;
|
||||
}
|
||||
/* 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: #7e7;
|
||||
z-index: 1;
|
||||
}
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
|
||||
|
||||
.cm-tab { display: inline-block; }
|
||||
|
||||
/* 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-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;
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
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%;
|
||||
padding-bottom: 30px;
|
||||
margin-bottom: -32px;
|
||||
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; 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;
|
||||
}
|
||||
}
|
||||
75
CodeMirror-3.12/theme/ambiance.css
Normal 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; }
|
||||
@@ -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; }
|
||||
@@ -20,6 +20,6 @@
|
||||
.cm-s-eclipse span.cm-link {color: #219;}
|
||||
|
||||
.cm-s-eclipse .CodeMirror-matchingbracket {
|
||||
border:1px solid grey;
|
||||
color:black !important;;
|
||||
outline:1px solid grey;
|
||||
color:black !important;
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
.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; }
|
||||
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
|
||||
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
|
||||
.cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; }
|
||||
.cm-s-erlang-dark span.cm-comment { color: #7777ff; }
|
||||
.cm-s-erlang-dark span.cm-def { color: #ee77aa; }
|
||||
.cm-s-erlang-dark span.cm-builtin { color: #eaa; }
|
||||
.cm-s-erlang-dark span.cm-comment { color: #77f; }
|
||||
.cm-s-erlang-dark span.cm-def { color: #e7a; }
|
||||
.cm-s-erlang-dark span.cm-error { color: #9d1e15; }
|
||||
.cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
|
||||
.cm-s-erlang-dark span.cm-meta { color: #50fefe; }
|
||||
.cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
|
||||
.cm-s-erlang-dark span.cm-operator { color: #dd1111; }
|
||||
.cm-s-erlang-dark span.cm-operator { color: #d11; }
|
||||
.cm-s-erlang-dark span.cm-string { color: #3ad900; }
|
||||
.cm-s-erlang-dark span.cm-tag { color: #9effff; }
|
||||
.cm-s-erlang-dark span.cm-variable { color: #50fe50; }
|
||||
.cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
|
||||
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
|
||||
@@ -9,15 +9,15 @@ Ported to CodeMirror by Peter Kroon
|
||||
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
|
||||
}
|
||||
|
||||
.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; }
|
||||
52
CodeMirror-3.12/theme/midnight.css
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
|
||||
|
||||
/*<!--breakpoint-->*/
|
||||
.breakpoints {width: .8em;}
|
||||
.breakpoint { color: #822; }
|
||||
|
||||
/*<!--match-->*/
|
||||
span.CodeMirror-matchhighlight { background: #494949 }
|
||||
.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67; !important }
|
||||
|
||||
/*<!--activeline-->*/
|
||||
.activeline {background: #253540 !important;}
|
||||
|
||||
.cm-s-midnight.CodeMirror {
|
||||
background: #0F192A;
|
||||
color: #D1EDFF;
|
||||
}
|
||||
|
||||
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||
|
||||
.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
|
||||
.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
|
||||
.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;}
|
||||
.cm-s-midnight .CodeMirror-cursor {
|
||||
border-left: 1px solid #F8F8F0 !important;
|
||||
}
|
||||
|
||||
.cm-s-midnight span.cm-comment {color: #428BDD;}
|
||||
.cm-s-midnight span.cm-atom {color: #AE81FF;}
|
||||
.cm-s-midnight span.cm-number {color: #D1EDFF;}
|
||||
|
||||
.cm-s-midnight span.cm-property, .cm-s-tropicaleve span.cm-attribute {color: #A6E22E;}
|
||||
.cm-s-midnight span.cm-keyword {color: #E83737;}
|
||||
.cm-s-midnight span.cm-string {color: #1DC116;}
|
||||
|
||||
.cm-s-midnight span.cm-variable {color: #FFAA3E;}
|
||||
.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;}
|
||||
.cm-s-midnight span.cm-def {color: #4DD;}
|
||||
.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;}
|
||||
.cm-s-midnight span.cm-bracket {color: #D1EDFF;}
|
||||
.cm-s-midnight span.cm-tag {color: #008;}
|
||||
.cm-s-midnight span.cm-link {color: #AE81FF;}
|
||||
|
||||
.cm-s-midnight .CodeMirror-matchingbracket {
|
||||
text-decoration: underline;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.typ { color: #FFAA3E; }
|
||||
.atn { color: #606; }
|
||||
.atv { color: #080; }
|
||||
.dec { color: #606; }
|
||||
@@ -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;}
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Loosely based on the Midnight Textmate theme */
|
||||
|
||||
.cm-s-night { background: #0a001f; color: #f8f8f8; }
|
||||
.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||
.cm-s-night div.CodeMirror-selected { background: #447 !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-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; }
|
||||
@@ -1,9 +1,9 @@
|
||||
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
||||
.cm-s-rubyblue { font-family: 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; }
|
||||
207
CodeMirror-3.12/theme/solarized.css
Normal file
26
CodeMirror-3.12/theme/twilight.css
Normal 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; } /**/
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Taken from the popular Visual Studio Vibrant Ink Schema */
|
||||
|
||||
.cm-s-vibrant-ink { background: black; color: white; }
|
||||
.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
|
||||
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
|
||||
|
||||
.cm-s-vibrant-ink .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
|
||||
.cm-s-vibrant-ink .CodeMirror-gutter-text { color: #d0d0d0; }
|
||||
.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; }
|
||||
46
CodeMirror-3.12/theme/xq-dark.css
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2011 by MarkLogic Corporation
|
||||
Author: Mike Brevoort <mike@brevoort.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
|
||||
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.
|
||||
*/
|
||||
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
||||
.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;}
|
||||
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
|
||||
.cm-s-xq-dark span.cm-number {color: #164;}
|
||||
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
|
||||
.cm-s-xq-dark span.cm-variable {color: #FFF;}
|
||||
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
|
||||
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
|
||||
.cm-s-xq-dark span.cm-property {}
|
||||
.cm-s-xq-dark span.cm-operator {}
|
||||
.cm-s-xq-dark span.cm-comment {color: gray;}
|
||||
.cm-s-xq-dark span.cm-string {color: #9FEE00;}
|
||||
.cm-s-xq-dark span.cm-meta {color: yellow;}
|
||||
.cm-s-xq-dark span.cm-error {color: #f00;}
|
||||
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
|
||||
.cm-s-xq-dark span.cm-builtin {color: #30a;}
|
||||
.cm-s-xq-dark span.cm-bracket {color: #cc7;}
|
||||
.cm-s-xq-dark span.cm-tag {color: #FFBD40;}
|
||||
.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
|
||||
43
CodeMirror-3.12/theme/xq-light.css
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2011 by MarkLogic Corporation
|
||||
Author: Mike Brevoort <mike@brevoort.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
|
||||
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.
|
||||
*/
|
||||
.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }
|
||||
.cm-s-xq-light span.cm-atom {color: #6C8CD5;}
|
||||
.cm-s-xq-light span.cm-number {color: #164;}
|
||||
.cm-s-xq-light span.cm-def {text-decoration:underline;}
|
||||
.cm-s-xq-light span.cm-variable {color: black; }
|
||||
.cm-s-xq-light span.cm-variable-2 {color:black;}
|
||||
.cm-s-xq-light span.cm-variable-3 {color: black; }
|
||||
.cm-s-xq-light span.cm-property {}
|
||||
.cm-s-xq-light span.cm-operator {}
|
||||
.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}
|
||||
.cm-s-xq-light span.cm-string {color: red;}
|
||||
.cm-s-xq-light span.cm-meta {color: yellow;}
|
||||
.cm-s-xq-light span.cm-error {color: #f00;}
|
||||
.cm-s-xq-light span.cm-qualifier {color: grey}
|
||||
.cm-s-xq-light span.cm-builtin {color: #7EA656;}
|
||||
.cm-s-xq-light span.cm-bracket {color: #cc7;}
|
||||
.cm-s-xq-light span.cm-tag {color: #3F7F7F;}
|
||||
.cm-s-xq-light span.cm-attribute {color: #7F007F;}
|
||||
|
||||
.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||
.cm-s-xq-light .CodeMirror-matchingbracket {border:1px solid grey;color:black !important;background:yellow;}
|
||||
@@ -1,7 +1,7 @@
|
||||
Copyright (C) 2012 Matt Pass
|
||||
Website: mattpass.com
|
||||
Email: matt@mattpass.com
|
||||
Twitter: @mattpass
|
||||
Copyright: © 2013 Matt Pass
|
||||
Website: mattpass.com
|
||||
Email: matt@mattpass.com
|
||||
Twitter: @mattpass
|
||||
|
||||
#ICEcoder License
|
||||
##Standard Open Source Initiative MIT License
|
||||
|
||||
31
README.md
@@ -1,13 +1,16 @@
|
||||
#ICEcoder
|
||||
##Web based IDE for smart web development
|
||||
##Web IDE / browser code editor awesomeness
|
||||
|
||||
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.
|
||||
ICEcoder is a web IDE / browser based code editor, which allows you to develop websites directly within the web browser. It 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/ice-coder-web-ide.jpg" alt="ICEcoder web IDE">
|
||||
<img src="http://icecoder.net/images/icecoder-v2-4-browser-code-editor.png" alt="ICEcoder web IDE">
|
||||
|
||||
###Requirements
|
||||
You can run ICEcoder either online or locally, on Linux, Windows or Mac based platforms. The only requirement is to have PHP 5 available (5.3 recommended). You can have this either as a vanilla installation or via a program such as WAMP or XAMPP (for Windows) or MAMP (for Mac).
|
||||
|
||||
###Features you'd expect
|
||||
* Context aware code highlighting
|
||||
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP & Ruby
|
||||
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
|
||||
* Smart tab key system (selected text indents line)
|
||||
* File manager
|
||||
* Find & replace/replace all
|
||||
@@ -31,13 +34,21 @@ Early version of the web based IDE which allows for creation of websites in the
|
||||
* Adds end tags as you type and in a context aware way
|
||||
* Can rename open files (whoaah!)
|
||||
* CTRL+Enter open current webpage in new tab
|
||||
* CTRL+S+Enter opens a sticky tab to show live edits
|
||||
* Window to view live edits
|
||||
* ESC = Comment/Uncomment line, incl partial lines
|
||||
* Image viewer
|
||||
* 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
|
||||
* Backs up files every 30 mins or on click of backup plugin icon
|
||||
* Github repo syncing with ICErepo plugin
|
||||
* Linux terminal
|
||||
* JS Hint validation as you type
|
||||
* Emmet snippet typing booster
|
||||
* HTML & JavaScript code hinting
|
||||
* Alphanumeric tab sorting
|
||||
* Tag wrappers
|
||||
* Config template
|
||||
* Farbtastic color picker integrated
|
||||
|
||||
###Installation
|
||||
|
||||
@@ -47,10 +58,10 @@ Early version of the web based IDE which allows for creation of websites in the
|
||||
$ git clone git@github:mattpass/ICEcoder
|
||||
```
|
||||
|
||||
####Step 2: Upload the files (Linux or Windows hosting OK)
|
||||
####Step 2: Place in your document root (online or local)
|
||||
```
|
||||
Upload to a new sub-dir URL such as yourdomain.com/_coder
|
||||
Set public write permissions on the backups folder and lib/config.php file
|
||||
Put in a new sub-dir URL such as yourdomain.com/_coder or localhost/_coder
|
||||
Set write permissions (757 or 775 depending on your system) on the 'backups', 'lib' and 'test' folders plus 'test/test-file1.txt'
|
||||
```
|
||||
|
||||
####Step 3: Start coding
|
||||
@@ -61,7 +72,7 @@ Now you're setup, auto-logged in and ready to code!
|
||||
|
||||
Suitable for commercial & non-commercial projects, just let me know if it's useful to you and any cool customisations you make to it. I take no responsibility for anything, your usage is all down to you.
|
||||
|
||||
Is fully open source and I'd encourage you to take it, make it your own and customise to your hearts content! :)
|
||||
It's fully open source and MIT licensed. I'm happy for you to take it, make it your own and customise to your hearts content and/or contribute to this main repo! :)
|
||||
|
||||
Plenty of comments included in the code to assist with understanding, customising etc.
|
||||
|
||||
|
||||
0
backups/.gitkeep
Normal file
@@ -1 +0,0 @@
|
||||
Zip It! backups are stored in this folder
|
||||
207
editor.php
@@ -1,37 +1,52 @@
|
||||
<?php include("lib/settings.php");?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html style="margin: 0" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'editor');top.ICEcoder.canResizeFilesW()}">
|
||||
<html style="margin: 0" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'editor');top.ICEcoder.canResizeFilesW()}">
|
||||
<head>
|
||||
<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/show-hint.css">
|
||||
<!--
|
||||
codemirror-compressed.js
|
||||
incls: codemirror.js
|
||||
modes: clike, coffeescript, css, javascript, less, php, ruby & xml
|
||||
utils: foldcode, searchcursor, match-highlighter
|
||||
incls: codemirror
|
||||
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, python, ruby & xml
|
||||
utils: closetag, foldcode, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter
|
||||
//-->
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
|
||||
<script src="lib/mmd.js"></script>
|
||||
<?php
|
||||
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";
|
||||
$activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat")) !== false ? "#ccc" : "#000";
|
||||
?>">
|
||||
<style type="text/css">
|
||||
.CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; top: 0px; width: 100%; z-index: 1}
|
||||
.CodeMirror-scroll {height: auto; overflow: visible}
|
||||
/* Make sure this next one remains the 1st item, updated with JS */
|
||||
.CodeMirror {position: absolute; top: 0px; width: 100%; font-size: <?php echo $ICEcoder["fontSize"];?>; 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}
|
||||
span.CodeMirror-matchhighlight {background: #555}
|
||||
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000; background: #555; !important}
|
||||
/* Make sure this next one remains the 6th item, updated with JS */
|
||||
.cm-matchhighlight, .CodeMirror-focused .cm-matchhighlight {color: #fff !important; background: #06c !important}
|
||||
/* 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($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";}
|
||||
.lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px}
|
||||
.lint-error-icon {background: #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);">
|
||||
<body style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
|
||||
<div style="margin: 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
|
||||
<?php if ($ICEcoder['demoMode']) {?>
|
||||
<div style="position: absolute; display: inline-block; width: 99px; height: 50px; top: 0; right: 30px; background: url('images/big-arrow.gif') 0 -10px no-repeat; text-align: center; font-family: arial; font-size: 10px; padding-top: 60px"><b>Click logo<br>for help &<br>usage info</b></div>
|
||||
<?php ;}; ?>
|
||||
|
||||
<div style="display: none; margin: 32px 43px 0 43px; padding: 10px; width: 500px; font-family: arial; font-size: 10px; color: #ddd; background: #333" id="dataMessage"></div>
|
||||
|
||||
<div style="margin: 20px 43px 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
|
||||
<div style="float: left; margin-right: 50px">
|
||||
<h2 style="color: rgba(0,198,255,0.7)">server</h2>
|
||||
<span style="color:#888">Server name, OS & IP:</span><br>
|
||||
@@ -39,7 +54,7 @@ span.CodeMirror-matchhighlight {background: #555}
|
||||
<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>
|
||||
<?php echo $docRoot.$iceRoot;?><br><br>
|
||||
<span style="color:#888">PHP version:</span><br>
|
||||
<?php echo phpversion();?><br><br>
|
||||
<span style="color:#888">Date & time:</span><br>
|
||||
@@ -62,8 +77,6 @@ span.CodeMirror-matchhighlight {background: #555}
|
||||
}
|
||||
}
|
||||
;?>
|
||||
<span style="color:#888">File & folder count:</span><br>
|
||||
<div id="fileFolderCounts"></div><br><br><br>
|
||||
</div>
|
||||
|
||||
<div style="clear: both">
|
||||
@@ -87,34 +100,68 @@ span.CodeMirror-matchhighlight {background: #555}
|
||||
}
|
||||
},1000);
|
||||
</script>
|
||||
<?php if(is_dir('test') && !$ICEcoder['demoMode']) {?>
|
||||
<div style="clear: both">
|
||||
<br><br>
|
||||
<h2 style="color: rgba(0,198,255,0.7)">test suite</h2>
|
||||
<span style="color:#888">Run unit tests:</span><br>
|
||||
<a href="javascript:top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff">Run unit tests</a><div id="unitTestResults"></div>
|
||||
</div>
|
||||
<?php ;};?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
CodeMirror.keyMap.ICEcoder = {
|
||||
// "Tab": "defaultTab", **Now used by Emmet**
|
||||
"Shift-Tab": "indentLess",
|
||||
"Ctrl-Space": "autocomplete",
|
||||
fallthrough: ["default"]
|
||||
};
|
||||
CodeMirror.commands.autocomplete = function(cm) {
|
||||
if (top.ICEcoder.caretLocType=="JavaScript") {
|
||||
CodeMirror.showHint(cm, CodeMirror.javascriptHint);
|
||||
} else {
|
||||
CodeMirror.showHint(cm, CodeMirror.htmlHint);
|
||||
}
|
||||
}
|
||||
|
||||
function createNewCMInstance(num) {
|
||||
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
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,top.ICEcoder.foldStyle);
|
||||
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,top.ICEcoder.foldStyle);
|
||||
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.ICEcoder.tabWidth,
|
||||
tabSize: top.ICEcoder.tabWidth,
|
||||
indentWithTabs: true,
|
||||
lineWrapping: top.ICEcoder.lineWrapping,
|
||||
indentWithTabs: top.ICEcoder.indentWithTabs,
|
||||
indentUnit: top.ICEcoder.indentSize,
|
||||
tabSize: top.ICEcoder.indentSize,
|
||||
electricChars: false,
|
||||
onCursorActivity: function(thisCM) {
|
||||
autoCloseTags: true,
|
||||
highlightSelectionMatches: true,
|
||||
keyMap: "ICEcoder",
|
||||
onKeyEvent: function(thisCM, e) {
|
||||
top.ICEcoder.redoChangedContent(e);
|
||||
top.ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
|
||||
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");
|
||||
tok = thisCM.getTokenAt(thisCM.getCursor());
|
||||
}
|
||||
});
|
||||
|
||||
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].getCursor('start').line == window['cM'+num].getCursor().line) {
|
||||
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine");
|
||||
}
|
||||
thisCM.matchHighlight("CodeMirror-matchhighlight");
|
||||
top.ICEcoder.cssColorPreview();
|
||||
},
|
||||
onChange: function() {
|
||||
}
|
||||
);
|
||||
|
||||
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;
|
||||
@@ -129,63 +176,65 @@ function createNewCMInstance(num) {
|
||||
top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results";
|
||||
top.ICEcoder.findMode = false;
|
||||
}
|
||||
},
|
||||
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());
|
||||
if (tok.string!=">") {lastString=tok.string};
|
||||
if (e.type=="keyup"&&e.keyCode=="16"&&lastKeyCode=="190") {
|
||||
canDoEndTag=true;
|
||||
if (top.ICEcoder.tagString!="script" && top.ICEcoder.tagNestExceptions.indexOf(top.ICEcoder.tagString)>-1) {
|
||||
canDoEndTag=false;
|
||||
}
|
||||
if (
|
||||
top.ICEcoder.tagString.slice(0,1)=="/"||
|
||||
top.ICEcoder.tagString.slice(0,1)=="?"||
|
||||
!top.ICEcoder.codeAssist||
|
||||
fileName && (fileName.indexOf(".js")>0||fileName.indexOf(".css")>0||fileName.indexOf(".less")>0)
|
||||
) {canDoEndTag=false}
|
||||
|
||||
contentType = top.ICEcoder.caretLocType;
|
||||
if (canDoEndTag && (contentType!="JavaScript"||(contentType=="JavaScript"&&top.ICEcoder.tagString=="script"))) {
|
||||
numTabs = top.ICEcoder.htmlTagArray.length;
|
||||
if (top.ICEcoder.htmlTagArray[0]=="html") {numTabs--};
|
||||
tabs = "";
|
||||
for (i=0;i<numTabs-1;i++) {
|
||||
tabs += "\t";
|
||||
}
|
||||
endTag = "</" + top.ICEcoder.tagString + ">";
|
||||
if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"};
|
||||
if(top.ICEcoder.tagString=="title"||top.ICEcoder.tagString=="a"||top.ICEcoder.tagString=="li"||top.ICEcoder.tagString=="span"||(top.ICEcoder.tagString.slice(0,1)=="h"&&parseInt(top.ICEcoder.tagString.slice(1,2),10)>=1&&parseInt(top.ICEcoder.tagString.slice(1,2),10)<=7)) {
|
||||
thisCM.replaceSelection(endTag);
|
||||
thisCM.setCursor(thisCM.getCursor().line,thisCM.getCursor().ch-top.ICEcoder.tagString.length-3);
|
||||
} else if(top.ICEcoder.tagString=="html"||top.ICEcoder.tagString=="head") {
|
||||
thisCM.replaceSelection("\n\n"+endTag);
|
||||
thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
|
||||
} else {
|
||||
thisCM.replaceSelection("\n"+tabs+"\t\n"+tabs+endTag);
|
||||
thisCM.setCursor(thisCM.getCursor().line-1,numTabs);
|
||||
if (top.ICEcoder.codeAssist) {
|
||||
clearTimeout(window['cM'+num+'waiting']);
|
||||
window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100);
|
||||
}
|
||||
var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
|
||||
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
|
||||
// Update HTML edited files live
|
||||
if (top.ICEcoder.previewWindow.location) {
|
||||
if (top.ICEcoder.previewWindow.location.pathname==filepath) {
|
||||
top.ICEcoder.previewWindow.document.documentElement.innerHTML =
|
||||
["htm","html","txt"].indexOf(fileExt) > -1
|
||||
? window['cM'+num].getValue()
|
||||
: ["md"].indexOf(fileExt) > -1
|
||||
? mmd(window['cM'+num].getValue())
|
||||
: false;
|
||||
} else if (["css"].indexOf(fileExt) > -1) {
|
||||
if (top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) {
|
||||
var css = window['cM'+num].getValue();
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.id = "ICEcoder"+filepath.replace(/\//g,"_");
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
if (top.ICEcoder.previewWindow.document.getElementById(style.id)) {
|
||||
top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(style.id));
|
||||
}
|
||||
top.ICEcoder.previewWindow.document.documentElement.appendChild(style);
|
||||
}
|
||||
}
|
||||
};
|
||||
lastKeyCode = e.keyCode;
|
||||
},
|
||||
onGutterClick: !fileName || (fileName && fileName.indexOf(".js") == -1 && fileName.indexOf(".coffee") == -1 && fileName.indexOf(".php") && fileName.indexOf(".rb") == -1) ? codeFoldTag : codeFoldBrace,
|
||||
extraKeys: {
|
||||
"Tab": function(cm) {CodeMirror.commands[top.ICEcoder.tabsIndent ? "defaultTab" : "insertTab"](cm);},
|
||||
"Shift-Tab": "indentLess",
|
||||
"Ctrl-Up": function() {},
|
||||
"Ctrl-Down": function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
window['cM'+num].on("scroll", function(thisCM) {
|
||||
top.ICEcoder.mouseDown=false;
|
||||
}
|
||||
);
|
||||
|
||||
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
|
||||
["JavaScript","CoffeeScript","PHP","Python","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>
|
||||
|
||||
341
farbtastic/LICENSE.txt
Normal file
@@ -0,0 +1,341 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
36
farbtastic/farbtastic.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.picker {
|
||||
display: inline-block;
|
||||
}
|
||||
.farbtastic {
|
||||
position: relative;
|
||||
}
|
||||
.farbtastic * {
|
||||
position: absolute;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.farbtastic, .farbtastic .wheel {
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
}
|
||||
.farbtastic .color, .farbtastic .overlay {
|
||||
top: 47px;
|
||||
left: 47px;
|
||||
width: 101px;
|
||||
height: 101px;
|
||||
}
|
||||
.farbtastic .wheel {
|
||||
background: url(wheel.png) no-repeat;
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
}
|
||||
.farbtastic .overlay {
|
||||
background: url(mask.png) no-repeat;
|
||||
}
|
||||
.farbtastic .marker {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
margin: -8px 0 0 -8px;
|
||||
overflow: hidden;
|
||||
background: url(marker.png) no-repeat;
|
||||
}
|
||||
|
||||
252
farbtastic/farbtastic.js
Normal file
@@ -0,0 +1,252 @@
|
||||
/*!
|
||||
* Farbtastic: NON jQuery color picker plug-in v1.4, based on v1.3u
|
||||
*
|
||||
* Licensed under the GPL license:
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
farbtasticFunc = function (options) {
|
||||
farbtastic(this, options);
|
||||
return this;
|
||||
};
|
||||
|
||||
farbtastic = function (container, callback) {
|
||||
var container = document.getElementById(container);
|
||||
var callback = document.getElementById(callback);
|
||||
return container.farbtastic || (container.farbtastic = new _farbtastic(container, callback));
|
||||
};
|
||||
|
||||
_farbtastic = function (container, callback) {
|
||||
// Store farbtastic object
|
||||
var fb = this;
|
||||
|
||||
// Insert markup
|
||||
container.innerHTML = '<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>';
|
||||
fb.wheel = document.getElementsByClassName('wheel')[0];
|
||||
// Dimensions
|
||||
fb.radius = 84;
|
||||
fb.square = 100;
|
||||
fb.width = 194;
|
||||
|
||||
/**
|
||||
* Link to the given element(s) or callback.
|
||||
*/
|
||||
fb.linkTo = function (callback) {
|
||||
// Unbind previous nodes
|
||||
if (typeof fb.callback == 'object') {
|
||||
console.log("Doesn't do anything?");
|
||||
fb.callback.removeEventListener('keyup', fb.updateValue);
|
||||
}
|
||||
|
||||
// Reset color
|
||||
fb.color = null;
|
||||
|
||||
// Bind callback or elements
|
||||
if (typeof callback == 'function') {
|
||||
fb.callback = callback;
|
||||
}
|
||||
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||
fb.callback = callback;
|
||||
fb.callback.addEventListener('keyup',fb.updateValue);
|
||||
if (fb.callback.value) {
|
||||
fb.setColor(fb.callback.value);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
fb.updateValue = function (event) {
|
||||
if (this.value && this.value != fb.color) {
|
||||
fb.setColor(this.value);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Change color with HTML syntax #123456
|
||||
*/
|
||||
fb.setColor = function (color) {
|
||||
var unpack = fb.unpack(color);
|
||||
if (fb.color != color && unpack) {
|
||||
fb.color = color;
|
||||
fb.rgb = unpack;
|
||||
fb.hsl = fb.RGBToHSL(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Change color with HSL triplet [0..1, 0..1, 0..1]
|
||||
*/
|
||||
fb.setHSL = function (hsl) {
|
||||
fb.hsl = hsl;
|
||||
fb.rgb = fb.HSLToRGB(hsl);
|
||||
fb.color = fb.pack(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
return this;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Retrieve the coordinates of the given event relative to the center
|
||||
* of the widget.
|
||||
*/
|
||||
fb.widgetCoords = function (event) {
|
||||
return { x: (event.pageX - fb.wheel.offsetParent.offsetLeft) - fb.width / 2, y: (event.pageY - fb.wheel.offsetParent.offsetTop) - fb.width / 2 };
|
||||
};
|
||||
|
||||
/**
|
||||
* Mousedown handler
|
||||
*/
|
||||
fb.mousedown = function (event) {
|
||||
// Capture mouse
|
||||
if (!document.dragging) {
|
||||
document.addEventListener('mousemove', fb.mousemove);
|
||||
document.addEventListener('mouseup', fb.mouseup);
|
||||
document.dragging = true;
|
||||
}
|
||||
|
||||
// Check which area is being dragged
|
||||
var pos = fb.widgetCoords(event);
|
||||
fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
|
||||
|
||||
// Process
|
||||
fb.mousemove(event);
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mousemove handler
|
||||
*/
|
||||
fb.mousemove = function (event) {
|
||||
// Get coordinates relative to color picker center
|
||||
var pos = fb.widgetCoords(event);
|
||||
|
||||
// Set new HSL parameters
|
||||
if (fb.circleDrag) {
|
||||
var hue = Math.atan2(pos.x, -pos.y) / 6.28;
|
||||
if (hue < 0) hue += 1;
|
||||
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
||||
}
|
||||
else {
|
||||
var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
|
||||
var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
|
||||
fb.setHSL([fb.hsl[0], sat, lum]);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouseup handler
|
||||
*/
|
||||
fb.mouseup = function () {
|
||||
// Uncapture mouse
|
||||
document.removeEventListener('mousemove', fb.mousemove);
|
||||
document.removeEventListener('mouseup', fb.mouseup);
|
||||
document.dragging = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the markers and styles
|
||||
*/
|
||||
fb.updateDisplay = function () {
|
||||
// Markers
|
||||
var angle = fb.hsl[0] * 6.28;
|
||||
document.getElementsByClassName('h-marker')[0].style.left = Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px';
|
||||
document.getElementsByClassName('h-marker')[0].style.top = Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px';
|
||||
|
||||
document.getElementsByClassName('sl-marker')[0].style.left = Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px';
|
||||
document.getElementsByClassName('sl-marker')[0].style.top = Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px';
|
||||
|
||||
// Saturation/Luminance gradient
|
||||
document.getElementsByClassName('color')[0].style.backgroundColor = fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]));
|
||||
|
||||
// Linked elements or callback
|
||||
if (typeof fb.callback == 'object') {
|
||||
// Set background/foreground color
|
||||
document.getElementById(fb.callback.id).style.backgroundColor = fb.color;
|
||||
document.getElementById(fb.callback.id).style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff';
|
||||
|
||||
// Change linked value
|
||||
if (callback.value && callback.value != fb.color) {
|
||||
callback.value = fb.color;
|
||||
}
|
||||
}
|
||||
else if (typeof fb.callback == 'function') {
|
||||
fb.callback.call(fb, fb.color);
|
||||
}
|
||||
};
|
||||
|
||||
/* Various color utility functions */
|
||||
fb.pack = function (rgb) {
|
||||
var r = Math.round(rgb[0] * 255);
|
||||
var g = Math.round(rgb[1] * 255);
|
||||
var b = Math.round(rgb[2] * 255);
|
||||
return '#' + (r < 16 ? '0' : '') + r.toString(16) +
|
||||
(g < 16 ? '0' : '') + g.toString(16) +
|
||||
(b < 16 ? '0' : '') + b.toString(16);
|
||||
};
|
||||
|
||||
fb.unpack = function (color) {
|
||||
if (color.length == 7) {
|
||||
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
||||
parseInt('0x' + color.substring(3, 5)) / 255,
|
||||
parseInt('0x' + color.substring(5, 7)) / 255];
|
||||
}
|
||||
else if (color.length == 4) {
|
||||
return [parseInt('0x' + color.substring(1, 2)) / 15,
|
||||
parseInt('0x' + color.substring(2, 3)) / 15,
|
||||
parseInt('0x' + color.substring(3, 4)) / 15];
|
||||
}
|
||||
};
|
||||
|
||||
fb.HSLToRGB = function (hsl) {
|
||||
var m1, m2, r, g, b;
|
||||
var h = hsl[0], s = hsl[1], l = hsl[2];
|
||||
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
|
||||
m1 = l * 2 - m2;
|
||||
return [this.hueToRGB(m1, m2, h+0.33333),
|
||||
this.hueToRGB(m1, m2, h),
|
||||
this.hueToRGB(m1, m2, h-0.33333)];
|
||||
};
|
||||
|
||||
fb.hueToRGB = function (m1, m2, h) {
|
||||
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
||||
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
||||
if (h * 2 < 1) return m2;
|
||||
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
||||
return m1;
|
||||
};
|
||||
|
||||
fb.RGBToHSL = function (rgb) {
|
||||
var min, max, delta, h, s, l;
|
||||
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||
min = Math.min(r, Math.min(g, b));
|
||||
max = Math.max(r, Math.max(g, b));
|
||||
delta = max - min;
|
||||
l = (min + max) / 2;
|
||||
s = 0;
|
||||
if (l > 0 && l < 1) {
|
||||
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
||||
}
|
||||
h = 0;
|
||||
if (delta > 0) {
|
||||
if (max == r && max != g) h += (g - b) / delta;
|
||||
if (max == g && max != b) h += (2 + (b - r) / delta);
|
||||
if (max == b && max != r) h += (4 + (r - g) / delta);
|
||||
h /= 6;
|
||||
}
|
||||
return [h, s, l];
|
||||
};
|
||||
|
||||
// Install mousedown handler (the others are set on the document on-demand)
|
||||
document.getElementsByClassName('farbtastic')[0].onmousedown = fb.mousedown;
|
||||
|
||||
// Init color
|
||||
fb.setColor('#000000');
|
||||
|
||||
// Set linked elements/callback
|
||||
if (callback) {
|
||||
fb.linkTo(callback);
|
||||
}
|
||||
};
|
||||
BIN
farbtastic/marker.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
farbtastic/mask.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
farbtastic/wheel.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
131
files.php
@@ -1,140 +1,25 @@
|
||||
<?php include("lib/settings.php");?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()">
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {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(event)" onClick="top.ICEcoder.selectFileFolder(event)">
|
||||
<head>
|
||||
<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/ice-coder.js" type="text/javascript"></script>
|
||||
<script src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.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);">
|
||||
<body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
|
||||
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
|
||||
|
||||
<?php
|
||||
// Function to sort given values alphabetically
|
||||
function alphasort($a, $b) {
|
||||
return strcasecmp($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
|
||||
$objectList = new SortingIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort');
|
||||
|
||||
// With that done, create arrays for out final ordered list and a temp container of files
|
||||
$finalArray = $tempArray = array();
|
||||
|
||||
// To start, push folders from object into finalArray, files into tempArray
|
||||
foreach ($objectList as $objectRef) {
|
||||
$fileFolderName = substr($objectRef->getPathname(), strlen($docRoot.$iceRoot));
|
||||
$canAdd = true;
|
||||
for ($i=0;$i<count($_SESSION['bannedFiles']);$i++) {
|
||||
if(strpos($fileFolderName,$_SESSION['bannedFiles'][$i])!==false) {$canAdd = false;}
|
||||
}
|
||||
if ($objectRef->getFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) {
|
||||
$fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName)
|
||||
? array_push($finalArray,$fileFolderName)
|
||||
: array_push($tempArray,$fileFolderName);
|
||||
}
|
||||
}
|
||||
|
||||
// Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs
|
||||
for ($i=0;$i<count($tempArray);$i++) {
|
||||
if (count(explode("/",$tempArray[$i]))==2) {
|
||||
array_push($finalArray,$tempArray[$i]);
|
||||
array_splice($tempArray,$i,1);
|
||||
$i--;
|
||||
}
|
||||
}
|
||||
|
||||
// Lastly we push remaining files into the right subdirs in finalArray
|
||||
for ($i=0;$i<count($tempArray);$i++) {
|
||||
$insertAt = array_search(dirname($tempArray[$i]),$finalArray)+1;
|
||||
for ($j=$insertAt;$j<count($finalArray);$j++) {
|
||||
if ( strcasecmp(dirname($finalArray[$j]), dirname($tempArray[$i]))==0 &&
|
||||
strcasecmp(basename($finalArray[$j]), basename($tempArray[$i]))<0 ||
|
||||
strpos(dirname($finalArray[$j]),dirname($tempArray[$i]))===0) {
|
||||
$insertAt++;
|
||||
}
|
||||
}
|
||||
array_splice($finalArray, $insertAt, 0, $tempArray[$i]);
|
||||
}
|
||||
|
||||
// Finally, we have our ordered list, so display in a UL
|
||||
$fileAtts = "";
|
||||
if ($serverType=="Linux") {
|
||||
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3);
|
||||
$fileAtts = '<span style="color: #888; font-size: 8px" id="|_perms">'.$chmodInfo.'</span>';
|
||||
}
|
||||
?>
|
||||
<ul class="fileManager">
|
||||
<li class="pft-directory">
|
||||
<a nohref title="/" onMouseOver="top.ICEcoder.overFileFolder('folder','/')" onMouseOut="top.ICEcoder.overFileFolder('folder','')" style="position: relative; left:-22px">
|
||||
|
||||
<span id="|">/
|
||||
<?php echo $iceRoot == "" ? "[ROOT]" : trim($iceRoot,"/");?>
|
||||
</span>
|
||||
<?php echo $fileAtts;?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$lastPath="";
|
||||
$fileCount=0;
|
||||
$fileBytes=0;
|
||||
$dirCount=0;
|
||||
for ($i=0;$i<count($finalArray);$i++) {
|
||||
$fileFolderName = str_replace("\\","/",$finalArray[$i]);
|
||||
$type = is_dir($docRoot.$iceRoot.$fileFolderName) ? "folder" : "file";
|
||||
$type=="folder" ? $dirCount++ : $fileCount++;
|
||||
if ($type=="file") {
|
||||
$fileBytes+=filesize($docRoot.$iceRoot.$fileFolderName);
|
||||
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
|
||||
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
|
||||
}
|
||||
$thisDepth = count(explode("/",$fileFolderName));
|
||||
$lastDepth = count(explode("/",$lastPath));
|
||||
if ($thisDepth > $lastDepth) {echo "<ul>\n";}
|
||||
if ($thisDepth < $lastDepth) {
|
||||
for ($j=$lastDepth;$j>$thisDepth;$j--) {
|
||||
echo "</ul>\n";
|
||||
}
|
||||
}
|
||||
if ($serverType=="Linux") {
|
||||
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3);
|
||||
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'.$chmodInfo.'</span>';
|
||||
}
|
||||
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
|
||||
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ".$fileAtts."</a>\n";
|
||||
if ($i<count($finalArray)) {echo "</li>\n";}
|
||||
$lastPath = $fileFolderName;
|
||||
}
|
||||
echo "</ul>\n</ul>\n";
|
||||
|
||||
// Output the JS vars
|
||||
echo "<script>\n";
|
||||
echo "top.ICEcoder.dirCount=";
|
||||
echo $dirCount ? $dirCount : "0";
|
||||
echo ";\ntop.ICEcoder.fileCount=";
|
||||
echo $fileCount ? $fileCount : "0";
|
||||
echo ";\ntop.ICEcoder.fileBytes=";
|
||||
echo $fileBytes ? $fileBytes : "0";
|
||||
echo ";\n</script>";
|
||||
?>
|
||||
<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"> <span id="|">/ <?php echo $iceRoot == "" ? "[ROOT]" : trim($iceRoot,"/");?></span> <span style="color: #888; font-size: 8px" id="|_perms"><?php echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3) : "";?></span></a></li><?php include("lib/get-branch.php");?>
|
||||
</ul>
|
||||
|
||||
<iframe name="fileControl" style="display: none"></iframe>
|
||||
|
||||
<iframe name="testControl" style="display: none"></iframe>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
BIN
images/big-arrow.gif
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
images/checkerboard.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
images/color-picker.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 164 B |
BIN
images/nav-alpha.png
Normal file
|
After Width: | Height: | Size: 990 B |
BIN
images/nest-tag-bg.gif
Normal file
|
After Width: | Height: | Size: 120 B |
91
index.php
@@ -8,16 +8,23 @@ if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*"
|
||||
$updateMsg = '';
|
||||
// Check for updates
|
||||
if ($ICEcoder["checkUpdates"]) {
|
||||
$icv = json_encode(file_get_contents("http://icecoder.net/latest-version.txt"));
|
||||
$icv = rtrim(ltrim($icv,'"'),'"\\n');
|
||||
$icv_url = "http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"];
|
||||
if (ini_get('allow_url_fopen')) {
|
||||
$icvInfo = explode("\n",file_get_contents($icv_url));
|
||||
} elseif (function_exists('curl_init')) {
|
||||
$ch = curl_init($icv_url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$icvInfo = explode("\n", curl_exec($ch));
|
||||
}
|
||||
$icv = $icvInfo[0];
|
||||
$icvI = $icvInfo[1];
|
||||
if ($ICEcoder["versionNo"]<$icv) {
|
||||
$updateMsg = ';top.ICEcoder.message(\'ICEcoder '.$icv.' now released\n\nPlease upgrade\')';
|
||||
$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><br>".$icvI."');";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'top');top.ICEcoder.canResizeFilesW()}">
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'top');top.ICEcoder.canResizeFilesW()}">
|
||||
<head>
|
||||
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
@@ -25,16 +32,23 @@ if ($ICEcoder["checkUpdates"]) {
|
||||
<link rel="stylesheet" type="text/css" href="lib/ice-coder.css">
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<script>
|
||||
iceRoot = "<?php echo $ICEcoder["root"]; ?>";
|
||||
iceRoot = "<?php echo $ICEcoder['root']; ?>";
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
if (top.ICEcoder.changedContent.indexOf(1)>-1) {
|
||||
return "You have some unsaved changes.";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script language="JavaScript" src="lib/ice-coder.js"></script>
|
||||
<script language="JavaScript" src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.js"></script>
|
||||
<script src="lib/mmd.js"></script>
|
||||
<?php
|
||||
if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
|
||||
echo '<script src="plugins/jshint/jshint.js"></script>';
|
||||
}
|
||||
?>
|
||||
<script src="farbtastic/farbtastic.js"></script>
|
||||
<link rel="stylesheet" href="farbtastic/farbtastic.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body onLoad="<?php
|
||||
@@ -46,15 +60,22 @@ window.onbeforeunload = function() {
|
||||
echo "];top.ICEcoder.theme = '";
|
||||
echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];
|
||||
echo "'";
|
||||
echo ';top.ICEcoder.tabsIndent = ';
|
||||
echo $ICEcoder["tabsIndent"] ? 'true' : 'false';
|
||||
echo ";top.ICEcoder.fontSize = '";
|
||||
echo $ICEcoder["fontSize"];
|
||||
echo "'";
|
||||
echo ';top.ICEcoder.openLastFiles = ';
|
||||
echo $ICEcoder["openLastFiles"] ? 'true' : 'false';
|
||||
echo ';top.ICEcoder.tabWidth = ';
|
||||
echo $ICEcoder["tabWidth"];
|
||||
echo ';top.ICEcoder.lineWrapping = ';
|
||||
echo $ICEcoder["lineWrapping"] ? 'true' : 'false';
|
||||
echo ';top.ICEcoder.indentWithTabs = ';
|
||||
echo $ICEcoder["indentWithTabs"] ? 'true' : 'false';
|
||||
echo ';top.ICEcoder.indentSize = ';
|
||||
echo $ICEcoder["indentSize"];
|
||||
echo ';top.ICEcoder.demoMode = ';
|
||||
echo $ICEcoder["demoMode"] ? 'true' : 'false';
|
||||
?>;ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
|
||||
|
||||
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)" onContextMenu="return false">
|
||||
<div id="blackMask" class="blackMask" onClick="if (!ICEcoder.overPopup) {ICEcoder.showHide('hide',this)}" onContextMenu="return false">
|
||||
<div class="popupVCenter">
|
||||
<div class="popup" id="mediaContainer"></div>
|
||||
</div>
|
||||
@@ -75,21 +96,34 @@ window.onbeforeunload = function() {
|
||||
<span id="folderMenuItems">
|
||||
<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.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>
|
||||
<a href="javascript:top.ICEcoder.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()" id="fmMenuPasteOption" style="display: none">Paste</a>
|
||||
</span>
|
||||
<a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</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="ICEcoder.showFileMenu()">Rename</a>
|
||||
<a href="javascript:window.open(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">View Webpage</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="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="tools">
|
||||
<a nohref onClick="top.ICEcoder.showColorPicker(top.document.getElementById('color') ? top.document.getElementById('color').value : '#123456')" title="Color Picker"><img src="images/color-picker.png" style="margin-top: 3px; cursor: pointer" alt="Color Picker"></a>
|
||||
</div>
|
||||
<div class="plugins" id="pluginsContainer">
|
||||
<?php echo $pluginsDisplay; ?>
|
||||
</div>
|
||||
<div class="version">v <?php echo $ICEcoder["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>
|
||||
|
||||
@@ -107,23 +141,25 @@ window.onbeforeunload = function() {
|
||||
<div title="Lock" onClick="ICEcoder.lockUnlockNav()" id="fmLock" class="lock"></div>
|
||||
</div>
|
||||
</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="ICEcoder.canSwitchTabs ? ICEcoder.switchTab('.$i.') : 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\'; if (!top.ICEcoder.overCloseLink) {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(top.document.getElementById('find').value,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)">
|
||||
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace(top.document.getElementById('find').value,true,false)">
|
||||
|
||||
<select name="connector" onChange="ICEcoder.findReplaceOptions()">
|
||||
<option>in</option>
|
||||
@@ -144,21 +180,24 @@ window.onbeforeunload = function() {
|
||||
<option>all files</option>
|
||||
<option>all filenames</option>
|
||||
</select>
|
||||
<input type="button" name="submit" value=">>" class="submit" onClick="ICEcoder.findReplace('findReplace',false,true)">
|
||||
<input type="submit" name="submit" value=">>" class="submit">
|
||||
<div class="results" id="results"></div>
|
||||
</div>
|
||||
</form>
|
||||
<form onSubmit="return ICEcoder.goToLine()">
|
||||
<div class="codeAssist"><input type="checkbox" name="codeAssist" id="codeAssist" checked onClick="top.ICEcoder.codeAssistToggle()">Code Assist</div>
|
||||
<div class="goLine">Go to Line<input type="text" name="goToLine" value="" id="goToLineNo" class="textbox goToLine">
|
||||
<div class="codeAssist" title="Turn on/off JS Hint & CSS color previews"><input type="checkbox" name="codeAssist" id="codeAssist" checked onClick="top.ICEcoder.codeAssistToggle()">Code Assist</div>
|
||||
<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>
|
||||
</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="system" id="system">
|
||||
<div onClick="top.ICEcoder.openPreviewWindow()" class="preview"></div>
|
||||
<div onClick="top.ICEcoder.openTerminal()" class="terminal"></div>
|
||||
</div>
|
||||
<div class="nesting" id="nestValid"></div>
|
||||
<div class="nestDisplay" id="nestDisplay"></div>
|
||||
<div class="charDisplay" id="charDisplay"><span id="char"></span></div>
|
||||
</div>
|
||||
|
||||
34
lib/config-template.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
$ICEcoder = array(
|
||||
"root" => "",
|
||||
"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("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.6.3-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("Voke","plugins/voke/icon.png","margin-top: 3px","http://voke.fm","_blank",""),
|
||||
array("Regexplained","plugins/regexplained/icon.png","margin-top: 3px","http://leaverou.github.io/regexplained","_blank",""),
|
||||
array("wireframe|cc","plugins/wireframecc/icon.png","margin-top: 3px","http://wireframe.cc","_blank",""),
|
||||
array("TinyPNG","plugins/tinypng/icon.png","margin-top: 7px","http://tinypng.org","_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",
|
||||
"fontSize" => "13px",
|
||||
"lineWrapping" => true,
|
||||
"indentWithTabs" => true,
|
||||
"indentSize" => 4,
|
||||
"previousFiles" => "",
|
||||
"last10Files" => ""
|
||||
);
|
||||
?>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?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"),
|
||||
"allowedIPs" => array("*"),
|
||||
"plugins" => array(
|
||||
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
|
||||
array("Zip It!","plugins/zip-it/icon.png","margin-top: 3px; margin-left: 3px","plugins/zip-it/?zip=|&exclude=*.doc*.gif*.jpg*.jpeg*.pdf*.png*.swf*.xml*.zip","fileControl:<b>Zipping Files</b>","30"),
|
||||
array("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","")
|
||||
),
|
||||
"theme" => "default",
|
||||
"tabWidth" => 4,
|
||||
"previousFiles" => "",
|
||||
"last10Files" => ""
|
||||
);
|
||||
?>
|
||||
@@ -1,4 +1,4 @@
|
||||
/* ICE coder default theme: Based VERY loosely on Monokai */
|
||||
/* ICEcoder default theme: Based VERY loosely on Monokai */
|
||||
|
||||
.cm-s-icecoder {color: #666; background: #1c1c19}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
.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-attribute {color: #0bb}
|
||||
|
||||
.cm-s-icecoder span.cm-header {color: #a0a}
|
||||
.cm-s-icecoder span.cm-quote {color: #090}
|
||||
@@ -34,7 +34,7 @@
|
||||
.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-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}
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php include("settings.php");?>
|
||||
<?php
|
||||
// Get the save type if any
|
||||
$saveType = "";
|
||||
if (isset($_GET['saveType'])) {$saveType = strClean($_GET['saveType']);};
|
||||
$saveType = isset($_GET['saveType']) ? strClean($_GET['saveType']) : "";
|
||||
|
||||
// Establish the filename/new filename
|
||||
$file = str_replace("|","/",strClean(
|
||||
@@ -11,8 +10,11 @@ $file = str_replace("|","/",strClean(
|
||||
: $_GET['file']
|
||||
));
|
||||
|
||||
// Trim any +'s or spaces from the end of file
|
||||
$file = rtrim(rtrim($file,'+'),' ');
|
||||
|
||||
// Make $file a full path and establish the $fileLoc and $fileName
|
||||
if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
|
||||
if (strpos($file,$docRoot)===false && $_GET['action']!="getRemoteFile") {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
|
||||
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
|
||||
$fileName = basename($file);
|
||||
|
||||
@@ -20,31 +22,53 @@ $fileName = basename($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($fileName,".jpg")>0||strpos($fileName,".jpeg")>0||strpos($fileName,".gif")>0||strpos($fileName,".png")>0) {$fileType="image";};
|
||||
|
||||
if ($fileType=="text") {
|
||||
if (file_exists($file)) {
|
||||
if (file_exists($file)) {
|
||||
$finfo = "";
|
||||
// Determine what to do based on mime type
|
||||
if (function_exists('finfo_open')) {
|
||||
$finfoMIME = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$finfo = finfo_file($finfoMIME, $file);
|
||||
finfo_close($finfoMIME);
|
||||
} else {
|
||||
$fileExt = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","py","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
|
||||
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
|
||||
}
|
||||
if (strpos($finfo,"text")===0 || strpos($finfo,"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>",htmlentities($loadedFile)).'</textarea>';
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&",$loadedFile)).'</textarea>';
|
||||
} else if (strpos($finfo,"image")===0) {
|
||||
echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>';
|
||||
} else {
|
||||
echo '<script>fileType="nothing"; top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</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>';
|
||||
}
|
||||
|
||||
if ($fileType=="image") {
|
||||
echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>';
|
||||
};
|
||||
};
|
||||
|
||||
// Get the contents of a remote URL
|
||||
if ($_GET['action']=="getRemoteFile") {
|
||||
if ($remoteFile = file_get_contents($file)) {
|
||||
// replace \r\n (Windows) and \r (old Mac) line endings with \n (Linux)
|
||||
$remoteFile = str_replace("\r\n", "\n", $remoteFile);
|
||||
$remoteFile = str_replace("\r", "\n", $remoteFile);
|
||||
echo '<script>top.ICEcoder.newTab();</script>';
|
||||
echo '<textarea name="remoteFile" id="remoteFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&",$remoteFile)).'</textarea>';
|
||||
echo '<script>top.ICEcoder.getcMInstance().setValue(document.getElementById("remoteFile").value);action="getRemoteFile";</script>';
|
||||
} else {
|
||||
echo '<script>action="nothing"; top.ICEcoder.message(\'Sorry, could\\\'t get contents of '.$file.'\');</script>';
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
}
|
||||
|
||||
// If we're due to add a new folder...
|
||||
if ($_GET['action']=="newFolder") {
|
||||
if (is_writable($docRoot.$fileLoc)) {
|
||||
if (!$demoMode && is_writable($docRoot.$fileLoc)) {
|
||||
mkdir($file, 0705);
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
|
||||
@@ -54,22 +78,123 @@ if ($_GET['action']=="newFolder") {
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</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);
|
||||
} else {
|
||||
for ($i=2; $i<1000000000; $i++) {
|
||||
if (!is_dir($dest." (".$i.")")) {
|
||||
$dest = $dest." (".$i.")";
|
||||
mkdir($dest, 0705);
|
||||
$i=1000000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 (is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
|
||||
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>';
|
||||
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 {
|
||||
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."');</script>";
|
||||
$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 (is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
||||
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);
|
||||
@@ -85,7 +210,7 @@ if ($_GET['action']=="replaceText") {
|
||||
|
||||
// If we're due to change permissions on a file/folder...
|
||||
if ($_GET['action']=="perms") {
|
||||
if (is_writable($file)) {
|
||||
if (!$demoMode && is_writable($file)) {
|
||||
chmod($file,octdec(numClean($_GET['perms'])));
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
|
||||
@@ -100,15 +225,21 @@ if ($_GET['action']=="perms") {
|
||||
if ($_GET['action']=="delete") {
|
||||
$filesArray = explode(";",$file); // May contain more than one file here
|
||||
for ($i=0;$i<=count($filesArray)-1;$i++) {
|
||||
if (is_writable($iceRoot.$filesArray[$i])) {
|
||||
is_dir($iceRoot.$filesArray[$i])
|
||||
? rrmdir($iceRoot.$filesArray[$i])
|
||||
: unlink($iceRoot.$filesArray[$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));
|
||||
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";};
|
||||
// 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 can\\'t delete\\n".$filesArray[$i]."');</script>";
|
||||
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".str_replace($docRoot,"",$fullPath)."');</script>";
|
||||
}
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
@@ -135,20 +266,27 @@ if ($_GET['action']=="save") {
|
||||
echo '<script>action="save";</script>';
|
||||
// on the form posting via a reload, save the file
|
||||
if (isset($_POST['contents'])) {
|
||||
if ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
||||
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
|
||||
if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="")) {
|
||||
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
|
||||
if (!(isset($_GET['fileMDT']))||$filemtime==$_GET['fileMDT']) {
|
||||
$fh = fopen($file, 'w') or die("Sorry, cannot save");
|
||||
fwrite($fh, $_POST['contents']);
|
||||
// replace \r\n (Windows) and \r (old Mac) line endings with \n (Linux)
|
||||
$contents = $_POST['contents'];
|
||||
$contents = str_replace("\r\n", "\n", $contents);
|
||||
$contents = str_replace("\r", "\n", $contents);
|
||||
// Now write that content, close the file and clear the statcache
|
||||
fwrite($fh, $contents);
|
||||
fclose($fh);
|
||||
clearstatcache();
|
||||
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>';
|
||||
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
|
||||
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";</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>';
|
||||
}
|
||||
// Reload stickytab window
|
||||
echo '<script>if (top.ICEcoder.stickyTab.location) {top.ICEcoder.stickyTab.location.reload()};action="doneSave";</script>';
|
||||
// Reload previewWindow window if not a Markdown file
|
||||
echo '<script>if (top.ICEcoder.previewWindow.location && top.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) {top.ICEcoder.previewWindow.location.reload()};action="doneSave";</script>';
|
||||
} else {
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
|
||||
@@ -163,7 +301,7 @@ if ($_GET['action']=="save") {
|
||||
// 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); ?>";
|
||||
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo $filemtime; ?>";
|
||||
cM.clearHistory();
|
||||
// Now for the new file
|
||||
top.ICEcoder.newTab();
|
||||
@@ -191,6 +329,9 @@ if (action=="load") {
|
||||
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
|
||||
@@ -202,7 +343,7 @@ if (action=="load") {
|
||||
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)
|
||||
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on ICEcoder's load)
|
||||
top.ICEcoder.switchMode();
|
||||
cM = top.ICEcoder.getcMInstance();
|
||||
cM.setValue(document.getElementById('loadedFile').value);
|
||||
@@ -212,18 +353,30 @@ if (action=="load") {
|
||||
|
||||
// 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.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.openFileMDTs.push('<?php echo $serverType=="Linux" ? filemtime($file) : "1000000"; ?>');
|
||||
top.ICEcoder.loadingFile = false;
|
||||
<?php
|
||||
;};
|
||||
?>
|
||||
}
|
||||
},4);
|
||||
}
|
||||
|
||||
if (fileType=="image") {
|
||||
top.document.getElementById('blackMask').style.visibility = "visible";
|
||||
top.document.getElementById('mediaContainer').innerHTML = "<img src=\"<?php echo $fileLoc."/".$fileName;?>\" class=\"whiteGlow\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px\" 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.document.getElementById('mediaContainer').innerHTML =
|
||||
"<canvas id=\"canvasPicker\" width=\"1\" height=\"1\" style=\"position: absolute; margin: 10px 0 0 10px; cursor: crosshair\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></canvas>" +
|
||||
"<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')\" onLoad=\"reducedImgMsg = (this.naturalWidth > 700 || this.naturalHeight > 500) ? ', displayed at ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; top.ICEcoder.drawCanvasImage(this)\"><br>" +
|
||||
"<div class=\"whiteGlow\" style=\"display: inline-block; margin-top: -10px; border: solid 10px #fff; color: #000; background-color: #fff\" id=\"imgInfo\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\">" +
|
||||
"<b><?php echo $fileLoc."/".$fileName;?></b>" +
|
||||
"</div><br>" +
|
||||
"<input type=\"text\" id=\"hexMouseXY\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
|
||||
"<input type=\"text\" id=\"rgbMouseXY\" style=\"border: 1px solid #888; margin-right: 10px; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
|
||||
"<input type=\"text\" id=\"hex\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
|
||||
"<input type=\"text\" id=\"rgb\" style=\"border: 1px solid #888; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>";
|
||||
}
|
||||
|
||||
top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);
|
||||
@@ -245,7 +398,7 @@ if (action=="save") {
|
||||
? 'Enter filename to save at '+fileLoc
|
||||
: 'Enter filename (including path, prefixed with /)'
|
||||
,'');
|
||||
if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
|
||||
if (newFileName && newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
|
||||
if (newFileName) {
|
||||
newFileName = fileLoc == "" ? newFileName : fileLoc + "/" + fileName;
|
||||
}
|
||||
|
||||
@@ -55,8 +55,10 @@ body {margin: 0; overflow: auto}
|
||||
.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}
|
||||
.fileManager LI.ext-md:before {background-position: -160px 0}
|
||||
.fileManager LI.ext-php:before {background-position: -176px 0}
|
||||
.fileManager LI.ext-png:before {background-position: -192px 0}
|
||||
.fileManager LI.ext-py:before {background-position: -208px 0}
|
||||
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -224px 0}
|
||||
.fileManager LI.ext-txt:before {background-position: -240px 0}
|
||||
.fileManager LI.ext-zip:before {background-position: -256px 0}
|
||||
71
lib/get-branch.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (!isset($ICEcoder['root'])) {
|
||||
include("settings.php");
|
||||
}
|
||||
|
||||
if (!$_SESSION['loggedIn']) {
|
||||
header("Location: ../");
|
||||
}
|
||||
|
||||
// If we're just getting a branch, get that and set as the finalArray
|
||||
$scanDir = $docRoot.$iceRoot;
|
||||
$location = "";
|
||||
if (isset($_GET['location'])) {
|
||||
echo '<div id="branch">';
|
||||
$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";
|
||||
if ($type=="file") {
|
||||
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
|
||||
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
|
||||
}
|
||||
if ($i==0) {echo "<ul style=\"display: block\">\n";}
|
||||
if ($i==count($finalArray)-1 && isset($_GET['location'])) {
|
||||
echo "</ul>\n";
|
||||
}
|
||||
$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',this.childNodes[1].id)\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" onClick=\"if(!event.ctrlKey) {top.ICEcoder.openCloseDir(this,$loadParam)}\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ";
|
||||
echo '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">';
|
||||
echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : '';
|
||||
echo "</span></a></li>\n";
|
||||
}
|
||||
|
||||
if (isset($_GET['location'])) {
|
||||
?>
|
||||
</div>
|
||||
<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 && locNest.nextSibling.tagName=="UL") {
|
||||
x = locNest.nextSibling;
|
||||
x.parentNode.removeChild(x);
|
||||
}
|
||||
newUL.innerHTML = document.getElementById('branch').innerHTML.slice(28).slice(0,-7);
|
||||
locNest.parentNode.insertBefore(newUL,locNest.nextSibling);
|
||||
</script>
|
||||
<?php
|
||||
;};
|
||||
?>
|
||||
15
lib/help.css
@@ -17,15 +17,16 @@ 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}
|
||||
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}
|
||||
72
lib/help.php
@@ -5,6 +5,7 @@
|
||||
<head>
|
||||
<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,32 +13,57 @@
|
||||
|
||||
<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> ↑</span> <span class="shortcut">Move line up</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> ↓</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><br>
|
||||
<div style="display: inline-block; width: 365px; margin-right: 20px">
|
||||
<h2>Within document</h2>
|
||||
<span class="key">CTRL <span class="plus">+</span> ↑</span> <span class="shortcut">Move line up</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> ↓</span> <span class="shortcut">Move line down</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> +</span> <span class="shortcut">Duplicate line</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> -</span> <span class="shortcut">Remove line</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> i</span> <span class="shortcut">Search selected text</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> j</span> <span class="shortcut">Jump to definition</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 <div></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> s</span> <span class="shortcut">Wrap selected in <span></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> p</span> <span class="shortcut">Wrap selected in <p></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> a</span> <span class="shortcut">Wrap selected in <a></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> b</span> <span class="shortcut">Wrap selected in <b></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> i</span> <span class="shortcut">Wrap selected in <i></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> g</span> <span class="shortcut">Wrap selected in <strong></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> e</span> <span class="shortcut">Wrap selected in <em></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> nums 1 - 7</span> <span class="shortcut">Wrap selected in <h1> - <h7></span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> Enter</span> <span class="shortcut">End line with <br></span><br>
|
||||
</div>
|
||||
|
||||
<h2>Anywhere</h2>
|
||||
<span class="key">CTRL <span class="plus">+</span> →</span> <span class="shortcut">Next tab</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> ←</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>
|
||||
<div style="display: inline-block; width: 365px">
|
||||
<h2>On 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><br>
|
||||
|
||||
<h2>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>
|
||||
<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> left 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>
|
||||
|
||||
<h2>Anywhere</h2>
|
||||
<span class="key">CTRL <span class="plus">+</span> →</span> <span class="shortcut">Next tab</span><br>
|
||||
<span class="key">CTRL <span class="plus">+</span> ←</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> o</span> <span class="shortcut">Open file prompt</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">Focus on Go to line input</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">Space</span> <span class="shortcut">Refocus on document</span><br>
|
||||
<span class="key">Esc</span> <span class="shortcut">Cancel tasks</span><br>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -66,14 +66,16 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
|
||||
}
|
||||
|
||||
.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 .tools {position: absolute; display: inline-block; left: 15px; top: 3px}
|
||||
.header .plugins {position: absolute; display: inline-block; left: 55px; 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 0 10px 4px rgba(0,0,0,0.4);
|
||||
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}
|
||||
@@ -90,45 +92,71 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
|
||||
.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: 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;
|
||||
transition: all 0.2s;
|
||||
.files .serverMessage {position: absolute; display: none; width: 450px; bottom: 0; margin-bottom: 30px; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 7px 12px; opacity: 0;
|
||||
-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-color: #888;}
|
||||
.tabsBar .tab {display: inline-block; display: none; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 5px 8px 2px 8px; font-size: 10px; border-left: solid 1px #fff; border-right: solid 1px #777; color: #fff; cursor: pointer;
|
||||
-webkit-transition: all 0.15s;
|
||||
-moz-transition: all 0.15s;
|
||||
transition: all 0.15s;
|
||||
.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;
|
||||
-webkit-transition: width 0.15s ease-in-out;
|
||||
-moz-transition: width 0.15s ease-in-out;
|
||||
transition: width 0.15s ease-in-out;
|
||||
-webkit-transition: left 0.15s ease-in-out;
|
||||
-moz-transition: left 0.15s ease-in-out;
|
||||
transition: left 0.15s ease-in-out;
|
||||
}
|
||||
.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;
|
||||
-webkit-transition: left 0.15s ease-in-out;
|
||||
-moz-transition: left 0.15s ease-in-out;
|
||||
transition: left 0.15s ease-in-out;
|
||||
}
|
||||
.tabsBar .tab .closeTab {margin: 1px 0 0 5px; border-radius: 6px}
|
||||
.tabsBar .newTab {display: inline-block; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 6px 5px 5px 5px; border-left: solid 1px #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: 14px; border: 0; top: -2px; font-size: 10px; padding-left: 5px; margin-right: 3px}
|
||||
.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: -2px; font-size: 10px; padding-left: 5px}
|
||||
.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: 1px solid #bbb; background-color: #f8f8f8; font-size: 10px; cursor: pointer}
|
||||
.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 {position: fixed; display: inline-block; width: 100px; right: 74px; top: 70px; height: 21px; font-size: 10px; cursor: default; 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}
|
||||
.findBar .goLine {position: fixed; display: inline-block; width: 100px; right: -10px; top: 70px; height: 21px; font-size: 10px; cursor: default; 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: 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}
|
||||
.footer .system {position: absolute; display: inline-block; padding: 10px 0 0 15px}
|
||||
.footer .system div {position: relative; display: inline-block; margin-right: 10px; width: 11px; height: 11px; cursor: pointer}
|
||||
.footer .system .preview {background: url('../images/file-manager-icons.png') no-repeat -116px -16px}
|
||||
.footer .system .terminal {background: url('../images/file-manager-icons.png') no-repeat -132px -16px}
|
||||
.footer .nesting {position: absolute; display: inline-block; padding: 5px; margin-top: 10px; left: 260px; border-radius: 5px; background-color: #0b0; cursor: default}
|
||||
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 267px; 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; cursor: default}
|
||||
|
||||
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
|
||||
|
||||
@@ -140,6 +168,8 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
|
||||
.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 .text {position: relative; display: block; margin-top: 15px; font-size: 10px; color: #888}
|
||||
.screenCenter .text input {margin-top: 1px}
|
||||
.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-color: #2187e7; color: #eee}
|
||||
.screenCenter .button:hover {background: #2187e7; color: #eee}
|
||||
1339
lib/ice-coder.js
106
lib/ice-coder.min.js
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
var ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,changedContent:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,lockedNav:!0,htmlTagArray:[],codeAssist:!0,mouseDown:!1,draggingFilesW:!1,draggingTab:!1,tabLeftPos:[],serverQueueItems:[],previewWindow:!1,pluginIntervalRefs:[],overPopup:!1,ready:!1,initAliases:function(){for(var a="header files account fmLock filesFrame editor tabsBar findBar content footer system nestValid nestDisplay charDisplay".split(" "),
|
||||
b=0;b<a.length;b++)ICEcoder[a[b]]=top.document.getElementById(a[b])},init:function(){var a,b;ICEcoder.setLayout();top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"));top.ICEcoder.openLastFiles&&top.ICEcoder.autoOpenFiles();setInterval(ICEcoder.updateNestingIndicator,30);a=top.document.getElementById("screenMode");b=["images/restored-screen.gif","images/full-screen.gif"];document.addEventListener("fullscreenchange",function(){a.src=document.fullscreen?b[0]:b[1]},!1);document.addEventListener("mozfullscreenchange",
|
||||
function(){a.src=document.mozFullScreen?b[0]:b[1]},!1);document.addEventListener("webkitfullscreenchange",function(){a.src=document.webkitIsFullScreen?b[0]:b[1]},!1);top.ICEcoder.ready=!0},setLayout:function(a){var b,c;b=window.innerWidth?window.innerWidth:document.body.clientWidth;c=window.innerHeight?window.innerHeight:document.body.clientHeight;this.header.style.width=this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width=this.editor.style.left=this.filesW+"px";this.account.style.height=
|
||||
this.accountH+"px";this.fmLock.style.marginLeft=this.filesW-42+"px";this.filesFrame.style.height=c-40-50-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.nestDisplay.style.left=this.filesW+17+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW+"px",ICEcoder.content.style.height=c-40-30-21-28+"px",setTimeout(function(){for(var a=0;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize("100%",
|
||||
top.ICEcoder.content.style.height)},4))},changeFilesW:function(a){if(!ICEcoder.lockedNav||ICEcoder.lockedNav&&ICEcoder.filesW==ICEcoder.minFilesW)"undefined"!=typeof ICEcoder.changeFilesInt&&clearInterval(ICEcoder.changeFilesInt),ICEcoder.changeFilesInt=setInterval(function(){ICEcoder.changeFilesWStep(a)},10)},changeFilesWStep:function(a){"expand"==a?ICEcoder.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>
|
||||
ICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW=250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>
|
||||
top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.account.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a;a=top.document.getElementById("fmLock");ICEcoder.lockedNav=ICEcoder.lockedNav?!1:!0;a.style.backgroundPosition=ICEcoder.lockedNav?"-64px -16px":"-80px -16px"},contentCleanUp:function(){var a,b;0>["js","coffee","css","less"].indexOf(ICEcoder.openFiles[ICEcoder.selectedTab-
|
||||
1].split(".")[1])&&(a=ICEcoder.getcMInstance(),b=a.getValue(),b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>"),a.setValue(b),a.clearHistory())},moveLine:function(a){var b,c,d;b=top.ICEcoder.getcMInstance();c=b.getCursor().line;"up"==a&&0<c&&(d=c-1);"down"==a&&c<b.lineCount()-1&&(d=c+1);isNaN(d)||(a=b.getLine(d),b.setLine(d,b.getLine(c)),b.setLine(c,a),ICEcoder.highlightLine(d))},highlightLine:function(a){var b;b=top.ICEcoder.getcMInstance();b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},
|
||||
goToLine:function(a){var b;b=ICEcoder.getcMInstance();b.setCursor(a?a-1:document.getElementById("goToLineNo").value-1);b.focus();return!1},switchMode:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a?b.setOption("mode",a):c&&(0<c.indexOf(".js")?b.setOption("mode","javascript"):0<c.indexOf(".coffee")?b.setOption("mode","coffeescript"):0<c.indexOf(".rb")?b.setOption("mode","ruby"):0<c.indexOf(".py")?b.setOption("mode","python"):0<c.indexOf(".css")?b.setOption("mode",
|
||||
"css"):0<c.indexOf(".less")?b.setOption("mode","less"):0<c.indexOf(".md")?b.setOption("mode","markdown"):b.setOption("mode","application/x-httpd-php"))},lineCommentToggle:function(){var a,b,c,d,e,f;a=ICEcoder.getcMInstance();b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);e=d.length;f=2;if(-1<"JavaScript CoffeeScript PHP Python Ruby CSS".split(" ").indexOf(ICEcoder.caretLocType))if(a.somethingSelected())if("Ruby"==ICEcoder.caretLocType||"Python"==ICEcoder.caretLocType){e=a.getCursor(!0).line;
|
||||
for(d=a.getCursor().line;e<=d;e++)a.setLine(e,"#"!=a.getLine(e).slice(0,1)?"#"+a.getLine(e):a.getLine(e).slice(1,a.getLine(e).length))}else a.replaceSelection("/*"!=a.getSelection().slice(0,2)?"/*"+a.getSelection()+"*/":a.getSelection().slice(2,a.getSelection().length-2));else-1<["CoffeeScript","CSS"].indexOf(ICEcoder.caretLocType)?(a.setLine(c,"/*"!=d.slice(0,2)?"/*"+d+"*/":d.slice(2,e).slice(0,e-4)),"/*"==d.slice(0,2)&&(f=-f)):"Ruby"==ICEcoder.caretLocType?(a.setLine(c,"#"!=d.slice(0,1)?"#"+d:d.slice(1,
|
||||
e)),"#"==d.slice(0,1)&&(f=-f)):(a.setLine(c,"//"!=d.slice(0,2)?"//"+d:d.slice(2,e)),"//"==d.slice(0,2)&&(f=-f));else a.somethingSelected()?a.replaceSelection("\x3c!--"!=a.getSelection().slice(0,4)?"\x3c!--"+a.getSelection()+"//--\x3e":a.getSelection().slice(4,a.getSelection().length-5)):(a.setLine(c,"\x3c!--"!=d.slice(0,4)?"\x3c!--"+d+"//--\x3e":d.slice(4,e).slice(0,e-9)),f="\x3c!--"==d.slice(0,4)?-4:4);a.somethingSelected()||a.setCursor(c,b+f)},highlightBlock:function(a,b){var c,d,e,f;c=top.ICEcoder.getcMInstance();
|
||||
if(b)top.ICEcoder.dontUpdateNest?c.setCursor(top.ICEcoder.cursorOrigLine,top.ICEcoder.cursorOrigCh):top.ICEcoder.getNestLocation("updateNestDisplay"),top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;top.ICEcoder.cursorOrigLine=c.getCursor().line;top.ICEcoder.dontUpdateNest=!0;d={};d.ch=c.getCursor().ch;d.line=c.getCursor().line;for(var g=top.ICEcoder.htmlTagArray.length-1;g>=a;g--)e=c.getSearchCursor("<"+top.ICEcoder.htmlTagArray[g],d),e.findPrevious(),d.ch=e.from().ch,
|
||||
d.line=e.from().line,g==a&&(f=c.getSearchCursor(">",d),f.findNext(),c.setCursor(f.from().line,f.from().ch+1),top.ICEcoder.getNestLocation(),ICEcoder.htmlTagArray.length-1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(c,d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf("</"+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+
|
||||
3,!top.ICEcoder.dontSelect?c.setSelection(d,e):top.ICEcoder.dontSelect=!1,c.scrollIntoView(d))}},setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);d.focus();for(d=b=0;d<=a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf(">",b+1);ICEcoder.nestDisplay.innerHTML=ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,
|
||||
c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,b.operation(function(){b.replaceSelection("<div>\n"+b.getSelection()+"\n</div>");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+2,"subtract")})):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+"</"+a+">"));"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9})},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();
|
||||
a||(a=b.getCursor().line);b.setLine(a,b.getLine(a)+"<br>")},duplicateLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.setLine(a,b.getLine(a)+"\n"+b.getLine(a));b.setCursor(a+1,c)},removeLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.removeLine(a);b.setCursor(a-1,c)},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);
|
||||
else{top.ICEcoder.origCurorPos=a.getCursor();a=["var "+b,"function "+b,b+"=function",b+"=new function",b+":","def "+b,"class "+b];for(b=0;b<a.length;b++)top.ICEcoder.findReplace(a[b],!1,!1)&&(b=a.length)}},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.openCloseDir(this,!1)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");
|
||||
b&&(top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/get-branch.php?location="+a.childNodes[1].id);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a){var b,c;""==top.ICEcoder.thisFileFolderLink?a.ctrlKey||top.ICEcoder.deselectAllFiles():top.ICEcoder.thisFileFolderLink&&(c=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),b=ICEcoder.filesFrame.contentWindow.document.getElementById(c),a.ctrlKey?
|
||||
-1<top.ICEcoder.selectedFiles.indexOf(c)?(ICEcoder.selectDeselectFile("deselect",b),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(c),1)):(ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)):(top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)));document.findAndReplace.target[2].innerHTML=!top.ICEcoder.selectedFiles[0]?"all files":"selected files";document.findAndReplace.target[3].innerHTML=!top.ICEcoder.selectedFiles[0]?
|
||||
"all filenames":"selected filenames";top.ICEcoder.fMIconVis("fMOpen",1==top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMNewFile",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMNewFolder",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMDelete",0<top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMRename",1==top.ICEcoder.selectedFiles.length?
|
||||
1:0.3);top.document.getElementById("fileMenu").style.display="none"},deselectAllFiles:function(){for(var a,b=0;b<top.ICEcoder.selectedFiles.length;b++)a=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.selectedFiles[b]),ICEcoder.selectDeselectFile("deselect",a);top.ICEcoder.selectedFiles.length=0},selectDeselectFile:function(a,b){var c;b&&(c=-1<top.ICEcoder.openFiles.indexOf(b.id.replace(/\|/g,"/"))?!0:!1,b.style.backgroundColor=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1]==b.id.replace(/\|/g,"/")?"#49d":"select"==a?"#888":b.style.backgroundColor=c?"rgba(255,255,255,0.15)":"transparent",b.style.color="select"==a?"#fff":"#eee")},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/");if(b=top.ICEcoder.getInput("Enter New Folder Name at "+a,""))b=(a+"/"+b).replace(/\/\//,"/"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+b.replace(/\//g,"|")),top.ICEcoder.serverMessage("<b>Creating Folder</b><br>"+
|
||||
b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");!1!==top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)?top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1):""!=top.ICEcoder.thisFileFolderLink&&"file"==top.ICEcoder.thisFileFolderType&&(a=top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/"),b=!0,100>top.ICEcoder.openFiles.length?-1<top.ICEcoder.openFiles.indexOf(a)&&"/[NEW]"!=a&&(b=!1,top.ICEcoder.switchTab(i+1)):
|
||||
(top.ICEcoder.message("Sorry, you can only have 100 files open at a time!"),b=!1),b&&(top.ICEcoder.shortURL=a,"/[NEW]"!=a?(top.ICEcoder.thisFileFolderLink=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink),top.ICEcoder.serverMessage("<b>Opening File</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},openPrompt:function(){var a;if(a=top.ICEcoder.getInput("Enter relative file path (prefixed with /) or remote URL",
|
||||
""))-1<a.indexOf("://")?top.ICEcoder.getRemoteFile(a):top.ICEcoder.openFile(a)},getRemoteFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+a);top.ICEcoder.serverMessage("<b>Getting</b><br>"+a)},saveFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|")+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+(a?"saveAs":
|
||||
"save"));top.ICEcoder.serverMessage("<b>Saving</b><br>"+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){var c,d;a?c=a.replace(/\|/g,"/"):(c=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"),a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"));b||(b=top.ICEcoder.getInput("Please enter the new name for",c));b&&(d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/")),-1<d&&(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',
|
||||
c=top.ICEcoder.openFiles[d],top.document.getElementById("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,""),top.document.getElementById("tab"+(d+1)).title=b),top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")),top.ICEcoder.serverMessage("<b>Renaming to</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFile:function(){var a;0<top.ICEcoder.selectedFiles.length&&(a=top.ICEcoder.ask("Delete:\n\n"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,
|
||||
"/").replace(/,/g,"\n")+"?"));if(a){a="";for(var b=0;b<top.ICEcoder.selectedFiles.length;b++)a+=top.ICEcoder.selectedFiles[b],b<top.ICEcoder.selectedFiles.length-1&&(a+=";");top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a);top.ICEcoder.serverMessage("<b>Deleting File</b><br>"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"))}},copyFile:function(){top.ICEcoder.copiedFiles=[];for(var a=0;a<top.ICEcoder.selectedFiles.length;a++)top.ICEcoder.copiedFiles[a]=
|
||||
top.ICEcoder.selectedFiles[a];top.document.getElementById("fmMenuPasteOption").style.display="block";top.ICEcoder.hideFileMenu()},pasteFile:function(a){if(top.ICEcoder.copiedFiles)for(var b=0;b<top.ICEcoder.copiedFiles.length;b++)top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFiles[b]+"&location="+a),top.ICEcoder.serverMessage("<b>Pasting File</b><br>"+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"));else top.ICEcoder.message("Nothing to paste, copy a file/folder first!")},
|
||||
uploadFilesSelect:function(a){top.document.getElementById("uploadDir").value=a;top.document.getElementById("fileInput").click()},uploadFilesSubmit:function(){""!=top.document.getElementById("fileInput").value&&(top.ICEcoder.showHide("show",top.document.getElementById("loadingMask")),document.getElementById("uploadFilesForm").submit(),event.preventDefault())},showMenu:function(a){var b;(0==top.ICEcoder.selectedFiles.length||-1==top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.rightClickedFile.replace(/\//g,
|
||||
"|")))&&top.ICEcoder.selectFileFolder(a);"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(a=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",b=top.document.getElementById("folderMenuItems"),b.style.display="folder"==a&&1==top.ICEcoder.selectedFiles.length?"block":"none",singleFileMenuItems.style.display=1<top.ICEcoder.selectedFiles.length?"none":"block",document.getElementById("fileMenu").style.display="inline-block",document.getElementById("fileMenu").style.left=
|
||||
top.ICEcoder.mouseX+20+"px",document.getElementById("fileMenu").style.top=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10+"px");return!1},showFileMenu:function(){document.getElementById("fileMenu").style.display="inline-block"},hideFileMenu:function(){document.getElementById("fileMenu").style.display="none"},updateFileManagerList:function(a,b,c,d,e,f){var g,l,h,j,m,n,k,p;if("add"==a&&!document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,
|
||||
"").replace(/\//g,"|")+"|"+c)){g=-1<c.indexOf(".")?"file":"folder";l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"");h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));j=h.parentNode.parentNode.nextSibling;m=document.createTextNode("\n");n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+g+"','"+b.replace(/\/$/,"").replace(/\//g,
|
||||
"|")+"|"+c+"')\" onMouseOut=\"top.ICEcoder.overFileFolder('"+g+'\',\'\')" style="position: relative; left:-22px"> <span id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="color: #888; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>j.childNodes.length)k=document.createElement("ul"),j=h.parentNode.parentNode,j.parentNode.insertBefore(k,j.nextSibling),k=document.createElement("li"),
|
||||
k.className=l,k.innerHTML=n,j.nextSibling.appendChild(k),j.nextSibling.appendChild(m);else for(h=0;h<=j.childNodes.length-1;h++)if(j.childNodes[h].className&&(k=0<j.childNodes[h].className.indexOf("directory")?"folder":"file",p=j.childNodes[h].getElementsByTagName("span")[0].innerHTML,k==g&&p>c||"folder"==g&&"file"==k||h==j.childNodes.length-1)){k=document.createElement("li");k.className=l;k.innerHTML=n;h==j.childNodes.length-1?(j.appendChild(k),j.appendChild(m)):(j.insertBefore(k,j.childNodes[h]),
|
||||
j.insertBefore(m,j.childNodes[h+1]));break}"file"==g&&!f&&(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(e=e.replace(/\//g,"|"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=document.getElementById("filesFrame").contentWindow.document.getElementById(e+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms");"chmod"==a&&(e=top.ICEcoder.rightClickedFile.replace(/\|/g,
|
||||
"/"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e.replace(/\//g,"|")+"_perms"),h.innerHTML=d);"delete"==a&&(h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c).parentNode.parentNode,h.parentNode.removeChild(h))},fMIcon:function(a){"save"==a&&0<ICEcoder.openFiles.length&&top.ICEcoder.saveFile();1==ICEcoder.selectedFiles.length&&(top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.selectedFiles[0].replace("|",
|
||||
"/"),"open"==a&&-1<ICEcoder.selectedFiles[0].indexOf(".")?(top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()):"newFile"==a?top.ICEcoder.newFile():"newFolder"==a?top.ICEcoder.newFolder():"rename"==a&&top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile));"delete"==a&&0<ICEcoder.selectedFiles.length&&top.ICEcoder.deleteFile();"view"==a&&0<ICEcoder.openFiles.length&&window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1])},refreshFileManager:function(){var a;a=top.document.getElementById("progressBar").style;
|
||||
a.webkitAnimation=a.mozAnimation="";setTimeout(function(){a.webkitAnimation=a.mozAnimation="fullexpand 10s ease-out"},4);top.ICEcoder.showHide("show",top.document.getElementById("loadingMask"));top.ICEcoder.filesFrame.src="files.php";top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"))}},findReplaceOptions:function(){top.document.getElementById("rText").style.display=
|
||||
top.document.getElementById("replace").style.display=top.document.getElementById("rTarget").style.display="and"==document.findAndReplace.connector.value?"inline-block":"none"},findReplace:function(a,b,c){var d,e,f,g;a=a.toLowerCase();d=top.document.getElementById("replace").value;e=top.document.getElementById("results");if((f=ICEcoder.getcMInstance())&&0<a.length&&"this document"==document.findAndReplace.target.value){f.getValue().toLowerCase();"and"==document.findAndReplace.connector.value&&("replace"==
|
||||
document.findAndReplace.replaceAction.value&&f.getSelection().toLowerCase()==a?f.replaceSelection(d):"replace all"==document.findAndReplace.replaceAction.value&&c&&(c=RegExp(a,"gi"),f.setValue(f.getValue().replace(c,d))));c=f.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];for(d=0;d<c.length;d++)c.substr(d,a.length)==a&&d!=ICEcoder.findResult&&ICEcoder.results.push(d);ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)e.innerHTML=ICEcoder.results.length+
|
||||
" results";else{b=1;for(d=g=0;d<c.length;d++)c.indexOf("\n",d)==d&&b<=f.getCursor().line&&(b++,g=d);b=g+f.getCursor().ch+1;for(d=ICEcoder.findResult=0;d<ICEcoder.results.length;d++)ICEcoder.results[d]<b&&ICEcoder.findResult++;ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);e.innerHTML="Highlighted result "+(ICEcoder.findResult+1)+" of "+ICEcoder.results.length+" results";for(d=b=0;d<ICEcoder.results[ICEcoder.findResult];d++)c.indexOf("\n",d)==d&&b++;f.lineInfo(0);e=f.getSearchCursor(a,
|
||||
f.getCursor(),!0);e.findNext();e.from()||(e=f.getSearchCursor(a,{line:0,ch:0},!0),e.findNext());f.setSelection(e.from(),e.to());f.focus();top.ICEcoder.findMode=!0}return!0}e.innerHTML="No results";return!1}if(""!=a&&c){filesQS=e=f="";"and"==document.findAndReplace.connector.value&&(f="&replace="+d);0<=document.findAndReplace.target.value.indexOf("file")&&(e="&target="+document.findAndReplace.target.value.replace(/ /g,"-"));if("selected files"==document.findAndReplace.target.value){filesQS="&selectedFiles=";
|
||||
for(d=0;d<top.ICEcoder.selectedFiles.length;d++)filesQS+=top.ICEcoder.selectedFiles[d]+":";filesQS=filesQS.replace(/\:$/,"")}a=a.replace(/\'/g,"'");a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a;top.ICEcoder.showHide("show",top.document.getElementById("loadingMask"));top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+a+f+e+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'}},replaceInFile:function(a,b,
|
||||
c){top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+a.replace(/\//g,"|")+"&find="+b+"&replace="+c);top.ICEcoder.serverMessage("<b>Replacing text in</b><br>"+a)},getNestLocation:function(a){var b,c,d;if(b=ICEcoder.getcMInstance()){c=b.getValue();b=b.getTokenAt(b.getCursor()).state;if("undefined"!=typeof b.curState&&"undefined"!=typeof b.curState.htmlState){ICEcoder.htmlTagArray=[];for(d=b.curState.htmlState.context;d;d=d.prev)"undefined"!=typeof d.tagName&&ICEcoder.htmlTagArray.unshift(d.tagName)}ICEcoder.tagString=
|
||||
ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1];"JavaScript"==ICEcoder.caretLocType&&(ICEcoder.tagString="script");if(a&&!top.ICEcoder.dontUpdateNest&&(ICEcoder.nestDisplay.innerHTML="","undefined"!=typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]&&(a=ICEcoder.openFiles[ICEcoder.selectedTab-1],0>["js","coffee","css","less"].indexOf(a.split(".")[1])&&-1==c.indexOf("include(")&&-1==c.indexOf("include_once(")&&(-1<c.indexOf("<html")||-1<c.indexOf("<body"))))){for(a=0;a<ICEcoder.htmlTagArray.length;a++)c=
|
||||
'onMouseover="top.ICEcoder.highlightBlock('+a+')" onMouseout="top.ICEcoder.highlightBlock('+a+",'hide')\" onClick=\"top.ICEcoder.setPosition("+a+",top.ICEcoder.startPosLine,'"+ICEcoder.htmlTagArray[a]+"')\"",0==a&&(ICEcoder.nestDisplay.innerHTML+="<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'),ICEcoder.nestDisplay.innerHTML+="<a "+c+' style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+
|
||||
ICEcoder.htmlTagArray[a]+"</a>",ICEcoder.nestDisplay.innerHTML+=a<ICEcoder.htmlTagArray.length-1?"<div "+c+' style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0; cursor: pointer"></div>':"<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -15px 0; cursor: pointer"></div>';"undefined"!=typeof b.curState&&
|
||||
0<ICEcoder.htmlTagArray.length&&(ICEcoder.nestDisplay.innerHTML+='<a style="display: inline-block; cursor: default; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px; color: #666">'+(b.curState.tagName?b.curState.tagName:"content")+"</a>")}}},updateNestingIndicator:function(){var a,b,c;a=ICEcoder.getcMInstance();b=!0;c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a&&(c&&-1==["js","coffee","css","less"].indexOf(c.split(".")[1]))&&(b="error"!=a.getTokenAt({line:a.lineCount(),ch:a.lineInfo(a.lineCount()-
|
||||
1).text.length}).className?!0:!1);ICEcoder.nestValid.style.background=b?"#0b0":"#f00";ICEcoder.nestValid.title=b?"Nesting OK":"Nesting Broken"},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getValue();c=a.getCursor().line;a=a.getCursor().ch;for(var e=d=0;e<c;e++)d=b.indexOf("\n",d),d+=1;ICEcoder.caretPos=d+a-1;ICEcoder.getNestLocation("yes")},updateCharDisplay:function(){var a;a=ICEcoder.getcMInstance();ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+
|
||||
", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},caretLocationType:function(){var a,b;a=ICEcoder.getcMInstance();b="Unknown";a=a.getValue().substr(0,ICEcoder.caretPos+1);a.lastIndexOf("<script")>a.lastIndexOf("\x3c/script>")&&"Unknown"==b?b="JavaScript":a.lastIndexOf("<?")>a.lastIndexOf("?>")&&"Unknown"==b?b="PHP":a.lastIndexOf("<%")>a.lastIndexOf("%>")&&"Unknown"==b?b="Ruby":a.lastIndexOf("<")>a.lastIndexOf(">")&&"Unknown"==b?b="HTML":"Unknown"==b&&(b="Content");a=ICEcoder.openFiles[ICEcoder.selectedTab-
|
||||
1];0<a.indexOf(".js")?b="JavaScript":0<a.indexOf(".coffee")?b="CoffeeScript":0<a.indexOf(".py")?b="Python":0<a.indexOf(".rb")?b="Ruby":0<a.indexOf(".css")?b="CSS":0<a.indexOf(".less")?b="LESS":0<a.indexOf(".md")&&(b="Markdown");ICEcoder.caretLocType=b},redoChangedContent:function(a){var b,c;b=ICEcoder.getcMInstance();c=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(!a.ctrlKey&&27!=c&&20!=c&&(16>c||19<c)&&(37>c||40<c)&&(144!=c||145!=c)&&(45!=c||46!=c)&&(33>c||36<c)&&(91!=c||92!=c)&&(112>c||123<
|
||||
c))ICEcoder.changedContent[ICEcoder.selectedTab-1]=0<b.historySize().undo?1:0,ICEcoder.redoTabHighlight(ICEcoder.selectedTab)},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow["new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:
|
||||
a.clientY+document.body.scrollTop;"top"!=b&&(top.ICEcoder.mouseY+=90);"editor"==b&&(top.ICEcoder.mouseX+=top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-top.ICEcoder.diffStartX;if(!1!==top.ICEcoder.draggingTab&&(top.ICEcoder.diffStartX&&(-10>=a||10<=a))&&top.ICEcoder.mouseX>parseInt(top.ICEcoder.files.style.width,10))top.ICEcoder.tabDragMouseX=top.ICEcoder.mouseX-parseInt(top.ICEcoder.files.style.width,
|
||||
10)-top.ICEcoder.tabDragMouseXStart,top.ICEcoder.tabDragMove();if(top.ICEcoder.ready&&(a=window.innerWidth?window.innerHeight:document.body.clientHeight,top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7&&40<top.ICEcoder.mouseY&&top.ICEcoder.mouseY<a-30||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=
|
||||
a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=a}},serverMessage:function(a){var b;b=document.getElementById("serverMessage");a?(b.innerHTML=a,b.style.display="inline-block"):setTimeout(function(){b.style.display="none"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=
|
||||
c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.document.getElementById("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},
|
||||
""==b.style.backgroundColor&&(b.style.display="none"),top.document.getElementById("header").appendChild(b),a.addWidget(a.getCursor(),top.document.getElementById("cssColor"),!0))},showColorPicker:function(a){top.document.getElementById("blackMask").style.visibility="visible";top.document.getElementById("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#123456" style="border: 0; width: 70px; padding-left: 5px"><input type="button" onClick="top.ICEcoder.insertColorValue()" value="insert >" style="background: #888; color: #fff; height: 18px; width: 70px; border: 0; margin-left: 5px; cursor: pointer">';
|
||||
farbtastic("picker","color");a&&top.document.getElementById("picker").farbtastic.setColor(a)},drawCanvasImage:function(a){var b=document.getElementById("canvasPicker").getContext("2d"),c=new Image;c.src=a.src;c.onload=function(){document.getElementById("canvasPicker").width=a.width;document.getElementById("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};document.getElementById("canvasPicker").onmousemove=function(a){var c=b.getImageData(a.pageX-this.offsetLeft,a.pageY-this.offsetTop,
|
||||
1,1).data;a=c[0];var f=c[1],g=c[2],c=a+","+f+","+g;a=top.ICEcoder.rgbToHex(a,f,g);document.getElementById("rgbMouseXY").value=c;document.getElementById("hexMouseXY").value="#"+a;document.getElementById("hexMouseXY").style.backgroundColor=document.getElementById("rgbMouseXY").style.backgroundColor="#"+a};document.getElementById("canvasPicker").onclick=function(){document.getElementById("rgb").value=document.getElementById("rgbMouseXY").value;document.getElementById("hex").value=document.getElementById("hexMouseXY").value;
|
||||
document.getElementById("hex").style.backgroundColor=document.getElementById("rgb").style.backgroundColor=document.getElementById("hex").value}},rgbToHex:function(a,b,c){return top.ICEcoder.toHex(a)+top.ICEcoder.toHex(b)+top.ICEcoder.toHex(c)},toHex:function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789ABCDEF".charAt((a-a%16)/16)+"0123456789ABCDEF".charAt(a%16)},insertColorValue:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor());
|
||||
a.replaceRange(top.document.getElementById("color").value,{line:a.getCursor().line,ch:b.start},{line:a.getCursor().line,ch:b.end})},fMIconVis:function(a,b){var c;if(c=top.document.getElementById(a))c.style.opacity=b},isOpen:function(a){a=a.replace(/\|/g,"/").replace(top.docRoot+top.iceRoot,"");a=top.ICEcoder.openFiles.indexOf(a);return-1!=a?a:!1},updateHints:function(){var a;if("undefined"!=typeof JSHINT&&-1<top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].indexOf(".js")){a=ICEcoder.getcMInstance();
|
||||
a.operation(function(){for(var b=top.ICEcoder["cM"+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);b.length=0;JSHINT(a.getValue());for(c=0;c<JSHINT.errors.length;++c){var f=JSHINT.errors[c];if(f){var g=document.createElement("div"),l=g.appendChild(document.createElement("span"));l.innerHTML="!!";l.className="lint-error-icon";g.appendChild(document.createTextNode(f.reason));g.className="lint-error";b.push(a.addLineWidget(f.line-1,g,{coverGutter:!1,
|
||||
noHScroll:!0}))}}});var b=a.getScrollInfo(),c=a.charCoords({line:a.getCursor().line+1,ch:0},"local").top;b.top+b.clientHeight<c&&a.scrollTo(null,c-b.clientHeight+3)}},startPluginIntervals:function(a,b,c,d){top.ICEcoder["plugTimer"+a]=-1<["_parent","_top","_self",""].indexOf(c)?top.ICEcoder["plugTimer"+a]=setInterval("window.location='"+b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",b);top.ICEcoder.serverMessage(c.split(":")[1])},
|
||||
6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+b+"','"+c+"')",6E4*d);top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a;a=ICEcoder.getcMInstance();top.ICEcoder.codeAssist=!top.ICEcoder.codeAssist;top.ICEcoder.cssColorPreview();a.focus();if(top.ICEcoder.codeAssist)top.ICEcoder.updateHints();else for(i=0;i<top.ICEcoder.cMInstances.length;i++)a=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]],a.operation(function(){for(var b=top.ICEcoder["cM"+
|
||||
top.ICEcoder.cMInstances[i]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);b.length=0})},serverQueue:function(a,b){var c,d,e;c=ICEcoder.getcMInstance();for(e=d=0;e<ICEcoder.serverQueueItems.length;e++)0<ICEcoder.serverQueueItems[e].indexOf("action=save")&&d++;d++;if("add"==a)ICEcoder.serverQueueItems.push(b),0<b.indexOf("action=save")&&(e=document.createElement("textarea"),e.setAttribute("id","saveTemp"+d),document.body.appendChild(e),document.getElementById("saveTemp"+d).value=c.getValue());
|
||||
else if("del"==a){if(ICEcoder.serverQueueItems[0]&&0<ICEcoder.serverQueueItems[0].indexOf("action=save")){c=d-1;for(e=1;e<c;e++)document.getElementById("saveTemp"+e).value=document.getElementById("saveTemp"+(e+1)).value;c=document.getElementById("saveTemp"+c);c.parentNode.removeChild(c)}ICEcoder.serverQueueItems.splice(0,1)}("del"==a&&1<=ICEcoder.serverQueueItems.length||1==ICEcoder.serverQueueItems.length)&&setTimeout(function(){top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=
|
||||
ICEcoder.serverQueueItems[0]},1)},cancelAllActions:function(){window.stop();0<ICEcoder.serverQueueItems.length&&ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"));top.ICEcoder.serverMessage('<b style="color: #d00">Cancelled tasks</b>');setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,
|
||||
"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+a)},autoOpenFiles:function(){if(0<top.ICEcoder.previousFiles.length&&top.ICEcoder.ask("Open previous files?\n\n"+top.ICEcoder.previousFiles.length+" files:\n"+top.ICEcoder.previousFiles.join("\n").replace(/\|/g,"/").replace(RegExp(top.docRoot+top.iceRoot,"gi"),"")))for(var a=0;a<top.ICEcoder.previousFiles.length;a++)top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[a].replace("|",
|
||||
"/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},settingsScreen:function(a){a||(top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 600px"></iframe>');top.ICEcoder.showHide(a?"hide":"show",top.document.getElementById("blackMask"))},helpScreen:function(){top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';
|
||||
top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},showManual:function(a){top.document.getElementById("mediaContainer").innerHTML='<iframe src="http://icecoder.net/manual?version='+a+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},propertiesScreen:function(a){top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/properties.php?fileName='+a.replace(/\//g,"|")+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';
|
||||
top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,l,h){var j;top.ICEcoder.theme=a.slice(a.lastIndexOf("/")+1,a.lastIndexOf("."));"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");j=document.createElement("link");j.setAttribute("rel","stylesheet");j.setAttribute("type","text/css");j.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(j);a=-1<["eclipse","elegant","neat"].indexOf(top.ICEcoder.theme)?
|
||||
"#ccc":"#000";top.ICEcoder.switchTab(top.ICEcoder.selectedTab);top.document.getElementById("codeAssist").checked=b;c!=top.ICEcoder.lockedNav&&top.ICEcoder.lockUnlockNav();c||(ICEcoder.changeFilesW("contract"),top.document.getElementById("fileMenu").style.display="none");c=ICEcoder.content.contentWindow.document.styleSheets[3];b=c.rules?"rules":"cssRules";c[b][0].style.fontSize=e;c[b][5].style.content=d?'"\\21e5"':'" "';c[b][2].style.cssText="background: "+a+" !important";top.ICEcoder.lineWrapping=
|
||||
f;top.ICEcoder.indentWithTabs=g;top.ICEcoder.indentSize=l;for(d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("tabSize",
|
||||
top.ICEcoder.indentSize);h&&top.ICEcoder.refreshFileManager()},updateResultsDisplay:function(a){ICEcoder.findReplace(top.document.getElementById("find").value,!0,!1);document.getElementById("results").style.display="show"==a?"inline-block":"none"},fullScreenSwitcher:function(){"undefined"!=typeof document.cancelFullScreen?document.fullScreen?document.cancelFullScreen():document.body.requestFullScreen():"undefined"!=typeof document.mozCancelFullScreen?document.mozFullScreen?document.mozCancelFullScreen():
|
||||
document.body.mozRequestFullScreen():"undefined"!=typeof document.webkitCancelFullScreen&&(document.webkitIsFullScreen?document.webkitCancelFullScreen():document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT))},zipIt:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="plugins/zip-it/index.php?zip="+a},chmod:function(a,b){top.ICEcoder.showHide("hide",top.document.getElementById("blackMask"));top.ICEcoder.serverQueue("add","lib/file-control.php?action=perms&file="+
|
||||
a.replace(top.iceRoot,"")+"&perms="+b);top.ICEcoder.serverMessage("<b>chMod "+b+" on </b><br>"+a.replace(top.iceRoot,""))},openPreviewWindow:function(){var a,b,c;b=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];c=b.substr(b.lastIndexOf("/")+1);c=c.substr(c.lastIndexOf(".")+1);a=ICEcoder.getcMInstance();top.ICEcoder.previewWindow=window.open(b,"previewWindow");-1<["md"].indexOf(c)&&(top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())})},
|
||||
openTerminal:function(){top.ICEcoder.demoMode?top.ICEcoder.message("Sorry, you need to be logged in to use the terminal"):window.open("terminal")},logout:function(){window.location+="?logout"},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b;b=top.ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},switchTab:function(a,b){var c;ICEcoder.selectedTab=a;if(c=
|
||||
ICEcoder.getcMInstance()){ICEcoder.switchMode();for(var d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].getWrapperElement().style.display="none";c.setOption("theme",top.ICEcoder.theme);c.getWrapperElement().style.display="block";b||setTimeout(function(){c.focus()},4);c.refresh();ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.findMode=!1;ICEcoder.findReplace(top.document.getElementById("find").value,!0,!1);top.ICEcoder.codeAssist&&top.ICEcoder.updateHints();
|
||||
top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay()}},newTab:function(){var a;ICEcoder.cMInstances.push(ICEcoder.nextcMInstance);ICEcoder.selectedTab=ICEcoder.cMInstances.length;ICEcoder.showHide("show",ICEcoder.content);ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance);ICEcoder.setLayout();ICEcoder.thisFileFolderType="file";ICEcoder.thisFileFolderLink="/[NEW]";ICEcoder.openFile();a=ICEcoder.getcMInstance("new");ICEcoder.switchTab(ICEcoder.openFiles.length);
|
||||
a.removeLineClass(ICEcoder["cMActiveLine"+ICEcoder.selectedTab],"background");ICEcoder["cMActiveLine"+ICEcoder.selectedTab]=a.addLineClass(0,"background","cm-s-activeLine");ICEcoder.nextcMInstance++},createNewTab:function(){var a;top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);top.document.getElementById("tab"+top.ICEcoder.openFiles.length).style.display="inline-block";a=top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];top.document.getElementById("tab"+top.ICEcoder.openFiles.length).innerHTML=
|
||||
'<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+a.slice(a.lastIndexOf("/")).replace(/\//,"");top.document.getElementById("tab"+top.ICEcoder.openFiles.length).title="/"+top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-
|
||||
1].replace(/\//,"");top.ICEcoder.setTabWidths();top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length;top.ICEcoder.changedContent.push(0);top.ICEcoder.setPreviousFiles()},nextTab:function(){top.ICEcoder.switchTab(top.ICEcoder.selectedTab+1<=top.ICEcoder.openFiles.length?top.ICEcoder.selectedTab+1:1,"noFocus")},previousTab:function(){top.ICEcoder.switchTab(1<=top.ICEcoder.selectedTab-1?top.ICEcoder.selectedTab-1:top.ICEcoder.openFiles.length,
|
||||
"noFocus")},renameTab:function(a,b){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.document.getElementById("tab"+a).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+c.slice(c.lastIndexOf("/")).replace(/\//,
|
||||
"");top.document.getElementById("tab"+a).title="/"+top.ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.changedContent.length;d++){document.getElementById("tab"+d).childNodes[0]&&(document.getElementById("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=1==ICEcoder.changedContent[d-1]?"#b00":"transparent");b=d==a?"#000":"#fff";if("undefined"!=typeof top.ICEcoder.openFiles[d-1]&&"/[NEW]"!=top.ICEcoder.openFiles[d-1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-
|
||||
1].replace(/\//g,"|"))))c.style.backgroundColor=d==a?"#49d":"rgba(255,255,255,0.15)";document.getElementById("tab"+d).style.color=b;b=d==a?-22:0;document.getElementById("tab"+d).style.backgroundPosition="0 "+b+"px"}top.ICEcoder.fMIconVis("fMSave",1==ICEcoder.changedContent[a-1]?1:0.3)},closeTab:function(a,b){var c;ICEcoder.getcMInstance();c=!0;1==ICEcoder.changedContent[a-1]&&(c=top.ICEcoder.ask("You have made changes.\n\nAre you sure you want to close without saving?"));if(c){c=top.ICEcoder.openFiles[a-
|
||||
1];for(var d=a;d<ICEcoder.openFiles.length;d++)top.document.getElementById("tab"+d).innerHTML=top.document.getElementById("tab"+(d+1)).innerHTML,top.document.getElementById("tab"+d).title=top.document.getElementById("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d];ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.document.getElementById("tab"+
|
||||
ICEcoder.openFiles.length).style.display="none";top.document.getElementById("tab"+ICEcoder.openFiles.length).innerHTML="";top.document.getElementById("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?ICEcoder.selectedTab-=1:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",0.3):(ICEcoder.switchMode(),
|
||||
ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.changedContent.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.getNestLocation("update");top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,"|")));b||top.ICEcoder.setPreviousFiles()}top.ICEcoder.canSwitchTabs=!1;top.ICEcoder.setTabWidths("posOnlyNewTab");setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(ICEcoder.ask("Close all tabs?"))for(var a=
|
||||
top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1)},setTabWidths:function(a){var b,c,d,e,f;b=parseInt(top.ICEcoder.content.style.width,10)-41-24-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=41;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&(g=top.ICEcoder.openFiles.length),d=168*top.ICEcoder.openFiles.length>b?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?41:parseInt(top.document.getElementById("tab"+g).style.left,10),f=0==g?0:parseInt(top.document.getElementById("tab"+
|
||||
g).style.width,10)+18,a?d=-18:(top.document.getElementById("tab"+(g+1)).style.left=e+f+"px",top.document.getElementById("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.document.getElementById("newTab").style.left=e+f+d+18+"px"},tabDragStart:function(a){top.ICEcoder.draggingTab=a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-(parseInt(top.ICEcoder.files.style.width,10)+41+18))%150;top.document.getElementById("tab"+a).style.zIndex=
|
||||
2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.document.getElementById("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a,b;a=parseInt(top.document.getElementById("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=41<=top.ICEcoder.tabDragMouseX?top.ICEcoder.tabDragMouseX<=parseInt(top.document.getElementById("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.document.getElementById("newTab").style.left,10)-a:41;
|
||||
top.document.getElementById("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.document.getElementById("tab"+c).style.opacity=c==top.ICEcoder.draggingTab?1:0.5,b=top.ICEcoder.tabLeftPos[c]?top.ICEcoder.tabLeftPos[c]-top.ICEcoder.tabLeftPos[c-1]:b,c!=top.ICEcoder.draggingTab&&(c<top.ICEcoder.draggingTab?top.document.getElementById("tab"+c).style.left=a<=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-
|
||||
1]+b:top.ICEcoder.tabLeftPos[c-1]:top.document.getElementById("tab"+c).style.left=a>=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top.ICEcoder.tabLeftPos[c-1])},tabDragEnd:function(){var a,b;top.ICEcoder.setTabWidths();for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.ICEcoder.thisLeft>=top.ICEcoder.tabLeftPos[c-1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>c?c+1:c),top.document.getElementById("tab"+c).className="tab",top.document.getElementById("tab"+
|
||||
c).style.opacity=1,c!=top.ICEcoder.dragTabNo?top.document.getElementById("tab"+c).style.zIndex=1:setTimeout(function(){top.document.getElementById("tab"+c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;
|
||||
b=[ICEcoder.changedContent,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e<b.length;e++){for(var f=0;f<b[e].length;f++)c[e].push(b[e][a[f]-1]);b[e]=c[e]}for(e=0;e<a.length;e++)document.getElementById("tab"+a[e]).id="tab"+(e+1)+".temp",top.ICEcoder.selectedTab==a[e]&&(d=e+1);for(e=0;e<a.length;e++)document.getElementById("tab"+(e+1)+".temp").id="tab"+(e+1);top.document.getElementById("tab"+d)&&(top.document.getElementById("tab"+d).className="tab tabSlide");
|
||||
ICEcoder.changedContent=b[0];ICEcoder.openFiles=b[1];ICEcoder.openFileMDTs=b[2];ICEcoder.cMInstances=b[3];top.ICEcoder.setTabWidths();top.ICEcoder.switchTab(d)},alphaTabs:function(){var a,b,c,d,e;a=[];b=[];c=[];for(var f=0;f<top.ICEcoder.openFiles.length;f++)a.push(top.ICEcoder.openFiles[f].slice(top.ICEcoder.openFiles[f].lastIndexOf("/")+1)),b.push(top.ICEcoder.openFiles[f]),top.document.getElementById("tab"+(f+1)).className="tab tabSlide";for(;0<a.length;){d=a[0];nextValueFull=b[0];for(f=e=0;f<
|
||||
a.length;f++)a[f]<d&&(d=a[f],nextValueFull=top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(b[f])],e=f);c.push(top.ICEcoder.openFiles.indexOf(nextValueFull)+1);a.splice(e,1);b.splice(e,1)}top.ICEcoder.sortTabs(c)},interceptKeys:function(a,b){var c;c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(46==c&&"files"==a)return top.ICEcoder.deleteFile(),!1;if(b.altKey){if(b.ctrlKey&&"content"==a){if(68==c)return top.ICEcoder.tagWrapper("div"),!1;if(83==c)return top.ICEcoder.tagWrapper("span"),!1;
|
||||
if(80==c)return top.ICEcoder.tagWrapper("p"),!1;if(65==c)return top.ICEcoder.tagWrapper("a"),!1;if(66==c)return top.ICEcoder.tagWrapper("b"),!1;if(73==c)return top.ICEcoder.tagWrapper("i"),!1;if(71==c)return top.ICEcoder.tagWrapper("strong"),!1;if(69==c)return top.ICEcoder.tagWrapper("em"),!1;if(49==c)return top.ICEcoder.tagWrapper("h1"),!1;if(50==c)return top.ICEcoder.tagWrapper("h2"),!1;if(51==c)return top.ICEcoder.tagWrapper("h3"),!1;if(52==c)return top.ICEcoder.tagWrapper("h4"),!1;if(53==c)return top.ICEcoder.tagWrapper("h5"),
|
||||
!1;if(54==c)return top.ICEcoder.tagWrapper("h6"),!1;if(55==c)return top.ICEcoder.tagWrapper("h7"),!1;if(13==c)return top.ICEcoder.addLineBreakAtEnd(),!1}return c}return 70==c&&b.ctrlKey?(top.document.getElementById("find").focus(),!1):71==c&&b.ctrlKey?(top.document.getElementById("goToLineNo").focus(),!1):73==c&&b.ctrlKey&&"content"==a?(c=top.ICEcoder.caretLocType.toLowerCase()+" ","CSS"==top.ICEcoder.caretLocType||"PHP"==top.ICEcoder.caretLocType?window.open("http://voke.fm/"+c+top.ICEcoder.getcMInstance().getSelection()):
|
||||
("Content"==top.ICEcoder.caretLocType&&(c=""),window.open("http://www.google.com/#output=search&q="+c+top.ICEcoder.getcMInstance().getSelection())),!1):39==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.nextTab(),!1):37==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.previousTab(),!1):38==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("up"),!1):40==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("down"),!1):107==c&&b.ctrlKey?("content"==a?top.ICEcoder.duplicateLine():top.ICEcoder.newTab(),!1):109==c&&b.ctrlKey?
|
||||
("content"==a?top.ICEcoder.removeLine():top.ICEcoder.closeTab(top.ICEcoder.selectedTab),!1):83==c&&b.ctrlKey?(b.shiftKey?top.ICEcoder.saveFile("saveAs"):top.ICEcoder.saveFile(),!1):13==c&&b.ctrlKey&&"/[NEW]"!=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]?(window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]),!1):79==c&&b.ctrlKey?(top.ICEcoder.openPrompt(),!1):32==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.addSnippet(),!1):32==c&&"content"!=a?(top.ICEcoder.getcMInstance().focus(),!1):
|
||||
74==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.jumpToDefinition(),!1):27==c&&"content"==a?(top.ICEcoder.lineCommentToggle(),!1):27==c&&"content"!=a?(top.ICEcoder.cancelAllActions(),!1):c},resetKeys:function(){},addSnippet:function(){var a,b,c;a=ICEcoder.getcMInstance();b=a.getCursor().line;c=a.getLine(b).length-a.getLine(b).replace(/^\s\s*/,"").length;a=a.getLine(b).slice(c);"function"==a.slice(0,8)?top.ICEcoder.doSnippet("function","function VAR() {\nINDENT\tCURSOR\nINDENT}"):"if"==a.slice(0,2)?top.ICEcoder.doSnippet("if",
|
||||
"if (CURSOR) {\nINDENT\t\nINDENT}"):"for"==a.slice(0,3)&&top.ICEcoder.doSnippet("for","for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}")},doSnippet:function(a,b){var c,d,e,f,g,l;c=top.ICEcoder.getcMInstance();d=c.getCursor().line;if(-1<c.getLine(d).indexOf(a)){e=c.getLine(d);f=e.indexOf(a);e=e.slice(e.indexOf(a)+a.length);b=b.replace(/VAR/g,e);e=c.getLine(d).slice(0,f);f=c.getLine(d).length-c.getLine(d).replace(/^\s\s*/,"").length;f=c.getLine(d).slice(0,f);b=b.replace(/INDENT/g,f);e+=b;f=e.indexOf("CURSOR");
|
||||
g=0;l=d;for(i=0;i<e.length;i++)e.indexOf("\n",g)<e.indexOf("CURSOR")&&(g=e.indexOf("\n",g)+1,l+=1);c.setLine(d,e.replace("CURSOR",""));c.setCursor(l,f);c.focus()}}};
|
||||
44
lib/mmd.js
Normal file
@@ -0,0 +1,44 @@
|
||||
;function mmd(src)
|
||||
{
|
||||
var h='';
|
||||
|
||||
function escape(t)
|
||||
{
|
||||
return new Option(t).innerHTML;
|
||||
}
|
||||
function inlineEscape(s)
|
||||
{
|
||||
return escape(s)
|
||||
.replace(/!\[([^\]]*)]\(([^(]+)\)/g, '<img alt="$1" src="$2">')
|
||||
.replace(/\[([^\]]+)]\(([^(]+)\)/g, '$1'.link('$2'))
|
||||
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/\*([^*]+)\*/g, '<em>$1</em>');
|
||||
}
|
||||
|
||||
src
|
||||
.replace(/^\s+|\r|\s+$/g, '')
|
||||
.replace(/\t/g, ' ')
|
||||
.split(/\n\n+/)
|
||||
.forEach(function(b, f, R)
|
||||
{
|
||||
f=b[0];
|
||||
R=
|
||||
{
|
||||
'*':[/\n\* /,'<ul><li>','</li></ul>'],
|
||||
'1':[/\n[1-9]\d*\.? /,'<ol><li>','</li></ol>'],
|
||||
' ':[/\n /,'<pre><code>','</pre></code>','\n'],
|
||||
'>':[/\n> /,'<blockquote>','</blockquote>','\n']
|
||||
}[f];
|
||||
h+=
|
||||
R?R[1]+('\n'+b)
|
||||
.split(R[0])
|
||||
.slice(1)
|
||||
.map(R[3]?escape:inlineEscape)
|
||||
.join(R[3]||'</li>\n<li>')+R[2]:
|
||||
f=='#'?'<h'+(f=b.indexOf(' '))+'>'+inlineEscape(b.slice(f+1))+'</h'+f+'>':
|
||||
f=='<'?b:
|
||||
'<p>'+inlineEscape(b)+'</p>';
|
||||
});
|
||||
return h;
|
||||
};
|
||||
@@ -1,10 +1,16 @@
|
||||
<?php include("settings.php");?>
|
||||
<?php
|
||||
if(isset($_GET['selectedFiles'])) {
|
||||
$selectedFiles=explode(":",strClean($_GET['selectedFiles']));
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<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>
|
||||
|
||||
@@ -16,14 +22,14 @@
|
||||
</div>
|
||||
<?php if (isset($_GET['replace'])) { ?>
|
||||
<div class="replaceAll" id="replaceAll" onClick="<?php
|
||||
if (strpos($_GET['target'],"filenames")) {
|
||||
if (isset($_GET['target']) && strpos($_GET['target'],"filenames")) {
|
||||
echo 'renameAll()';
|
||||
} else if (strpos($_GET['target'],"files")) {
|
||||
} else if (isset($_GET['target']) && strpos($_GET['target'],"files")) {
|
||||
echo 'replaceInFilesAll()';
|
||||
} else {
|
||||
echo 'replaceAll()';
|
||||
}
|
||||
?>" style="opacity: 0.1"><?php echo strpos($_GET['target'],"filenames") ? 'rename all' : 'replace all';?></div>
|
||||
?>" style="opacity: 0.1"><?php echo isset($_GET['target']) && strpos($_GET['target'],"filenames") ? 'rename all' : 'replace all';?></div>
|
||||
<?php ;}; ?>
|
||||
|
||||
<script>
|
||||
@@ -34,7 +40,7 @@ var resultsDisplay = "";
|
||||
var foundArray = [];
|
||||
foundInSelected = false;
|
||||
userTarget = top.document.findAndReplace.target.value;
|
||||
findText = top.findAndReplace.find.value;
|
||||
findText = top.findAndReplace.find.value.toLowerCase();
|
||||
<?php
|
||||
$findText = str_replace("ICEcoder:","",str_replace("'","\'",$_GET['find']));
|
||||
// Find in open docs?
|
||||
@@ -42,7 +48,7 @@ if (!isset($_GET['target'])) {
|
||||
$targetName = "document";
|
||||
?>
|
||||
var startTab = top.ICEcoder.selectedTab;
|
||||
var rExp = new RegExp(findText,"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();
|
||||
@@ -67,18 +73,33 @@ if (startTab!=top.ICEcoder.selectedTab) {
|
||||
?>
|
||||
var spansArray = top.ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span');
|
||||
for (var i=0;i<spansArray.length;i++) {
|
||||
targetURL = spansArray[i].id.replace(/\|/g,"/");
|
||||
if (targetURL.indexOf(findText)>-1 && targetURL.indexOf('_perms')>-1) {
|
||||
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 (top.ICEcoder.selectedFiles[j].indexOf(targetURL.replace(/\//g,"|").replace(/_perms/g,""))>-1) {
|
||||
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\'))">'+ targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",$findText); ?>/g,"<b>"+findText+"</b>")+ '</a><br><div id="foundCount'+i+'">'+spansArray[i].innerHTML+', rename to '+targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(/<?php echo str_replace("/","\/",$findText); ?>/g,"<b><?php if(isset($_GET['replace'])) {echo strClean($_GET['replace']);};?></b>")+'</div>';
|
||||
<?php if (isset($_GET['replace'])) { ?>
|
||||
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>';
|
||||
@@ -92,11 +113,9 @@ if (startTab!=top.ICEcoder.selectedTab) {
|
||||
$r = 0;
|
||||
function phpGrep($q, $path, $base) {
|
||||
$fp = opendir($path);
|
||||
global $r;
|
||||
global $ICEcoder;
|
||||
global $serverType;
|
||||
global $r, $ICEcoder, $serverType, $selectedFiles;
|
||||
if (!isset($ret)) {$ret="";};
|
||||
$slash = $serverType == "Windows" ? "\\" : "/";
|
||||
$slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/";
|
||||
while($f = readdir($fp)) {
|
||||
if(preg_match("#^\.+$#", $f)) continue;
|
||||
$fullPath = $path.$slash.$f;
|
||||
@@ -104,17 +123,25 @@ if (startTab!=top.ICEcoder.selectedTab) {
|
||||
$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])>0) {$bFile = true;};
|
||||
if (strpos($f,$ICEcoder['bannedFiles'][$i])!==false) {$bFile = true;};
|
||||
}
|
||||
if (!$bFile) {
|
||||
$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>";
|
||||
};
|
||||
$ret .= '<hr>';
|
||||
echo 'foundArray.push("'.$fullPath.'");';
|
||||
echo 'foundArray.push("'.$fullPath.'");'.PHP_EOL;
|
||||
$r++;
|
||||
}
|
||||
}
|
||||
|
||||
1
lib/php.ini
Normal file
@@ -0,0 +1 @@
|
||||
magic_quotes_gpc = Off
|
||||
@@ -5,6 +5,7 @@
|
||||
<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>
|
||||
|
||||
@@ -34,8 +35,8 @@ if ($outputSize >= 1024) {
|
||||
}
|
||||
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>
|
||||
<span class="column" style="margin: 0 10px">Modified: <?php echo date( "D jS M Y g:i:sa", filemtime($fileName)); ?></span>
|
||||
<span class="column">Last access: <?php echo date( "D jS 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:
|
||||
|
||||
@@ -12,15 +12,16 @@ table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: 0;
|
||||
font-size: 12px;
|
||||
/*font-size: 12px;*/
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
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;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
<head>
|
||||
<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 $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; color: #000; font-family: monospace; width: 420px}
|
||||
.CodeMirror-scroll {height: 240px; overflow: hidden}
|
||||
.CodeMirror {position: absolute; width: 409px; height: 240px; font-size: <?php echo $ICEcoder["fontSize"];?>}
|
||||
.CodeMirror-scroll {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($ICEcoder["visibleTabs"]) {echo '\21e5';};?>";}
|
||||
</style>
|
||||
@@ -35,10 +36,14 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
<body class="settings">
|
||||
|
||||
<div class="infoPane">
|
||||
<img src="../images/ice-coder.png" class="logo">
|
||||
<a href="http://icecoder.net" target="_blank"><img src="../images/ice-coder.png" class="logo"></a>
|
||||
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
|
||||
|
||||
<p>
|
||||
website:<br>
|
||||
<a href="http://icecoder.net" target="_blank">http://icecoder.net</a>
|
||||
<br><br>
|
||||
|
||||
git:<br>
|
||||
<a href="http://github.com/mattpass/ICEcoder" target="_blank">http://github.com/mattpass/ICEcoder</a>
|
||||
<br><br>
|
||||
@@ -54,7 +59,7 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
<br><br>
|
||||
|
||||
file manager root:<br>
|
||||
<?php echo $ICEcoder['root'];?>
|
||||
<?php echo $ICEcoder['root'] == "" ? "/" : $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>
|
||||
@@ -63,7 +68,7 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
|
||||
Thanks go to the following people who have inspired me to create this and in the odd case, provided feedback or code:<br>
|
||||
<?php
|
||||
$peopleArray = array("marijnjh", "maettig", "wimtibackx", "jakubvrana", "_higg_", "yandle", "davidwalshblog", "kuvos", "mathias", "rem");
|
||||
$peopleArray = array("marijnjh", "maettig", "a_harris88", "emmetio", "prinzhorn", "wimtibackx", "jakubvrana", "davidwalshblog");
|
||||
for ($i=0;$i<count($peopleArray)-1;$i++) {
|
||||
echo '<a href="http://www.twitter.com/'.$peopleArray[$i].'" style="font-size: 10px" target="_blank">@'.$peopleArray[$i].'</a>';
|
||||
if ($i<count($peopleArray)-2) {
|
||||
@@ -71,7 +76,8 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<br><br>
|
||||
...plus a whole load of people on Github. Thanks for your contributions!
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
@@ -80,7 +86,6 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
<div class="settingsColumn1">
|
||||
<h1>settings</h1>
|
||||
<h2>functionality</h2>
|
||||
<input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($ICEcoder["tabsIndent"]) {echo ' checked';};?>> tab indents selection<br>
|
||||
<input type="checkbox" onclick="showButton()" name="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>
|
||||
@@ -102,8 +107,9 @@ confirm password<br>
|
||||
<br>
|
||||
banned files/folders<br>
|
||||
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($ICEcoder["bannedFiles"])-1;$i++) {echo $ICEcoder["bannedFiles"][$i]; if ($i<count($ICEcoder["bannedFiles"])-1) {echo ', ';};}; ?>"><br>
|
||||
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($ICEcoder["allowedIPs"])-1;$i++) {echo $ICEcoder["allowedIPs"][$i]; if ($i<count($ICEcoder["allowedIPs"])-1) {echo ', ';};}; ?>"><br>
|
||||
</div>
|
||||
@@ -133,9 +139,30 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
?>
|
||||
</select>
|
||||
|
||||
<span style="position: absolute; margin: -18px 0 0 30px">
|
||||
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 style="position: absolute; margin: -15px 0 0 10px">
|
||||
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 100px">
|
||||
indent type<br>
|
||||
<select onchange="showButton()" name="indentWithTabs">
|
||||
<option value="true"<?php if($ICEcoder["indentWithTabs"]) {echo " selected";};?>>tabs</option>
|
||||
<option value="false"<?php if(!$ICEcoder["indentWithTabs"]) {echo " selected";};?>>spaces</option>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<span style="position: absolute; margin: -15px 0 0 190px">
|
||||
indent size <br>
|
||||
<input type="text" name="indentSize" id="indentSize" style="width: 30px" onkeydown="showButton()" onkeyup="changeIndentSize()" value="<?php echo $ICEcoder["indentSize"];?>">
|
||||
</span>
|
||||
|
||||
<span style="position: absolute; margin: -15px 0 0 267px">
|
||||
font size <br>
|
||||
<input type="text" name="fontSize" id="fontSize" style="width: 44px" onkeydown="showButton()" onkeyup="changeFontSize()" value="<?php echo $ICEcoder["fontSize"];?>">
|
||||
</span>
|
||||
<br><br>
|
||||
|
||||
@@ -157,15 +184,15 @@ function findSequence(goal) {
|
||||
<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: 250px" onkeydown="document.settings.changedFileSettings.value='true';showButton()" value="<?php echo $ICEcoder["root"];?>">
|
||||
<input type="text" name="root" style="width: 200px" onkeydown="document.settings.changedFileSettings.value='true';showButton()" value="<?php echo $ICEcoder["root"];?>">
|
||||
</span>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
readOnly: "nocursor",
|
||||
indentUnit: top.ICEcoder.tabWidth,
|
||||
tabSize: top.ICEcoder.tabWidth,
|
||||
indentUnit: top.ICEcoder.indentSize,
|
||||
tabSize: top.ICEcoder.indentSize,
|
||||
mode: "javascript",
|
||||
theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>"
|
||||
});
|
||||
@@ -177,10 +204,16 @@ function selectTheme() {
|
||||
editor.setOption("theme", theme);
|
||||
}
|
||||
|
||||
function changeTabWidth() {
|
||||
var tabWidth = document.getElementById("tabWidth").value;
|
||||
editor.setOption("indentUnit", tabWidth);
|
||||
editor.setOption("tabSize", tabWidth);
|
||||
function changeIndentSize() {
|
||||
var indentSize = document.getElementById("indentSize").value;
|
||||
editor.setOption("indentUnit", indentSize);
|
||||
editor.setOption("tabSize", indentSize);
|
||||
}
|
||||
|
||||
function changeFontSize() {
|
||||
cMCSS = document.styleSheets[2];
|
||||
cMCSS.rules ? strCSS = 'rules' : strCSS = 'cssRules';
|
||||
cMCSS[strCSS][0].style['fontSize'] = document.getElementById("fontSize").value;
|
||||
}
|
||||
|
||||
var showButton = function() {
|
||||
|
||||
134
lib/settings.php
@@ -1,11 +1,35 @@
|
||||
<?php
|
||||
// Display & log all errors
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', dirname(__FILE__).'/../error_log.txt');
|
||||
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");
|
||||
}
|
||||
|
||||
// If magic quotes are still on (attempted to switch off in php.ini)
|
||||
if (get_magic_quotes_gpc ()) {
|
||||
function stripslashes_deep($value) {
|
||||
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
|
||||
return $value;
|
||||
}
|
||||
$_POST = (isset($_POST) && !empty($_POST)) ? array_map('stripslashes_deep', $_POST) : array();
|
||||
$_GET = (isset($_GET) && !empty($_GET)) ? array_map('stripslashes_deep', $_GET) : array();
|
||||
$_COOKIE = (isset($_COOKIE) && !empty($_COOKIE)) ? array_map('stripslashes_deep', $_COOKIE) : array();
|
||||
$_REQUEST = (isset($_REQUEST) && !empty($_REQUEST)) ? array_map('stripslashes_deep', $_REQUEST) : array();
|
||||
}
|
||||
|
||||
// Function to handle salted hashing
|
||||
define('SALT_LENGTH',9);
|
||||
function generateHash($plainText,$salt=null) {
|
||||
@@ -28,20 +52,31 @@ function numClean($var) {
|
||||
}
|
||||
|
||||
// Settings are stored in this file
|
||||
$settingsTemplate = 'config-template.php';
|
||||
$settingsFile = 'config.php';
|
||||
include($settingsFile);
|
||||
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(dirname(__FILE__)."/".$settingsFile);
|
||||
|
||||
// Add ICEcoder settings to beginning of $ICEcoder array
|
||||
$ICEcoder = array(
|
||||
"versionNo" => "1.0.0",
|
||||
"codeMirrorDir" => "CodeMirror-2.34"
|
||||
"versionNo" => "2.4",
|
||||
"codeMirrorDir" => "CodeMirror-3.12",
|
||||
"demoMode" => false,
|
||||
"devMode" => false
|
||||
)+$ICEcoder;
|
||||
|
||||
$onLoadExtras = "";
|
||||
$pluginsDisplay = "";
|
||||
|
||||
if ($ICEcoder['demoMode'] && $ICEcoder['accountPassword']!="") {$_SESSION['loggedIn']=true;};
|
||||
$demoMode = $ICEcoder['demoMode'];
|
||||
|
||||
// Update this config file?
|
||||
if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
|
||||
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
// Replace our settings vars
|
||||
$repPosStart = strpos($settingsContents,'"root"');
|
||||
@@ -49,7 +84,6 @@ if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme
|
||||
|
||||
// Prepare all our vars
|
||||
$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']))).'")';
|
||||
@@ -58,25 +92,33 @@ if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme
|
||||
$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["tabWidth"] = numClean($_POST['tabWidth']);
|
||||
$ICEcoder["fontSize"] = strClean($_POST['fontSize']);
|
||||
$ICEcoder["lineWrapping"] = strClean($_POST['lineWrapping']);
|
||||
$ICEcoder["indentWithTabs"] = strClean($_POST['indentWithTabs']);
|
||||
$ICEcoder["indentSize"] = numClean($_POST['indentSize']);
|
||||
|
||||
$settingsArray = array("root","tabsIndent","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","allowedIPs","plugins","theme","tabWidth");
|
||||
$settingsArray = array("root","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","bannedPaths","allowedIPs","plugins","theme","fontSize","lineWrapping","indentWithTabs","indentSize");
|
||||
$settingsNew = "";
|
||||
for ($i=0;$i<count($settingsArray);$i++) {
|
||||
$settingsNew .= '"'.$settingsArray[$i].'"'.PHP_EOL.' => ';
|
||||
$settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="accountPassword"||$settingsArray[$i]=="theme" ? '"' : '';
|
||||
$settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="accountPassword"||$settingsArray[$i]=="theme"||$settingsArray[$i]=="fontSize" ? '"' : '';
|
||||
$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/".$settingsFile." and press refresh");
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
if (is_writeable($settingsFile)) {
|
||||
$fh = fopen($settingsFile, 'w');
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Cannot update config file. Please set public write permissions on lib/".$settingsFile." and try again');</script>";
|
||||
}
|
||||
|
||||
// OK, now the config file has been updated, update our current session with new arrays
|
||||
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
|
||||
@@ -88,7 +130,7 @@ if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme
|
||||
// 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["tabWidth"].",".$refreshFM.");</script>";
|
||||
echo "<script>top.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$ICEcoder["codeAssist"].",".$ICEcoder["lockedNav"].",".$ICEcoder["visibleTabs"].",'".$ICEcoder["fontSize"]."',".$ICEcoder["lineWrapping"].",".$ICEcoder["indentWithTabs"].",".$ICEcoder["indentSize"].",".$refreshFM.");</script>";
|
||||
}
|
||||
|
||||
// Establish our user level
|
||||
@@ -129,19 +171,29 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
||||
// Replace our previousFiles var with the the current
|
||||
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
|
||||
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
|
||||
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].",";
|
||||
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 = "";
|
||||
}
|
||||
$saveFiles = rtrim($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 (is_writeable($settingsFile)) {
|
||||
$fh = fopen($settingsFile, 'w');
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Cannot update config file. Please set public write permissions on lib/".$settingsFile." and try again');</script>";
|
||||
}
|
||||
|
||||
// Update our last10Files var?
|
||||
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||
@@ -154,11 +206,15 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
||||
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);
|
||||
if (is_writeable($settingsFile)) {
|
||||
$fh = fopen($settingsFile, 'w');
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Cannot update config file. Please set public write permissions on lib/".$settingsFile." and try again');</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
}
|
||||
@@ -209,8 +265,10 @@ if ($_SESSION['loggedIn']) {
|
||||
$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 (!$_SESSION['loggedIn']) {
|
||||
} 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']));
|
||||
@@ -218,6 +276,11 @@ if (!$_SESSION['loggedIn']) {
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
// Replace our empty password with the one submitted by user
|
||||
$settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents);
|
||||
// Also set the update checker preference
|
||||
$checkUpdates = $_POST['checkUpdates']=="true" ? "true" : "false";
|
||||
// once to cover the true setting, once to cover false
|
||||
$settingsContents = str_replace('"checkUpdates" => true,','"checkUpdates" => '.$checkUpdates.',',$settingsContents);
|
||||
$settingsContents = str_replace('"checkUpdates" => false,','"checkUpdates" => '.$checkUpdates.',',$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);
|
||||
@@ -236,6 +299,8 @@ if (!$_SESSION['loggedIn']) {
|
||||
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>
|
||||
@@ -248,8 +313,13 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
|
||||
<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">
|
||||
<input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "Set Password" : "Login"; ?>" class="button">
|
||||
<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">
|
||||
<?php
|
||||
if ($ICEcoder["accountPassword"] == "") {
|
||||
echo '<div class="text"><input type="checkbox" name="checkUpdates" value="true" checked> auto-check for updates</div>';
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -259,9 +329,7 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
|
||||
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_SERVER['SCRIPT_NAME'],"lib/settings.php")) {
|
||||
header('Location: lib/settings.php');
|
||||
} elseif ($_SESSION['loggedIn'] && $ICEcoder["accountPassword"]=="") {
|
||||
header("Location: ../?logout");
|
||||
}
|
||||
?>
|
||||
@@ -1,967 +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.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=' ';}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):" ");}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"))."&page=last' title='".'Last page'."'>>></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&version=3.4.0",'">
|
||||
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&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&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> » ';$_=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> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ba)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> » ';if(is_array($Ba)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> » ';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> » ';}}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> <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?"&ns=":"")."&database=' title='".'Alter database'."'>".nbsp(db_collation($i,$d))."</a>","<td align='right'><a href='$ve&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=" ";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> ';}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&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&version=3.4.0' alt='+' title='".'Add next'."' onclick='return !editingAddRow(this, $qa, 1);'> "."<input type='image' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=up.gif&version=3.4.0' alt='^' title='".'Move up'."'> "."<input type='image' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=down.gif&version=3.4.0' alt='v' title='".'Move down'."'> ":""),($Cd==""||support("drop_col")?"<input type='image' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME))."?file=cross.gif&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> ":"")."</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;&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> </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;"').'> (< '.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&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> <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> ";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> ":"")."<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=" ";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)."'> ");}echo(support("comment")?"<td id='Comment-".h($D)."'> ":"");}echo"<tr><td> <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'> ";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> </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();
|
||||
791
plugins/adminer/adminer-3.6.3-mysql-en.php
Normal file
@@ -56,3 +56,7 @@ outline:0;background:url(http://www.bradezone.com/random/adminer_logo.gif) no-re
|
||||
* html #lang,* html #menu,* html #breadcrumb{position:absolute}
|
||||
* html #lang{padding-top:10px;height:30px}
|
||||
* html form#form{height:100%}
|
||||
#logins a,#tables a{background: none}
|
||||
#logout{color:#333;text-decoration:none;border-bottom:1px dotted}
|
||||
#logout:hover{border-color:#333;background:#333;color:#fff}
|
||||
.js .column{background:#ddd}
|
||||
313
plugins/emmet/emmet.min.js
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
var _=function(){function f(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 g=e.call(a);if(g!=e.call(b))return!1;switch(g){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(g=="[object Array]"){if(d=a.length,j=d==b.length)for(;d--;)if(!(j=d in a==d in b&&f(a[d],b[d],c)))break}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return!1;for(var h in a)if(k.has(a,h)&&(d++,!(j=k.has(b,h)&&f(a[h],b[h],c))))break;if(j){for(h in b)if(k.has(b,h)&&!d--)break;
|
||||
j=!d}}c.pop();return j}var d=this,h=d._,i={},b=Array.prototype,c=Object.prototype,a=b.slice,g=b.unshift,e=c.toString,j=c.hasOwnProperty,n=b.forEach,o=b.map,l=b.reduce,m=b.reduceRight,p=b.filter,r=b.every,q=b.some,u=b.indexOf,s=b.lastIndexOf,c=Array.isArray,v=Object.keys,w=Function.prototype.bind,k=function(a){return new x(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,e){if(a!=null)if(n&&a.forEach===n)a.forEach(b,e);else if(a.length===+a.length)for(var c=0,g=a.length;c<g;c++){if(c in a&&b.call(e,a[c],c,a)===i)break}else for(c in a)if(k.has(a,c)&&b.call(e,a[c],c,a)===i)break};k.map=k.collect=function(a,b,e){var c=[];if(a==null)return c;if(o&&a.map===o)return a.map(b,e);t(a,function(a,g,k){c[c.length]=b.call(e,a,g,k)});if(a.length===+a.length)c.length=a.length;return c};k.reduce=k.foldl=k.inject=function(a,b,c,e){var g=arguments.length>2;a==null&&(a=[]);if(l&&
|
||||
a.reduce===l)return e&&(b=k.bind(b,e)),g?a.reduce(b,c):a.reduce(b);t(a,function(a,k,d){g?c=b.call(e,c,a,k,d):(c=a,g=!0)});if(!g)throw new TypeError("Reduce of empty array with no initial value");return c};k.reduceRight=k.foldr=function(a,b,c,e){var g=arguments.length>2;a==null&&(a=[]);if(m&&a.reduceRight===m)return e&&(b=k.bind(b,e)),g?a.reduceRight(b,c):a.reduceRight(b);var d=k.toArray(a).reverse();e&&!g&&(b=k.bind(b,e));return g?k.reduce(d,b,c,e):k.reduce(d,b)};k.find=k.detect=function(a,b,c){var e;
|
||||
D(a,function(a,g,k){if(b.call(c,a,g,k))return e=a,!0});return e};k.filter=k.select=function(a,b,e){var c=[];if(a==null)return c;if(p&&a.filter===p)return a.filter(b,e);t(a,function(a,g,k){b.call(e,a,g,k)&&(c[c.length]=a)});return c};k.reject=function(a,b,c){var e=[];if(a==null)return e;t(a,function(a,g,k){b.call(c,a,g,k)||(e[e.length]=a)});return e};k.every=k.all=function(a,b,e){var c=!0;if(a==null)return c;if(r&&a.every===r)return a.every(b,e);t(a,function(a,g,k){if(!(c=c&&b.call(e,a,g,k)))return i});
|
||||
return!!c};var D=k.some=k.any=function(a,b,c){b||(b=k.identity);var e=!1;if(a==null)return e;if(q&&a.some===q)return a.some(b,c);t(a,function(a,g,k){if(e||(e=b.call(c,a,g,k)))return i});return!!e};k.include=k.contains=function(a,b){var e=!1;return a==null?e:u&&a.indexOf===u?a.indexOf(b)!=-1:e=D(a,function(a){return a===b})};k.invoke=function(b,e){var c=a.call(arguments,2);return k.map(b,function(a){return(k.isFunction(e)?e||a:a[e]).apply(a,c)})};k.pluck=function(a,b){return k.map(a,function(a){return a[b]})};
|
||||
k.max=function(a,b,e){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!b&&k.isEmpty(a))return-Infinity;var c={computed:-Infinity};t(a,function(a,g,k){g=b?b.call(e,a,g,k):a;g>=c.computed&&(c={value:a,computed:g})});return c.value};k.min=function(a,b,e){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!b&&k.isEmpty(a))return Infinity;var c={computed:Infinity};t(a,function(a,g,k){g=b?b.call(e,a,g,k):a;g<c.computed&&(c={value:a,computed:g})});return c.value};k.shuffle=
|
||||
function(a){var b=[],e;t(a,function(a,c){e=Math.floor(Math.random()*(c+1));b[c]=b[e];b[e]=a});return b};k.sortBy=function(a,b,e){var c=k.isFunction(b)?b:function(a){return a[b]};return k.pluck(k.map(a,function(a,b,g){return{value:a,criteria:c.call(e,a,b,g)}}).sort(function(a,b){var e=a.criteria,c=b.criteria;return e===void 0?1:c===void 0?-1:e<c?-1:e>c?1:0}),"value")};k.groupBy=function(a,b){var e={},c=k.isFunction(b)?b:function(a){return a[b]};t(a,function(a,b){var g=c(a,b);(e[g]||(e[g]=[])).push(a)});
|
||||
return e};k.sortedIndex=function(a,b,e){e||(e=k.identity);for(var c=0,g=a.length;c<g;){var d=c+g>>1;e(a[d])<e(b)?c=d+1:g=d}return c};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,e,c){return e!=null&&!c?a.call(b,0,e):b[0]};k.initial=function(b,e,c){return a.call(b,0,b.length-(e==null||c?1:e))};k.last=function(b,
|
||||
e,c){return e!=null&&!c?a.call(b,Math.max(b.length-e,0)):b[b.length-1]};k.rest=k.tail=function(b,e,c){return a.call(b,e==null||c?1:e)};k.compact=function(a){return k.filter(a,function(a){return!!a})};k.flatten=function(a,b){return k.reduce(a,function(a,e){if(k.isArray(e))return a.concat(b?e:k.flatten(e));a[a.length]=e;return a},[])};k.without=function(b){return k.difference(b,a.call(arguments,1))};k.uniq=k.unique=function(a,b,e){var e=e?k.map(a,e):a,c=[];a.length<3&&(b=!0);k.reduce(e,function(e,g,
|
||||
d){if(b?k.last(e)!==g||!e.length:!k.include(e,g))e.push(g),c.push(a[d]);return e},[]);return c};k.union=function(){return k.uniq(k.flatten(arguments,!0))};k.intersection=k.intersect=function(b){var e=a.call(arguments,1);return k.filter(k.uniq(b),function(a){return k.every(e,function(b){return k.indexOf(b,a)>=0})})};k.difference=function(b){var e=k.flatten(a.call(arguments,1),!0);return k.filter(b,function(a){return!k.include(e,a)})};k.zip=function(){for(var b=a.call(arguments),e=k.max(k.pluck(b,"length")),
|
||||
c=Array(e),g=0;g<e;g++)c[g]=k.pluck(b,""+g);return c};k.indexOf=function(a,b,e){if(a==null)return-1;var c;if(e)return e=k.sortedIndex(a,b),a[e]===b?e:-1;if(u&&a.indexOf===u)return a.indexOf(b);e=0;for(c=a.length;e<c;e++)if(e in a&&a[e]===b)return e;return-1};k.lastIndexOf=function(a,b){if(a==null)return-1;if(s&&a.lastIndexOf===s)return a.lastIndexOf(b);for(var e=a.length;e--;)if(e in a&&a[e]===b)return e;return-1};k.range=function(a,b,e){arguments.length<=1&&(b=a||0,a=0);for(var e=arguments[2]||1,
|
||||
c=Math.max(Math.ceil((b-a)/e),0),g=0,k=Array(c);g<c;)k[g++]=a,a+=e;return k};var E=function(){};k.bind=function(b,e){var c,g;if(b.bind===w&&w)return w.apply(b,a.call(arguments,1));if(!k.isFunction(b))throw new TypeError;g=a.call(arguments,2);return c=function(){if(!(this instanceof c))return b.apply(e,g.concat(a.call(arguments)));E.prototype=b.prototype;var k=new E,d=b.apply(k,g.concat(a.call(arguments)));return Object(d)===d?d:k}};k.bindAll=function(b){var e=a.call(arguments,1);e.length==0&&(e=k.functions(b));
|
||||
t(e,function(a){b[a]=k.bind(b[a],b)});return b};k.memoize=function(a,b){var e={};b||(b=k.identity);return function(){var c=b.apply(this,arguments);return k.has(e,c)?e[c]:e[c]=a.apply(this,arguments)}};k.delay=function(b,e){var c=a.call(arguments,2);return setTimeout(function(){return b.apply(null,c)},e)};k.defer=function(b){return k.delay.apply(k,[b,1].concat(a.call(arguments,1)))};k.throttle=function(a,b){var e,c,g,d,j,f,h=k.debounce(function(){j=d=!1},b);return function(){e=this;c=arguments;var k;
|
||||
g||(g=setTimeout(function(){g=null;j&&a.apply(e,c);h()},b));d?j=!0:f=a.apply(e,c);h();d=!0;return f}};k.debounce=function(a,b,e){var c;return function(){var g=this,k=arguments;e&&!c&&a.apply(g,k);clearTimeout(c);c=setTimeout(function(){c=null;e||a.apply(g,k)},b)}};k.once=function(a){var b=!1,e;return function(){if(b)return e;b=!0;return e=a.apply(this,arguments)}};k.wrap=function(b,e){return function(){var c=[b].concat(a.call(arguments,0));return e.apply(this,c)}};k.compose=function(){var a=arguments;
|
||||
return function(){for(var b=arguments,e=a.length-1;e>=0;e--)b=[a[e].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=[],e;for(e in a)k.has(a,e)&&(b[b.length]=e);return b};k.values=function(a){return k.map(a,k.identity)};k.functions=k.methods=function(a){var b=[],e;for(e in a)k.isFunction(a[e])&&b.push(e);return b.sort()};k.extend=function(b){t(a.call(arguments,
|
||||
1),function(a){for(var e in a)b[e]=a[e]});return b};k.pick=function(b){var e={};t(k.flatten(a.call(arguments,1)),function(a){a in b&&(e[a]=b[a])});return e};k.defaults=function(b){t(a.call(arguments,1),function(a){for(var e in a)b[e]==null&&(b[e]=a[e])});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 f(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 e.call(a)=="[object Array]"};k.isObject=function(a){return a===Object(a)};k.isArguments=function(a){return e.call(a)=="[object Arguments]"};if(!k.isArguments(arguments))k.isArguments=function(a){return!(!a||!k.has(a,"callee"))};k.isFunction=function(a){return e.call(a)=="[object Function]"};k.isString=function(a){return e.call(a)=="[object String]"};k.isNumber=function(a){return e.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||e.call(a)=="[object Boolean]"};k.isDate=function(a){return e.call(a)=="[object Date]"};k.isRegExp=function(a){return e.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._=h;return this};k.identity=function(a){return a};
|
||||
k.times=function(a,b,e){for(var c=0;c<a;c++)b.call(e,c)};k.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};k.result=function(a,b){if(a==null)return null;var e=a[b];return k.isFunction(e)?e.call(a):e};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 z=/.^/,y={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},A;for(A in y)y[y[A]]=A;var H=/\\|'|\r|\n|\t|\u2028|\u2029/g,I=/\\(\\|'|r|n|t|u2028|u2029)/g,B=function(a){return a.replace(I,function(a,b){return y[b]})};k.template=function(a,b,e){e=k.defaults(e||{},k.templateSettings);a="__p+='"+a.replace(H,function(a){return"\\"+y[a]}).replace(e.escape||z,function(a,b){return"'+\n_.escape("+B(b)+")+\n'"}).replace(e.interpolate||z,function(a,b){return"'+\n("+
|
||||
B(b)+")+\n'"}).replace(e.evaluate||z,function(a,b){return"';\n"+B(b)+"\n;__p+='"})+"';\n";e.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",c=new Function(e.variable||"obj","_",a);if(b)return c(b,k);b=function(a){return c.call(this,a,k)};b.source="function("+(e.variable||"obj")+"){\n"+a+"}";return b};k.chain=function(a){return k(a).chain()};var x=function(a){this._wrapped=a};k.prototype=x.prototype;
|
||||
var C=function(a,b){return b?k(a).chain():a},F=function(b,e){x.prototype[b]=function(){var b=a.call(arguments);g.call(b,this._wrapped);return C(e.apply(k,b),this._chain)}};k.mixin(k);t(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var e=b[a];x.prototype[a]=function(){var b=this._wrapped;e.apply(b,arguments);var c=b.length;(a=="shift"||a=="splice")&&c===0&&delete b[0];return C(b,this._chain)}});t(["concat","join","slice"],function(a){var e=b[a];x.prototype[a]=function(){return C(e.apply(this._wrapped,
|
||||
arguments),this._chain)}});x.prototype.chain=function(){this._chain=!0;return this};x.prototype.value=function(){return this._wrapped};return k}.call({}),emmet=function(f){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 h(c){!(c in b)&&a&&a(c);return b[c]}if(typeof _=="undefined")try{_=
|
||||
f.require("underscore")}catch(i){}if(typeof _=="undefined")throw"Cannot access to Underscore.js lib";var b={_:_},c=function(){},a=null;return{define:function(a,e){a in b||(b[a]=_.isFunction(e)?this.exec(e):e)},require:h,exec:function(a,b){return a.call(b||f,_.bind(h,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",f=h("filters"),i=
|
||||
h("abbreviationParser"),c=h("profile").get(c,b);h("tabStops").resetTabstopIndex();a=f.extractFromAbbreviation(a);d=i.parse(a[0],{syntax:b,contextNode:d});b=f.composeList(b,c,a[1]);f.apply(d,b,c);return d.toString()},defaultSyntax:function(){return"html"},defaultProfile:function(){return"plain"},log:function(){f.console&&f.console.log&&f.console.log.apply(f.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}typeof define!=="undefined"&&define(emmet);
|
||||
emmet.define("abbreviationParser",function(f,d){function h(){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=f("utils").trim(a),e=new h,c=e.addChild(),g,j=f("stringStream").create(a),a=1E3,n;!j.eol()&&--a>0;)switch(g=j.peek(),g){case "(":j.start=j.pos;
|
||||
if(j.skipToPair("(",")"))g=b(i(j.current())),(n=j.match(/^\*(\d+)?/,!0))&&c._setRepeat(n[1]),d.each(g.children,function(a){c.addChild(a)});else throw'Invalid abbreviation: mo matching ")" found for character at '+j.pos;break;case ">":c=c.addChild();j.next();break;case "+":c=c.parent.addChild();j.next();break;case "^":g=c.parent||c;c=(g.parent||g).addChild();j.next();break;default:j.start=j.pos,j.eatWhile(function(a){if(a=="["||a=="{"){if(j.skipToPair(a,p[a]))return j.backUp(1),!0;throw'Invalid abbreviation: mo matching "'+
|
||||
p[a]+'" found for character at '+j.pos;}return a=="+"?(j.next(),a=j.eol()||~"+>^*".indexOf(j.peek()),j.backUp(1),a):a!="("&&o(a)}),c.setAbbreviation(j.current()),j.start=j.pos}if(a<1)throw"Endless loop detected";return e}function c(a){var a=f("utils").trim(a),b=[],a=f("stringStream").create(a);for(a.eatSpace();!a.eol();)if(a.start=a.pos,a.eatWhile(m)){var e=a.current(),c="";if(a.peek()=="="){a.next();a.start=a.pos;var g=a.peek();if(g=='"'||g=="'"){a.next();a:{for(var c=a,d=void 0;d=c.next();)if(d===
|
||||
g){c=!0;break a}c=!1}if(c)c=a.current(),c=c.substring(1,c.length-1);else throw"Invalid attribute value";}else if(a.eatWhile(/[^\s\]]/))c=a.current();else throw"Invalid attribute value";}b.push({name:e,value:c});a.eatSpace()}else break;return b}function a(a){for(var b=[],e={"#":"id",".":"class"},d=null,j=f("stringStream").create(a);!j.eol();)switch(j.peek()){case "#":case ".":if(d===null)d=j.pos;var h=e[j.peek()];j.next();j.start=j.pos;j.eatWhile(m);b.push({name:h,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:g(b)}}function g(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 e=b[a.name];a.name.toLowerCase()=="class"?e.value+=(e.value.length?" ":"")+a.value:e.value=a.value;return!1})}function e(a){if(!~a.indexOf("{"))return null;
|
||||
for(var b=f("stringStream").create(a);!b.eol();)switch(b.peek()){case "[":case "(":b.skipToPair(b.peek(),p[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,e,c,g;b>=0;b--)if(c=a.children[b],c.isRepeating()){g=e=c.repeatCount;c.repeatCount=1;c.updateProperty("counter",1);for(c.updateProperty("maxCount",g);--e>0;)c.parent.addChild(c.clone(),b+1).updateProperty("counter",
|
||||
e+1).updateProperty("maxCount",g)}d.each(a.children,j);return a}function n(a){for(var b=a.children.length-1;b>=0;b--){var e=a.children[b];e.isGroup()?e.replace(n(e).children):e.isEmpty()&&e.remove()}d.each(a.children,n);return a}function o(a){var b=a.charCodeAt(0);return b>64&&b<91||b>96&&b<123||b>47&&b<58||"#.*:$-_!@|%".indexOf(a)!=-1}var l=/^[\w\-\$\:@\!%]+\+?$/i,m=/[\w\-:\$@]/,p={"[":"]","(":")","{":"}"},r=Array.prototype.splice,q=[],u=[],s=[];h.prototype={addChild:function(a,b){a=a||new h;a.parent=
|
||||
this;d.isUndefined(b)?this.children.push(a):this.children.splice(b,0,a);return a},clone:function(){var a=new h;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),e=d.flatten(arguments);r.apply(a.children,[b,1].concat(e));d.each(e,function(b){b.parent=a})},updateProperty:function(a,b){this[a]=b;d.each(this.children,function(e){e.updateProperty(a,b)});return this},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 e=[];d.each(this.children,function(b){a(b)&&e.push(b);e=
|
||||
e.concat(b.findAll(a))});return d.compact(e)},data:function(a,b){if(arguments.length==2&&(this._data[a]=b,a=="resource"&&f("elements").is(b,"snippet")&&(this.content=b.data,this._text)))this.content=f("abbreviationUtils").insertChildContent(b.data,this._text);return this._data[a]},name:function(){var a=this.matchedResource();return f("elements").is(a,"element")?a.name:this._name},attributeList:function(){var a=[],b=this.matchedResource();f("elements").is(b,"element")&&d.isArray(b.attributes)&&(a=
|
||||
a.concat(b.attributes));return g(a.concat(this._attributes))},attribute:function(a,b){if(arguments.length==2){var e=d.indexOf(d.pluck(this._attributes,"name"),a.toLowerCase());~e?this._attributes[e].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 g=e(b);if(g)b=g.element,this.content=this._text=g.text;if(g=a(b))b=g.element,this._attributes=g.attributes;if((this._name=b)&&!l.test(this._name))throw"Invalid abbreviation";},toString:function(){var a=f("utils"),b=this.start,e=this.end,c=this.content,g=this;d.each(s,function(a){b=a(b,g,"start");c=a(c,g,"content");e=a(e,g,
|
||||
"end")});var j=d.map(this.children,function(a){return a.toString()}).join(""),c=f("abbreviationUtils").insertChildContent(c,j,{keepVariable:!1});return b+a.padString(c,this.padding)+e},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}};s.push(function(a,b){return f("utils").replaceCounter(a,b.counter,b.maxCount)});return{parse:function(a,e){var e=e||{},c=b(a);if(e.contextNode){c._name=e.contextNode.name;var g={};d.each(c._attributes,function(a){g[a.name]=
|
||||
a});d.each(e.contextNode.attributes,function(a){a.name in g?g[a.name].value=a.value:(a=d.clone(a),c._attributes.push(a),g[a.name]=a)})}d.each(q,function(a){a(c,e)});c=n(j(c));d.each(u,function(a){a(c,e)});return c},AbbreviationNode:h,addPreprocessor:function(a){d.include(q,a)||q.push(a)},removeFilter:function(a){preprocessor=d.without(q,a)},addPostprocessor:function(a){d.include(u,a)||u.push(a)},removePostprocessor:function(a){u=d.without(u,a)},addOutputProcessor:function(a){d.include(s,a)||s.push(a)},
|
||||
removeOutputProcessor:function(a){s=d.without(s,a)},isAllowedChar:function(a){a=String(a);return o(a)||~">+^[](){}".indexOf(a)}}});
|
||||
emmet.exec(function(f,d){function h(i,b){var c=f("resources"),a=f("elements"),g=f("abbreviationParser");d.each(d.clone(i.children),function(e){var j=c.getMatchedResource(e,b);if(d.isString(j))e.data("resource",a.create("snippet",j));else if(a.is(j,"reference")){j=g.parse(j.data,{syntax:b});if(e.repeatCount>1){var f=j.findAll(function(a){return a.hasImplicitRepeat});d.each(f,function(a){a.repeatCount=e.repeatCount;a.hasImplicitRepeat=!1})}var i=j.deepestChild();i&&d.each(e.children,function(a){i.addChild(a)});
|
||||
d.each(j.children,function(a){d.each(e.attributeList(),function(b){a.attribute(b.name,b.value)})});e.replace(j.children)}else e.data("resource",j);h(e,b)})}f("abbreviationParser").addPreprocessor(function(d,b){var c=b.syntax||emmet.defaultSyntax();h(d,c)})});
|
||||
emmet.exec(function(f,d){function h(a){for(var b=f("range"),c=[],a=f("stringStream").create(a);!a.eol();){if(a.peek()=="\\")a.next();else if(a.start=a.pos,a.match(g,!0)){c.push(b.create(a.start,g));continue}a.next()}return c}function i(a,b){var c=f("utils"),g=h(a);g.reverse();d.each(g,function(g){a=c.replaceSubstring(a,b,g)});return a}function b(a){return h(a.content).length?!0:!!d.find(a.attributeList(),function(a){return!!h(a.value).length})}function c(a,c,g){var h=a.findAll(function(a){return b(a)});
|
||||
b(a)&&h.unshift(a);h.length?d.each(h,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=g?c:f("abbreviationUtils").insertChildContent(a.content,c))}var a=f("abbreviationParser"),g="$#";a.addPreprocessor(function(a,b){if(b.pastedContent){var c=f("utils"),g=d.map(c.splitByLines(b.pastedContent,!0),c.trim);a.findAll(function(a){if(a.hasImplicitRepeat)return a.data("paste",g),a.repeatCount=g.length})}});a.addPostprocessor(function(a,
|
||||
b){!a.findAll(function(a){var b=a.data("paste"),e="";d.isArray(b)?e=b[a.counter-1]:d.isFunction(b)?e=b(a.counter-1,a.content):b&&(e=b);e&&c(a,e,!!a.data("pasteOverwrites"));a.data("paste",null);return!!b}).length&&b.pastedContent&&c(a,b.pastedContent)})});emmet.exec(function(f,d){function h(i){var b=f("tagName");d.each(i.children,function(c){if(c.hasImplicitName()||c.data("forceNameResolving"))c._name=b.resolve(c.parent.name());h(c)});return i}f("abbreviationParser").addPostprocessor(h)});
|
||||
emmet.define("cssParser",function(f,d){function h(a){return typeof a!=="undefined"}function i(){return{"char":e.chnum,line:e.linenum}}function b(a,b,c){var g=e,c=c||{};j.push({charstart:h(c["char"])?c["char"]:g.chnum,charend:h(c.charend)?c.charend:g.chnum,linestart:h(c.line)?c.line:g.linenum,lineend:h(c.lineend)?c.lineend:g.linenum,value:a,type:b||a})}function c(a,b){var c=e,g=b||{},d=h(g["char"])?g["char"]:c.chnum,g=h(g.line)?g.line:c.linenum;return{name:"ParseError",message:a+" at line "+(g+1)+
|
||||
" char "+(d+1),walker:c,tokens:j}}function a(a){var c=e,g=c.ch,d=i(),j=a?a+g:g,g=c.nextChar();for(a&&(d["char"]-=a.length);o(g)||l(g);)j+=g,g=c.nextChar();b(j,"identifier",d)}function g(){var g=e.ch;if(g===" "||g==="\t"){for(var d=e.ch,j="",f=i();d===" "||d==="\t";)j+=d,d=e.nextChar();b(j,"white",f)}else{if(g==="/"){var d=e,g=f=d.ch,h,s=i();h=d.nextChar();if(h!=="*")s.charend=s["char"],s.lineend=s.line,j=b(g,g,s);else{for(;!(f==="*"&&h==="/");)g+=h,f=h,h=d.nextChar();g+=h;d.nextChar();b(g,"comment",
|
||||
s)}return j}if(g==='"'||g==="'"){d=e;g=f=j=d.ch;s=i();for(j=d.nextChar();j!==f;){if(j==="\n")if(h=d.nextChar(),h==="\\")g+=j+h;else throw c("Unterminated string",s);else g+=j==="\\"?j+d.nextChar():j;j=d.nextChar()}g+=j;d.nextChar();b(g,"string",s)}else if(g==="("){d=e;j=d.ch;f=0;g=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);g+=j;j=d.nextChar()}g+=j;d.nextChar();b(g,"brace",h)}else{if(g==="-"||g==="."||l(g)){j=e;f=j.ch;
|
||||
g=i();h=f;var s=h===".",v,f=j.nextChar();v=!l(f);if(s&&v)g.charend=g["char"],g.lineend=g.line,d=b(h,".",g);else if(h==="-"&&v)d=a("-");else{for(;f!==!1&&(l(f)||!s&&f===".");)f==="."&&(s=!0),h+=f,f=j.nextChar();b(h,"number",g)}return d}if(o(g))return a();if(n(g))return d=e,g=d.ch,j=i(),h=d.nextChar(),h==="="&&n(g,!0)?(g+=h,b(g,"match",j),d.nextChar(),f=void 0):(j.charend=j["char"]+1,j.lineend=j.line,b(g,g,j)),f;if(g==="\n")b("line"),e.nextChar();else throw c("Unrecognized character");}}}var e,j=[],
|
||||
n,o,l;e={lines:null,total_lines:0,linenum:-1,line:"",ch:"",chnum:-1,init:function(a){var b=e;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)}};o=function(a){return a=="&"||a==="_"||a==="-"||a>="a"&&a<="z"||a>="A"&&a<="Z"};l=function(a){return a!==!1&&a>="0"&&a<="9"};n=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){e.init(a);
|
||||
for(j=[];e.ch!==!1;)g();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(f){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=h;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 h(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=h;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 g(){a.apply(null,arguments);return!0}function e(){if(k.context)k.context=k.context.prev}function j(a){if(a==
|
||||
"openTag")return k.tagName=v,g(m,n(k.startOfLine));else if(a=="closeTag")return a=!1,k.context?k.context.tagName!=v&&(s.implicitlyClosed.hasOwnProperty(k.context.tagName.toLowerCase())&&e(),a=!k.context||k.context.tagName!=v):a=!0,a&&(t="error"),g(o(a));return g()}function n(a){return function(b){if(b=="selfcloseTag"||b=="endTag"&&s.autoSelfClosers.hasOwnProperty(k.tagName.toLowerCase()))return l(k.tagName.toLowerCase()),g();if(b=="endTag"){l(k.tagName.toLowerCase());var b=k.tagName,c=s.doNotIndent.hasOwnProperty(b)||
|
||||
k.context&&k.context.noIndent;k.context={prev:k.context,tagName:b,indent:k.indented,startOfLine:a,noIndent:c}}return g()}}function o(a){return function(b){a&&(t="error");if(b=="endTag")return e(),g();t="error";return g(arguments.callee)}}function l(a){for(var b;;){if(!k.context)break;b=k.context.tagName.toLowerCase();if(!s.contextGrabbers.hasOwnProperty(b)||!s.contextGrabbers[b].hasOwnProperty(a))break;e()}}function m(b){if(b=="word")return t="attribute",g(p,m);if(b=="endTag"||b=="selfcloseTag")return a();
|
||||
t="error";return g(m)}function p(b){if(b=="equals")return g(r,m);s.allowMissing||(t="error");return b=="endTag"||b=="selfcloseTag"?a():g()}function r(b){if(b=="string")return g(q);if(b=="word"&&s.allowUnquoted)return t="string",g();t="error";return b=="endTag"||b=="selfCloseTag"?a():g()}function q(b){return b=="string"?g(q):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 s={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=f("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(f,d,h){if(f==d)return 1;if(d=="")return 0;for(var i=0,b=d.length,c=f.length,a,g=1,e=0,j,n,o,l;e<b;++e){o=d.charAt(e);j=f.indexOf(o.toLowerCase());n=f.indexOf(o.toUpperCase());l=Math.min(j,n);n=l>-1?l:Math.max(j,n);if(n===-1)if(h){g+=1-h;continue}else return 0;else j=0.1;f[n]===o&&(j+=0.1);n===0?(j+=0.6,e===0&&(a=1)):f.charAt(n-1)===" "&&(j+=0.8);f=f.substring(n+1,c);i+=j}f=i/b;b=(f*(b/c)+f)/2;b/=g;a&&b+0.15<1&&(b+=0.15);return b}}});
|
||||
emmet.define("utils",function(f,d){function h(b){this._data=[];this.length=0;b&&this.append(b)}var i="${0}";h.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=f("resources");if(!b)return"\n";b=b.getVariable("newline");return d.isString(b)?b:"\n"},setNewline:function(b){var c=f("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=[],g=0;g<c;g++)a.push(b);return a.join("")},getStringsPads:function(b){var b=d.map(b,function(a){return d.isString(a)?a.length:+a}),c=d.max(b);return d.map(b,function(a){return(a=c-a)?this.repeatString(" ",a):""},this)},padString:function(b,c){var a=d.isNumber(c)?this.repeatString(f("resources").getVariable("indentation")||"\t",c):c,g=[],e=this.splitByLines(b),j=this.getNewline();
|
||||
g.push(e[0]);for(var h=1;h<e.length;h++)g.push(j+a+e[h]);return g.join("")},zeroPadString:function(b,c){for(var a="",g=b.length;c>g++;)a+="0";return a+b},unindentString:function(b,c){for(var a=this.splitByLines(b),g=0;g<a.length;g++)a[g].search(c)==0&&(a[g]=a[g].substr(c.length));return a.join(this.getNewline())},replaceUnescapedSymbol:function(b,c,a){for(var g=0,e=b.length,j=c.length,f=0;g<e;)if(b.charAt(g)=="\\")g+=j+1;else if(b.substr(g,j)==c){var h=j;f++;var i=a;if(d.isFunction(a))(i=a(b,c,g,
|
||||
f))?(h=i[0].length,i=i[1]):i=!1;i===!1?g++:(b=b.substring(0,g)+i+b.substring(g+h),e=b.length,g+=i.length)}else g++;return b},replaceVariables:function(b,c){var c=c||{},a=d.isFunction(c)?c:function(a,b){return b in c?c[b]:null},g=f("resources");return f("tabStops").processText(b,{variable:function(b){var c=a(b.token,b.name,b);c===null&&(c=g.getVariable(b.name));if(c===null||d.isUndefined(c))c=b.token;return c}})},replaceCounter:function(b,c,a){b=String(b);c=String(c);/^\-?\d+$/.test(c)&&(c=+c);var g=
|
||||
this;return this.replaceUnescapedSymbol(b,"$",function(b,j,f){if(b.charAt(f+1)=="{"||g.isNumeric(b.charAt(f+1)))return!1;for(j=f+1;b.charAt(j)=="$"&&b.charAt(j+1)!="{";)j++;var h=j-f,i=0,m=!1,p;if(p=b.substr(j).match(/^@(\-?)(\d*)/))j+=p[0].length,p[1]&&(m=!0),i=parseInt(p[2]||1)-1;m&&a&&d.isNumber(c)&&(c=a-c+1);c+=i;return[b.substring(f,j),g.zeroPadString(c+"",h)]})},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 h(b)},
|
||||
replaceSubstring:function(b,c,a,g){if(d.isObject(a)&&"end"in a)g=a.end,a=a.start;d.isString(g)&&(g=a+g.length);d.isUndefined(g)&&(g=a);return a<0||a>b.length?b:b.substring(0,a)+c+b.substring(g)},narrowToNonSpace:function(b,c,a){c=f("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,g=0,e=a-1,d=c-1;d>0;d--){var h=
|
||||
b.charAt(d);if(h=="\n"||h=="\r"){g=d+1;break}}for(d=c;d<a;d++)if(h=b.charAt(d),h=="\n"||h=="\r"){e=d;break}return f("range").create(g,e-g)},deepMerge:function(){var b,c,a,g,e,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],g=b[c],j!==g&&(g&&(d.isObject(g)||(e=d.isArray(g)))?(e?(e=!1,a=a&&d.isArray(a)?a:[]):a=a&&d.isObject(a)?a:{},j[c]=this.deepMerge(a,g)):g!==void 0&&(j[c]=g));return j}}});
|
||||
emmet.define("range",function(f,d){function h(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 g;b instanceof i?(g=b.start,b=b.end):g=b;return h(this.start,g,c||"<=")&&h(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(f,d){function h(){this._list=[]}h.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 h}}});
|
||||
emmet.define("tokenIterator",function(f,d){function h(d){this.tokens=d;this._position=0;this.reset()}h.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 h(d)}}});
|
||||
emmet.define("stringStream",function(){function f(d){this.pos=this.start=0;this.string=d}f.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 i=0,b,c=this.pos,a=this.string.length;c<a;)if(b=this.string.charAt(c++),b==d)i++;else if(b==f&&(i--,i<1))return this.pos=c,!0;return!1},backUp:function(d){this.pos-=d},match:function(d,f,i){if(typeof d==
|
||||
"string"){if(i=i?function(b){return b.toLowerCase()}:function(b){return b},i(this.string).indexOf(i(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 f(d)}}});
|
||||
emmet.define("resources",function(f,d){function h(a,c,g){var d=f("utils"),c=d.replaceUnescapedSymbol(c,"|",d.getCaretPlaceholder());if(g=="snippets")return f("elements").create("snippet",c);if(g=="abbreviations"){g=c;f("utils").trim(a);var a=f("elements"),h;return(h=b.exec(g))?a.create("element",h[1],h[2],h[4]=="/"):a.create("reference",g)}}var i={},b=/^<(\w+\:?[\w\-]*)((?:\s+[\w\:\-]+\s*=\s*(['"]).*?\3)*)\s*(\/?)>/,c={},a={},g=f("handlerList").create();return{setVocabulary:function(b,g){i={};g==
|
||||
"system"?c=b:a=b},getVocabulary:function(b){return b=="system"?c:a},getMatchedResource:function(a,b){return g.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){g.add(a,b)},removeResolver:function(a){g.remove(a)},getSection:function(b){if(!b)return null;b in i||(i[b]=f("utils").deepMerge({},c[b],a[b]));for(var g=i[b],h=d.rest(arguments),o;g&&(o=h.shift());)if(o in g)g=g[o];else return null;return g},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||[],g=[b];~b.indexOf("-")&&g.push(b.replace(/\-/g,":"));var f=this.getSection(a),i=null;
|
||||
d.find(["snippets","abbreviations"],function(b){var c=this.getSection(a,b);if(c)return d.find(g,function(a){if(c[a])return i=h(a,c[a],b)})},this);c.push(a);return!i&&f["extends"]&&!d.include(c,f["extends"])?this.findSnippet(f["extends"],b,c):i},fuzzyFindSnippet:function(a,b,c){var c=c||0.3,a=this.getAllSnippets(a),g=f("string-score"),b=b.replace(/:$/,"").replace(/:/g,"-"),h=d.map(a,function(a,c){return{key:c,score:g.score(a.nk,b,0.1)}});if((h=d.last(d.sortBy(h,"score")))&&h.score>=c)return a[h.key].parsedValue},
|
||||
getAllSnippets:function(a){var b="all-"+a;if(!i[b]){var c=[],g=[];do{var f=this.getSection(a);if(!f)break;d.each(["snippets","abbreviations"],function(a){var b={};d.each(f[a]||null,function(c,g){b[g]={nk:g.replace(/:$/,"").replace(/:/g,"-"),value:c,parsedValue:h(g,c,a),type:a}});c.push(b)});g.push(a);a=f["extends"]}while(a&&!d.include(g,a));i[b]=d.extend.apply(d,c.reverse())}return i[b]}}});
|
||||
emmet.define("actions",function(f,d){function h(b){return f("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=h(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 g=h(a.name),e=c;if(a.options.label)for(var j=a.options.label.split("/"),g=j.pop(),f,i;f=j.shift();)i=d.find(e,function(a){return a.type=="submenu"&&a.name==f}),i||(i={name:f,type:"submenu",items:[]},e.push(i)),e=i.items;e.push({type:"action",name:a.name,label:g})}});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(f,d){function h(a){d.extend(this,g,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 h(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={},g={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:""};h.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?f("utils").getCaretPlaceholder():""}};c();return{create:function(a,
|
||||
c){return arguments.length==2?b(a,c):new h(d.defaults(a||{},g))},get:function(b,c){if(!b&&c){var g=f("resources").findItem(c,"profile");g&&(b=g)}return!b?a.plain:b instanceof h?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(f){return{isInsideTag:function(d,f){for(var i=/^<\/?\w[\w\:\-]*.*?>/,b=f;b>-1;){if(d.charAt(b)=="<")break;b--}return b!=-1&&(i=i.exec(d.substring(b)))&&f>b&&f<b+i[0].length?!0:!1},outputInfo:function(d,f,i){i=i||d.getProfileName();return{syntax:String(f||d.getSyntax()),profile:i?String(i):null,content:String(d.getContent())}},unindent:function(d,h){return f("utils").unindentString(h,this.getCurrentLinePadding(d))},getCurrentLinePadding:function(d){return f("utils").getLinePadding(d.getCurrentLine())}}});
|
||||
emmet.define("actionUtils",function(f){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 h=d.length,i=-1,b=0,c=0,a=0,g=f("utils"),e=f("abbreviationParser");;){h--;if(h<0){i=0;break}var j=d.charAt(h);if(j=="]")c++;else if(j=="["){if(!c){i=h+1;break}c--}else if(j=="}")a++;else if(j=="{"){if(!a){i=h+1;break}a--}else if(j==")")b++;else if(j=="("){if(!b){i=h+1;break}b--}else if(!c&&
|
||||
!a&&(!e.isAllowedChar(j)||j==">"&&g.endsWithTag(d.substring(0,h+1)))){i=h+1;break}}return i!=-1&&!a&&!c&&!b?d.substring(i).replace(/^[\*\+\>\^]+/,""):""},getImageSize:function(d){var f=function(){return d.charCodeAt(i++)};if(d.substr(0,8)==="\u0089PNG\r\n\u001a\n"){var i=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 i=6,{width:f()|f()<<8,height:f()|f()<<8};else if(d.substr(0,2)==="\u00ff\u00d8")for(var i=2,b=d.length;i<
|
||||
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 i+=1,{height:f()<<8|f(),width:f()<<8|f()};else i+=a-2}},captureContext:function(d){if(String(d.getSyntax())in{html:1,xml:1,xsl:1}){var h=String(d.getContent()),i=f("htmlMatcher").find(h,d.getCaretPos());if(i&&i.type=="tag"){for(var d=/([\w\-:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,i=i.open,h=i.range.substring(h).replace(/^<[\w\-\:]+/,""),i={name:i.name,attributes:[]},
|
||||
b;b=d.exec(h);)i.attributes.push({name:b[1],value:b[2]});return i}}return null},findExpressionBounds:function(d,h){for(var i=String(d.getContent()),b=i.length,c=d.getCaretPos()-1,a=c+1;c>=0&&h(i.charAt(c),c,i);)c--;for(;a<b&&h(i.charAt(a),a,i);)a++;if(a>c)return f("range").create([++c,a])},compoundUpdate:function(d,f){if(f){var i=d.getSelectionRange();d.replaceContent(f.data,f.start,f.end,!0);d.createSelection(f.caret,f.caret+i.end-i.start);return!0}return!1},detectSyntax:function(d,h){var i=h||"html";
|
||||
f("resources").hasSyntax(i)||(i="html");if(i=="html"&&(this.isStyle(d)||this.isInlineCSS(d)))i="css";return i},detectProfile:function(d){var h=d.getSyntax(),i=f("resources").findItem(h,"profile");if(i)return i;switch(h){case "xml":case "xsl":return"xml";case "css":if(this.isInlineCSS(d))return"line";break;case "html":return(i=f("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 h=
|
||||
String(d.getContent()),d=d.getCaretPos();return(h=f("htmlMatcher").tag(h,d))&&h.open.name.toLowerCase()=="style"&&h.innerRange.cmp(d,"lte","gte")},isInlineCSS:function(d){var h=String(d.getContent()),d=d.getCaretPos();return(h=f("xmlEditTree").parseFromPosition(h,d,!0))?(h=h.itemFromPosition(d,!0))&&h.name().toLowerCase()=="style"&&h.valueRange(!0).cmp(d,"lte","gte"):!1}}});
|
||||
emmet.define("abbreviationUtils",function(f,d){return{isSnippet:function(d){return f("elements").is(d.matchedResource(),"snippet")},isUnary:function(d){var i=d.matchedResource();return d.children.length||this.isSnippet(d)?!1:i&&i.is_empty||f("tagName").isEmptyElement(d.name())},isInline:function(d){return d.isTextNode()||!d.name()||f("tagName").isInlineLevel(d.name())},isBlock:function(d){return this.isSnippet(d)||!this.isInline(d)},isSnippet:function(d){return f("elements").is(d.matchedResource(),
|
||||
"snippet")},hasTagsInContent:function(d){return f("utils").matchesTag(d.content)},hasBlockChildren:function(f){return this.hasTagsInContent(f)&&this.isBlock(f)||d.any(f.children,function(d){return this.isBlock(d)},this)},insertChildContent:function(h,i,b){var b=d.extend({keepVariable:!0,appendIfNoChild:!0},b||{}),c=!1,a=f("utils"),h=a.replaceVariables(h,function(g,e,d){var f=g;e=="child"&&(f=a.padString(i,a.getLinePaddingFromPosition(h,d.start)),c=!0,b.keepVariable&&(f+=g));return f});!c&&b.appendIfNoChild&&
|
||||
(h+=i);return h}}});
|
||||
emmet.define("base64",function(){return{encode:function(f){for(var d=[],h,i,b,c,a,g,e=0,j=f.length;e<j;)c=f.charCodeAt(e++),a=f.charCodeAt(e++),g=f.charCodeAt(e++),h=c&255,i=a&255,b=g&255,c=h>>2,h=(h&3)<<4|i>>4,i=(i&15)<<2|b>>6,b&=63,isNaN(a)?i=b=64:isNaN(g)&&(b=64),d.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(i)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b));
|
||||
return d.join("")},decode:function(f){var d,h,i,b,c,a=0,g=0,e=[],j=f.length;if(!f)return f;f+="";do d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(a++)),h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(a++)),b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(a++)),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(a++)),i=d<<18|h<<12|b<<6|c,d=i>>16&
|
||||
255,h=i>>8&255,i&=255,b==64?e[g++]=String.fromCharCode(d):c==64?e[g++]=String.fromCharCode(d,h):e[g++]=String.fromCharCode(d,h,i);while(a<j);return e.join("")}}});
|
||||
emmet.define("htmlMatcher",function(f,d){function h(b){var e={},d;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(h){var i="p"+h;if(!(i in e)&&b.charAt(h)=="<"){var l=b.slice(h);e[i]=(d=l.match(c))?{name:d[1],selfClose:!!d[3],range:f("range").create(h,d[0]),type:"open"}:(d=l.match(a))?{name:d[1],range:f("range").create(h,d[0]),type:"close"}:!1}return e[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=[],f=null,h=b.text(),l=a.range.end,m=h.length;l<m;l++){if(i(h,l,"<\!--"))for(f=l;f<m;f++)if(i(h,f,"--\>")){l=f+3;break}if(f=b.matches(l))if(f.type=="open"&&!f.selfClose)c.push(f.name);else if(f.type=="close"){if(!c.length)return f.name==a.name?f:null;if(d.last(c)==f.name)c.pop();else{for(var p=!1;c.length&&!p;)c.pop()==f.name&&(p=!0);if(!c.length&&!p)return f.name==a.name?f:null}}}}var c=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
|
||||
a=/^<\/([\w\:\-]+)[^>]*>/;return{find:function(a,c){for(var j=f("range"),n=h(a),o=null,l=null,m=c;m>=0;m--)if(o=n.open(m))if(o.selfClose){if(o.range.cmp(c,"lt","gt"))break}else{if(l=b(o,n)){if(j.create2(o.range.start,l.range.end).contains(c))break}else if(o.range.contains(c))break;o=null}else if(i(a,m,"--\>"))for(var p=m-1;p>=0;p--)if(i(a,p,"--\>"))break;else{if(i(a,p,"<\!--")){m=p;break}}else if(i(a,m,"<\!--")){p=m+4;for(o=a.length;p<o;p++)if(i(a,p,"--\>")){p+=3;break}o={range:f("range").create(m,
|
||||
d.isNumber(p)?p-m:p[0]),type:"comment"};break}if(o)return p=m=null,l?(m=j.create2(o.range.start,l.range.end),p=j.create2(o.range.end,l.range.start)):m=p=j.create2(o.range.start,o.range.end),o.type=="comment"&&(j=m.substring(a),p.start+=j.length-j.replace(/^<\!--\s*/,"").length,p.end-=j.length-j.replace(/\s*--\>$/,"").length),{open:o,close:l,type:o.type=="comment"?"comment":"tag",innerRange:p,innerContent:function(){return this.innerRange.substring(a)},outerRange:m,outerContent:function(){return this.outerRange.substring(a)},
|
||||
range:!p.length()||!p.cmp(c,"lte","gte")?m:p,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(f,d){var h=100,i=0,b={replaceCarets:!1,escape:function(b){return"\\"+b},tabstop:function(b){return b.token},variable:function(b){return b.token}};f("abbreviationParser").addOutputProcessor(function(b,a){var g=0,e=f("tabStops"),d=f("utils"),h={tabstop:function(a){var b=parseInt(a.group);if(b==0)return"${0}";b>g&&(g=b);return a.placeholder?(b+=i,a=e.processText(a.placeholder,h),"${"+b+":"+a+"}"):"${"+(b+i)+"}"}},b=e.processText(b,h),b=d.replaceVariables(b,e.variablesResolver(a));
|
||||
i+=g+1;return b});return{extract:function(c,a){var g=f("utils"),e={carets:""},j=[],a=d.extend({},b,a,{tabstop:function(a){var b=a.token,c="";if(a.placeholder=="cursor")j.push({start:a.start,end:a.start+b.length,group:"carets",value:""});else{if("placeholder"in a)e[a.group]=a.placeholder;a.group in e&&(c=e[a.group]);j.push({start:a.start,end:a.start+b.length,group:a.group,value:c})}return b}});a.replaceCarets&&(c=c.replace(RegExp(g.escapeForRegexp(g.getCaretPlaceholder()),"g"),"${0:cursor}"));var c=
|
||||
this.processText(c,a),h=g.stringBuilder(),i=0,g=d.map(j,function(a){h.append(c.substring(i,a.start));var b=h.length,g=e[a.group]||"";h.append(g);i=a.end;return{group:a.group,start:b,end:b+g.length}});h.append(c.substring(i));return{text:h.toString(),tabstops:d.sortBy(g,"start")}},processText:function(c,a){for(var a=d.extend({},b,a),g=f("utils").stringBuilder(),e=f("stringStream").create(c),j,h;j=e.next();)if(j=="\\"&&!e.eol())g.append(a.escape(e.next()));else{h=j;if(j=="$")if(e.start=e.pos-1,e.match(/^[0-9]+/))h=
|
||||
a.tabstop({start:g.length,group:e.current().substr(1),token:e.current()});else if(j=e.match(/^\{([a-z_\-][\w\-]*)\}/))h=a.variable({start:g.length,name:j[1],token:e.current()});else if(j=e.match(/^\{([0-9]+)(:.+?)?\}/,!1)){e.skipToPair("{","}");h={start:g.length,group:j[1],token:e.current()};if(j=h.token.substring(h.group.length+2,h.token.length-1))h.placeholder=j.substr(1);h=a.tabstop(h)}g.append(h)}return g.toString()},upgrade:function(b,a){var g=0,e={tabstop:function(b){var c=parseInt(b.group);
|
||||
c>g&&(g=c);return b.placeholder?"${"+(c+a)+":"+b.placeholder+"}":"${"+(c+a)+"}"}};d.each(["start","end","content"],function(a){b[a]=this.processText(b[a],e)},this);return g},variablesResolver:function(b){var a={},g=f("resources");return function(e,j){if(j=="child")return e;if(j=="cursor")return f("utils").getCaretPlaceholder();var i=b.attribute(j);if(!d.isUndefined(i)&&i!==e)return i;if(i=g.getVariable(j))return i;a[j]||(a[j]=h++);return"${"+a[j]+":"+j+"}"}},resetTabstopIndex:function(){i=0;h=100}}});
|
||||
emmet.define("preferences",function(f,d){var h={},i={},b=null,c=null;return{define:function(a,b,c){var f=a;d.isString(a)&&(f={},f[a]={value:b,description:c});d.each(f,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+=""}h[b]=a}else b in h&&delete h[b]})},get:function(a){if(a in h)return h[a];if(a in i)return i[a].value},getArray:function(a){a=this.get(a);d.isUndefined(a)||(a=d.map(a.split(","),f("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 h&&delete h[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(h)},reset:function(){h={}},_startTest:function(){b=i;c=h;i={};h={}},_stopTest:function(){i=b;h=c}}});
|
||||
emmet.define("filters",function(f,d){function h(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 g=f("utils"),a=f("profile").get(a);d.each(h(c),function(c){(c=g.trim(c.toLowerCase()))&&c in i&&(b=i[c](b,a))});return b},composeList:function(b,c,a){c=f("profile").get(c);b=h(c.filters||f("resources").findItem(b,"filters")||"html");c.extraFilters&&(b=b.concat(h(c.extraFilters)));a&&(b=b.concat(h(a)));if(!b||!b.length)b=h("html");return b},
|
||||
extractFromAbbreviation:function(b){var c="",b=b.replace(/\|([\w\|\-]+)$/,function(a,b){c=b;return""});return[b,h(c)]}}});
|
||||
emmet.define("elements",function(f,d){function h(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,e){var f={name:a,is_empty:!!e};if(c)if(f.attributes=[],d.isArray(c))f.attributes=c;else if(d.isString(c))for(;a=
|
||||
b.exec(c);)f.attributes.push({name:a[1],value:a[3]});else d.each(c,function(a,b){f.attributes.push({name:b,value:a})});return f});c.add("snippet",h);c.add("reference",h);c.add("empty",function(){return{}});return c});
|
||||
emmet.define("editTree",function(f,d,h){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=f("range").create;i.extend=h.extend;i.prototype={initialize:function(){},_updateSource:function(a,b,e){var j=c(b,d.isUndefined(e)?0:e-b),h=a.length-
|
||||
j.length(),i=function(a){d.each(a,function(b,c){b>=j.end&&(a[c]+=h)})};i(this._positions);d.each(this.list(),function(a){i(a._positions)});this.source=f("utils").replaceSubstring(this.source,a,j)},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,f){return d.include(c,f)||d.include(b,a.name())})},value:function(a,b,c){var f=this.get(a);if(f)return f.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=h.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(f,d){function h(a,b){return f("range").create(a,b)}function i(a,b){var b=b||g|e,c=["white","line"];if((b&e)==e)for(;a.length&&d.include(c,d.last(a).type);)a.pop();if((b&g)==g)for(;a.length&&d.include(c,a[0].type);)a.shift();return a}function b(a){var b=["white","line",":"],c=[],f,j;a.nextUntil(function(){return!d.include(b,this.itemNext().type)});for(j=a.current().end;f=a.next();){if(f.type=="}"||f.type==";")return i(c,g|(f.type=="}"?e:0)),c.length?(j=c[0].start,
|
||||
a=d.last(c).end):a=j,h(j,a-j);c.push(f)}if(c.length)return h(c[0].start,d.last(c).end-c[0].start)}function c(a){var b=f("stringStream").create(a),c=[],g=/[\s\u00a0,]/,e=function(){b.next();c.push(h(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;e()}else if(a=="("){b.backUp(1);if(!b.skipToPair("(",")"))break;b.backUp(1);e()}else if(g.test(a))c.push(h(b.start,b.current().length-1)),b.eatWhile(g),b.start=b.pos;e();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},g=1,e=2,j=f("editTree").EditContainer.extend({initialize:function(c){d.defaults(this.options,a);var g=f("editTree"),e=f("tokenIterator").create(f("cssParser").parse(c)),j,r=[],q;for(j=e.position();q=e.next();){if(q.type=="{")break;r.push(q)}i(r);r.length?(j=r[0].start,r=d.last(r).end):r=j;j=h(j,r-j);this._positions.name=j.start;this._name=j.substring(c);if(!e.current()||e.current().type!="{")throw"Invalid CSS rule";
|
||||
for(this._positions.contentStart=e.position()+1;j=e.next();){if(r=j.type=="identifier")a:{r=e.tokens;q=e._i+1;for(var u=r.length;q<u;q++){if(r[q].type==":"){r=!0;break a}if(r[q].type=="identifier"||r[q].type=="line"){r=!1;break a}}r=!1}r&&(j=h(j),r=b(e),q=e.current()&&e.current().type==";"?h(e.current()):h(r.end,0),this._children.push(new n(this,g.createToken(j.start,j.substring(c)),g.createToken(r.start,r.substring(c)),g.createToken(q.start,q.substring(c)))))}this._saveStyle()},_saveStyle:function(){var a=
|
||||
this._positions.contentStart,b=this.source,c=f("utils");d.each(this.list(),function(g){g.styleBefore=b.substring(a,g.namePosition());var e=c.splitByLines(g.styleBefore);if(e.length>1)g.styleBefore="\n"+d.last(e);g.styleSeparator=b.substring(g.nameRange().end,g.valuePosition());g.styleBefore=d.last(g.styleBefore.split("*/"));g.styleSeparator=g.styleSeparator.replace(/\/\*.*?\*\//g,"");a=g.range().end})},add:function(a,b,c){var g=this.list(),e=this._positions.contentStart,j=d.pick(this.options,"styleBefore",
|
||||
"styleSeparator"),h=f("editTree");if(d.isUndefined(c))c=g.length;var i=g[c];if(i)e=i.fullRange().start;else if(i=g[c-1])i.end(";"),e=i.range().end;i&&(j=d.pick(i,"styleBefore","styleSeparator"));a=h.createToken(e+j.styleBefore.length,a);b=h.createToken(a.end+j.styleSeparator.length,b);h=new n(this,a,b,h.createToken(b.end,";"));d.extend(h,j);this._updateSource(h.styleBefore+h.toString(),e);this._children.splice(c,0,h);return h}}),n=f("editTree").EditElement.extend({initialize:function(a,b,c,g){this.styleBefore=
|
||||
a.options.styleBefore;this.styleSeparator=a.options.styleSeparator;this._end=g.value;this._positions.end=g.start},valueParts:function(a){var b=c(this.value());if(a){var g=this.valuePosition(!0);d.each(b,function(a){a.shift(g)})}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 g="",d=a.length,e=-1,j;b>=0;){j=a.charAt(b);if(j=="{"){e=b;break}else if(j=="}"&&!c){b++;break}b--}for(;b<d;){j=a.charAt(b);if(j=="{")e=b;else if(j=="}"){e!=-1&&(g=a.substring(e,b+1));break}b++}if(g){b=e-1;for(c="";b>=0;){j=a.charAt(b);if("{}/\\<>\n\r".indexOf(j)!=
|
||||
-1)break;b--}c=a.substring(b+1,e).replace(/^[\s\n\r]+/m,"");return f("range").create(e-c.length,g.length+c.length)}return null},baseName:function(a){return a.replace(/^\s*\-\w+\-/,"")},findParts:c}});
|
||||
emmet.define("xmlEditTree",function(f,d){var h={styleBefore:" ",styleSeparator:"=",styleQuote:'"',offset:0},i=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/m,b=f("editTree").EditContainer.extend({initialize:function(a){d.defaults(this.options,h);this._positions.name=1;var b=null,e=f("xmlParser").parse(a),j=f("range");d.each(e,function(e){e.value=j.create(e).substring(a);switch(e.type){case "tag":if(/^<[^\/]+/.test(e.value))this._name=e.value.substring(1);
|
||||
break;case "attribute":b&&this._children.push(new c(this,b));b=e;break;case "string":this._children.push(new c(this,b,e)),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,e){var j=
|
||||
this.list(),h=this.nameRange().end,i=f("editTree"),l=d.pick(this.options,"styleBefore","styleSeparator","styleQuote");if(d.isUndefined(e))e=j.length;var m=j[e];if(m)h=m.fullRange().start;else if(m=j[e-1])h=m.range().end;m&&(l=d.pick(m,"styleBefore","styleSeparator","styleQuote"));b=l.styleQuote+b+l.styleQuote;a=new c(this,i.createToken(h+l.styleBefore.length,a),i.createToken(h+l.styleBefore.length+a.length+l.styleSeparator.length,b));d.extend(a,l);this._updateSource(a.styleBefore+a.toString(),h);
|
||||
this._children.splice(e,0,a);return a}}),c=f("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,h,o=f("range"),l=Math.min(2E3,d),m=null,p=function(b){var c;if(a.charAt(b)=="<"&&(c=a.substr(b,l).match(i)))return o.create(b,c[0])};for(h=b;h>=0;h--)if(m=p(h))break;if(m&&(m.inside(b)||c))return m;if(!m&&c)return null;
|
||||
for(h=b;h<d;h++)if(m=p(h))return m}}});
|
||||
emmet.define("expandAbbreviation",function(f,d){var h=f("handlerList").create(),i=null,b=f("actions");b.add("expand_abbreviation",function(b,a,g){var e=d.toArray(arguments),j=f("editorUtils").outputInfo(b,a,g);e[1]=j.syntax;e[2]=j.profile;return h.exec(!1,e)});b.add("expand_abbreviation_with_tab",function(c,a,d){var e=c.getSelection(),j=f("resources").getVariable("indentation");if(e)return d=f("utils"),a=f("range").create(c.getSelectionRange()),e=d.padString(e,j),c.replaceContent(j+"${0}",c.getCaretPos()),
|
||||
j=f("range").create(c.getCaretPos(),a.length()),c.replaceContent(e,j.start,j.end,!0),c.createSelection(j.start,j.start+e.length),!0;b.run("expand_abbreviation",c,a,d)||c.replaceContent(j,c.getCaretPos());return!0},{hidden:!0});h.add(function(b,a,d){var e=b.getSelectionRange().end,j=i.findAbbreviation(b);return j&&(a=emmet.expandAbbreviation(j,a,d,f("actionUtils").captureContext(b)))?(b.replaceContent(a,e-j.length,e),!0):!1},{order:-1});return i={addHandler:function(b,a){h.add(b,a)},removeHandler:function(b){h.remove(b,
|
||||
options)},findAbbreviation:function(b){var a=f("range").create(b.getSelectionRange()),d=String(b.getContent());if(a.length())return a.substring(d);b=b.getCurrentLineRange();return f("actionUtils").extractAbbreviation(d.substring(b.start,a.start))}}});
|
||||
emmet.define("wrapWithAbbreviation",function(f){var d=null;f("actions").add("wrap_with_abbreviation",function(h,i,b,c){var b=f("editorUtils").outputInfo(h,b,c),a=f("utils"),c=f("editorUtils"),i=i||h.prompt("Enter abbreviation");if(!i)return null;var i=String(i),g=f("range").create(h.getSelectionRange());if(!g.length()){g=f("htmlMatcher").tag(b.content,g.start);if(!g)return!1;g=a.narrowToNonSpace(b.content,g.range)}a=a.escapeText(g.substring(b.content));return(i=d.wrap(i,c.unindent(h,a),b.syntax,b.profile,
|
||||
f("actionUtils").captureContext(h)))?(h.replaceContent(i,g.start,g.end),!0):!1});return d={wrap:function(d,i,b,c,a){var g=f("filters"),e=f("utils"),b=b||emmet.defaultSyntax(),c=f("profile").get(c,b);f("tabStops").resetTabstopIndex();d=g.extractFromAbbreviation(d);return(i=f("abbreviationParser").parse(d[0],{syntax:b,pastedContent:i,contextNode:a}))?(b=g.composeList(b,c,d[1]),g.apply(i,b,c),e.replaceVariables(i.toString())):null}}});
|
||||
emmet.exec(function(f,d){function h(b,a){var g=a-(b.options.offset||0),e=/^[\s\n\r]/;return d.find(b.list(),function(a){return a.range().end===g?e.test(b.source.charAt(g)):a.range().inside(g)})}function i(b,a,d,e){for(var j=-1,h=-1;a--;)if(b.substr(a,d.length)==d){j=a;break}if(j!=-1){a=j;for(d=b.length;d>=a++;)if(b.substr(a,e.length)==e){h=a+e.length;break}}return j!=-1&&h!=-1?f("range").create(j,h-j):null}function b(b,a,d,e){function j(b){return b.replace(RegExp("^"+p.escapeForRegexp(a)+"\\s*"),
|
||||
function(a){l-=a.length;return""}).replace(RegExp("\\s*"+p.escapeForRegexp(d)+"$"),"")}var h=f("editorUtils"),o=h.outputInfo(b).content,l=b.getCaretPos(),m=null,p=f("utils");(m=i(o,l,a,d))&&m.overlap(e)?(e=m,m=j(e.substring(o))):(m=a+" "+e.substring(o).replace(RegExp(p.escapeForRegexp(a)+"\\s*|\\s*"+p.escapeForRegexp(d),"g"),"")+" "+d,l+=a.length+1);return m!==null?(m=p.escapeText(m),b.setCaretPos(e.start),b.replaceContent(h.unindent(b,m),e.start,e.end),b.setCaretPos(l),!0):!1}f("actions").add("toggle_comment",
|
||||
function(c){var a=f("editorUtils").outputInfo(c);if(a.syntax=="css"){var d=c.getCaretPos(),e=f("htmlMatcher").tag(a.content,d);if(e&&e.open.range.inside(d))a.syntax="html"}if(a.syntax=="css"){e=f("range").create(c.getSelectionRange());a=f("editorUtils").outputInfo(c);if(!e.length()&&(d=f("cssEditTree").parseFromPosition(a.content,c.getCaretPos())))e=(e=h(d,c.getCaretPos()))?e.range(!0):f("range").create(d.nameRange(!0).start,d.source);e.length()||(e=f("range").create(c.getCurrentLineRange()),f("utils").narrowToNonSpace(a.content,
|
||||
e));c=b(c,"/*","*/",e)}else{a=f("range").create(c.getSelectionRange());d=f("editorUtils").outputInfo(c);if(!a.length()&&(d=f("htmlMatcher").tag(d.content,c.getCaretPos())))a=d.outerRange;c=b(c,"<\!--","--\>",a)}return c})});
|
||||
emmet.exec(function(f){function d(d,f,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 f=f||1,b=d.getCaretPos()+(b||0),a=String(d.getContent()),d=a.length,g=-1,e=/^\s+$/;b<=d&&b>=0;){b+=f;var j=a.charAt(b),n=a.charAt(b+1),o=a.charAt(b-1);switch(j){case '"':case "'":n==j&&o=="="&&(g=b+1);break;case ">":n=="<"&&(g=b+1);break;case "\n":case "\r":e.test(c(b-1))&&(g=b)}if(g!=-1)break}return g}f=f("actions");f.add("prev_edit_point",function(f){var i=
|
||||
f.getCaretPos(),b=d(f,-1);b==i&&(b=d(f,-1,-2));return b!=-1?(f.setCaretPos(b),!0):!1},{label:"Previous Edit Point"});f.add("next_edit_point",function(f){var i=d(f,1);return i!=-1?(f.setCaretPos(i),!0):!1})});
|
||||
emmet.exec(function(f,d){function h(a,b,c,d){var e=f("range"),g=f("editorUtils").outputInfo(a).content,j=g.length,h,i=e.create(-1,0),m=e.create(a.getSelectionRange());h=m.start;for(var n=1E5;h>=0&&h<j&&--n>0;){if(e=c(g,h,b)){if(i.equal(e))break;i=e.clone();if(h=d(e.substring(g),e.start,m.clone()))return a.createSelection(h.start,h.end),!0;else h=b?e.start:e.end-1}h+=b?-1:1}return!1}function i(a){var b=!0;return h(a,!1,function(a,c){if(b){b=!1;var d;a:{d=c;for(var g;d>=0;){if(g=e(a,d)){d=g;break a}d--}d=
|
||||
null}return d}else return e(a,c)},function(a,b,c){return g(a,b,c,!1)})}function b(a){return h(a,!0,e,function(a,b,c){return g(a,b,c,!0)})}function c(b,c,e){var e=e||0,g=f("range"),h=[],k=-1,i="",m="",n,l;d.each(c,function(c){switch(c.type){case "tag":l=b.substring(c.start,c.end);/^<[\w\:\-]/.test(l)&&h.push(g.create({start:c.start+1,end:c.end}));break;case "attribute":k=c.start;i=b.substring(c.start,c.end);break;case "string":h.push(g.create(k,c.end-k)),n=g.create(c),m=n.substring(b),j(m.charAt(0))&&
|
||||
n.start++,j(m.charAt(m.length-1))&&n.end--,h.push(n),i=="class"&&(h=h.concat(a(n.substring(b),n.start)))}});d.each(h,function(a){a.shift(e)});return d.chain(h).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}function a(a,b){var b=b||0,c=[],d=f("stringStream").create(a),e=f("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 g(a,b,e,g){a=c(a,f("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 e(a,b){var c;if(a.charAt(b)=="<"&&(c=a.substring(b,a.length).match(p)))return f("range").create(b,c[0])}function j(a){return a=='"'||a=="'"}function n(a){var b=
|
||||
a.valueRange(!0),c=[a.range(!0),b],e=f("stringStream"),g=f("cssEditTree"),k=f("range"),j=a.value();d.each(a.valueParts(),function(a){var f=a.clone();c.push(f.shift(b.start));var h=e.create(a.substring(j));if(h.match(/^[\w\-]+\(/,!0)){h.start=h.pos;h.skipToPair("(",")");var i=h.current();c.push(k.create(f.start+h.start,i));d.each(g.findParts(i),function(a){c.push(k.create(f.start+h.start+a.start,a.substring(i)))})}});return d.chain(c).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}
|
||||
function o(a,b,c){var e=null,g=null,f=a.list(),j,h;c?(f.reverse(),j=function(a){return a.range(!0).start<=b.start},h=function(a){return a.start<b.start}):(j=function(a){return a.range(!0).end>=b.end},h=function(a){return a.end>b.start});for(;e=d.find(f,j);){a=n(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,h))break}g=null;b.start=b.end=
|
||||
c?e.range(!0).start-1:e.range(!0).end+1}return g}function l(a,b,c){a=f("cssEditTree").parse(a,{offset:b});b=a.nameRange(!0);return c.end<b.end?b:o(a,c,!1)}function m(a,b,c){b=f("cssEditTree").parse(a,{offset:b});a=o(b,c,!0);return!a&&(b=b.nameRange(!0),c.start>b.start)?b:a}var p=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,r=f("actions");r.add("select_next_item",function(a){return a.getSyntax()=="css"?h(a,!1,f("cssEditTree").extractRule,l):i(a)});r.add("select_previous_item",
|
||||
function(a){return a.getSyntax()=="css"?h(a,!0,f("cssEditTree").extractRule,m):b(a)})});
|
||||
emmet.exec(function(f){function d(c,a){var a=String((a||"out").toLowerCase()),d=f("editorUtils").outputInfo(c),e=f("range").create(c.getSelectionRange()),d=d.content;b&&!b.range.equal(e)&&(b=null);if(b&&e.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 j=f("utils").narrowToNonSpace(d,b.innerRange);if((b=i.find(d,j.start+1))&&b.range.equal(e)&&b.outerRange.equal(e))b.range=b.innerRange}else if(!b.innerRange.equal(b.outerRange)&&
|
||||
b.range.equal(b.innerRange)&&e.equal(b.range))b.range=b.outerRange;else{if((b=i.find(d,e.start))&&b.range.equal(e)&&b.innerRange.equal(e))b.range=b.outerRange}else b=i.find(d,e.start);if(b&&!b.range.equal(e))return c.createSelection(b.range.start,b.range.end),!0;b=null;return!1}var h=f("actions"),i=f("htmlMatcher"),b=null;h.add("match_pair",d,{hidden:!0});h.add("match_pair_inward",function(b){return d(b,"in")},{label:"HTML/Match Pair Tag (inward)"});h.add("match_pair_outward",function(b){return d(b,
|
||||
"out")},{label:"HTML/Match Pair Tag (outward)"});h.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(f){f("actions").add("remove_tag",function(d){var h=f("utils"),i=f("editorUtils").outputInfo(d),b=f("htmlMatcher").tag(i.content,d.getCaretPos());if(b){if(b.close){var c=h.narrowToNonSpace(i.content,b.innerRange),a=h.findNewlineBounds(i.content,c.start),a=h.getLinePadding(a.substring(i.content)),i=c.substring(i.content),i=h.unindentString(i,a);d.replaceContent(h.getCaretPlaceholder()+h.escapeText(i),b.outerRange.start,b.outerRange.end)}else d.replaceContent(h.getCaretPlaceholder(),
|
||||
b.range.start,b.range.end);return!0}return!1},{label:"HTML/Remove Tag"})});
|
||||
emmet.exec(function(f){f("actions").add("split_join_tag",function(d,h){var i=f("htmlMatcher"),b=f("editorUtils").outputInfo(d,null,h),c=f("profile").get(b.profile);if(i=i.tag(b.content,d.getCaretPos())){if(i.close){var b=f("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=f("utils"),g=b.getNewline(),
|
||||
e=f("resources").getVariable("indentation"),a=d.getCaretPos(),c=c.tag_nl===!0?g+e+g:"",g=i.outerContent().replace(/\s*\/>$/,">"),a=i.outerRange.start+g.length;g+=c+"</"+i.open.name+">";g=b.escapeText(g);d.replaceContent(g,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(f,d){function h(c){var a=f("cssEditTree"),d=f("editorUtils").outputInfo(c),c=c.getCaretPos();if(a=a.parseFromPosition(d.content,c))if(d=a.itemFromPosition(c,!0)){var e=a.source,j=a.options.offset,c=c-j-d.range().start;b.exec(!1,[d]);if(e!==a.source)return{data:a.source,start:j,end:j+e.length,caret:j+d.range().start+c}}}function i(b){var b=f("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=f("handlerList").create();f("actions").add("reflect_css_value",function(b){return b.getSyntax()!="css"?!1:f("actionUtils").compoundUpdate(b,h(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 e;var j=b.name(),
|
||||
h=b.value(),i=d.name();e=d.value();var l=f("cssEditTree"),m=f("utils"),j=l.baseName(j),i=l.baseName(i);e=j=="opacity"&&i=="filter"?e.replace(/opacity=[^)]*/i,"opacity="+Math.floor(parseFloat(h)*100)):j=="filter"&&i=="opacity"?(j=h.match(/opacity=([^)]*)/i))?m.prettifyNumber(parseInt(j[1])/100):e:h;d.value(e)}})},{order:-1});return{addHandler:function(c,a){b.add(c,a)},removeHandler:function(c){b.remove(c,options)}}});
|
||||
emmet.exec(function(f){f("actions").add("evaluate_math_expression",function(d){var h=f("actionUtils"),i=f("utils"),b=String(d.getContent()),c=f("range").create(d.getSelectionRange());c.length()||(c=h.findExpressionBounds(d,function(a){return i.isNumeric(a)||".+-*/\\".indexOf(a)!=-1}));if(c&&c.length()){h=c.substring(b);h=h.replace(/([\d\.\-]+)\\([\d\.\-]+)/g,"Math.round($1/$2)");try{var a=i.prettifyNumber((new Function("return "+h))());d.replaceContent(a,c.start,c.end);d.setCaretPos(c.start+a.length);
|
||||
return!0}catch(g){}}return!1},{label:"Numbers/Evaluate Math Expression"})});
|
||||
emmet.exec(function(f,d){function h(b,a){var g=f("utils"),e=!1,j=!1,h=f("actionUtils").findExpressionBounds(b,function(a,b,c){return g.isNumeric(a)?!0:a=="."?!g.isNumeric(c.charAt(b+1))?!1:j?!1:j=!0:a=="-"?e?!1:e=!0:!1});if(h&&h.length()){var o=h.substring(String(b.getContent())),l=parseFloat(o);if(!d.isNaN(l)){l=g.prettifyNumber(l+a);if(/^(\-?)0+[1-9]/.test(o)){var m="";RegExp.$1&&(m="-",l=l.substring(1));l=l.split(".");l[0]=g.zeroPadString(l[0],i(o));l=m+l.join(".")}b.replaceContent(l,h.start,h.end);
|
||||
b.createSelection(h.start,h.start+l.length);return!0}}return!1}function i(b){b=b.replace(/^\-/,"");return~b.indexOf(".")?b.split(".")[0].length:b.length}var b=f("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 h(a,c)},{label:"Numbers/"+a.charAt(0).toUpperCase()+a.substring(1)+" number by "+Math.abs(c)})})});
|
||||
emmet.exec(function(f,d){var h=f("actions"),i=f("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.");
|
||||
h.add("insert_formatted_line_break_only",function(b){var c=f("utils"),a=f("resources"),g=f("editorUtils").outputInfo(b),e=b.getCaretPos(),j=c.getNewline();if(d.include(["html","xml","xsl"],g.syntax)){if(a=a.getVariable("indentation"),(g=f("htmlMatcher").tag(g.content,e))&&!g.innerRange.length())return b.replaceContent(j+a+c.getCaretPlaceholder()+j,e),!0}else if(g.syntax=="css"&&(g=g.content,e&&g.charAt(e-1)=="{")){var h=i.get("css.closeBraceIndentation"),a=a.getVariable("indentation"),o=g.charAt(e)==
|
||||
"}";if(!o)for(var l=e,m=g.length,p;l<m;l++){p=g.charAt(l);if(p=="{")break;if(p=="}"){h="";o=!0;break}}o||(h+="}");c=j+a+c.getCaretPlaceholder()+h;b.replaceContent(c,e);return!0}return!1},{hidden:!0});h.add("insert_formatted_line_break",function(b){if(!h.run("insert_formatted_line_break_only",b)){for(var c=f("utils"),a=f("editorUtils").getCurrentLinePadding(b),d=String(b.getContent()),e=b.getCaretPos(),j=d.length,c=c.getNewline(),i="",o=b.getCurrentLineRange().end+1,l;o<j;o++)if(l=d.charAt(o),l==" "||
|
||||
l=="\t")i+=l;else break;i.length>a.length?b.replaceContent(c+i,e,e,!0):b.replaceContent(c,e)}return!0},{hidden:!0})});
|
||||
emmet.exec(function(f){f("actions").add("merge_lines",function(d){var h=f("htmlMatcher"),i=f("utils"),b=f("editorUtils").outputInfo(d),c=f("range").create(d.getSelectionRange());if(!c.length()&&(h=h.find(b.content,d.getCaretPos())))c=h.outerRange;if(c.length()){b=c.substring(b.content);b=i.splitByLines(b);for(h=1;h<b.length;h++)b[h]=b[h].replace(/^\s+/,"");b=b.join("").replace(/\s{2,}/," ");h=b.length;b=i.escapeText(b);d.replaceContent(b,c.start,c.end);d.createSelection(c.start,c.start+h);return!0}return!1})});
|
||||
emmet.exec(function(f){function d(d,b,c){c=c||0;return b.charAt(c)==d.charAt(0)&&b.substr(c,d.length)==d}function h(d,b,c){var a=f("file"),g=f("actionUtils"),e=d.getFilePath();if(e===null)throw"You should save your file before using this action";var h=a.locateFile(e,b);if(h===null)throw"Can't find "+b+" file";a.read(h,function(e,o){if(e)throw"Unable to read "+h+": "+e;var l=f("base64").encode(String(o));if(!l)throw"Can't encode file content to base64";l="data:"+(g.mimeTypes[String(a.getExt(h))]||
|
||||
"application/octet-stream")+";base64,"+l;d.replaceContent("$0"+l,c,c+b.length)});return!0}f("actions").add("encode_decode_data_url",function(i){var b=String(i.getSelection()),c=i.getCaretPos();if(!b)for(var a=String(i.getContent());c-- >=0;)if(d("src=",a,c)){if(a=a.substr(c).match(/^(src=(["'])?)([^'"<>\s]+)\1?/))b=a[3],c+=a[1].length;break}else if(d("url(",a,c)){if(a=a.substr(c).match(/^(url\((['"])?)([^'"\)\s]+)\1?/))b=a[3],c+=a[1].length;break}if(b)if(d("data:",b))if(a=String(i.prompt("Enter path to file (absolute or relative)"))){var g=
|
||||
f("file"),e=g.createPath(i.getFilePath(),a);if(!e)throw"Can't save file";g.save(e,f("base64").decode(b.replace(/^data\:.+?;.+?,/,"")));i.replaceContent("$0"+a,c,c+b.length);i=!0}else i=!1;else i=h(i,b,c);else i=!1;return i},{label:"Encode\\Decode data:URL image"})});
|
||||
emmet.exec(function(f,d){function h(c){var a=c.getCaretPos(),g=f("editorUtils").outputInfo(c),e=f("xmlEditTree").parseFromPosition(g.content,a,!0);e&&(e.name()||"").toLowerCase()=="img"&&b(c,e.value("src"),function(b){if(b){var g=e.range(!0);e.value("width",b.width);e.value("height",b.height,e.indexOf("width")+1);f("actionUtils").compoundUpdate(c,d.extend(g,{data:e.toString(),caret:a}))}})}function i(c){var a=c.getCaretPos(),g=f("editorUtils").outputInfo(c),e=f("cssEditTree").parseFromPosition(g.content,
|
||||
a,!0);if(e){var g=e.itemFromPosition(a,!0),h;g&&(h=/url\((["']?)(.+?)\1\)/i.exec(g.value()||""))&&b(c,h[2],function(b){if(b){var g=e.range(!0);e.value("width",b.width+"px");e.value("height",b.height+"px",e.indexOf("width")+1);f("actionUtils").compoundUpdate(c,d.extend(g,{data:e.toString(),caret:a}))}})}}function b(b,a,d){var e=f("actionUtils");if(a){if(/^data:/.test(a))return b=f("base64").decode(a.replace(/^data\:.+?;.+?,/,"")),d(e.getImageSize(b));var h=f("file"),i=h.locateFile(b.getFilePath(),
|
||||
a);if(i===null)throw"Can't find "+a+" file";h.read(i,function(a,b){if(a)throw"Unable to read "+i+": "+a;d(e.getImageSize(String(b)))})}}f("actions").add("update_image_size",function(b){d.include(["css","less","scss"],String(b.getSyntax()))?i(b):h(b);return!0})});
|
||||
emmet.define("cssResolver",function(f,d){function h(a){var b=a&&a.charCodeAt(0);return a&&a=="."||b>47&&b<58}function i(a){a=f("utils").trim(a);if(~a.indexOf("/*")||/[\n\r]/.test(a))return!1;if(!/^[a-z0-9\-]+\s*\:/i.test(a))return!1;a=f("tabStops").processText(a,{replaceCarets:!0,tabstop:function(){return"value"}});return a.split(":").length==2}function b(a){a.charAt(0)=="-"&&!/^\-[\.\d]/.test(a)&&(a=a.replace(/^\-+/,""));if(a.charAt(0)=="#"){var b=a.replace(/^#+/,"")||"0";if(b.toLowerCase()=="t")a=
|
||||
"transparent";else{var d=f("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)}q.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(q.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=q.getDict("css.keywordAliases");return a in b?b[a]:a}function a(a){return d.include(q.getArray("css.keywords"),c(a))}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 e(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 j(a,b){d.isString(b)&&(b={prefix:b});r[a]=d.extend({},p,b)}function n(a,b){if(b){var c=q.get(b+"."+a);
|
||||
if(!d.isUndefined(c))return c}return q.get("css."+a)}function o(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+$/,"")+n("valueSeparator",c)+f("utils").trim(a.substring(b+1));return a.replace(/\s*;\s*$/,n("propertyEnd",c))}function l(a){var b=q.getArray(a);d.each(q.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 m=null,p={prefix:"emmet",obsolete:!1,transformName:function(a){return"-"+this.prefix+"-"+a},properties:function(){return l("css."+this.prefix+"Properties")||[]},supports:function(a){return d.include(this.properties(),a)}},r={},q=f("preferences");q.define("css.valueSeparator",": ","Defines a symbol that should be placed between CSS property and value when expanding CSS abbreviations.");q.define("css.propertyEnd",";","Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations.");
|
||||
q.define("stylus.valueSeparator"," ","Defines a symbol that should be placed between CSS property and value when expanding CSS abbreviations in Stylus dialect.");q.define("stylus.propertyEnd","","Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations in Stylus dialect.");q.define("sass.propertyEnd","","Defines a symbol that should be placed at the end of CSS property when expanding CSS abbreviations in SASS dialect.");q.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 u=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."),
|
||||
s=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){q.define("css."+b+"Properties",a,u({vendor:b}));q.define("css."+b+"PropertiesAddon","",s({vendor:b}))});q.define("css.unitlessProperties","z-index, line-height, opacity, font-weight, zoom","The list of properties whose values \u200b\u200bmust not contain units.");q.define("css.intUnit","px","Default unit for integer values");q.define("css.floatUnit","em","Default unit for float values");q.define("css.keywords","auto, inherit","A comma-separated list of valid keywords that can be used in CSS abbreviations.");
|
||||
q.define("css.keywordAliases","a:auto, i:inherit, s:solid, da:dashed, do:dotted, t:transparent","A comma-separated list of keyword aliases, used in CSS abbreviation. Each alias should be defined as <code>alias:keyword_name</code>.");q.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>.");q.define("css.color.short",!0,"Should color values like <code>#ffffff</code> be shortened to <code>#fff</code> after abbreviation with color was expanded.");
|
||||
q.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>.");q.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>");
|
||||
q.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.");q.define("css.alignVendor",!1,"If set to <code>true</code>, all generated vendor-prefixed properties will be aligned by real property name.");j("w",{prefix:"webkit"});j("m",{prefix:"moz"});j("s",{prefix:"ms"});j("o",{prefix:"o"});var v=["css","less","sass","scss","stylus"];f("resources").addResolver(function(a,
|
||||
b){return d.include(v,b)&&a.isElement()?m.expandToSnippet(a.abbreviation,b):null});var w=f("expandAbbreviation");w.addHandler(function(a,b,c){if(!d.include(v,b))return!1;var e=a.getSelectionRange().end,g=w.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 m={addPrefix:j,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="",j;d<e;){j=b.charAt(d);if(h(j)||
|
||||
j=="#"||j=="-"&&h(b.charAt(d+1))){g=b.substring(d);break}d++}j=b.substring(0,b.length-g.length);d=f("resources");for(e=[];~j.indexOf("-")&&!d.findSnippet(c,j);){j=j.split("-");var i=j.pop();if(!a(i))break;e.unshift(i);j=j.join("-")}return e.join("-")+g},parseValues:function(c){for(var e=f("stringStream").create(c),g=[],j=null;j=e.next();){if(j=="#")e.match(/^t|[0-9a-f]+/i,!0);else if(j=="-"){if(a(d.last(g))||e.start&&h(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=q.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=q.getDict("css.unitAliases"),e+=g in a?a[g]:
|
||||
g):e=e.replace(/\.$/,"")+q.get(~e.indexOf(".")?"css.floatUnit":"css.intUnit");return e})},expand:function(a,b,c){var c=c||"css",g=f("resources"),h=q.get("css.autoInsertVendorPrefixes"),j;if(j=/^(.+)\!$/.test(a))a=RegExp.$1;var m=g.findSnippet(c,a);if(m&&!h)return o(m,j,c);var a=this.extractPrefixes(a),l=this.extractValues(a.property),a=d.extend(a,l);m?a.values=null:m=g.findSnippet(c,a.property);!m&&q.get("css.fuzzySearch")&&(m=g.fuzzyFindSnippet(c,a.property,parseFloat(q.get("css.fuzzySearchMinScore"))));
|
||||
if(m){if(!d.isString(m))m=m.data}else m=a.property+":${1};";if(!i(m))return m;var n=this.splitSnippet(m),v=[];!b&&a.values&&(b=d.map(a.values,function(a){return this.normalizeValue(a,n.name)},this).join(" ")+";");n.value=b||n.value;var b=a.prefixes=="all"||!a.prefixes&&h?e(n.name,h&&a.prefixes!="all"):a.prefixes,p=[],w;d.each(b,function(a){a in r&&(w=r[a].transformName(n.name),p.push(w),v.push(o(w+":"+n.value,j,c)))});v.push(o(n.name+":"+n.value,j,c));p.push(n.name);if(q.get("css.alignVendor"))var s=
|
||||
f("utils").getStringsPads(p),v=d.map(v,function(a,b){return s[b]+a});return v},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)},splitSnippet:function(a){var b=f("utils"),a=b.trim(a);if(a.indexOf(":")==-1)return{name:a,value:"${1};"};a=a.split(":");return{name:b.trim(a.shift()),value:b.trim(a.join(":")).replace(/^(\$\{0\}|\$0)(\s*;?)$/,"${1}$2")}},getSyntaxPreference:n,transformSnippet:o}});
|
||||
emmet.define("cssGradient",function(f,d){function h(a){return f("utils").trim(a).replace(/\s+/g," ")}function i(a){var a=h(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(q.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 g(a){var b=
|
||||
s.getArray("css.gradient.prefixes"),b=d.map(b,function(b){return"-"+b+"-"+a});b.push(a);return b}function e(a,b){var c=[],e=f("cssResolver");s.get("css.gradient.fallback")&&~b.toLowerCase().indexOf("background")&&c.push({name:"background-color",value:"${1:"+a.colorStops[0].color+"}"});d.each(s.getArray("css.gradient.prefixes"),function(d){var g=e.prefixed(b,d);if(d=="webkit"&&s.get("css.gradient.oldWebkit"))try{c.push({name:g,value:p.oldWebkitLinearGradient(a)})}catch(f){}c.push({name:g,value:p.toString(a,
|
||||
d)})});return c.sort(function(a,b){return b.name.length-a.name.length})}function j(a,b,c){var h=a.parent,j=f("utils"),i=f("preferences").get("css.alignVendor"),m=a.styleSeparator,l=a.styleBefore;d.each(h.getAll(g(a.name())),function(b){if(b!=a&&/gradient/i.test(b.value())){if(b.styleSeparator.length<m.length)m=b.styleSeparator;if(b.styleBefore.length<l.length)l=b.styleBefore;h.remove(b)}});if(i){if(l!=a.styleBefore){var n=a.fullRange();h._updateSource(l,n.start,n.start+a.styleBefore.length);a.styleBefore=
|
||||
l}if(m!=a.styleSeparator)h._updateSource(m,a.nameRange().end,a.valueRange().start),a.styleSeparator=m}var o=a.value();c||(c=f("range").create(0,a.value()));a.value(function(a){return j.replaceSubstring(o,a,c)}(p.toString(b))+"${2}");b=e(b,a.name());if(i){i=d.pluck(b,"value");n=d.pluck(b,"name");i.push(a.value());n.push(a.name());var r=j.getStringsPads(d.map(i,function(a){return a.substring(0,a.indexOf("("))})),q=j.getStringsPads(n);a.name(d.last(q)+a.name());d.each(b,function(a,b){a.name=q[b]+a.name;
|
||||
a.value=r[b]+a.value});a.value(d.last(r)+a.value())}d.each(b,function(b){h.add(b.name,b.value,h.indexOf(a))})}function n(a){var b=a.value(),c=null;return(a=d.find(a.valueParts(),function(a){return c=p.parse(a.substring(b))}))&&c?{gradient:c,valueRange:a}:null}function o(a,b){var c=s.get("css.gradient.defaultProperty");if(!c)return!1;var g=String(a.getContent()),h=f("range").create(a.getCurrentLineRange()),j=h.substring(g).replace(/^\s+/,function(a){h.start+=a.length;return""}).replace(/\s+$/,function(a){h.end-=
|
||||
a.length;return""}),g=f("cssResolver");if(j=p.parse(j)){var i=e(j,c);i.push({name:c,value:p.toString(j)+"${2}"});var m=g.getSyntaxPreference("valueSeparator",b),l=g.getSyntaxPreference("propertyEnd",b);if(f("preferences").get("css.alignVendor")){var n=f("utils").getStringsPads(d.map(i,function(a){return a.value.substring(0,a.value.indexOf("("))}));d.each(i,function(a,b){a.value=n[b]+a.value})}i=d.map(i,function(a){return a.name+m+a.value+l});a.replaceContent(i.join("\n"),h.start,h.end);return!0}return!1}
|
||||
function l(a,b){var c=null,e=f("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 m=["top","to bottom","0deg"],p=null,r=["css","less","sass","scss","stylus","styl"],q=/\d+deg/i,u=/top|bottom|left|right/i,s=f("preferences");s.define("css.gradient.prefixes","webkit, moz, o","A comma-separated list of vendor-prefixes for which values should be generated.");s.define("css.gradient.oldWebkit",
|
||||
!0,"Generate gradient definition for old Webkit implementations");s.define("css.gradient.omitDefaultDirection",!0,"Do not output default direction definition in generated gradients.");s.define("css.gradient.defaultProperty","background-image","When gradient expanded outside CSS value context, it will produce properties with this name.");s.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.");
|
||||
f("expandAbbreviation").addHandler(function(a,b,c){c=f("editorUtils").outputInfo(a,b,c);if(!d.include(r,c.syntax))return!1;var e=a.getCaretPos(),g=c.content,c=l(g,e);if(c.property){var h=n(c.property);if(h){var i=c.rule.options.offset||0,m=i+c.rule.toString().length;if(/[\n\r]/.test(c.property.value())){var p=c.property.valueRange(!0).start+h.valueRange.end,g=f("utils").replaceSubstring(g,";",p),e=l(g,e);e.property&&(h=n(e.property),c=e)}c.property.end(";");var e=c.property.name(),g=f("resources"),
|
||||
p=f("preferences"),q=g.findSnippet(b,e);!q&&p.get("css.fuzzySearch")&&(q=g.fuzzyFindSnippet(b,e,parseFloat(p.get("css.fuzzySearchMinScore"))));if(q){if(!d.isString(q))q=q.data;b=f("cssResolver").splitSnippet(q).name}else b=void 0;b&&c.property.name(b);j(c.property,h.gradient,h.valueRange);a.replaceContent(c.rule.toString(),i,m,!0);return!0}}return o(a,b)});f("reflectCSSValue").addHandler(function(a){var b=f("utils"),c=n(a);if(!c)return!1;var e=a.value(),h=function(a){return b.replaceSubstring(e,a,
|
||||
c.valueRange)};d.each(a.parent.getAll(g(a.name())),function(b){if(b!==a){var d=b.value().match(/^\s*(\-([a-z]+)\-)?linear\-gradient/);d?b.value(h(p.toString(c.gradient,d[2]||""))):b.value().match(/\s*\-webkit\-gradient/)&&b.value(h(p.oldWebkitLinearGradient(c.gradient)))}});return!0});return p={parse:function(a){var b=null;f("utils").trim(a).replace(/^([\w\-]+)\((.+?)\)$/,function(a,c,e){c=c.toLowerCase().replace(/^\-[a-z]+\-/,"");if(c=="linear-gradient"||c=="lg"){for(var a=m[0],e=f("stringStream").create(f("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,h));if(c.length){if(q.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&&(!s.get("css.gradient.omitDefaultDirection")||!d.include(m,a.direction))&&e.unshift(a.direction);return c+"("+e.join(", ")+")"}}}});emmet.exec(function(f,d){var h=f("handlerList").create(),i=f("resources");d.extend(i,{addGenerator:function(b,c,a){d.isString(b)&&(b=RegExp(b));h.add(function(a,d){var f;return(f=b.exec(a.name()))?c(f,a,d):null},a)}});i.addResolver(function(b,c){return h.exec(null,d.toArray(arguments))})});
|
||||
emmet.define("tagName",function(f,d){var h={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(h[c],b)},addMapping:function(b,c){i[b]=c},removeMapping:function(b){b in i&&delete i[b]},addElementToCollection:function(b,c){h[c]||(h[c]=[]);var a=this.getCollection(c);d.include(a,b)||a.push(b)},removeElementFromCollection:function(b,c){c in h&&(h[c]=d.without(this.getCollection(c),b))},getCollection:function(b){return h[b]}}});
|
||||
emmet.exec(function(f,d){function h(){return{element:g.get("bem.elementSeparator"),modifier:g.get("bem.modifierSeparator")}}function i(a){if(f("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="",f="",b=h();~d.indexOf(b.element)?(e=d.split(b.element),f=e[1].split(b.modifier),e=e[0],g=f.shift(),f=f.join(b.modifier)):~d.indexOf(b.modifier)&&(f=d.split(b.modifier),e=f.shift(),f=f.join(b.modifier));if(e||g||f){if(!e)e=a.__bem.block;d=e;var i=[];g&&(d+=b.element+g);i.push(d);f&&i.push(d+b.modifier+f);a.__bem.block=e;a.__bem.element=g;a.__bem.modifier=f;b=i}else b=d;return b}).flatten().uniq().value().join(" "))&&a.attribute("class",e);return a}function b(a){var b=f("utils"),a=(" "+(a||
|
||||
"")+" ").replace(/\s+/g," "),c=g.get("bem.shortElementPrefix");c&&(c=RegExp("\\s("+b.escapeForRegexp(c)+"+)","g"),a=a.replace(c,function(a,c){return" "+b.repeatString(h().element,c.length)}));return b.trim(a)}function c(a,b,c){var d=h(),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""}),f=b;f.parent&&g--;)f=f.parent;if(!f||!f.__bem)f=b;if(f&&f.__bem)return a=f.__bem.block,c=="modifier"&&f.__bem.element&&(a+=d.element+f.__bem.element),
|
||||
a+d[c]+e}return a}function a(b,c){b.name&&i(b,c);var g=f("abbreviationUtils");d.each(b.children,function(b){a(b,c);!g.isSnippet(b)&&b.start&&(e=!0)});return b}var g=f("preferences");g.define("bem.elementSeparator","__","Class name\u2019s element separator.");g.define("bem.modifierSeparator","_","Class name\u2019s modifier separator.");g.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 e=!1;f("filters").add("bem",function(b,c){e=!1;b=a(b,c);e&&(b=f("filters").apply(b,"html",c));return b})});
|
||||
emmet.exec(function(f,d){function h(c,a,g){var e=f("utils"),h=b.get("filter.commentTrigger");if(h=="*"||d.find(h.split(","),function(a){return!!c.attribute(e.trim(a))}))h={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=e.normalizeNewline(a?a(h):""),g=e.normalizeNewline(g?g(h):""),c.start=c.start.replace(/</,a+"<"),c.end=c.end.replace(/>/,">"+g)}function i(b,a,g){var e=f("abbreviationUtils");d.each(b.children,function(b){e.isBlock(b)&&
|
||||
h(b,a,g);i(b,a,g)});return b}var b=f("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>");f("filters").add("c",function(c){var a=
|
||||
d.template(b.get("filter.commentBefore")),g=d.template(b.get("filter.commentAfter"));return i(c,a,g)})});emmet.exec(function(f,d){function h(b){return b.replace(/([<>&])/g,function(b,a){return i[a]})}var i={"<":"<",">":">","&":"&"};f("filters").add("e",function c(a){d.each(a.children,function(a){a.start=h(a.start);a.end=h(a.end);a.content=h(a.content);c(a)});return a})});
|
||||
emmet.exec(function(f,d){function h(a){return a.parent&&!a.parent.parent&&!a.index()}function i(a,c){var d=f("abbreviationUtils");return c.tag_nl===!0||d.isBlock(a)?!0:!a.parent||!c.inline_break?!1:b(a.parent,c)}function b(a,b){var c=0,h=f("abbreviationUtils");return!!d.find(a.children,function(a){a.isTextNode()||!h.isInline(a)?c=0:h.isInline(a)&&c++;if(c>=b.inline_break)return!0})}function c(a,c){var h=f("abbreviationUtils");return!d.any(a.children,function(a){return h.isSnippet(a)?!1:!h.isInline(a)})?
|
||||
b(a,c):!0}var a=f("preferences");a.define("format.noIndentTags","html","A comma-separated list of tag names that should not get inner indentation.");a.define("format.forceIndentationForTags","body","A comma-separated list of tag names that should <em>always</em> get inner indentation.");f("filters").add("_format",function e(b,n,o){var o=o||0,l=f("abbreviationUtils");d.each(b.children,function(b){if(l.isSnippet(b)){if(b.start=b.end="",!h(b)&&n.tag_nl!==!1&&i(b,n)&&(!b.parent.parent||!f("abbreviationUtils").isInline(b.parent)))b.start=
|
||||
f("utils").getNewline()+b.start}else{b.start=b.end="%s";var j=f("utils"),r=f("abbreviationUtils"),q=r.isUnary(b),j=j.getNewline(),u=d.include(a.getArray("format.noIndentTags")||[],b.name())?"":f("resources").getVariable("indentation");if(n.tag_nl!==!1){var s=n.tag_nl===!0&&(n.tag_nl_leaf||b.children.length);s||(s=d.include(a.getArray("format.forceIndentationForTags")||[],b.name()));if(!b.isTextNode()){if(i(b,n)){if(!h(b)&&(!r.isSnippet(b.parent)||b.index()))b.start=j+b.start;if(r.hasBlockChildren(b)||
|
||||
b.children.length&&i(b.children[0],n)||s&&!q)b.end=j+b.end;if(r.hasTagsInContent(b)||s&&!b.children.length&&!q)b.start+=j+u}else if(r.isInline(b)&&b.parent&&f("abbreviationUtils").hasBlockChildren(b.parent)&&!h(b))b.start=j+b.start;else if(r.isInline(b)&&c(b,n))b.end=j+b.end;b.padding=u}}}e(b,n,o+1)});return b})});
|
||||
emmet.exec(function(f,d){function h(h,b){var c="",a=[],g=b.attributeQuote(),e=b.cursor();d.each(h.attributeList(),function(d){var h=b.attributeName(d.name);switch(h.toLowerCase()){case "id":c+="#"+(d.value||e);break;case "class":c+="."+f("utils").trim(d.value||e).replace(/\s+/g,".");break;default:a.push(":"+h+" => "+g+(d.value||e)+g)}});a.length&&(c+="{"+a.join(", ")+"}");return c}f("filters").add("haml",function b(c,a,g){var g=g||0,e=f("abbreviationUtils");g||(c=f("filters").apply(c,"_format",a));
|
||||
d.each(c.children,function(c){if(!e.isSnippet(c)&&c.parent){var d=f("abbreviationUtils"),o=f("utils"),l=h(c,a),m=a.cursor(),d=d.isUnary(c),p=a.self_closing_tag&&d?"/":"",r="",r="%"+a.tagName(c.name());r.toLowerCase()=="%div"&&l&&l.indexOf("{")==-1&&(r="");c.end="";c.start=o.replaceSubstring(c.start,r+l+p+" ",c.start.indexOf("%s"),"%s");!c.children.length&&!d&&(c.start+=m)}b(c,a,g+1)});return c})});
|
||||
emmet.exec(function(f,d){function h(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("")}f("filters").add("html",function b(c,a,g){var g=g||0,e=f("abbreviationUtils");g||(c=f("filters").apply(c,"_format",a));d.each(c.children,function(c){if(!e.isSnippet(c)&&c.parent){var d=f("abbreviationUtils"),o=f("utils"),l=h(c,a),m=a.cursor(),d=d.isUnary(c),p="",r="";if(!c.isTextNode()){var q=a.tagName(c.name());
|
||||
d?(p="<"+q+l+a.selfClosing()+">",c.end=""):(p="<"+q+l+">",r="</"+q+">")}c.start=o.replaceSubstring(c.start,p,c.start.indexOf("%s"),"%s");c.end=o.replaceSubstring(c.end,r,c.end.indexOf("%s"),"%s");!c.children.length&&!d&&!~c.content.indexOf(m)&&!f("tabStops").extract(c.content).tabstops.length&&(c.start+=m)}b(c,a,g+1)});return c})});
|
||||
emmet.exec(function(f,d){var h=/^\s+/,i=/[\n\r]/g;f("filters").add("s",function c(a){var g=f("abbreviationUtils");d.each(a.children,function(a){if(!g.isSnippet(a))a.start=a.start.replace(h,""),a.end=a.end.replace(h,"");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(f,d){function h(f,b){d.each(f.children,function(c){if(c.content)c.content=c.content.replace(b,"");h(c,b)});return f}f("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).");f("filters").add("t",function(d){var b=
|
||||
RegExp(f("preferences").get("filter.trimRegexp"));return h(d,b)})});emmet.exec(function(f,d){var h={"xsl:variable":1,"xsl:with-param":1};f("filters").add("xsl",function b(c){var a=f("abbreviationUtils");d.each(c.children,function(c){if(!a.isSnippet(c)&&(c.name()||"").toLowerCase()in h&&c.children.length)c.start=c.start.replace(/\s+select\s*=\s*(['"]).*?\1/,"");b(c)});return c})});
|
||||
emmet.exec(function(f,d){function h(a,b){return Math.round(Math.random()*(b-a)+a)}function i(a,b){for(var c=a.length,g=Math.min(c,b),f=[];f.length<g;){var i=h(0,c-1);d.include(f,i)||f.push(i)}return d.map(f,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(h(0,4)):"?!..."[h(0,4)]))}function c(a){var b=a.length,c=0,c=b>3&&b<=6?h(0,1):b>6&&b<=12?h(0,2):h(1,4);d.each(i(d.range(c)),function(b){a[b]+=
|
||||
","})}f("abbreviationParser").addPreprocessor(function(d){var f=/^(?:lorem|lipsum)(\d*)$/i,n;d.findAll(function(d){if(d._name&&(n=d._name.match(f))){var e=n[1]||30;d._name="";d.data("forceNameResolving",d.isRepeating()||d.attributeList().length);d.data("pasteOverwrites",!0);d.data("paste",function(d){var f=e,j=!d,d=[],n=0,f=parseInt(f,10);j&&(j=a.slice(0,f),j.length>5&&(j[4]+=","),n+=j.length,d.push(b(j,".")));for(;n<f;)j=i(g,Math.min(h(3,12)*h(1,5),f-n)),n+=j.length,c(j),d.push(b(j));return d.join(" ")})}})});
|
||||
var a="lorem ipsum dolor sit amet consectetur adipisicing elit".split(" "),g=["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(f){f("actions").add("select_line",function(d){var f=d.getCurrentLineRange();d.createSelection(f.start,f.end);return!0})});
|
||||
emmet.exec(function(f){f("resources").setVocabulary({variables:{lang:"en",locale:"en-US",charset:"UTF-8",indentation:"\t",newline:"\n"},css:{filters:"html",snippets:{"@i":"@import url(|);","@import":"@import url(|);","@m":"@media ${1:screen} {\n\t|\n}","@media":"@media ${1:screen} {\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}",
|
||||
"@kf":"@-webkit-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-o-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-moz-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}",anim:"animation:|;","anim-":"animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode};",animdel:"animation-delay:${1:time};",
|
||||
animdir:"animation-direction:${1:normal};","animdir:n":"animation-direction:normal;","animdir:r":"animation-direction:reverse;","animdir:a":"animation-direction:alternate;","animdir:ar":"animation-direction:alternate-reverse;",animdur:"animation-duration:${1:0}s;",animfm:"animation-fill-mode:${1:both};","animfm:f":"animation-fill-mode:forwards;","animfm:b":"animation-fill-mode:backwards;","animfm:bt":"animation-fill-mode:both;","animfm:bh":"animation-fill-mode:both;",animic:"animation-iteration-count:${1:1};",
|
||||
"animic:i":"animation-iteration-count:infinite;",animn:"animation-name:${1:none};",animps:"animation-play-state:${1:running};","animps:p":"animation-play-state:paused;","animps:r":"animation-play-state:running;",animtf:"animation-timing-function:${1:linear};","animtf:e":"animation-timing-function:ease;","animtf:ei":"animation-timing-function:ease-in;","animtf:eo":"animation-timing-function:ease-out;","animtf:eio":"animation-timing-function:ease-in-out;","animtf:l":"animation-timing-function:linear;",
|
||||
"animtf:cb":"animation-timing-function:cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1});",ap:"appearance:${none}","!":"!important",pos:"position:${1:relative};","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:${1:left};","fl:n":"float:none;","fl:l":"float:left;",
|
||||
"fl:r":"float:right;",cl:"clear:${1:both};","cl:n":"clear:none;","cl:l":"clear:left;","cl:r":"clear:right;","cl:b":"clear:both;",colm:"columns:|;",colmc:"column-count:|;",colmf:"column-fill:|;",colmg:"column-gap:|;",colmr:"column-rule:|;",colmrc:"column-rule-color:|;",colmrs:"column-rule-style:|;",colmrw:"column-rule-width:|;",colms:"column-span:|;",colmw:"column-width:|;",d:"display:${1:block};","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:${1:hidden};","v:v":"visibility:visible;","v:h":"visibility:hidden;","v:c":"visibility:collapse;",ov:"overflow:${1:hidden};","ov:v":"overflow:visible;","ov:h":"overflow:hidden;","ov:s":"overflow:scroll;","ov:a":"overflow:auto;",ovx:"overflow-x:${1:hidden};","ovx:v":"overflow-x:visible;","ovx:h":"overflow-x:hidden;","ovx:s":"overflow-x:scroll;","ovx:a":"overflow-x:auto;",ovy:"overflow-y:${1:hidden};","ovy:v":"overflow-y:visible;","ovy:h":"overflow-y:hidden;",
|
||||
"ovy:s":"overflow-y:scroll;","ovy:a":"overflow-y:auto;",ovs:"overflow-style:${1:scrollbar};","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;",zm:"zoom:1;",cp:"clip:|;","cp:a":"clip:auto;","cp:r":"clip:rect(${1:top} ${2:right} ${3:bottom} ${4:left});",bxz:"box-sizing:${1:border-box};","bxz:cb":"box-sizing:content-box;","bxz:bb":"box-sizing:border-box;",bxsh:"box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:color};",
|
||||
"bxsh:r":"box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:spread }rgb(${6:0}, ${7:0}, ${8:0});","bxsh:ra":"box-shadow:${1:inset }${2:h} ${3:v} ${4:blur} ${5:spread }rgba(${6:0}, ${7:0}, ${8:0}, .${9:5});","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:|;",mar:"max-resolution:${1:res};",mir:"min-resolution:${1:res};",ori:"orientation:|;","ori:l":"orientation:landscape;","ori:p":"orientation:portrait;",ol:"outline:|;","ol:n":"outline:none;",olo:"outline-offset:|;",olw:"outline-width:|;",ols:"outline-style:|;",
|
||||
olc:"outline-color:#${1:000};","olc:i":"outline-color:invert;",bd:"border:|;","bd+":"border:${1:1px} ${2:solid} ${3:#000};","bd:n":"border:none;",bdbk:"border-break:${1:close};","bdbk:c":"border-break:close;",bdcl:"border-collapse:|;","bdcl:c":"border-collapse:collapse;","bdcl:s":"border-collapse:separate;",bdc:"border-color:#${1:000};","bdc:t":"border-color:transparent;",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:${1:repeat};","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;",
|
||||
bdlen:"border-length:|;","bdlen: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:|;",bdtw:"border-top-width:|;",bdrw:"border-right-width:|;",bdbw:"border-bottom-width:|;",bdlw:"border-left-width:|;",bdt:"border-top:|;",bt:"border-top:|;","bdt+":"border-top:${1:1px} ${2:solid} ${3:#000};","bdt:n":"border-top:none;",bdts:"border-top-style:|;","bdts:n":"border-top-style:none;",bdtc:"border-top-color:#${1:000};","bdtc:t":"border-top-color:transparent;",bdr:"border-right:|;",br:"border-right:|;","bdr+":"border-right:${1:1px} ${2:solid} ${3:#000};","bdr:n":"border-right:none;",
|
||||
bdrst:"border-right-style:|;","bdrst:n":"border-right-style:none;",bdrc:"border-right-color:#${1:000};","bdrc:t":"border-right-color:transparent;",bdb:"border-bottom:|;",bb:"border-bottom:|;","bdb+":"border-bottom:${1:1px} ${2:solid} ${3:#000};","bdb:n":"border-bottom:none;",bdbs:"border-bottom-style:|;","bdbs:n":"border-bottom-style:none;",bdbc:"border-bottom-color:#${1:000};","bdbc:t":"border-bottom-color:transparent;",bdl:"border-left:|;",bl:"border-left:|;","bdl+":"border-left:${1:1px} ${2:solid} ${3:#000};",
|
||||
"bdl:n":"border-left:none;",bdls:"border-left-style:|;","bdls:n":"border-left-style:none;",bdlc:"border-left-color:#${1:000};","bdlc:t":"border-left-color:transparent;",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};","bgc:t":"background-color:transparent;",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;","bgr:sp":"background-repeat:space;","bgr:rd":"background-repeat:round;",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:${1:padding-box};","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;",bgsz:"background-size:|;","bgsz:a":"background-size:auto;","bgsz:ct":"background-size:contain;","bgsz:cv":"background-size:cover;",c:"color:#${1:000};","c:r":"color:rgb(${1:0}, ${2:0}, ${3:0});","c:ra":"color:rgba(${1:0}, ${2:0}, ${3:0}, .${4:5});",cm:"/* |${child} */",cnt:"content:'|';","cnt:n":"content:normal;","cnt:oq":"content:open-quote;","cnt:noq":"content:no-open-quote;","cnt:cq":"content:close-quote;","cnt:ncq":"content:no-close-quote;","cnt:a":"content:attr(|);",
|
||||
"cnt:c":"content:counter(|);","cnt:cs":"content:counters(|);",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:${1:top};","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:${1:left};","ta:l":"text-align:left;","ta:c":"text-align:center;","ta:r":"text-align:right;","ta:j":"text-align:justify;","ta-lst":"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:${1:none};","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;",tov:"text-overflow:${ellipsis};","tov:e":"text-overflow:ellipsis;","tov:c":"text-overflow:clip;",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:${1:uppercase};","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:r":"text-shadow:${1:h} ${2:v} ${3:blur} rgb(${4:0}, ${5:0}, ${6:0});","tsh:ra":"text-shadow:${1:h} ${2:v} ${3:blur} rgba(${4:0}, ${5:0}, ${6:0}, .${7:5});","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});",trfo:"transform-origin:|;",trfs:"transform-style:${1:preserve-3d};",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:${italic};","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)';",rsz:"resize:|;","rsz:n":"resize:none;","rsz:b":"resize:both;","rsz:h":"resize:horizontal;","rsz:v":"resize:vertical;",cur:"cursor:${pointer};","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:|;",us:"user-select:${none};",wid:"widows:|;",
|
||||
wfsm:"-webkit-font-smoothing:${antialiased};","wfsm:a":"-webkit-font-smoothing:antialiased;","wfsm:s":"-webkit-font-smoothing:subpixel-antialiased;","wfsm:sa":"-webkit-font-smoothing:subpixel-antialiased;","wfsm:n":"-webkit-font-smoothing:none;"}},html:{filters:"html",profile:"html",snippets:{"!!!":"<!doctype html>","!!!4t":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',"!!!4s":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
"!!!xt":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',"!!!xs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',"!!!xxs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',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]--\>"},
|
||||
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:vp":'<meta name="viewport" content="width=${1:device-width}, user-scalable=${2:no}, initial-scale=${3:1.0}, maximum-scale=${4:1.0}, minimum-scale=${5:1.0}" />',
|
||||
"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="${1:text}" />',inp:'<input type="${1:text}" name="" id="" />',"input:hidden":"input[type=hidden name]","input:h":"input:hidden","input:text":"inp","input:t":"inp","input:search":"inp[type=search]","input:email":"inp[type=email]","input:url":"inp[type=url]","input:password":"inp[type=password]",
|
||||
"input:p":"input:password","input:datetime":"inp[type=datetime]","input:date":"inp[type=date]","input:datetime-local":"inp[type=datetime-local]","input:month":"inp[type=month]","input:week":"inp[type=week]","input:time":"inp[type=time]","input:number":"inp[type=number]","input:color":"inp[type=color]","input:checkbox":"inp[type=checkbox]","input:c":"input:checkbox","input:radio":"inp[type=radio]","input:r":"input:radio","input:range":"inp[type=range]","input:file":"inp[type=file]","input:f":"input:file",
|
||||
"input:submit":'<input type="submit" value="" />',"input:s":"input:submit","input:image":'<input type="image" src="" alt="" />',"input:i":"input:image","input:button":'<input type="button" value="" />',"input:b":"input:button","input:reset":"input:button[type=reset]",select:'<select name="" id="">',option:'<option value="">',textarea:'<textarea name="" id="" cols="${1:30}" rows="${2:10}">',"menu:context":"menu[type=context]>","menu:c":"menu:context","menu:toolbar":"menu[type=toolbar]>","menu:t":"menu: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",doc:"html>(head>meta[charset=UTF-8]+title{${1:Document}})+body",doc4:'html>(head>meta[http-equiv="Content-Type" content="text/html;charset=${charset}"]+title{${1:Document}})',"html:4t":"!!!4t+doc4[lang=${lang}]","html:4s":"!!!4s+doc4[lang=${lang}]","html:xt":"!!!xt+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]","html:xs":"!!!xs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]","html:xxs":"!!!xxs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]",
|
||||
"html:5":"!!!+doc[lang=${lang}]","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",xsl:"!!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform]>{\n|}"},snippets:{"!!!":'<?xml version="1.0" encoding="UTF-8"?>'}},haml:{filters:"haml","extends":"html",profile:"xml"},scss:{"extends":"css"},sass:{"extends":"css"},less:{"extends":"css"},stylus:{"extends":"css"}},"system")});
|
||||
emmet.define("cm-editor-proxy",function(f,d){function h(){if(CodeMirror.version>="3.1")return CodeMirror.Pass;throw CodeMirror.Pass;}var i=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)||/Mac/.test(navigator.platform),b={"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"},
|
||||
c={"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 a={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,h){d.isUndefined(c)&&(c=d.isUndefined(b)?
|
||||
content.length:b);d.isUndefined(b)&&(b=0);var i=f("utils");h||(a=i.padString(a,i.getLinePaddingFromPosition(this.getContent(),b)));var h=f("tabStops").extract(a,{escape:function(a){return a}}),a=h.text,l=h.tabstops[0];l?(l.start+=b,l.end+=b):l={start:a.length+b,end:a.length+b};var m=this;(this.context.operation||this.context.compoundChange).call(this.context,function(){m.context.replaceRange(a,m.context.posFromIndex(b),m.context.posFromIndex(c));m.createSelection(l.start,l.end)})},getContent:function(){return this.context.getValue()},
|
||||
getSyntax:function(){var a=this.context.getOption("mode");a in c&&(a=c[a]);return f("actionUtils").detectSyntax(this,a)},getProfileName:function(){return this.context.getOption("profile")?this.context.getOption("profile"):f("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=f("utils").repeatString(" ",
|
||||
a.getOption("indentUnit")));f("resources").setVariable("indentation",b)},addAction:function(b,c,d){var n="emmet."+b;CodeMirror.commands[n]||(CodeMirror.commands[n]=function(c){var d;a.setupContext(c);var e;if(e=b=="expand_abbreviation_with_tab")if(!(e=a.getSelection()))e=a.getSyntax(),e=!f("resources").hasSyntax(e);if(e)d=h();else{e=!0;try{var i=f("actions").run(b,a);(b=="next_edit_point"||b=="prev_edit_point")&&c.replaceSelection("");!i&&b=="insert_formatted_line_break_only"&&(e=!1)}catch(j){}e||
|
||||
(d=h())}return d});if(c){if(!d)if(CodeMirror.keyMap&&CodeMirror.keyMap["default"])d=CodeMirror.keyMap["default"];else{if(!CodeMirror.defaults.extraKeys)CodeMirror.defaults.extraKeys={};d=CodeMirror.defaults.extraKeys}i||(c=c.replace("Cmd","Ctrl"));d&&(d[c]=n)}}};typeof emmetKeymap!="undefined"&&(b=emmetKeymap);d.each(b,function(b,c){a.addAction(b,c)});return a});
|
||||
BIN
plugins/emmet/icon.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
plugins/jshint/icon.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
4832
plugins/jshint/jshint.js
Normal file
BIN
plugins/regexplained/icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
plugins/tinypng/icon.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
plugins/voke/icon.png
Normal file
|
After Width: | Height: | Size: 1002 B |
BIN
plugins/wireframecc/icon.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// -----------------------------------------------
|
||||
// Zip-It! for ICEcoder v0.9.5 by Matt Pass
|
||||
// Zip-It! for ICEcoder v1.0 by Matt Pass
|
||||
// Will backup requested files/folders in ICEcoder
|
||||
// and remove old backups older than $keepLastDays
|
||||
// -----------------------------------------------
|
||||
@@ -12,7 +12,7 @@ include("../../lib/settings.php");
|
||||
<title>Zip It! for ICEcoder</title>
|
||||
</head>
|
||||
<body>
|
||||
<?
|
||||
<?php
|
||||
$saveLocation = '../../backups/';
|
||||
$_GET['zip']=="|" ? $fileName = "root" : $fileName = str_replace("|","_",strClean($_GET['zip']));
|
||||
$fileName .= '-'.time().'.zip';
|
||||
@@ -24,7 +24,7 @@ Class zipIt {
|
||||
$zipName = $zipDir.$zipFile;
|
||||
$zipFiles = array();
|
||||
$_GET['zip']=="|" ? $zipTgt = "" : $zipTgt = str_replace("|","/",strClean($_GET['zip']));
|
||||
if (strpos($_GET['zip'],"/")!==0) {$zipTgt = "/".$zipTgt;};
|
||||
if (strpos($_GET['zip'],"/")!==0) {$zipTgt = "/".trim($zipTgt,"/");};
|
||||
$addItem = $docRoot.$zipTgt;
|
||||
|
||||
if (is_dir($addItem)) {
|
||||
@@ -33,7 +33,7 @@ Class zipIt {
|
||||
$currentDir = array_pop($dirStack);
|
||||
$dir = dir($currentDir);
|
||||
while (false !== ($node = $dir->read())) {
|
||||
if (($node == '.') || ($node == '..')) {continue;}
|
||||
if ($node == '.' || $node == '..') {continue;}
|
||||
if (is_dir($currentDir.$node) && !strpos($currentDir.$node,"_coder") && !strpos($currentDir.$node,"ICEcoder")) {
|
||||
array_push($dirStack,$currentDir.$node.'/');
|
||||
}
|
||||
@@ -58,11 +58,11 @@ Class zipIt {
|
||||
if(count($zipFiles)) {
|
||||
$zip = new ZipArchive();
|
||||
if($zip->open($zipName,ZIPARCHIVE::CREATE)!== true) {return false;}
|
||||
$excludeFilesFolders = explode("*",strClean($_GET['exclude']));
|
||||
$excludeFilesFolders = isset($_GET['exclude']) ? explode("*",strClean($_GET['exclude'])) : array();
|
||||
foreach($zipFiles as $file) {
|
||||
$canAdd=true;
|
||||
for ($i=0;$i<count($excludeFilesFolders);$i++) {
|
||||
if(strpos($file,$excludeFilesFolders[$i])!==false) {$canAdd=false;};
|
||||
if($excludeFilesFolders[$i] && strpos($file,$excludeFilesFolders[$i])!==false) {$canAdd=false;};
|
||||
}
|
||||
if ($canAdd==true) {
|
||||
$zip->addFile($file,str_replace($docRoot."/","",$file));
|
||||
|
||||
201
terminal/index.php
Normal 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">$> <input class="command" name="command" type="text" size='50' onkeyup="key(event)" tabindex="1"></p>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php } ?>
|
||||
28
terminal/terminal.css
Normal 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}
|
||||
99
test/index.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<script src="object-watch.js"></script>
|
||||
</head>
|
||||
|
||||
<body onLoad="runTests()">
|
||||
|
||||
<script>
|
||||
ICEcoder=top.ICEcoder;
|
||||
if(ICEcoder.openFiles.length>0) {ICEcoder.closeAllTabs();}
|
||||
|
||||
function runTests() {
|
||||
o = {p: 'start'}; // var used to test another var has changed
|
||||
s = 0; // successful tests
|
||||
test.openFile(); // start the first test
|
||||
t = 0; // tries
|
||||
}
|
||||
|
||||
test = {
|
||||
openFile: function() {
|
||||
o.p = ICEcoder.openFiles[0];
|
||||
t = 0;
|
||||
x = setInterval(function() {
|
||||
wait();
|
||||
cM = ICEcoder.getcMInstance();
|
||||
if (cM && ICEcoder.openFiles[0]!="") {
|
||||
s++;
|
||||
displayResults(s);
|
||||
clearInterval(x);
|
||||
console.log('+ GOOD Opened file OK. Took '+(t*10)+'ms');
|
||||
test.updateDoc();
|
||||
} else if (t==100) {
|
||||
displayResults(s);
|
||||
clearInterval(x);
|
||||
console.log('- FAIL Failed to open file');
|
||||
}
|
||||
o.p = ICEcoder.openFiles[0];
|
||||
t++;
|
||||
},10);
|
||||
result = ICEcoder.openFile('<?php echo str_replace("\\","/",dirname($_SERVER['PHP_SELF']))."/test-file1.txt";?>');
|
||||
},
|
||||
|
||||
updateDoc: function() {
|
||||
cM.setValue('Updated');
|
||||
if (cM.getValue()=="Updated") {s++};
|
||||
displayResults(s);
|
||||
console.log((cM.getValue()=="Updated") ? '+ GOOD Change file contents OK' : '- FAIL Didnt update contents');
|
||||
test.saveFile();
|
||||
},
|
||||
|
||||
saveFile: function() {
|
||||
o.p = ICEcoder.changedContent[0];
|
||||
t = 0;
|
||||
x = setInterval(function() {
|
||||
w = wait();
|
||||
cM = ICEcoder.getcMInstance();
|
||||
if (cM && ICEcoder.changedContent[0]==0) {
|
||||
s++;
|
||||
displayResults(s);
|
||||
clearInterval(x);
|
||||
console.log('+ GOOD Saved file OK. Took '+(t*10)+'ms');
|
||||
test.closeTab();
|
||||
} else if (t==100) {
|
||||
displayResults(s);
|
||||
clearInterval(x);
|
||||
console.log('- FAIL Didnt save file');
|
||||
}
|
||||
o.p = ICEcoder.changedContent[0];
|
||||
t++;
|
||||
},10);
|
||||
result = ICEcoder.saveFile();
|
||||
},
|
||||
|
||||
closeTab: function() {
|
||||
ICEcoder.closeTab(1);
|
||||
if (cM.getValue()=="Updated") {s++};
|
||||
displayResults(s);
|
||||
console.log(ICEcoder.openFiles.length==0 ? '+ GOOD Closed file OK' : '- FAIL Didnt close file OK');
|
||||
}
|
||||
}
|
||||
|
||||
function wait() {
|
||||
o.watch("p", function (id, oldval, newval) {
|
||||
if (oldval != newval) {
|
||||
o.unwatch('p');
|
||||
return newval;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function displayResults(successful) {
|
||||
total = Object.keys(test).length;
|
||||
top.ICEcoder.content.contentWindow.document.getElementById('unitTestResults').innerHTML = "Ran "+successful+" of "+total+" tests OK";
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
54
test/object-watch.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* object.watch polyfill
|
||||
*
|
||||
* 2012-04-03
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* Public Domain.
|
||||
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
// object.watch
|
||||
if (!Object.prototype.watch) {
|
||||
Object.defineProperty(Object.prototype, "watch", {
|
||||
enumerable: false
|
||||
, configurable: true
|
||||
, writable: false
|
||||
, value: function (prop, handler) {
|
||||
var
|
||||
oldval = this[prop]
|
||||
, newval = oldval
|
||||
, getter = function () {
|
||||
return newval;
|
||||
}
|
||||
, setter = function (val) {
|
||||
oldval = newval;
|
||||
return newval = handler.call(this, prop, oldval, val);
|
||||
}
|
||||
;
|
||||
|
||||
if (delete this[prop]) { // can't watch constants
|
||||
Object.defineProperty(this, prop, {
|
||||
get: getter
|
||||
, set: setter
|
||||
, enumerable: true
|
||||
, configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// object.unwatch
|
||||
if (!Object.prototype.unwatch) {
|
||||
Object.defineProperty(Object.prototype, "unwatch", {
|
||||
enumerable: false
|
||||
, configurable: true
|
||||
, writable: false
|
||||
, value: function (prop) {
|
||||
var val = this[prop];
|
||||
delete this[prop]; // remove accessors
|
||||
this[prop] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
1
test/test-file1.txt
Normal file
@@ -0,0 +1 @@
|
||||
initial text
|
||||