diff --git a/module/common/view/kindeditor.html.php b/module/common/view/kindeditor.html.php index 60292ea343..420585fbcb 100644 --- a/module/common/view/kindeditor.html.php +++ b/module/common/view/kindeditor.html.php @@ -77,7 +77,7 @@ $(document).ready(function() var contentType = arr[0].split(";")[0].split(":")[1]; html = ''; - $.post(createLink('file', 'ajaxEditorImage'), {editor: html}, function(data){cmd.inserthtml(data);}); + $.post(createLink('file', 'ajaxPasteImage'), {editor: html}, function(data){cmd.inserthtml(data);}); }; reader.readAsDataURL(file); @@ -94,7 +94,7 @@ $(document).ready(function() var html = K(doc.body).html(); if(html.search(//U', $data, $out); - foreach($out[3] as $id => $base64Image) + ini_set('pcre.backtrack_limit', strlen($data)); + preg_match_all('//U', $data, $out); + foreach($out[3] as $key => $base64Image) { $imageData = base64_decode($base64Image); - $file['extension'] = $out[2][$id]; - $file['pathname'] = $this->setPathName($id, $file['extension']); + $file['extension'] = $out[2][$key]; + $file['pathname'] = $this->setPathName($key, $file['extension']); $file['size'] = strlen($imageData); $file['addedBy'] = $this->app->user->account; $file['addedDate'] = helper::today(); - $file['title'] = 'Paste in editor'; + $file['title'] = basename($file['pathname']); file_put_contents($this->savePath . $file['pathname'], $imageData); $this->dao->insert(TABLE_FILE)->data($file)->exec(); - $data = str_replace($out[1][$id], $this->webPath . $file['pathname'], $data); + $data = str_replace($out[1][$key], $this->webPath . $file['pathname'], $data); } return $data;