Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
b0ccfa00
Unverified
Commit
b0ccfa00
authored
Dec 04, 2018
by
Scott
Committed by
GitHub
Dec 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #664 from pupi1985/patch-111
Refactor WYSIWYG file upload
parents
1d36caf1
fbe6bf07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
qa-wysiwyg-upload.php
qa-plugin/wysiwyg-editor/qa-wysiwyg-upload.php
+24
-15
No files found.
qa-plugin/wysiwyg-editor/qa-wysiwyg-upload.php
View file @
b0ccfa00
...
...
@@ -25,7 +25,7 @@ class qa_wysiwyg_upload
{
public
function
match_request
(
$request
)
{
return
(
$request
==
'wysiwyg-editor-upload'
)
;
return
$request
===
'wysiwyg-editor-upload'
;
}
public
function
process_request
(
$request
)
...
...
@@ -34,24 +34,33 @@ class qa_wysiwyg_upload
$url
=
''
;
if
(
is_array
(
$_FILES
)
&&
count
(
$_FILES
))
{
if
(
!
qa_opt
(
'wysiwyg_editor_upload_images'
))
$message
=
qa_lang
(
'users/no_permission'
);
require_once
QA_INCLUDE_DIR
.
'app/upload.php'
;
if
(
qa_opt
(
'wysiwyg_editor_upload_images'
))
{
require_once
QA_INCLUDE_DIR
.
'app/upload.php'
;
$upload
=
qa_upload_file_one
(
qa_opt
(
'wysiwyg_editor_upload_max_size'
),
qa_get
(
'qa_only_image'
)
||
!
qa_opt
(
'wysiwyg_editor_upload_all'
),
qa_get
(
'qa_only_image'
)
?
600
:
null
,
// max width if it's an image upload
null
// no max height
);
$onlyImage
=
qa_get
(
'qa_only_image'
);
$upload
=
qa_upload_file_one
(
qa_opt
(
'wysiwyg_editor_upload_max_size'
),
$onlyImage
||
!
qa_opt
(
'wysiwyg_editor_upload_all'
),
$onlyImage
?
600
:
null
,
// max width if it's an image upload
null
// no max height
);
$message
=
@
$upload
[
'error'
];
$url
=
@
$upload
[
'bloburl'
];
if
(
isset
(
$upload
[
'error'
]))
{
$message
=
$upload
[
'error'
];
}
else
{
$url
=
$upload
[
'bloburl'
];
}
}
else
{
$message
=
qa_lang
(
'users/no_permission'
);
}
}
echo
"<script>window.parent.CKEDITOR.tools.callFunction("
.
qa_js
(
qa_get
(
'CKEditorFuncNum'
))
.
", "
.
qa_js
(
$url
)
.
", "
.
qa_js
(
$message
)
.
");</script>"
;
echo
sprintf
(
'<script>window.parent.CKEDITOR.tools.callFunction(%s, %s, %s);</script>'
,
qa_js
(
qa_get
(
'CKEditorFuncNum'
)),
qa_js
(
$url
),
qa_js
(
$message
)
);
return
null
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment