Post by R_D » Wed Jun 29, 2016 12:00 am

straightlight wrote:Do you see any error messages on the top of your screen when trying to upload png files?

If not, in your admin - > systems - > tools - > error log page, do you see any latest event regarding the filemanager.php file?

Nope, no errors in the error.log

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by straightlight » Wed Jun 29, 2016 12:04 am

Go to your admin - > systems - > settings - > edit store - > server tab - > Error Handling. Are the first and second option enable on that section? If not, enable them.

Then, save the changes. Retry the file manager with PNG, notice if there are any errors on top of the screen and in the error log. When viewing the error log, ensure to see the latest date and time on the left-end side.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by R_D » Wed Jun 29, 2016 12:09 am

straightlight wrote:Go to your admin - > systems - > settings - > edit store - > server tab - > Error Handling. Are the first and second option enable on that section? If not, enable them.

Then, save the changes. Retry the file manager with PNG, notice if there are any errors on top of the screen and in the error log. When viewing the error log, ensure to see the latest date and time on the left-end side.
They are on, but no errors in the log file....

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by IP_CAM » Wed Jun 29, 2016 12:15 am

SORRY! Unfortunately, this is the case, and, in my case, regardless of trying with xxx.JPG or xxx.PNG !
No error, nothing !
Ernie
Last edited by IP_CAM on Wed Jun 29, 2016 6:28 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Wed Jun 29, 2016 12:24 am

While one may be able to upload, since each server configurations may differ, screenshots would be inaccurate in this case since there are developed and engineered functions that are able to troubleshoot uploaded files on a web server as the reported issue only requires troubleshooting.

In admin/controller/common/filemanager.php file,

find:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, try the action again. With this replacement, it not only verifies the source file but also valdates if the file has been successfully uploaded to the server.

As for this line:

Code: Select all

$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
There are three files in OC v2.2.0.0 that shows as such and I don't entirely agree with this. That being said, each should be replaced with:

Code: Select all

$filename = html_entity_decode(basename($this->request->files['file']['name']), ENT_QUOTES, 'UTF-8');

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by R_D » Wed Jun 29, 2016 12:38 am

straightlight wrote:While one may be able to upload, since each server configurations may differ, screenshots would be inaccurate in this case since there are developed and engineered functions that are able to troubleshoot uploaded files on a web server as the reported issue only requires troubleshooting.

In admin/controller/common/filemanager.php file,

find:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, try the action again. With this replacement, it not only verifies the source file but also valdates if the file has been successfully uploaded to the server.

As for this line:

Code: Select all

$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
There are three files in OC v2.2.0.0 that shows as such and I don't entirely agree with this. That being said, each should be replaced with:

Code: Select all

$filename = html_entity_decode(basename($this->request->files['file']['name']), ENT_QUOTES, 'UTF-8');
It works! I've done all from the above and changed it in the admin/controller/common/filemanager.php file and now it is inserted into the description! Thanks!!!

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by straightlight » Wed Jun 29, 2016 12:48 am

Excellent. This issue was definitely a bug.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by R_D » Wed Jun 29, 2016 12:59 am

straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images? ;) :laugh:

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by straightlight » Wed Jun 29, 2016 1:02 am

Now that we know the above was a bug, I would suggest to apply the same fixes to the following files for OC v2.2.0.0 release:

- admin/controller/catalog/download.php file
- admin/controller/feed/google_base.php file

This should definitely rectify the issue.

As for the rest of the upload files that wasn't covered in the topic, here are the following fixes as well.

In admin/controller/extension/installer.php file,

find:

Code: Select all

if (strrchr($this->request->files['file']['name'], '.') == '.xml') {
replace with:

Code: Select all

if (is_uploaded_file($this->request->files['file']['name']) && strrchr($this->request->files['file']['name'], '.') == '.xml') {
In admin/controller/tool/upload.php file,

find:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
In your catalog/controller/tool/upload.php file,

find:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:

Code: Select all

if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, find:

Code: Select all

$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
replace with:

Code: Select all

$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
As for this line, I have no idea why it would be the only line matching for REGEXP compared to the rest of the other uploads in the platform:

Code: Select all

$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
replace with:

Code: Select all

$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
If there is really something special about that line and should be the only line to where special chars should be considered throughout the rest of the same process of Opencart, at least - if there's one thing useful about GitHub would be to document the difference on that upload !
Last edited by straightlight on Wed Jun 29, 2016 1:07 am, edited 2 times in total.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Wed Jun 29, 2016 1:02 am

R_D wrote:
straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images? ;) :laugh:
Could you elaborate that a little?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by R_D » Wed Jun 29, 2016 1:06 am

straightlight wrote:
R_D wrote:
straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images? ;) :laugh:
Could you elaborate that a little?
I've already had a post about it: http://forum.opencart.com/viewtopic.php?f=188&t=163914

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by straightlight » Wed Jun 29, 2016 1:08 am

I have modified my steps above. It seem that even the basename doesn't fit on either cases. Tested with full base URL; now working.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Wed Jun 29, 2016 1:15 am

I can just repeat it again ! ;)
Ernie
PS: works only for sure after a full clear out of /system/storage/cache/... Sub Content, the both /vqmod/xxx.cache files and the /vqmod/vqcache/... Sub Content! If someone uses OcMod-Extensions, also RESET all this as well!
Last edited by IP_CAM on Wed Jun 29, 2016 6:38 am, edited 7 times in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Wed Jun 29, 2016 1:46 am

It indicates in your last response that you would try it but no results were posted afterwards. Would it be possible to post more details about this?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Wed Jun 29, 2016 2:05 am

This is my LATEST tested VqMod Version on my OC v.2.2.0.0, after putting the formerly
modified files back to default OC Mode. The Results, produced by the VqMod, can be seen here:
http://www.bigmax.ch/oc22/index.php?rou ... duct_id=42
---
IMPORTANT, regarding Images acting responsive, read this Post as well:
http://forum.opencart.com/viewtopic.php ... 40#p626266
---
image_bug_quick_fix_oc_22.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Image Directory Bug Fix OC v.2.2.x]]></id>
<version><![CDATA[OC v.2.2.x]]></version>
<vqmver><![CDATA[2.6.1]]></vqmver>
<author><![CDATA[straightlight - VqModded by IP_CAM]]></author>

<file name="admin/controller/common/filemanager.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>

<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>

<file name="admin/controller/catalog/download.php">
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>

<file name="admin/controller/feed/google_base.php">
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>

<file name="admin/controller/extension/installer.php">
<operation error="log">
<search position="replace"><![CDATA[
if (strrchr($this->request->files['file']['name'], '.') == '.xml') {
]]></search>
<add><![CDATA[
if (is_uploaded_file($this->request->files['file']['name']) && strrchr($this->request->files['file']['name'], '.') == '.xml') {
]]></add>
</operation>
</file>

<file name="admin/controller/tool/upload.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>
</file>

<file name="catalog/controller/tool/upload.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>

<operation error="skip">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>

<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>

</modification>
Last edited by IP_CAM on Fri Jul 01, 2016 12:15 am, edited 10 times in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Wed Jun 29, 2016 2:20 am

The basename was removed and mentioned on my previous post. Your XML file will cause the relative path to be removed. You'll need to re-compare your XML with my fix.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Wed Jun 29, 2016 2:24 am

I made it, to implement all of your Changes, as mentioned to this!
Shall I change anything? It's planned to do it all at once, for those, using 'virgin' Source!?
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Wed Jun 29, 2016 2:46 am

IP_CAM wrote:I made it, to implement all of your Changes, as mentioned to this!
Shall I change anything? It's planned to do it all at once, for those, using 'virgin' Source!?
Ernie
As you can see from my modifications, the basename function has been removed after I edited it and announced. You'd need to re-modify the XML file. Otherwise, it will lead people not being able to upload to their relative path.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Wed Jun 29, 2016 3:51 am

So, I removed all basename-related sections.
untested, but it won't do any harm, I guess ! ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Wed Jun 29, 2016 3:57 am

IP_CAM wrote:So, I removed all basename-related sections.
untested, but it won't do any harm, I guess ! ;)
Ernie
You removed the entire XML blocks to where the basename originates ... while this portion of code is what needs to be replaced into:

Code: Select all

$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
as per my instructions indicates. As for the rest of the replacements, it should be fine.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 178 guests