fileuploadattribute - Version 1.2.0

Version Notes

Allow for the upload of unsafe file extensions

Download this release

Release Info

Developer Javier Villanueva
Extension fileuploadattribute
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.1 to 1.2.0

app/code/community/Jvs/FileAttribute/Model/Attribute/Backend/File.php CHANGED
@@ -58,7 +58,21 @@ class Jvs_FileAttribute_Model_Attribute_Backend_File
58
  $uploader->setAllowRenameFiles(true);
59
  $uploader->setFilesDispersion(true);
60
 
 
 
 
 
 
 
 
 
 
 
61
  $uploader->save(Mage::getBaseDir('media') . '/catalog/product');
 
 
 
 
62
  } catch (Exception $e) {
63
  return $this;
64
  }
58
  $uploader->setAllowRenameFiles(true);
59
  $uploader->setFilesDispersion(true);
60
 
61
+ // Make sure to unset the file extension from the main
62
+ // protected extension node to allow uploading
63
+ $store = Mage::app()->getStore();
64
+
65
+ $defaultConfig = Mage::getStoreConfig('general/file/protected_extensions', $store);
66
+
67
+ $filteredExtensions = array_diff($defaultConfig, $uploadedFile->getData('allowed_extensions'));
68
+
69
+ $store->setConfig('general/file/protected_extensions', $filteredExtensions);
70
+
71
  $uploader->save(Mage::getBaseDir('media') . '/catalog/product');
72
+
73
+ // Restore main protected extensions
74
+ $store->setConfig('general/file/protected_extensions', $defaultConfig);
75
+
76
  } catch (Exception $e) {
77
  return $this;
78
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>fileuploadattribute</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT</license>
7
  <channel>community</channel>
@@ -10,11 +10,11 @@
10
  <description>This extension allows you to create file upload attributes for your products by adding a new input type to the attribute creation form.&#xD;
11
  &#xD;
12
  You will be able to assign multiple file upload attributes to your products, restrict allowed file extensions and choose to display them automatically on your product pages or display it by yourself however you want to.</description>
13
- <notes>Increase maximum PHP compatible version</notes>
14
  <authors><author><name>Javier Villanueva</name><user>javiervd</user><email>javiervd@gmail.com</email></author></authors>
15
- <date>2016-01-04</date>
16
- <time>20:42:30</time>
17
- <contents><target name="magecommunity"><dir name="Jvs"><dir name="FileAttribute"><dir name="Block"><dir name="Element"><file name="File.php" hash="3cc11497c90e17d239a56474e13d0b08"/></dir><dir name="Product"><dir name="View"><file name="Attributes.php" hash="23804c6ac14597db3147ce47c2b58131"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fad835c3b52c614614eedd1bdeab633f"/></dir><dir name="Model"><dir name="Attribute"><dir name="Backend"><file name="File.php" hash="b91adc1758e024f248938844103f51da"/></dir></dir><file name="Observer.php" hash="04c446dacc6c760454d6d33acd607ba1"/></dir><dir name="etc"><file name="config.xml" hash="5c5593331b1be697c818eaebf758857b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jvs_FileAttribute.xml" hash="23788d82b953b31264288716e8536ba9"/></dir></target></contents>
18
  <compatible/>
19
- <dependencies><required><php><min>5.3.0</min><max>5.6.16</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>fileuploadattribute</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT</license>
7
  <channel>community</channel>
10
  <description>This extension allows you to create file upload attributes for your products by adding a new input type to the attribute creation form.&#xD;
11
  &#xD;
12
  You will be able to assign multiple file upload attributes to your products, restrict allowed file extensions and choose to display them automatically on your product pages or display it by yourself however you want to.</description>
13
+ <notes>Allow for the upload of unsafe file extensions</notes>
14
  <authors><author><name>Javier Villanueva</name><user>javiervd</user><email>javiervd@gmail.com</email></author></authors>
15
+ <date>2016-03-12</date>
16
+ <time>13:59:57</time>
17
+ <contents><target name="magecommunity"><dir name="Jvs"><dir name="FileAttribute"><dir name="Block"><dir name="Element"><file name="File.php" hash="3cc11497c90e17d239a56474e13d0b08"/></dir><dir name="Product"><dir name="View"><file name="Attributes.php" hash="23804c6ac14597db3147ce47c2b58131"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fad835c3b52c614614eedd1bdeab633f"/></dir><dir name="Model"><dir name="Attribute"><dir name="Backend"><file name="File.php" hash="eadb7ec113ccb821ad696a5275f72f5f"/></dir></dir><file name="Observer.php" hash="04c446dacc6c760454d6d33acd607ba1"/></dir><dir name="etc"><file name="config.xml" hash="5c5593331b1be697c818eaebf758857b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jvs_FileAttribute.xml" hash="23788d82b953b31264288716e8536ba9"/></dir></target></contents>
18
  <compatible/>
19
+ <dependencies><required><php><min>5.3.0</min><max>7.0.4</max></php></required></dependencies>
20
  </package>