This repository has been archived by the owner on Mar 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from infabo/magento-1.9.2.4-SUPEE-8788
apply SUPEE-8788
- Loading branch information
Showing
80 changed files
with
3,450 additions
and
1,137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,29 +31,24 @@ | |
* @package Mage_Adminhtml | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
class Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Uploader extends Mage_Adminhtml_Block_Media_Uploader | ||
class Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Uploader extends Mage_Uploader_Block_Multiple | ||
{ | ||
/** | ||
* Uploader block constructor | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$params = $this->getConfig()->getParams(); | ||
$type = $this->_getMediaType(); | ||
$allowed = Mage::getSingleton('cms/wysiwyg_images_storage')->getAllowedExtensions($type); | ||
$labels = array(); | ||
$files = array(); | ||
foreach ($allowed as $ext) { | ||
$labels[] = '.' . $ext; | ||
$files[] = '*.' . $ext; | ||
} | ||
$this->getConfig() | ||
->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload', array('type' => $type))) | ||
->setParams($params) | ||
->setFileField('image') | ||
->setFilters(array( | ||
'images' => array( | ||
'label' => $this->helper('cms')->__('Images (%s)', implode(', ', $labels)), | ||
'files' => $files | ||
) | ||
$this->getUploaderConfig() | ||
->setFileParameterName('image') | ||
->setTarget( | ||
Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload', array('type' => $type)) | ||
); | ||
$this->getButtonConfig() | ||
->setAttributes(array( | ||
'accept' => $this->getButtonConfig()->getMimeTypesByExtensions($allowed) | ||
)); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,189 +31,20 @@ | |
* @package Mage_Adminhtml | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
class Mage_Adminhtml_Block_Media_Uploader extends Mage_Adminhtml_Block_Widget | ||
{ | ||
|
||
protected $_config; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->setId($this->getId() . '_Uploader'); | ||
$this->setTemplate('media/uploader.phtml'); | ||
$this->getConfig()->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload')); | ||
$this->getConfig()->setParams(array('form_key' => $this->getFormKey())); | ||
$this->getConfig()->setFileField('file'); | ||
$this->getConfig()->setFilters(array( | ||
'images' => array( | ||
'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'), | ||
'files' => array('*.gif', '*.jpg', '*.png') | ||
), | ||
'media' => array( | ||
'label' => Mage::helper('adminhtml')->__('Media (.avi, .flv, .swf)'), | ||
'files' => array('*.avi', '*.flv', '*.swf') | ||
), | ||
'all' => array( | ||
'label' => Mage::helper('adminhtml')->__('All Files'), | ||
'files' => array('*.*') | ||
) | ||
)); | ||
} | ||
|
||
protected function _prepareLayout() | ||
{ | ||
$this->setChild( | ||
'browse_button', | ||
$this->getLayout()->createBlock('adminhtml/widget_button') | ||
->addData(array( | ||
'id' => $this->_getButtonId('browse'), | ||
'label' => Mage::helper('adminhtml')->__('Browse Files...'), | ||
'type' => 'button', | ||
'onclick' => $this->getJsObjectName() . '.browse()' | ||
)) | ||
); | ||
|
||
$this->setChild( | ||
'upload_button', | ||
$this->getLayout()->createBlock('adminhtml/widget_button') | ||
->addData(array( | ||
'id' => $this->_getButtonId('upload'), | ||
'label' => Mage::helper('adminhtml')->__('Upload Files'), | ||
'type' => 'button', | ||
'onclick' => $this->getJsObjectName() . '.upload()' | ||
)) | ||
); | ||
|
||
$this->setChild( | ||
'delete_button', | ||
$this->getLayout()->createBlock('adminhtml/widget_button') | ||
->addData(array( | ||
'id' => '{{id}}-delete', | ||
'class' => 'delete', | ||
'type' => 'button', | ||
'label' => Mage::helper('adminhtml')->__('Remove'), | ||
'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')' | ||
)) | ||
); | ||
|
||
return parent::_prepareLayout(); | ||
} | ||
|
||
protected function _getButtonId($buttonName) | ||
{ | ||
return $this->getHtmlId() . '-' . $buttonName; | ||
} | ||
|
||
public function getBrowseButtonHtml() | ||
{ | ||
return $this->getChildHtml('browse_button'); | ||
} | ||
|
||
public function getUploadButtonHtml() | ||
{ | ||
return $this->getChildHtml('upload_button'); | ||
} | ||
|
||
public function getDeleteButtonHtml() | ||
{ | ||
return $this->getChildHtml('delete_button'); | ||
} | ||
|
||
/** | ||
* Retrive uploader js object name | ||
* | ||
* @return string | ||
*/ | ||
public function getJsObjectName() | ||
{ | ||
return $this->getHtmlId() . 'JsObject'; | ||
} | ||
|
||
/** | ||
* Retrive config json | ||
* | ||
* @return string | ||
*/ | ||
public function getConfigJson() | ||
{ | ||
return Mage::helper('core')->jsonEncode($this->getConfig()->getData()); | ||
} | ||
|
||
/** | ||
* Retrive config object | ||
* | ||
* @return Varien_Config | ||
*/ | ||
public function getConfig() | ||
{ | ||
if(is_null($this->_config)) { | ||
$this->_config = new Varien_Object(); | ||
} | ||
|
||
return $this->_config; | ||
} | ||
|
||
public function getPostMaxSize() | ||
{ | ||
return ini_get('post_max_size'); | ||
} | ||
|
||
public function getUploadMaxSize() | ||
{ | ||
return ini_get('upload_max_filesize'); | ||
} | ||
|
||
public function getDataMaxSize() | ||
{ | ||
return min($this->getPostMaxSize(), $this->getUploadMaxSize()); | ||
} | ||
|
||
public function getDataMaxSizeInBytes() | ||
{ | ||
$iniSize = $this->getDataMaxSize(); | ||
$size = substr($iniSize, 0, strlen($iniSize)-1); | ||
$parsedSize = 0; | ||
switch (strtolower(substr($iniSize, strlen($iniSize)-1))) { | ||
case 't': | ||
$parsedSize = $size*(1024*1024*1024*1024); | ||
break; | ||
case 'g': | ||
$parsedSize = $size*(1024*1024*1024); | ||
break; | ||
case 'm': | ||
$parsedSize = $size*(1024*1024); | ||
break; | ||
case 'k': | ||
$parsedSize = $size*1024; | ||
break; | ||
case 'b': | ||
default: | ||
$parsedSize = $size; | ||
break; | ||
} | ||
return $parsedSize; | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* Class Mage_Adminhtml_Block_Media_Uploader | ||
*/ | ||
class Mage_Adminhtml_Block_Media_Uploader extends Mage_Uploader_Block_Multiple | ||
{ | ||
/** | ||
* Retrieve full uploader SWF's file URL | ||
* Implemented to solve problem with cross domain SWFs | ||
* Now uploader can be only in the same URL where backend located | ||
* | ||
* @param string $url url to uploader in current theme | ||
* | ||
* @return string full URL | ||
* Constructor for uploader block | ||
*/ | ||
public function getUploaderUrl($url) | ||
public function __construct() | ||
{ | ||
if (!is_string($url)) { | ||
$url = ''; | ||
} | ||
$design = Mage::getDesign(); | ||
$theme = $design->getTheme('skin'); | ||
if (empty($url) || !$design->validateFile($url, array('_type' => 'skin', '_theme' => $theme))) { | ||
$theme = $design->getDefaultTheme(); | ||
} | ||
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'skin/' . | ||
$design->getArea() . '/' . $design->getPackageName() . '/' . $theme . '/' . $url; | ||
parent::__construct(); | ||
$this->getUploaderConfig()->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload')); | ||
$this->getUploaderConfig()->setFileParameterName('file'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.