diff --git a/admin/common-js.php b/admin/common-js.php
index 2fb0aa99..79833280 100644
--- a/admin/common-js.php
+++ b/admin/common-js.php
@@ -30,7 +30,8 @@
$('a').each(function () {
var t = $(this), href = t.attr('href');
- if (/^adminUrl, '/'); ?>.*$/.exec(href)
+ if ((href.length > 1 && href[0] == '#')
+ /^adminUrl, '/'); ?>.*$/.exec(href)
|| /^index), '/'), 0, -1); ?>action\/[_a-zA-Z0-9\/]+.*$/.exec(href)) {
return;
}
diff --git a/admin/css/style.css b/admin/css/style.css
index 56e450fa..534623d0 100644
--- a/admin/css/style.css
+++ b/admin/css/style.css
@@ -1980,7 +1980,6 @@ ul.typecho-list-notable li .loading {
.visuallyhidden {
border: 0;
- clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
diff --git a/admin/file-upload-js.php b/admin/file-upload-js.php
index 9ab87669..8eceb6cf 100644
--- a/admin/file-upload-js.php
+++ b/admin/file-upload-js.php
@@ -50,16 +50,17 @@ $(document).ready(function() {
$('.upload-file').fileUpload({
url : 'index('/action/upload'
. (isset($fileParentContent) ? '?cid=' . $fileParentContent->cid : '')); ?>',
- types : 'allowedAttachmentTypes;
- $attachmentTypesCount = count($attachmentTypes);
- for ($i = 0; $i < $attachmentTypesCount; $i ++) {
- echo '*.' . $attachmentTypes[$i];
- if ($i < $attachmentTypesCount - 1) {
- echo ';';
- }
+ types : allowedattachmenttypes;
+ $attachmenttypescount = count($attachmenttypes);
+ $types = array();
+
+ for ($i = 0; $i < $attachmenttypescount; $i ++) {
+ $types[] = '.' . $attachmenttypes[$i];
}
-?>',
+
+ echo json_encode($types);
+?>,
typesError : '',
onUpload : fileUploadStart,
onError : function (id) {
@@ -72,16 +73,17 @@ $(document).ready(function() {
$('#upload-panel').filedrop({
url : 'index('/action/upload'
. (isset($fileParentContent) ? '?cid=' . $fileParentContent->cid : '')); ?>',
- allowedfileextensions : [allowedAttachmentTypes;
- $attachmentTypesCount = count($attachmentTypes);
- for ($i = 0; $i < $attachmentTypesCount; $i ++) {
- echo '".' . $attachmentTypes[$i] . '"';
- if ($i < $attachmentTypesCount - 1) {
- echo ',';
- }
+ allowedfileextensions : allowedattachmenttypes;
+ $attachmenttypescount = count($attachmenttypes);
+ $types = array();
+
+ for ($i = 0; $i < $attachmenttypescount; $i ++) {
+ $types[] = '.' . $attachmenttypes[$i];
}
-?>],
+
+ echo json_encode($types);
+?>,
maxfilesize :
- 将要上传的文件拖放到这里 或者
选择文件上传
+ 将要上传的文件拖放到这里 或者
选择文件上传
next()): ?>
- title(); ?> attachment->size / 1024)); ?> Kb 插入 ×
diff --git a/admin/javascript/typecho.js b/admin/javascript/typecho.js
index e73cb083..ff78e0ee 100644
--- a/admin/javascript/typecho.js
+++ b/admin/javascript/typecho.js
@@ -91,22 +91,22 @@
onUpload : null,
onComplete : null,
onError : null,
- types : null,
+ types : [],
name : 'file',
typesError : 'file type error',
single : false
}, options),
p = this.parent().css('position', 'relative'),
- input = $('').css({
+ input = $('').css({
opacity : 0,
cursor : 'pointer',
position : 'absolute',
width : this.outerWidth(),
- height : this.outerHeight,
+ height : this.outerHeight(),
left : this.offset().left - p.offset().left,
top : this.offset().top - p.offset().top
}).insertAfter(this), queue = {}, prefix = 'queue-',
- index = 0, types = [];
+ index = 0;
window.fileUploadComplete = function (id, url, data) {
if (s.single) {
@@ -138,15 +138,6 @@
}
};
- if (!!s.types) {
- var list = s.types.split(';');
- for (var i = 0; i < list.length; i ++) {
- var parts = list[i].split('.');
- parts.shift();
- types.push('.' + parts.join('.'));
- }
- }
-
function upload (frame, id) {
var form = $('
'),
replace = input.clone(true).val(''),
@@ -162,12 +153,12 @@
}
function checkTypes (file) {
- if (!types.length) {
+ if (!s.types.length) {
return true;
}
- for (var i = 0; i < types.length; i ++) {
- var ext = types[i];
+ for (var i = 0; i < s.types.length; i ++) {
+ var ext = s.types[i];
if (file.length <= ext.length) {
continue;
diff --git a/admin/media.php b/admin/media.php
index 841ec51a..571d80f5 100644
--- a/admin/media.php
+++ b/admin/media.php
@@ -27,10 +27,8 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
@@ -44,148 +42,144 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
include 'copyright.php';
include 'common-js.php';
?>
-
-
+
response->setStatus(502);
- exit;
- } else {
-
+ if (false !== $result) {
$struct = array(
'title' => $result['name'],
'slug' => $result['name'],
@@ -370,11 +366,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface
$result = self::modifyHandle($this->row, $file);
- if (false === $result) {
- $this->response->setStatus(502);
- exit;
- } else {
-
+ if (false !== $result) {
$this->update(array(
'text' => serialize($result)
), $this->db->sql()->where('cid = ?', $this->cid));