update smarteditor
This commit is contained in:
parent
3302649c3c
commit
6145459b5d
37 changed files with 6429 additions and 7953 deletions
|
|
@ -1,10 +1,8 @@
|
|||
function get_editor_wr_content()
|
||||
{
|
||||
function get_editor_wr_content() {
|
||||
return oEditors.getById['wr_content'].getIR();;
|
||||
}
|
||||
|
||||
function put_editor_wr_content(content)
|
||||
{
|
||||
function put_editor_wr_content(content) {
|
||||
oEditors.getById["wr_content"].exec("SET_CONTENTS", [""]);
|
||||
//oEditors.getById["wr_content"].exec("SET_IR", [""]);
|
||||
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ function editor_html($id, $content, $is_dhtml_editor = true)
|
|||
|
||||
if ($is_dhtml_editor && $js) {
|
||||
$html .= "\n<script src=\"{$editor_url}/js/service/HuskyEZCreator.js\"></script>";
|
||||
$html .= "\n<script>let g5_editor_url = \"{$editor_url}\", oEditors = [], ed_nonce = \"{ft_nonce_create('smarteditor')}\";let editorAdditionalFontList = [";
|
||||
$html .= "\n<script>var g5_editor_url = '" . $editor_url . "', oEditors = [], ed_nonce = '" . ft_nonce_create('smarteditor') . "', editorAdditionalFontList = [";
|
||||
|
||||
$sql = "SELECT * FROM {$g5['font_table']} ORDER BY font_name ASC";
|
||||
$result = sql_query($sql);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,6 +17,7 @@
|
|||
font-size: inherit;
|
||||
direction: inherit;
|
||||
}
|
||||
|
||||
.fileinput-button span {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,18 @@
|
|||
.fileupload-buttonbar .toggle {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.progress-animated .progress-bar,
|
||||
.progress-animated .bar {
|
||||
background: url("../img/progressbar.gif") !important;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
.fileupload-process {
|
||||
float: right;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.fileupload-processing .fileupload-process,
|
||||
.files .processing .preview {
|
||||
display: block;
|
||||
|
|
@ -31,25 +34,30 @@
|
|||
background: url("../img/loading.gif") center no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
.fileupload-buttonbar .toggle,
|
||||
.files .toggle,
|
||||
.files .btn span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.files .name {
|
||||
width: 80px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.files img,
|
||||
.files canvas {
|
||||
max-width: 100%;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fileinput-button input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
|
|
|||
|
|
@ -10,24 +10,91 @@
|
|||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {margin:0;padding:0;overflow-x:hidden}
|
||||
body,input,textarea,select,button,table{font-family:'돋움',Dotum,Helvetica,sans-serif;font-size:12px}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-x: hidden
|
||||
}
|
||||
|
||||
#pop_header{height:26px;padding:14px 0 0 20px;border-bottom:1px solid #ededeb;background:#f4f4f3}
|
||||
#pop_header h1{color:#333;font-size:14px;letter-spacing:-1px;margin:0;padding:0}
|
||||
body,
|
||||
input,
|
||||
textarea,
|
||||
select,
|
||||
button,
|
||||
table {
|
||||
font-family: '돋움', Dotum, Helvetica, sans-serif;
|
||||
font-size: 12px
|
||||
}
|
||||
|
||||
.content_container{padding:5px 10px}
|
||||
#pop_header {
|
||||
height: 26px;
|
||||
padding: 14px 0 0 20px;
|
||||
border-bottom: 1px solid #ededeb;
|
||||
background: #f4f4f3
|
||||
}
|
||||
|
||||
.swfupload{OUTLINE-WIDTH: 0px; OUTLINE-STYLE: none; OUTLINE-COLOR: invert}
|
||||
#pop_header h1 {
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
letter-spacing: -1px;
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.pop_container .drag_area{overflow:hidden;overflow-y:auto;position:relative;width:100%;height:250px;margin-top:4px;border:1px solid #eceff2}
|
||||
.pop_container .blind{visibility:hidden;position:absolute;line-height:0}
|
||||
.pop_container .drag_area .bg{position:absolute;top:0;left:0;width:100%;height:250px;background: #fdfdfd url(../../../img/photoQuickPopup/bg_drag_image.png) 50% 50% no-repeat;}
|
||||
.pop_container .drag_area .showbg{display:block}
|
||||
.pop_container .drag_area .hidebg{display:none}
|
||||
.content_container {
|
||||
padding: 5px 10px
|
||||
}
|
||||
|
||||
ul.sortable{margin:0;padding:0;*zoom:1}
|
||||
ul.sortable:after{display:block;clear:both;content:""}
|
||||
.swfupload {
|
||||
OUTLINE-WIDTH: 0px;
|
||||
OUTLINE-STYLE: none;
|
||||
OUTLINE-COLOR: invert
|
||||
}
|
||||
|
||||
.pop_container .drag_area {
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
margin-top: 4px;
|
||||
border: 1px solid #eceff2
|
||||
}
|
||||
|
||||
.pop_container .blind {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
line-height: 0
|
||||
}
|
||||
|
||||
.pop_container .drag_area .bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
background: #fdfdfd url(../../../img/photoQuickPopup/bg_drag_image.png) 50% 50% no-repeat;
|
||||
}
|
||||
|
||||
.pop_container .drag_area .showbg {
|
||||
display: block
|
||||
}
|
||||
|
||||
.pop_container .drag_area .hidebg {
|
||||
display: none
|
||||
}
|
||||
|
||||
ul.sortable {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
*zoom: 1
|
||||
}
|
||||
|
||||
ul.sortable:after {
|
||||
display: block;
|
||||
clear: both;
|
||||
content: ""
|
||||
}
|
||||
|
||||
.sortable>li {
|
||||
list-style: none;
|
||||
|
|
@ -36,10 +103,18 @@ width: 110px;
|
|||
height: 110px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
margin: 4px 3px; border: 1px solid #DDDDDD;padding:1px; cursor: move;
|
||||
margin: 4px 3px;
|
||||
border: 1px solid #DDDDDD;
|
||||
padding: 1px;
|
||||
cursor: move;
|
||||
background: #ffffff;
|
||||
}
|
||||
.sortable > li:hover, .sortable > li.ui-sortable-helper{border:2px solid #E58524;padding:0;}
|
||||
|
||||
.sortable>li:hover,
|
||||
.sortable>li.ui-sortable-helper {
|
||||
border: 2px solid #E58524;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sortable>li>div {
|
||||
background: #f7f7f7;
|
||||
|
|
@ -49,14 +124,32 @@ font-size:11px;
|
|||
height: 106px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space:nowrap;-o-text-overflow:ellipsis;text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
position: relative;
|
||||
}
|
||||
.sortable > li > div > img{margin:3px;}
|
||||
.sortable > li > div .delete_img{position:absolute;top:0;right:0px;display:none}
|
||||
.sortable > li:hover > div .delete_img{display:block;cursor:pointer}
|
||||
|
||||
.sortable>li>div>img {
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
.sortable>li>div .delete_img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0px;
|
||||
display: none
|
||||
}
|
||||
|
||||
.sortable>li:hover>div .delete_img {
|
||||
display: block;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.sortable>li.placeholder {
|
||||
border: dashed 2px #ccc;background-color:#FFF;padding:0;
|
||||
border: dashed 2px #ccc;
|
||||
background-color: #FFF;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.btn {
|
||||
|
|
@ -78,22 +171,49 @@ border-radius: 4px;
|
|||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
color: #fff;
|
||||
background-color: #5cb85c;
|
||||
border-color: #4cae4c;
|
||||
}
|
||||
.btn:hover, .btn:focus {
|
||||
|
||||
.btn:hover,
|
||||
.btn:focus {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .open .dropdown-toggle.btn-success {
|
||||
|
||||
.btn-success:hover,
|
||||
.btn-success:focus,
|
||||
.btn-success:active,
|
||||
.btn-success.active,
|
||||
.open .dropdown-toggle.btn-success {
|
||||
color: #fff;
|
||||
background-color: #47a447;
|
||||
border-color: #398439;
|
||||
}
|
||||
.seletion_explain{margin:10px 0}
|
||||
.drag_explain{position:relative;height:36px}
|
||||
.drag_explain p {padding:12px 0 0 0;margin:0;}
|
||||
.file_selet_group{position:absolute;top:0;right:0}
|
||||
.btn_group{text-align:center}
|
||||
|
||||
.seletion_explain {
|
||||
margin: 10px 0
|
||||
}
|
||||
|
||||
.drag_explain {
|
||||
position: relative;
|
||||
height: 36px
|
||||
}
|
||||
|
||||
.drag_explain p {
|
||||
padding: 12px 0 0 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.file_selet_group {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0
|
||||
}
|
||||
|
||||
.btn_group {
|
||||
text-align: center
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,12 +55,8 @@
|
|||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||||
<script src="./js/jquery.iframe-transport.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./swfupload/swfupload.js?v=210625-1329"></script>
|
||||
<script type="text/javascript" src="./swfupload/jquery.swfupload.js?v=210625-1329"></script>
|
||||
|
||||
<!-- The basic File Upload plugin -->
|
||||
<script src="./js/jquery.fileupload.js?v=210625-1329"></script>
|
||||
|
||||
<script src="./js/basic.js?v=210625-1329"></script>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -961,8 +961,7 @@
|
|||
i,
|
||||
j = 0;
|
||||
|
||||
if ( options.limit_filesLength && filesLength > options.limit_filesLength)
|
||||
{
|
||||
if (options.limit_filesLength && filesLength > options.limit_filesLength) {
|
||||
filesLength = options.limit_filesLength; //사용자추가
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,9 +369,12 @@ class Services_JSON
|
|||
}
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
$char = pack(
|
||||
'C*',
|
||||
$ord_var_c,
|
||||
@ord($var[$c + 1]),
|
||||
@ord($var[$c + 2]));
|
||||
@ord($var[$c + 2])
|
||||
);
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
|
|
@ -385,10 +388,13 @@ class Services_JSON
|
|||
}
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
$char = pack(
|
||||
'C*',
|
||||
$ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]));
|
||||
ord($var[$c + 3])
|
||||
);
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
|
|
@ -402,11 +408,14 @@ class Services_JSON
|
|||
$ascii .= '?';
|
||||
break;
|
||||
}
|
||||
$char = pack('C*', $ord_var_c,
|
||||
$char = pack(
|
||||
'C*',
|
||||
$ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]),
|
||||
ord($var[$c + 4]));
|
||||
ord($var[$c + 4])
|
||||
);
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
|
|
@ -420,12 +429,15 @@ class Services_JSON
|
|||
}
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
$char = pack(
|
||||
'C*',
|
||||
$ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]),
|
||||
ord($var[$c + 4]),
|
||||
ord($var[$c + 5]));
|
||||
ord($var[$c + 5])
|
||||
);
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
|
|
@ -455,9 +467,11 @@ class Services_JSON
|
|||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, count($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
$properties = array_map(
|
||||
array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
array_values($var)
|
||||
);
|
||||
|
||||
foreach ($properties as $property) {
|
||||
if (Services_JSON::isError($property)) {
|
||||
|
|
@ -501,9 +515,11 @@ class Services_JSON
|
|||
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
$properties = array_map(
|
||||
array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
array_values($vars)
|
||||
);
|
||||
|
||||
foreach ($properties as $property) {
|
||||
if (Services_JSON::isError($property)) {
|
||||
|
|
@ -646,8 +662,10 @@ class Services_JSON
|
|||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
if (
|
||||
($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')
|
||||
) {
|
||||
$utf8 .= $chrs[++$c];
|
||||
}
|
||||
break;
|
||||
|
|
@ -721,9 +739,11 @@ class Services_JSON
|
|||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
array_push($stk, array(
|
||||
'what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
'delim' => false
|
||||
));
|
||||
|
||||
$chrs = $this->substr8($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
|
@ -793,17 +813,21 @@ class Services_JSON
|
|||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs[$c] == $top['delim']) &&
|
||||
} elseif (
|
||||
($chrs[$c] == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
(($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
(($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)
|
||||
) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs[$c] == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
} elseif (
|
||||
($chrs[$c] == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||
) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
|
@ -813,8 +837,10 @@ class Services_JSON
|
|||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs[$c] == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
} elseif (
|
||||
($chrs[$c] == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||
) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
|
@ -824,8 +850,10 @@ class Services_JSON
|
|||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
} elseif (
|
||||
($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||
) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
|
|
@ -864,8 +892,10 @@ class Services_JSON
|
|||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
} elseif (
|
||||
is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -909,9 +939,13 @@ if (class_exists('PEAR_Error')) {
|
|||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
function Services_JSON_Error(
|
||||
$message = 'unknown error',
|
||||
$code = null,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
$userinfo = null
|
||||
) {
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -923,9 +957,13 @@ if (class_exists('PEAR_Error')) {
|
|||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
function Services_JSON_Error(
|
||||
$message = 'unknown error',
|
||||
$code = null,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
$userinfo = null
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ class UploadHandler
|
|||
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
|
||||
);
|
||||
|
||||
public function __construct($options = null, $initialize = true, $error_messages = null) {
|
||||
public function __construct($options = null, $initialize = true, $error_messages = null)
|
||||
{
|
||||
|
||||
$this->post_max_size = (defined('SMARTEDITOR_UPLOAD_SIZE_LIMIT') && SMARTEDITOR_UPLOAD_SIZE_LIMIT) ? SMARTEDITOR_UPLOAD_SIZE_LIMIT . 'M' : ini_get('post_max_size');
|
||||
|
||||
|
|
@ -179,7 +180,8 @@ class UploadHandler
|
|||
}
|
||||
}
|
||||
|
||||
protected function initialize() {
|
||||
protected function initialize()
|
||||
{
|
||||
switch ($this->get_server_var('REQUEST_METHOD')) {
|
||||
case 'OPTIONS':
|
||||
case 'HEAD':
|
||||
|
|
@ -205,7 +207,8 @@ class UploadHandler
|
|||
}
|
||||
}
|
||||
|
||||
protected function get_full_url() {
|
||||
protected function get_full_url()
|
||||
{
|
||||
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
|
||||
return
|
||||
($https ? 'https://' : 'http://') .
|
||||
|
|
@ -216,7 +219,8 @@ class UploadHandler
|
|||
substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
}
|
||||
|
||||
protected function get_user_id($is_add=true) {
|
||||
protected function get_user_id($is_add = true)
|
||||
{
|
||||
global $member;
|
||||
|
||||
if (session_id() == '') {
|
||||
|
|
@ -227,14 +231,16 @@ class UploadHandler
|
|||
return session_id() . $add_str;
|
||||
}
|
||||
|
||||
protected function get_user_path() {
|
||||
protected function get_user_path()
|
||||
{
|
||||
if ($this->options['user_dirs']) {
|
||||
return $this->get_user_id(false) . '/';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function get_upload_path($file_name = null, $version = null) {
|
||||
protected function get_upload_path($file_name = null, $version = null)
|
||||
{
|
||||
$file_name = $file_name ? $file_name : '';
|
||||
if (empty($version)) {
|
||||
$version_path = '';
|
||||
|
|
@ -249,11 +255,13 @@ class UploadHandler
|
|||
. $version_path . $file_name;
|
||||
}
|
||||
|
||||
protected function get_query_separator($url) {
|
||||
protected function get_query_separator($url)
|
||||
{
|
||||
return strpos($url, '?') === false ? '?' : '&';
|
||||
}
|
||||
|
||||
protected function get_download_url($file_name, $version = null, $direct = false) {
|
||||
protected function get_download_url($file_name, $version = null, $direct = false)
|
||||
{
|
||||
if (!$direct && $this->options['download_via_php']) {
|
||||
$url = $this->options['script_url']
|
||||
. $this->get_query_separator($this->options['script_url'])
|
||||
|
|
@ -277,7 +285,8 @@ class UploadHandler
|
|||
. $version_path . rawurlencode($file_name);
|
||||
}
|
||||
|
||||
protected function set_additional_file_properties($file) {
|
||||
protected function set_additional_file_properties($file)
|
||||
{
|
||||
$file->deleteUrl = $this->options['script_url']
|
||||
. $this->get_query_separator($this->options['script_url'])
|
||||
. $this->get_singular_param_name()
|
||||
|
|
@ -293,14 +302,16 @@ class UploadHandler
|
|||
|
||||
// Fix for overflowing signed 32 bit integers,
|
||||
// works for sizes up to 2^32-1 bytes (4 GiB - 1):
|
||||
protected function fix_integer_overflow($size) {
|
||||
protected function fix_integer_overflow($size)
|
||||
{
|
||||
if ($size < 0) {
|
||||
$size += 2.0 * (PHP_INT_MAX + 1);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
protected function get_file_size($file_path, $clear_stat_cache = false) {
|
||||
protected function get_file_size($file_path, $clear_stat_cache = false)
|
||||
{
|
||||
if ($clear_stat_cache) {
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
clearstatcache(true, $file_path);
|
||||
|
|
@ -311,7 +322,8 @@ class UploadHandler
|
|||
return $this->fix_integer_overflow(filesize($file_path));
|
||||
}
|
||||
|
||||
protected function is_valid_file_object($file_name) {
|
||||
protected function is_valid_file_object($file_name)
|
||||
{
|
||||
$file_path = $this->get_upload_path($file_name);
|
||||
if (is_file($file_path) && $file_name[0] !== '.') {
|
||||
return true;
|
||||
|
|
@ -319,7 +331,8 @@ class UploadHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
protected function get_file_object($file_name) {
|
||||
protected function get_file_object($file_name)
|
||||
{
|
||||
if ($this->is_valid_file_object($file_name)) {
|
||||
$file = new \stdClass();
|
||||
$file->name = iconv('UTF-8', 'UTF-8//IGNORE', $file_name);
|
||||
|
|
@ -346,7 +359,8 @@ class UploadHandler
|
|||
return null;
|
||||
}
|
||||
|
||||
protected function get_file_objects($iteration_method = 'get_file_object') {
|
||||
protected function get_file_objects($iteration_method = 'get_file_object')
|
||||
{
|
||||
$upload_dir = $this->get_upload_path();
|
||||
if (!is_dir($upload_dir)) {
|
||||
return array();
|
||||
|
|
@ -357,16 +371,19 @@ class UploadHandler
|
|||
)));
|
||||
}
|
||||
|
||||
protected function count_file_objects() {
|
||||
protected function count_file_objects()
|
||||
{
|
||||
return count($this->get_file_objects('is_valid_file_object'));
|
||||
}
|
||||
|
||||
protected function get_error_message($error) {
|
||||
protected function get_error_message($error)
|
||||
{
|
||||
return array_key_exists($error, $this->error_messages) ?
|
||||
$this->error_messages[$error] : $error;
|
||||
}
|
||||
|
||||
function get_config_bytes($val) {
|
||||
function get_config_bytes($val)
|
||||
{
|
||||
$val = trim($val);
|
||||
$val_strlen = strlen($val) - 1;
|
||||
$last = isset($val[$val_strlen]) ? strtolower($val[$val_strlen]) : '';
|
||||
|
|
@ -383,7 +400,8 @@ class UploadHandler
|
|||
return $this->fix_integer_overflow($bytes);
|
||||
}
|
||||
|
||||
protected function validate($uploaded_file, $file, $error, $index) {
|
||||
protected function validate($uploaded_file, $file, $error, $index)
|
||||
{
|
||||
if ($error) {
|
||||
$file->error = $this->get_error_message($error);
|
||||
return false;
|
||||
|
|
@ -406,22 +424,27 @@ class UploadHandler
|
|||
} else {
|
||||
$file_size = $content_length;
|
||||
}
|
||||
if ($this->options['max_file_size'] && (
|
||||
if (
|
||||
$this->options['max_file_size'] && (
|
||||
$file_size > $this->options['max_file_size'] ||
|
||||
$file->size > $this->options['max_file_size'])
|
||||
) {
|
||||
$file->error = $this->get_error_message('max_file_size');
|
||||
return false;
|
||||
}
|
||||
if ($this->options['min_file_size'] &&
|
||||
$file_size < $this->options['min_file_size']) {
|
||||
if (
|
||||
$this->options['min_file_size'] &&
|
||||
$file_size < $this->options['min_file_size']
|
||||
) {
|
||||
$file->error = $this->get_error_message('min_file_size');
|
||||
return false;
|
||||
}
|
||||
if (is_int($this->options['max_number_of_files']) &&
|
||||
if (
|
||||
is_int($this->options['max_number_of_files']) &&
|
||||
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
|
||||
// Ignore additional chunks of existing files:
|
||||
!is_file($this->get_upload_path($file->name))) {
|
||||
!is_file($this->get_upload_path($file->name))
|
||||
) {
|
||||
$file->error = $this->get_error_message('max_number_of_files');
|
||||
return false;
|
||||
}
|
||||
|
|
@ -429,8 +452,10 @@ class UploadHandler
|
|||
$max_height = @$this->options['max_height'];
|
||||
$min_width = @$this->options['min_width'];
|
||||
$min_height = @$this->options['min_height'];
|
||||
if (($max_width || $max_height || $min_width || $min_height)
|
||||
&& preg_match($this->options['image_file_types'], $file->name)) {
|
||||
if (
|
||||
($max_width || $max_height || $min_width || $min_height)
|
||||
&& preg_match($this->options['image_file_types'], $file->name)
|
||||
) {
|
||||
list($img_width, $img_height) = $this->get_image_size($uploaded_file);
|
||||
}
|
||||
|
||||
|
|
@ -455,13 +480,15 @@ class UploadHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function upcount_name_callback($matches) {
|
||||
protected function upcount_name_callback($matches)
|
||||
{
|
||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||
return ' (' . $index . ')' . $ext;
|
||||
}
|
||||
|
||||
protected function upcount_name($name) {
|
||||
protected function upcount_name($name)
|
||||
{
|
||||
return preg_replace_callback(
|
||||
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
||||
array($this, 'upcount_name_callback'),
|
||||
|
|
@ -470,7 +497,8 @@ class UploadHandler
|
|||
);
|
||||
}
|
||||
|
||||
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range) {
|
||||
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||
{
|
||||
while (is_dir($this->get_upload_path($name))) {
|
||||
$name = $this->upcount_name($name);
|
||||
}
|
||||
|
|
@ -479,8 +507,11 @@ class UploadHandler
|
|||
// Keep an existing filename if this is part of a chunked upload:
|
||||
$uploaded_bytes = $this->fix_integer_overflow($content_range_byte);
|
||||
while (is_file($this->get_upload_path($name))) {
|
||||
if ($uploaded_bytes === $this->get_file_size(
|
||||
$this->get_upload_path($name))) {
|
||||
if (
|
||||
$uploaded_bytes === $this->get_file_size(
|
||||
$this->get_upload_path($name)
|
||||
)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
$name = $this->upcount_name($name);
|
||||
|
|
@ -488,7 +519,8 @@ class UploadHandler
|
|||
return $name;
|
||||
}
|
||||
|
||||
protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
|
||||
protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||
{
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
|
|
@ -498,8 +530,10 @@ class UploadHandler
|
|||
$name = str_replace('.', '-', microtime(true));
|
||||
}
|
||||
// Add missing file extension for known image types:
|
||||
if (strpos($name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)) {
|
||||
if (
|
||||
strpos($name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)
|
||||
) {
|
||||
$name .= '.' . $matches[1];
|
||||
}
|
||||
if (function_exists('exif_imagetype') && $file_path) {
|
||||
|
|
@ -531,7 +565,8 @@ class UploadHandler
|
|||
return $name;
|
||||
}
|
||||
|
||||
protected function get_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
|
||||
protected function get_file_name($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||
{
|
||||
return $this->get_unique_filename(
|
||||
$file_path,
|
||||
$this->trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range),
|
||||
|
|
@ -543,11 +578,13 @@ class UploadHandler
|
|||
);
|
||||
}
|
||||
|
||||
protected function handle_form_data($file, $index) {
|
||||
protected function handle_form_data($file, $index)
|
||||
{
|
||||
// Handle form data, e.g. $_REQUEST['description'][$index]
|
||||
}
|
||||
|
||||
protected function get_scaled_image_file_paths($file_name, $version) {
|
||||
protected function get_scaled_image_file_paths($file_name, $version)
|
||||
{
|
||||
$file_path = $this->get_upload_path($file_name);
|
||||
if (!empty($version)) {
|
||||
$version_dir = $this->get_upload_path(null, $version);
|
||||
|
|
@ -561,7 +598,8 @@ class UploadHandler
|
|||
return array($file_path, $new_file_path);
|
||||
}
|
||||
|
||||
protected function gd_get_image_object($file_path, $func, $no_cache = false) {
|
||||
protected function gd_get_image_object($file_path, $func, $no_cache = false)
|
||||
{
|
||||
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
||||
$this->gd_destroy_image_object($file_path);
|
||||
$this->image_objects[$file_path] = $func($file_path);
|
||||
|
|
@ -569,17 +607,20 @@ class UploadHandler
|
|||
return $this->image_objects[$file_path];
|
||||
}
|
||||
|
||||
protected function gd_set_image_object($file_path, $image) {
|
||||
protected function gd_set_image_object($file_path, $image)
|
||||
{
|
||||
$this->gd_destroy_image_object($file_path);
|
||||
$this->image_objects[$file_path] = $image;
|
||||
}
|
||||
|
||||
protected function gd_destroy_image_object($file_path) {
|
||||
protected function gd_destroy_image_object($file_path)
|
||||
{
|
||||
$image = @$this->image_objects[$file_path];
|
||||
return $image && imagedestroy($image);
|
||||
}
|
||||
|
||||
protected function gd_imageflip($image, $mode) {
|
||||
protected function gd_imageflip($image, $mode)
|
||||
{
|
||||
if (function_exists('imageflip')) {
|
||||
return imageflip($image, $mode);
|
||||
}
|
||||
|
|
@ -621,7 +662,8 @@ class UploadHandler
|
|||
return $new_img;
|
||||
}
|
||||
|
||||
protected function gd_orient_image($file_path, $src_img) {
|
||||
protected function gd_orient_image($file_path, $src_img)
|
||||
{
|
||||
if (!function_exists('exif_read_data')) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -678,7 +720,8 @@ class UploadHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function gd_create_scaled_image($file_name, $version, $options) {
|
||||
protected function gd_create_scaled_image($file_name, $version, $options)
|
||||
{
|
||||
if (!function_exists('imagecreatetruecolor')) {
|
||||
error_log('Function not found: imagecreatetruecolor');
|
||||
return false;
|
||||
|
|
@ -719,10 +762,12 @@ class UploadHandler
|
|||
!empty($options['no_cache'])
|
||||
);
|
||||
$image_oriented = false;
|
||||
if (!empty($options['auto_orient']) && $this->gd_orient_image(
|
||||
if (
|
||||
!empty($options['auto_orient']) && $this->gd_orient_image(
|
||||
$file_path,
|
||||
$src_img
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
$image_oriented = true;
|
||||
$src_img = $this->gd_get_image_object(
|
||||
$file_path,
|
||||
|
|
@ -794,7 +839,8 @@ class UploadHandler
|
|||
return $success;
|
||||
}
|
||||
|
||||
protected function imagick_get_image_object($file_path, $no_cache = false) {
|
||||
protected function imagick_get_image_object($file_path, $no_cache = false)
|
||||
{
|
||||
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
||||
$this->imagick_destroy_image_object($file_path);
|
||||
$image = new \Imagick();
|
||||
|
|
@ -809,17 +855,20 @@ class UploadHandler
|
|||
return $this->image_objects[$file_path];
|
||||
}
|
||||
|
||||
protected function imagick_set_image_object($file_path, $image) {
|
||||
protected function imagick_set_image_object($file_path, $image)
|
||||
{
|
||||
$this->imagick_destroy_image_object($file_path);
|
||||
$this->image_objects[$file_path] = $image;
|
||||
}
|
||||
|
||||
protected function imagick_destroy_image_object($file_path) {
|
||||
protected function imagick_destroy_image_object($file_path)
|
||||
{
|
||||
$image = @$this->image_objects[$file_path];
|
||||
return $image && $image->destroy();
|
||||
}
|
||||
|
||||
protected function imagick_orient_image($image) {
|
||||
protected function imagick_orient_image($image)
|
||||
{
|
||||
$orientation = $image->getImageOrientation();
|
||||
$background = new \ImagickPixel('none');
|
||||
switch ($orientation) {
|
||||
|
|
@ -853,7 +902,8 @@ class UploadHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function imagick_create_scaled_image($file_name, $version, $options) {
|
||||
protected function imagick_create_scaled_image($file_name, $version, $options)
|
||||
{
|
||||
list($file_path, $new_file_path) =
|
||||
$this->get_scaled_image_file_paths($file_name, $version);
|
||||
$image = $this->imagick_get_image_object(
|
||||
|
|
@ -933,7 +983,8 @@ class UploadHandler
|
|||
return $success && $image->writeImage($new_file_path);
|
||||
}
|
||||
|
||||
protected function imagemagick_create_scaled_image($file_name, $version, $options) {
|
||||
protected function imagemagick_create_scaled_image($file_name, $version, $options)
|
||||
{
|
||||
list($file_path, $new_file_path) =
|
||||
$this->get_scaled_image_file_paths($file_name, $version);
|
||||
$resize = @$options['max_width']
|
||||
|
|
@ -977,7 +1028,8 @@ class UploadHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function get_image_size($file_path) {
|
||||
protected function get_image_size($file_path)
|
||||
{
|
||||
if ($this->options['image_library']) {
|
||||
if (extension_loaded('imagick')) {
|
||||
$image = new \Imagick();
|
||||
|
|
@ -1012,7 +1064,8 @@ class UploadHandler
|
|||
return @getimagesize($file_path);
|
||||
}
|
||||
|
||||
protected function create_scaled_image($file_name, $version, $options) {
|
||||
protected function create_scaled_image($file_name, $version, $options)
|
||||
{
|
||||
if ($this->options['image_library'] === 2) {
|
||||
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
|
||||
}
|
||||
|
|
@ -1022,13 +1075,15 @@ class UploadHandler
|
|||
return $this->gd_create_scaled_image($file_name, $version, $options);
|
||||
}
|
||||
|
||||
protected function destroy_image_object($file_path) {
|
||||
protected function destroy_image_object($file_path)
|
||||
{
|
||||
if ($this->options['image_library'] && extension_loaded('imagick')) {
|
||||
return $this->imagick_destroy_image_object($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
protected function is_valid_image_file($file_path) {
|
||||
protected function is_valid_image_file($file_path)
|
||||
{
|
||||
if (!preg_match($this->options['image_file_types'], $file_path)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1039,7 +1094,8 @@ class UploadHandler
|
|||
return $image_info && $image_info[0] && $image_info[1];
|
||||
}
|
||||
|
||||
protected function handle_image_file($file_path, $file) {
|
||||
protected function handle_image_file($file_path, $file)
|
||||
{
|
||||
$failed_versions = array();
|
||||
foreach ($this->options['image_versions'] as $version => $options) {
|
||||
if ($this->create_scaled_image($file->name, $version, $options)) {
|
||||
|
|
@ -1063,12 +1119,14 @@ class UploadHandler
|
|||
$this->destroy_image_object($file_path);
|
||||
}
|
||||
|
||||
protected function get_microtime(){
|
||||
protected function get_microtime()
|
||||
{
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ((float) $usec + (float) $sec);
|
||||
}
|
||||
|
||||
protected function get_file_passname(){
|
||||
protected function get_file_passname()
|
||||
{
|
||||
$tmp_name = $this->get_user_id() . $_SERVER['REMOTE_ADDR'];
|
||||
$tmp_name = md5(sha1($tmp_name));
|
||||
return $tmp_name;
|
||||
|
|
@ -1076,7 +1134,8 @@ class UploadHandler
|
|||
|
||||
protected function reprocessImage($file_path, $callback)
|
||||
{
|
||||
if( ! $file_path ) return;
|
||||
if (!$file_path)
|
||||
return;
|
||||
|
||||
// Extracting mime type using getimagesize
|
||||
try {
|
||||
|
|
@ -1123,7 +1182,8 @@ class UploadHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) {
|
||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
|
||||
{
|
||||
$file = new \stdClass();
|
||||
$file->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
||||
|
||||
|
|
@ -1170,7 +1230,8 @@ class UploadHandler
|
|||
$file_size = $this->get_file_size($file_path, $append_file);
|
||||
|
||||
try {
|
||||
if(defined('G5_FILE_PERMISSION')) chmod($file_path, G5_FILE_PERMISSION);
|
||||
if (defined('G5_FILE_PERMISSION'))
|
||||
chmod($file_path, G5_FILE_PERMISSION);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
|
|
@ -1218,7 +1279,8 @@ class UploadHandler
|
|||
return $file;
|
||||
}
|
||||
|
||||
protected function readfile($file_path) {
|
||||
protected function readfile($file_path)
|
||||
{
|
||||
$file_size = $this->get_file_size($file_path);
|
||||
$chunk_size = $this->options['readfile_chunk_size'];
|
||||
if ($chunk_size && $file_size > $chunk_size) {
|
||||
|
|
@ -1234,19 +1296,23 @@ class UploadHandler
|
|||
return readfile($file_path);
|
||||
}
|
||||
|
||||
protected function body($str) {
|
||||
protected function body($str)
|
||||
{
|
||||
echo $str;
|
||||
}
|
||||
|
||||
protected function header($str) {
|
||||
protected function header($str)
|
||||
{
|
||||
header($str);
|
||||
}
|
||||
|
||||
protected function get_server_var($id) {
|
||||
protected function get_server_var($id)
|
||||
{
|
||||
return isset($_SERVER[$id]) ? $_SERVER[$id] : '';
|
||||
}
|
||||
|
||||
protected function generate_response($content, $print_response = true) {
|
||||
protected function generate_response($content, $print_response = true)
|
||||
{
|
||||
if ($print_response) {
|
||||
$json = json_encode($content);
|
||||
|
||||
|
|
@ -1271,20 +1337,24 @@ class UploadHandler
|
|||
return $content;
|
||||
}
|
||||
|
||||
protected function get_version_param() {
|
||||
protected function get_version_param()
|
||||
{
|
||||
return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
|
||||
}
|
||||
|
||||
protected function get_singular_param_name() {
|
||||
protected function get_singular_param_name()
|
||||
{
|
||||
return substr($this->options['param_name'], 0, -1);
|
||||
}
|
||||
|
||||
protected function get_file_name_param() {
|
||||
protected function get_file_name_param()
|
||||
{
|
||||
$name = $this->get_singular_param_name();
|
||||
return isset($_GET[$name]) ? basename(stripslashes($_GET[$name])) : null;
|
||||
}
|
||||
|
||||
protected function get_file_names_params() {
|
||||
protected function get_file_names_params()
|
||||
{
|
||||
$params = isset($_GET[$this->options['param_name']]) ?
|
||||
$_GET[$this->options['param_name']] : array();
|
||||
foreach ($params as $key => $value) {
|
||||
|
|
@ -1293,7 +1363,8 @@ class UploadHandler
|
|||
return $params;
|
||||
}
|
||||
|
||||
protected function get_file_type($file_path) {
|
||||
protected function get_file_type($file_path)
|
||||
{
|
||||
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
|
||||
case 'jpeg':
|
||||
case 'jpg':
|
||||
|
|
@ -1309,7 +1380,8 @@ class UploadHandler
|
|||
}
|
||||
}
|
||||
|
||||
protected function download() {
|
||||
protected function download()
|
||||
{
|
||||
switch ($this->options['download_via_php']) {
|
||||
case 1:
|
||||
$redirect_header = null;
|
||||
|
|
@ -1351,7 +1423,8 @@ class UploadHandler
|
|||
$this->readfile($file_path);
|
||||
}
|
||||
|
||||
protected function send_content_type_header() {
|
||||
protected function send_content_type_header()
|
||||
{
|
||||
$this->header('Vary: Accept');
|
||||
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
|
||||
$this->header('Content-type: application/json');
|
||||
|
|
@ -1360,7 +1433,8 @@ class UploadHandler
|
|||
}
|
||||
}
|
||||
|
||||
protected function send_access_control_headers() {
|
||||
protected function send_access_control_headers()
|
||||
{
|
||||
$this->header('Access-Control-Allow-Origin: ' . $this->options['access_control_allow_origin']);
|
||||
$this->header('Access-Control-Allow-Credentials: '
|
||||
. ($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
||||
|
|
@ -1370,7 +1444,8 @@ class UploadHandler
|
|||
. implode(', ', $this->options['access_control_allow_headers']));
|
||||
}
|
||||
|
||||
public function head() {
|
||||
public function head()
|
||||
{
|
||||
$this->header('Pragma: no-cache');
|
||||
$this->header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
$this->header('Content-Disposition: inline; filename="files.json"');
|
||||
|
|
@ -1382,7 +1457,8 @@ class UploadHandler
|
|||
$this->send_content_type_header();
|
||||
}
|
||||
|
||||
public function get($print_response = true) {
|
||||
public function get($print_response = true)
|
||||
{
|
||||
//보안 이슈로 인해 사용하지 않습니다.
|
||||
/*
|
||||
if ($print_response && isset($_GET['download'])) {
|
||||
|
|
@ -1402,7 +1478,8 @@ class UploadHandler
|
|||
*/
|
||||
}
|
||||
|
||||
public function post($print_response = true) {
|
||||
public function post($print_response = true)
|
||||
{
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||
return $this->delete($print_response);
|
||||
}
|
||||
|
|
@ -1457,7 +1534,8 @@ class UploadHandler
|
|||
);
|
||||
}
|
||||
|
||||
public function delete($print_response = true) {
|
||||
public function delete($print_response = true)
|
||||
{
|
||||
/* 보안 이슈 url을 참고 https://github.com/blueimp/jQuery-File-Upload/issues/2426 */
|
||||
$file_names = $this->get_file_names_params();
|
||||
if (empty($file_names)) {
|
||||
|
|
@ -1465,7 +1543,8 @@ class UploadHandler
|
|||
}
|
||||
$response = array();
|
||||
foreach ($file_names as $file_name) {
|
||||
if( substr($file_name, 0 , 32) != $this->get_file_passname() ) continue; //session_id() 와 비교하여 틀리면 지우지 않음
|
||||
if (substr($file_name, 0, 32) != $this->get_file_passname())
|
||||
continue; //session_id() 와 비교하여 틀리면 지우지 않음
|
||||
$file_path = $this->get_upload_path($file_name);
|
||||
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ include_once("./_common.php");
|
|||
|
||||
if (!function_exists('json_encode')) {
|
||||
@include_once("./JSON.php");
|
||||
function json_encode($data) {
|
||||
function json_encode($data)
|
||||
{
|
||||
$json = new Services_JSON();
|
||||
return ($json->encode($data));
|
||||
}
|
||||
|
|
@ -49,12 +50,12 @@ if( $is_editor_upload ) {
|
|||
'upload_url' => $data_url,
|
||||
// This option will disable creating thumbnail images and will not create that extra folder.
|
||||
// However, due to this, the images preview will not be displayed after upload
|
||||
'image_versions' => array()
|
||||
'image_versions' => []
|
||||
);
|
||||
|
||||
$upload_handler = new UploadHandler($options);
|
||||
|
||||
} else {
|
||||
echo json_encode(array('files'=>array('0'=>array('error'=>'정상적인 업로드가 아닙니다.'))));
|
||||
echo json_encode(array('files' => array('0' => array('error' => $_GET['_nonce']))));
|
||||
exit;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,203 +0,0 @@
|
|||
/*
|
||||
A simple class for displaying file information and progress
|
||||
Note: This is a demonstration only and not part of SWFUpload.
|
||||
Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.
|
||||
*/
|
||||
|
||||
// Constructor
|
||||
// file is a SWFUpload file object
|
||||
// targetID is the HTML element id attribute that the FileProgress HTML structure will be added to.
|
||||
// Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements
|
||||
function FileProgress(file, targetID) {
|
||||
this.fileProgressID = file.id;
|
||||
|
||||
this.opacity = 100;
|
||||
this.height = 0;
|
||||
|
||||
|
||||
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
|
||||
if (!this.fileProgressWrapper) {
|
||||
this.fileProgressWrapper = document.createElement("div");
|
||||
this.fileProgressWrapper.className = "progressWrapper";
|
||||
this.fileProgressWrapper.id = this.fileProgressID;
|
||||
|
||||
this.fileProgressElement = document.createElement("div");
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
|
||||
var progressCancel = document.createElement("a");
|
||||
progressCancel.className = "progressCancel";
|
||||
progressCancel.href = "#";
|
||||
progressCancel.style.visibility = "hidden";
|
||||
progressCancel.appendChild(document.createTextNode(" "));
|
||||
|
||||
var progressText = document.createElement("div");
|
||||
progressText.className = "progressName";
|
||||
progressText.appendChild(document.createTextNode(file.name));
|
||||
|
||||
var progressBar = document.createElement("div");
|
||||
progressBar.className = "progressBarInProgress";
|
||||
|
||||
var progressStatus = document.createElement("div");
|
||||
progressStatus.className = "progressBarStatus";
|
||||
progressStatus.innerHTML = " ";
|
||||
|
||||
this.fileProgressElement.appendChild(progressCancel);
|
||||
this.fileProgressElement.appendChild(progressText);
|
||||
this.fileProgressElement.appendChild(progressStatus);
|
||||
this.fileProgressElement.appendChild(progressBar);
|
||||
|
||||
this.fileProgressWrapper.appendChild(this.fileProgressElement);
|
||||
|
||||
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
|
||||
} else {
|
||||
this.fileProgressElement = this.fileProgressWrapper.firstChild;
|
||||
this.reset();
|
||||
}
|
||||
|
||||
this.height = this.fileProgressWrapper.offsetHeight;
|
||||
this.setTimer(null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
FileProgress.prototype.setTimer = function (timer) {
|
||||
this.fileProgressElement["FP_TIMER"] = timer;
|
||||
};
|
||||
FileProgress.prototype.getTimer = function (timer) {
|
||||
return this.fileProgressElement["FP_TIMER"] || null;
|
||||
};
|
||||
|
||||
FileProgress.prototype.reset = function () {
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
|
||||
this.fileProgressElement.childNodes[2].innerHTML = " ";
|
||||
this.fileProgressElement.childNodes[2].className = "progressBarStatus";
|
||||
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
||||
this.fileProgressElement.childNodes[3].style.width = "0%";
|
||||
|
||||
this.appear();
|
||||
};
|
||||
|
||||
FileProgress.prototype.setProgress = function (percentage) {
|
||||
this.fileProgressElement.className = "progressContainer green";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
||||
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
|
||||
|
||||
this.appear();
|
||||
};
|
||||
FileProgress.prototype.setComplete = function () {
|
||||
this.fileProgressElement.className = "progressContainer blue";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 10000));
|
||||
};
|
||||
FileProgress.prototype.setError = function () {
|
||||
this.fileProgressElement.className = "progressContainer red";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 5000));
|
||||
};
|
||||
FileProgress.prototype.setCancelled = function () {
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 2000));
|
||||
};
|
||||
FileProgress.prototype.setStatus = function (status) {
|
||||
this.fileProgressElement.childNodes[2].innerHTML = status;
|
||||
};
|
||||
|
||||
// Show/Hide the cancel button
|
||||
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
|
||||
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
|
||||
if (swfUploadInstance) {
|
||||
var fileID = this.fileProgressID;
|
||||
this.fileProgressElement.childNodes[0].onclick = function () {
|
||||
swfUploadInstance.cancelUpload(fileID);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
FileProgress.prototype.appear = function () {
|
||||
if (this.getTimer() !== null) {
|
||||
clearTimeout(this.getTimer());
|
||||
this.setTimer(null);
|
||||
}
|
||||
|
||||
if (this.fileProgressWrapper.filters) {
|
||||
try {
|
||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;
|
||||
} catch (e) {
|
||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
|
||||
}
|
||||
} else {
|
||||
this.fileProgressWrapper.style.opacity = 1;
|
||||
}
|
||||
|
||||
this.fileProgressWrapper.style.height = "";
|
||||
|
||||
this.height = this.fileProgressWrapper.offsetHeight;
|
||||
this.opacity = 100;
|
||||
this.fileProgressWrapper.style.display = "";
|
||||
|
||||
};
|
||||
|
||||
// Fades out and clips away the FileProgress box.
|
||||
FileProgress.prototype.disappear = function () {
|
||||
|
||||
var reduceOpacityBy = 15;
|
||||
var reduceHeightBy = 4;
|
||||
var rate = 30; // 15 fps
|
||||
|
||||
if (this.opacity > 0) {
|
||||
this.opacity -= reduceOpacityBy;
|
||||
if (this.opacity < 0) {
|
||||
this.opacity = 0;
|
||||
}
|
||||
|
||||
if (this.fileProgressWrapper.filters) {
|
||||
try {
|
||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
|
||||
} catch (e) {
|
||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
|
||||
}
|
||||
} else {
|
||||
this.fileProgressWrapper.style.opacity = this.opacity / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.height > 0) {
|
||||
this.height -= reduceHeightBy;
|
||||
if (this.height < 0) {
|
||||
this.height = 0;
|
||||
}
|
||||
|
||||
this.fileProgressWrapper.style.height = this.height + "px";
|
||||
}
|
||||
|
||||
if (this.height > 0 || this.opacity > 0) {
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, rate));
|
||||
} else {
|
||||
this.fileProgressWrapper.style.display = "none";
|
||||
this.setTimer(null);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,378 +0,0 @@
|
|||
/*
|
||||
@author romeojks (romeojks@gmail.com)
|
||||
@version 0.1
|
||||
@brief 파일 업로드 관련
|
||||
*/
|
||||
|
||||
function swfUploadPreLoad() {
|
||||
var self = this;
|
||||
var loading = function () {
|
||||
document.getElementById("divLoadingContent").style.display = "";
|
||||
|
||||
var longLoad = function () {
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "";
|
||||
};
|
||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
||||
longLoad.call(self)
|
||||
},
|
||||
15 * 1000
|
||||
);
|
||||
};
|
||||
|
||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
||||
loading.call(self);
|
||||
},
|
||||
1*1000
|
||||
);
|
||||
}
|
||||
|
||||
function swfUploadLoaded() {
|
||||
var self = this;
|
||||
clearTimeout(this.customSettings.loadingTimeout);
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "none";
|
||||
document.getElementById("divAlternateContent").style.display = "none";
|
||||
}
|
||||
|
||||
function swfUploadLoadFailed() {
|
||||
clearTimeout(this.customSettings.loadingTimeout);
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "none";
|
||||
document.getElementById("divAlternateContent").style.display = "";
|
||||
}
|
||||
|
||||
function fileQueued(file) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var filename = file.name;
|
||||
|
||||
if (filename.length > 20) {
|
||||
filename = filename.substr(0,20) + "...";
|
||||
};
|
||||
|
||||
var text = filename + " (대기중...)";
|
||||
var value = last_bf_no + file.index;
|
||||
var opt_obj = new Option(text, value, true, true);
|
||||
obj.options[obj.options.length] = opt_obj;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function fileQueueError(file, errorCode, message) {
|
||||
try {
|
||||
switch (errorCode) {
|
||||
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED :
|
||||
alert(message == 0 ? "더이상 업로드 할 수 없습니다." : (message == file_upload_limit ? file_upload_limit + "개 까지만 업로드 할 수 있습니다." : file_upload_limit + "개 까지만 업로드 할 수 있습니다.\n\n" + "현재 " + message + "개 남았습니다."));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT :
|
||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE :
|
||||
alert("파일 사이즈가 '0' 입니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE :
|
||||
alert("파일 타입이 올바르지 않습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
default :
|
||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
||||
break;
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function fileDialogComplete(numFilesSelected, numFilesQueued) {
|
||||
try {
|
||||
this.startUpload();
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadStart(file) {
|
||||
try {
|
||||
if ((sum_filesize + file.size) > getfilesize1(file_allsize_limit)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadProgress(file, bytesLoaded, bytesTotal) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
||||
var filename = file.name;
|
||||
|
||||
if (filename.length > 20) {
|
||||
filename = filename.substr(0,20) + "...";
|
||||
};
|
||||
|
||||
var text = filename + " (" + percent + " %)";
|
||||
var bf_position = last_bf_no + file.index;
|
||||
|
||||
obj.options[bf_position].text = text;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadSuccess(file, serverData) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var bf_position = last_bf_no + file.index;
|
||||
var params = {
|
||||
"bo_table" : bo_table,
|
||||
"wr_id" : wr_id,
|
||||
"w" : w,
|
||||
"bf_position" : bf_position+1
|
||||
};
|
||||
|
||||
var url = swfupload_path + "/get_file_info.php";
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: url,
|
||||
data: params,
|
||||
success : after_upload_success = function(req) {
|
||||
var file = eval('('+req+')');
|
||||
var file_size = (file.bf_filesize / 1024).toFixed(1);
|
||||
var text = file.bf_source + " (" + getfilesize(file.bf_filesize) + ")";
|
||||
var value = file.bf_no + "|" + file.bf_source + "|" + file.bf_file + "|" + file.bf_filesize + "|" + file.bf_width + "|" + file.bf_type;
|
||||
obj.options[bf_position].text = text;
|
||||
obj.options[bf_position].value = value;
|
||||
eval("preview(file.bf_file)");
|
||||
}
|
||||
});
|
||||
|
||||
sum_filesize = sum_filesize + file.size;
|
||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadError(file, errorCode, message) {
|
||||
try {
|
||||
switch (errorCode) {
|
||||
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR :
|
||||
alert("네트워크 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED :
|
||||
alert("파일 업로드가 실패하였습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.IO_ERROR :
|
||||
alert("입출력 에러가 발생하였습니다.\n\n" + "다른 프로그램에서 이 파일(" + file.name + ")을 사용중인지 확인하세요.");
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR :
|
||||
alert("보안 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED :
|
||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED :
|
||||
alert("업로드 가능한 총파일 용량(" + file_allsize_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED :
|
||||
// If there aren't any files left (they were all cancelled) disable the cancel button
|
||||
if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
};
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED :
|
||||
break;
|
||||
default :
|
||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadComplete(file) {
|
||||
/*if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
function getfilesize(size) {
|
||||
if (!size) {
|
||||
return "0 Byte";
|
||||
};
|
||||
if (size < 1024) {
|
||||
return (size + " Byte");
|
||||
} else if (size > 1024 && size < 1024 *1024) {
|
||||
return (size / 1024).toFixed(1) + " KB";
|
||||
} else {
|
||||
return (size / (1024*1024)).toFixed(2) + " MB";
|
||||
};
|
||||
}
|
||||
|
||||
function getfilesize1(size) {
|
||||
var file_size = size.split(" ");
|
||||
if (!file_size[0]) {
|
||||
return 0;
|
||||
};
|
||||
if (file_size[1] == "MB") {
|
||||
return (file_size[0] * (1024*1024));
|
||||
} else if (file_size[1] == "KB") {
|
||||
return (file_size[0] * 1024);
|
||||
} else {
|
||||
return (file_size[0]);
|
||||
};
|
||||
}
|
||||
|
||||
function delete_file() {
|
||||
try {
|
||||
var obj = document.getElementById("uploaded_file_list");
|
||||
var url = swfupload_path + "/file_delete.php";
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
if (obj.options[i].selected == true) {
|
||||
var file = get_file_info(obj.options[i].value);
|
||||
var params = {
|
||||
"bo_table" : bo_table,
|
||||
"wr_id" : wr_id,
|
||||
"bf_no" : file.bf_no,
|
||||
"w" : w,
|
||||
"board_file_path" : board_file_path
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: url,
|
||||
data: params,
|
||||
success : eval("delete_file_complete")
|
||||
});
|
||||
|
||||
sum_filesize = sum_filesize - file.bf_filesize;
|
||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
||||
};
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function delete_file_complete() {
|
||||
try {
|
||||
var obj = document.getElementById("uploaded_file_list");
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
if (obj.options[i].selected == true) {
|
||||
op = obj.options[i];
|
||||
obj.removeChild(op);
|
||||
last_bf_no--;
|
||||
};
|
||||
};
|
||||
|
||||
if (obj.options.length) {
|
||||
obj.options[obj.options.length-1].selected = true;
|
||||
};
|
||||
|
||||
eval("preview()");
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function preview(thumb) {
|
||||
try {
|
||||
if (!thumb) {
|
||||
var file = get_file_info(document.getElementById("uploaded_file_list").value);
|
||||
var thumb = file.bf_file;
|
||||
}
|
||||
|
||||
var pattern = /\.(jpg|png|gif|webp)$/i;
|
||||
if (pattern.test(thumb)) {
|
||||
var thumb_kind = "img";
|
||||
} else {
|
||||
var thumb_kind = "etc";
|
||||
}
|
||||
|
||||
if (thumb && thumb_kind == "img") {
|
||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_file_path + "/" + thumb + " width=" + thumb_width + " height=" + thumb_height + ">";
|
||||
} else if (thumb && thumb_kind == "etc") {
|
||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_skin_path + "/img/icon_etc.gif" + " width=" + thumb_width + " height=" + thumb_height + ">";
|
||||
} else {
|
||||
document.getElementById("image_preview").innerHTML = "미리보기";
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function file_to_editor() {
|
||||
try {
|
||||
var files_list = document.getElementById("uploaded_file_list");
|
||||
var html = '';
|
||||
|
||||
if (!files_list.value) {
|
||||
alert('파일을 선택해주세요.');
|
||||
return false;
|
||||
};
|
||||
|
||||
for (var i=0; i<files_list.options.length; i++) {
|
||||
if (files_list.options[i].selected == true) {
|
||||
var file = get_file_info(files_list.options[i].value);
|
||||
var path = board_file_path + '/' + file.bf_file;
|
||||
|
||||
var pattern = /\.(jpg|png|gif|webp)$/i;
|
||||
if (pattern.test(file.bf_file)) {
|
||||
if (wr_id) {
|
||||
html = "{이미지:" + file.bf_no + "}";
|
||||
} else {
|
||||
html = "{이미지:" + i + "}";
|
||||
}
|
||||
html2 = "<img src='"+path+"'>";
|
||||
} else {
|
||||
alert("이미지만 삽입 할 수 있습니다.");
|
||||
//path = "download.php?bo_table=" + bo_table + "&filename=" + file.bf_file + "&filesource=" + file.bf_source + "";
|
||||
//html += "<a href=\"" + path + "\">" + file.bf_source + "</a><br/>\n";
|
||||
}
|
||||
};
|
||||
};
|
||||
insert_editor(html2);
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function insert_editor(html) {
|
||||
try {
|
||||
ed_wr_content.insertContents(html);
|
||||
/*
|
||||
if (typeof(ed_wr_content) != "undefined")
|
||||
if (geditor_wr_content.get_mode() == "WYSIWYG") {
|
||||
document.getElementById("geditor_wr_content_frame").contentWindow.document.body.focus();
|
||||
geditor_wr_content.get_range();
|
||||
html = html + "<br />";
|
||||
} else if (geditor_wr_content.get_mode() == "TEXT") {
|
||||
html = html + "\n";
|
||||
} else {
|
||||
html = html + "<br />";
|
||||
}
|
||||
geditor_wr_content.insert_editor(html);
|
||||
} else {
|
||||
document.getElementById("wr_content").value += html + "\n";
|
||||
}
|
||||
*/
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function get_file_info(val) {
|
||||
try {
|
||||
var arr = val.split('|');
|
||||
var ret = {"bf_no":arr[0], "bf_source":arr[1], "bf_file":arr[2], "bf_filesize":arr[3], "bf_width":arr[4], "bf_type":arr[5]};
|
||||
return ret;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* SWFUpload jQuery Plugin v1.0.0
|
||||
*
|
||||
* Copyright (c) 2009 Adam Royle
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
*/
|
||||
|
||||
(function($){
|
||||
|
||||
var defaultHandlers = [
|
||||
'swfupload_preload_handler',
|
||||
'swfupload_load_failed_handler',
|
||||
'swfupload_loaded_handler',
|
||||
'file_dialog_start_handler',
|
||||
'file_queued_handler',
|
||||
'file_queue_error_handler',
|
||||
'file_dialog_complete_handler',
|
||||
'upload_resize_start_handler',
|
||||
'upload_start_handler',
|
||||
'upload_progress_handler',
|
||||
'upload_error_handler',
|
||||
'upload_success_handler',
|
||||
'upload_complete_handler',
|
||||
'mouse_click_handler',
|
||||
'mouse_out_handler',
|
||||
'mouse_over_handler',
|
||||
'queue_complete_handler'
|
||||
];
|
||||
var additionalHandlers = [];
|
||||
|
||||
$.fn.swfupload = function(){
|
||||
var args = $.makeArray(arguments);
|
||||
return this.each(function(){
|
||||
var swfu;
|
||||
if (args.length == 1 && typeof(args[0]) == 'object') {
|
||||
swfu = $(this).data('__swfu');
|
||||
if (!swfu) {
|
||||
var settings = args[0];
|
||||
var $magicUploadControl = $(this);
|
||||
var handlers = [];
|
||||
$.merge(handlers, defaultHandlers);
|
||||
$.merge(handlers, additionalHandlers);
|
||||
$.each(handlers, function(i, v){
|
||||
var eventName = v.replace(/_handler$/, '').replace(/_([a-z])/g, function(){ return arguments[1].toUpperCase(); });
|
||||
settings[v] = function() {
|
||||
var event = $.Event(eventName);
|
||||
$magicUploadControl.trigger(event, $.makeArray(arguments));
|
||||
return !event.isDefaultPrevented();
|
||||
};
|
||||
});
|
||||
$(this).data('__swfu', new SWFUpload(settings));
|
||||
}
|
||||
} else if (args.length > 0 && typeof(args[0]) == 'string') {
|
||||
var methodName = args.shift();
|
||||
swfu = $(this).data('__swfu');
|
||||
if (swfu && swfu[methodName]) {
|
||||
swfu[methodName].apply(swfu, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.swfupload = {
|
||||
additionalHandlers: function() {
|
||||
if (arguments.length === 0) {
|
||||
return additionalHandlers.slice();
|
||||
} else {
|
||||
$(arguments).each(function(i, v){
|
||||
$.merge(additionalHandlers, $.makeArray(v));
|
||||
});
|
||||
}
|
||||
},
|
||||
defaultHandlers: function() {
|
||||
return defaultHandlers.slice();
|
||||
},
|
||||
getInstance: function(el) {
|
||||
return $(el).data('__swfu');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
Queue Plug-in
|
||||
|
||||
Features:
|
||||
*Adds a cancelQueue() method for cancelling the entire queue.
|
||||
*All queued files are uploaded when startUpload() is called.
|
||||
*If false is returned from uploadComplete then the queue upload is stopped.
|
||||
If false is not returned (strict comparison) then the queue upload is continued.
|
||||
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
||||
Set the event handler with the queue_complete_handler setting.
|
||||
|
||||
*/
|
||||
|
||||
var SWFUpload;
|
||||
if (typeof(SWFUpload) === "function") {
|
||||
SWFUpload.queue = {};
|
||||
|
||||
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
||||
return function () {
|
||||
if (typeof(oldInitSettings) === "function") {
|
||||
oldInitSettings.call(this);
|
||||
}
|
||||
|
||||
this.queueSettings = {};
|
||||
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
|
||||
this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
||||
this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
|
||||
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
||||
this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
|
||||
|
||||
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
|
||||
};
|
||||
})(SWFUpload.prototype.initSettings);
|
||||
|
||||
SWFUpload.prototype.startUpload = function (fileID) {
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.callFlash("StartUpload", [fileID]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.cancelQueue = function () {
|
||||
this.queueSettings.queue_cancelled_flag = true;
|
||||
this.stopUpload();
|
||||
|
||||
var stats = this.getStats();
|
||||
while (stats.files_queued > 0) {
|
||||
this.cancelUpload();
|
||||
stats = this.getStats();
|
||||
}
|
||||
};
|
||||
|
||||
SWFUpload.queue.uploadStartHandler = function (file) {
|
||||
var returnValue;
|
||||
if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
|
||||
returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
|
||||
}
|
||||
|
||||
// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
|
||||
returnValue = (returnValue === false) ? false : true;
|
||||
|
||||
this.queueSettings.queue_cancelled_flag = !returnValue;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
||||
var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
|
||||
var continueUpload;
|
||||
|
||||
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
|
||||
this.queueSettings.queue_upload_count++;
|
||||
}
|
||||
|
||||
if (typeof(user_upload_complete_handler) === "function") {
|
||||
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
||||
} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
|
||||
// If the file was stopped and re-queued don't restart the upload
|
||||
continueUpload = false;
|
||||
} else {
|
||||
continueUpload = true;
|
||||
}
|
||||
|
||||
if (continueUpload) {
|
||||
var stats = this.getStats();
|
||||
if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
|
||||
this.startUpload();
|
||||
} else if (this.queueSettings.queue_cancelled_flag === false) {
|
||||
console.debug('ydfsdfgsdfgsdfg');
|
||||
this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
} else {
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in a new issue