diff --git a/app/code/core/Mage/Cms/Model/Resource/Block.php b/app/code/core/Mage/Cms/Model/Resource/Block.php
new file mode 100755
index 00000000..0cea3b84
--- /dev/null
+++ b/app/code/core/Mage/Cms/Model/Resource/Block.php
@@ -0,0 +1,242 @@
+
+ */
+class Mage_Cms_Model_Resource_Block extends Mage_Core_Model_Resource_Db_Abstract
+{
+ /**
+ * Initialize resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('cms/block', 'block_id');
+ }
+
+ /**
+ * Process block data before deleting
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object)
+ {
+ $condition = array(
+ 'block_id = ?' => (int) $object->getId(),
+ );
+
+ $this->_getWriteAdapter()->delete($this->getTable('cms/block_store'), $condition);
+
+ return parent::_beforeDelete($object);
+ }
+
+ /**
+ * Perform operations before object save
+ *
+ * @param Mage_Cms_Model_Block $object
+ * @return Mage_Cms_Model_Resource_Block
+ */
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
+ {
+ if (!$this->getIsUniqueBlockToStores($object)) {
+ Mage::throwException(Mage::helper('cms')->__('A block identifier with the same properties already exists in the selected store.'));
+ }
+
+ if (! $object->getId()) {
+ $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
+ }
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
+ return $this;
+ }
+
+ /**
+ * Perform operations after object save
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Block
+ */
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
+ {
+ $oldStores = $this->lookupStoreIds($object->getId());
+ $newStores = (array)$object->getStores();
+
+ $table = $this->getTable('cms/block_store');
+ $insert = array_diff($newStores, $oldStores);
+ $delete = array_diff($oldStores, $newStores);
+
+ if ($delete) {
+ $where = array(
+ 'block_id = ?' => (int) $object->getId(),
+ 'store_id IN (?)' => $delete
+ );
+
+ $this->_getWriteAdapter()->delete($table, $where);
+ }
+
+ if ($insert) {
+ $data = array();
+
+ foreach ($insert as $storeId) {
+ $data[] = array(
+ 'block_id' => (int) $object->getId(),
+ 'store_id' => (int) $storeId
+ );
+ }
+
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
+ }
+
+ return parent::_afterSave($object);
+
+ }
+
+ /**
+ * Load an object using 'identifier' field if there's no field specified and value is not numeric
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @param mixed $value
+ * @param string $field
+ * @return Mage_Cms_Model_Resource_Block
+ */
+ public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
+ {
+ if (!is_numeric($value) && is_null($field)) {
+ $field = 'identifier';
+ }
+
+ return parent::load($object, $value, $field);
+ }
+
+ /**
+ * Perform operations after object load
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Block
+ */
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
+ {
+ if ($object->getId()) {
+ $stores = $this->lookupStoreIds($object->getId());
+ $object->setData('store_id', $stores);
+ $object->setData('stores', $stores);
+ }
+
+ return parent::_afterLoad($object);
+ }
+
+ /**
+ * Retrieve select object for load object data
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param Mage_Cms_Model_Block $object
+ * @return Zend_Db_Select
+ */
+ protected function _getLoadSelect($field, $value, $object)
+ {
+ $select = parent::_getLoadSelect($field, $value, $object);
+
+ if ($object->getStoreId()) {
+ $stores = array(
+ (int) $object->getStoreId(),
+ Mage_Core_Model_App::ADMIN_STORE_ID,
+ );
+
+ $select->join(
+ array('cbs' => $this->getTable('cms/block_store')),
+ $this->getMainTable().'.block_id = cbs.block_id',
+ array('store_id')
+ )->where('is_active = ?', 1)
+ ->where('cbs.store_id in (?) ', $stores)
+ ->order('store_id DESC')
+ ->limit(1);
+ }
+
+ return $select;
+ }
+
+ /**
+ * Check for unique of identifier of block to selected store(s).
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return bool
+ */
+ public function getIsUniqueBlockToStores(Mage_Core_Model_Abstract $object)
+ {
+ if (Mage::app()->isSingleStoreMode()) {
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
+ } else {
+ $stores = (array)$object->getData('stores');
+ }
+
+ $select = $this->_getReadAdapter()->select()
+ ->from(array('cb' => $this->getMainTable()))
+ ->join(
+ array('cbs' => $this->getTable('cms/block_store')),
+ 'cb.block_id = cbs.block_id',
+ array()
+ )->where('cb.identifier = ?', $object->getData('identifier'))
+ ->where('cbs.store_id IN (?)', $stores);
+
+ if ($object->getId()) {
+ $select->where('cb.block_id <> ?', $object->getId());
+ }
+
+ if ($this->_getReadAdapter()->fetchRow($select)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get store ids to which specified item is assigned
+ *
+ * @param int $id
+ * @return array
+ */
+ public function lookupStoreIds($id)
+ {
+ $adapter = $this->_getReadAdapter();
+
+ $select = $adapter->select()
+ ->from($this->getTable('cms/block_store'), 'store_id')
+ ->where('block_id = :block_id');
+
+ $binds = array(
+ ':block_id' => (int) $id
+ );
+
+ return $adapter->fetchCol($select, $binds);
+ }
+}
diff --git a/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php b/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php
new file mode 100755
index 00000000..05afb6cc
--- /dev/null
+++ b/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php
@@ -0,0 +1,118 @@
+
+ */
+class Mage_Cms_Model_Resource_Block_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
+{
+ /**
+ * Define resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('cms/block');
+ $this->_map['fields']['store'] = 'store_table.store_id';
+ }
+
+ /**
+ * Returns pairs block_id - title
+ *
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ return $this->_toOptionArray('block_id', 'title');
+ }
+
+ /**
+ * Add filter by store
+ *
+ * @param int|Mage_Core_Model_Store $store
+ * @param bool $withAdmin
+ * @return Mage_Cms_Model_Resource_Block_Collection
+ */
+ public function addStoreFilter($store, $withAdmin = true)
+ {
+ if ($store instanceof Mage_Core_Model_Store) {
+ $store = array($store->getId());
+ }
+
+ if (!is_array($store)) {
+ $store = array($store);
+ }
+
+ if ($withAdmin) {
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
+ }
+
+ $this->addFilter('store', array('in' => $store), 'public');
+
+ return $this;
+ }
+
+ /**
+ * Get SQL for get record count.
+ * Extra GROUP BY strip added.
+ *
+ * @return Varien_Db_Select
+ */
+ public function getSelectCountSql()
+ {
+ $countSelect = parent::getSelectCountSql();
+
+ $countSelect->reset(Zend_Db_Select::GROUP);
+
+ return $countSelect;
+ }
+
+ /**
+ * Join store relation table if there is store filter
+ */
+ protected function _renderFiltersBefore()
+ {
+ if ($this->getFilter('store')) {
+ $this->getSelect()->join(
+ array('store_table' => $this->getTable('cms/block_store')),
+ 'main_table.block_id = store_table.block_id',
+ array()
+ )->group('main_table.block_id');
+
+ /*
+ * Allow analytic functions usage because of one field grouping
+ */
+ $this->_useAnalyticFunction = true;
+ }
+ return parent::_renderFiltersBefore();
+ }
+
+}
diff --git a/app/code/core/Mage/Cms/Model/Resource/Page.php b/app/code/core/Mage/Cms/Model/Resource/Page.php
new file mode 100755
index 00000000..d2814500
--- /dev/null
+++ b/app/code/core/Mage/Cms/Model/Resource/Page.php
@@ -0,0 +1,416 @@
+
+ */
+class Mage_Cms_Model_Resource_Page extends Mage_Core_Model_Resource_Db_Abstract
+{
+ /**
+ * Store model
+ *
+ * @var null|Mage_Core_Model_Store
+ */
+ protected $_store = null;
+
+ /**
+ * Initialize resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('cms/page', 'page_id');
+ }
+
+ /**
+ * Process page data before deleting
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object)
+ {
+ $condition = array(
+ 'page_id = ?' => (int) $object->getId(),
+ );
+
+ $this->_getWriteAdapter()->delete($this->getTable('cms/page_store'), $condition);
+
+ return parent::_beforeDelete($object);
+ }
+
+ /**
+ * Process page data before saving
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
+ {
+ /*
+ * For two attributes which represent timestamp data in DB
+ * we should make converting such as:
+ * If they are empty we need to convert them into DB
+ * type NULL so in DB they will be empty and not some default value
+ */
+ foreach (array('custom_theme_from', 'custom_theme_to') as $field) {
+ $value = !$object->getData($field) ? null : $object->getData($field);
+ $object->setData($field, $this->formatDate($value));
+ }
+
+ if (!$this->getIsUniquePageToStores($object)) {
+ Mage::throwException(Mage::helper('cms')->__('A page URL key for specified store already exists.'));
+ }
+
+ if (!$this->isValidPageIdentifier($object)) {
+ Mage::throwException(Mage::helper('cms')->__('The page URL key contains capital letters or disallowed symbols.'));
+ }
+
+ if ($this->isNumericPageIdentifier($object)) {
+ Mage::throwException(Mage::helper('cms')->__('The page URL key cannot consist only of numbers.'));
+ }
+
+ // modify create / update dates
+ if ($object->isObjectNew() && !$object->hasCreationTime()) {
+ $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
+ }
+
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
+
+ return parent::_beforeSave($object);
+ }
+
+ /**
+ * Assign page to store views
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
+ {
+ $oldStores = $this->lookupStoreIds($object->getId());
+ $newStores = (array)$object->getStores();
+ if (empty($newStores)) {
+ $newStores = (array)$object->getStoreId();
+ }
+ $table = $this->getTable('cms/page_store');
+ $insert = array_diff($newStores, $oldStores);
+ $delete = array_diff($oldStores, $newStores);
+
+ if ($delete) {
+ $where = array(
+ 'page_id = ?' => (int) $object->getId(),
+ 'store_id IN (?)' => $delete
+ );
+
+ $this->_getWriteAdapter()->delete($table, $where);
+ }
+
+ if ($insert) {
+ $data = array();
+
+ foreach ($insert as $storeId) {
+ $data[] = array(
+ 'page_id' => (int) $object->getId(),
+ 'store_id' => (int) $storeId
+ );
+ }
+
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
+ }
+
+ return parent::_afterSave($object);
+ }
+
+ /**
+ * Load an object using 'identifier' field if there's no field specified and value is not numeric
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @param mixed $value
+ * @param string $field
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
+ {
+ if (!is_numeric($value) && is_null($field)) {
+ $field = 'identifier';
+ }
+
+ return parent::load($object, $value, $field);
+ }
+
+ /**
+ * Perform operations after object load
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
+ {
+ if ($object->getId()) {
+ $stores = $this->lookupStoreIds($object->getId());
+
+ $object->setData('store_id', $stores);
+
+ }
+
+ return parent::_afterLoad($object);
+ }
+
+ /**
+ * Retrieve select object for load object data
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param Mage_Cms_Model_Page $object
+ * @return Zend_Db_Select
+ */
+ protected function _getLoadSelect($field, $value, $object)
+ {
+ $select = parent::_getLoadSelect($field, $value, $object);
+
+ if ($object->getStoreId()) {
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
+ $select->join(
+ array('cms_page_store' => $this->getTable('cms/page_store')),
+ $this->getMainTable() . '.page_id = cms_page_store.page_id',
+ array())
+ ->where('is_active = ?', 1)
+ ->where('cms_page_store.store_id IN (?)', $storeIds)
+ ->order('cms_page_store.store_id DESC')
+ ->limit(1);
+ }
+
+ return $select;
+ }
+
+ /**
+ * Retrieve load select with filter by identifier, store and activity
+ *
+ * @param string $identifier
+ * @param int|array $store
+ * @param int $isActive
+ * @return Varien_Db_Select
+ */
+ protected function _getLoadByIdentifierSelect($identifier, $store, $isActive = null)
+ {
+ $select = $this->_getReadAdapter()->select()
+ ->from(array('cp' => $this->getMainTable()))
+ ->join(
+ array('cps' => $this->getTable('cms/page_store')),
+ 'cp.page_id = cps.page_id',
+ array())
+ ->where('cp.identifier = ?', $identifier)
+ ->where('cps.store_id IN (?)', $store);
+
+ if (!is_null($isActive)) {
+ $select->where('cp.is_active = ?', $isActive);
+ }
+
+ return $select;
+ }
+
+ /**
+ * Check for unique of identifier of page to selected store(s).
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return bool
+ */
+ public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object)
+ {
+ if (Mage::app()->isSingleStoreMode() || !$object->hasStores()) {
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
+ } else {
+ $stores = (array)$object->getData('stores');
+ }
+
+ $select = $this->_getLoadByIdentifierSelect($object->getData('identifier'), $stores);
+
+ if ($object->getId()) {
+ $select->where('cps.page_id <> ?', $object->getId());
+ }
+
+ if ($this->_getWriteAdapter()->fetchRow($select)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Check whether page identifier is numeric
+ *
+ * @date Wed Mar 26 18:12:28 EET 2008
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return bool
+ */
+ protected function isNumericPageIdentifier(Mage_Core_Model_Abstract $object)
+ {
+ return preg_match('/^[0-9]+$/', $object->getData('identifier'));
+ }
+
+ /**
+ * Check whether page identifier is valid
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return bool
+ */
+ protected function isValidPageIdentifier(Mage_Core_Model_Abstract $object)
+ {
+ return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('identifier'));
+ }
+
+
+
+ /**
+ * Check if page identifier exist for specific store
+ * return page id if page exists
+ *
+ * @param string $identifier
+ * @param int $storeId
+ * @return int
+ */
+ public function checkIdentifier($identifier, $storeId)
+ {
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID, $storeId);
+ $select = $this->_getLoadByIdentifierSelect($identifier, $stores, 1);
+ $select->reset(Zend_Db_Select::COLUMNS)
+ ->columns('cp.page_id')
+ ->order('cps.store_id DESC')
+ ->limit(1);
+
+ return $this->_getReadAdapter()->fetchOne($select);
+ }
+
+ /**
+ * Retrieves cms page title from DB by passed identifier.
+ *
+ * @param string $identifier
+ * @return string|false
+ */
+ public function getCmsPageTitleByIdentifier($identifier)
+ {
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
+ if ($this->_store) {
+ $stores[] = (int)$this->getStore()->getId();
+ }
+
+ $select = $this->_getLoadByIdentifierSelect($identifier, $stores);
+ $select->reset(Zend_Db_Select::COLUMNS)
+ ->columns('cp.title')
+ ->order('cps.store_id DESC')
+ ->limit(1);
+
+ return $this->_getReadAdapter()->fetchOne($select);
+ }
+
+ /**
+ * Retrieves cms page title from DB by passed id.
+ *
+ * @param string $id
+ * @return string|false
+ */
+ public function getCmsPageTitleById($id)
+ {
+ $adapter = $this->_getReadAdapter();
+
+ $select = $adapter->select()
+ ->from($this->getMainTable(), 'title')
+ ->where('page_id = :page_id');
+
+ $binds = array(
+ 'page_id' => (int) $id
+ );
+
+ return $adapter->fetchOne($select, $binds);
+ }
+
+ /**
+ * Retrieves cms page identifier from DB by passed id.
+ *
+ * @param string $id
+ * @return string|false
+ */
+ public function getCmsPageIdentifierById($id)
+ {
+ $adapter = $this->_getReadAdapter();
+
+ $select = $adapter->select()
+ ->from($this->getMainTable(), 'identifier')
+ ->where('page_id = :page_id');
+
+ $binds = array(
+ 'page_id' => (int) $id
+ );
+
+ return $adapter->fetchOne($select, $binds);
+ }
+
+ /**
+ * Get store ids to which specified item is assigned
+ *
+ * @param int $id
+ * @return array
+ */
+ public function lookupStoreIds($pageId)
+ {
+ $adapter = $this->_getReadAdapter();
+
+ $select = $adapter->select()
+ ->from($this->getTable('cms/page_store'), 'store_id')
+ ->where('page_id = ?',(int)$pageId);
+
+ return $adapter->fetchCol($select);
+ }
+
+ /**
+ * Set store model
+ *
+ * @param Mage_Core_Model_Store $store
+ * @return Mage_Cms_Model_Resource_Page
+ */
+ public function setStore($store)
+ {
+ $this->_store = $store;
+ return $this;
+ }
+
+ /**
+ * Retrieve store model
+ *
+ * @return Mage_Core_Model_Store
+ */
+ public function getStore()
+ {
+ return Mage::app()->getStore($this->_store);
+ }
+}
diff --git a/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php b/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php
new file mode 100755
index 00000000..ff2ea2e4
--- /dev/null
+++ b/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php
@@ -0,0 +1,206 @@
+
+ */
+class Mage_Cms_Model_Resource_Page_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
+{
+ /**
+ * Load data for preview flag
+ *
+ * @var bool
+ */
+ protected $_previewFlag;
+
+
+ /**
+ * Define resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('cms/page');
+ $this->_map['fields']['page_id'] = 'main_table.page_id';
+ $this->_map['fields']['store'] = 'store_table.store_id';
+ }
+
+ /**
+ * deprecated after 1.4.0.1, use toOptionIdArray()
+ *
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ return $this->_toOptionArray('identifier', 'title');
+ }
+
+ /**
+ * Returns pairs identifier - title for unique identifiers
+ * and pairs identifier|page_id - title for non-unique after first
+ *
+ * @return array
+ */
+ public function toOptionIdArray()
+ {
+ $res = array();
+ $existingIdentifiers = array();
+ foreach ($this as $item) {
+ $identifier = $item->getData('identifier');
+
+ $data['value'] = $identifier;
+ $data['label'] = $item->getData('title');
+
+ if (in_array($identifier, $existingIdentifiers)) {
+ $data['value'] .= '|' . $item->getData('page_id');
+ } else {
+ $existingIdentifiers[] = $identifier;
+ }
+
+ $res[] = $data;
+ }
+
+ return $res;
+ }
+
+ /**
+ * Set first store flag
+ *
+ * @param bool $flag
+ * @return Mage_Cms_Model_Resource_Page_Collection
+ */
+ public function setFirstStoreFlag($flag = false)
+ {
+ $this->_previewFlag = $flag;
+ return $this;
+ }
+
+ /**
+ * Perform operations after collection load
+ *
+ * @return Mage_Cms_Model_Resource_Page_Collection
+ */
+ protected function _afterLoad()
+ {
+ if ($this->_previewFlag) {
+ $items = $this->getColumnValues('page_id');
+ $connection = $this->getConnection();
+ if (count($items)) {
+ $select = $connection->select()
+ ->from(array('cps'=>$this->getTable('cms/page_store')))
+ ->where('cps.page_id IN (?)', $items);
+
+ if ($result = $connection->fetchPairs($select)) {
+ foreach ($this as $item) {
+ if (!isset($result[$item->getData('page_id')])) {
+ continue;
+ }
+ if ($result[$item->getData('page_id')] == 0) {
+ $stores = Mage::app()->getStores(false, true);
+ $storeId = current($stores)->getId();
+ $storeCode = key($stores);
+ } else {
+ $storeId = $result[$item->getData('page_id')];
+ $storeCode = Mage::app()->getStore($storeId)->getCode();
+ }
+ $item->setData('_first_store_id', $storeId);
+ $item->setData('store_code', $storeCode);
+ }
+ }
+ }
+ }
+
+ return parent::_afterLoad();
+ }
+
+ /**
+ * Add filter by store
+ *
+ * @param int|Mage_Core_Model_Store $store
+ * @param bool $withAdmin
+ * @return Mage_Cms_Model_Resource_Page_Collection
+ */
+ public function addStoreFilter($store, $withAdmin = true)
+ {
+ if (!$this->getFlag('store_filter_added')) {
+ if ($store instanceof Mage_Core_Model_Store) {
+ $store = array($store->getId());
+ }
+
+ if (!is_array($store)) {
+ $store = array($store);
+ }
+
+ if ($withAdmin) {
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
+ }
+
+ $this->addFilter('store', array('in' => $store), 'public');
+ }
+ return $this;
+ }
+
+ /**
+ * Join store relation table if there is store filter
+ */
+ protected function _renderFiltersBefore()
+ {
+ if ($this->getFilter('store')) {
+ $this->getSelect()->join(
+ array('store_table' => $this->getTable('cms/page_store')),
+ 'main_table.page_id = store_table.page_id',
+ array()
+ )->group('main_table.page_id');
+
+ /*
+ * Allow analytic functions usage because of one field grouping
+ */
+ $this->_useAnalyticFunction = true;
+ }
+ return parent::_renderFiltersBefore();
+ }
+
+
+ /**
+ * Get SQL for get record count.
+ * Extra GROUP BY strip added.
+ *
+ * @return Varien_Db_Select
+ */
+ public function getSelectCountSql()
+ {
+ $countSelect = parent::getSelectCountSql();
+
+ $countSelect->reset(Zend_Db_Select::GROUP);
+
+ return $countSelect;
+ }
+}
diff --git a/app/code/core/Mage/Cms/Model/Resource/Page/Service.php b/app/code/core/Mage/Cms/Model/Resource/Page/Service.php
new file mode 100644
index 00000000..000488da
--- /dev/null
+++ b/app/code/core/Mage/Cms/Model/Resource/Page/Service.php
@@ -0,0 +1,97 @@
+
+ */
+class Mage_Cms_Model_Resource_Page_Service extends Mage_Core_Model_Resource_Db_Abstract
+{
+ /**
+ * Init cms page service model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('cms/page', 'page_id');
+ }
+
+ /**
+ * Unlinks from $fromStoreId store pages that have same identifiers as pages in $byStoreId
+ *
+ * Routine is intented to be used before linking pages of some store ($byStoreId) to other store ($fromStoreId)
+ * to prevent duplication of url keys
+ *
+ * Resolved $byLinkTable can be provided when restoring links from some backup table
+ *
+ * @param int $fromStoreId
+ * @param int $byStoreId
+ * @param string $byLinkTable
+ *
+ * @return Mage_Cms_Model_Mysql4_Page_Service
+ */
+ public function unlinkConflicts($fromStoreId, $byStoreId, $byLinkTable = null)
+ {
+ $readAdapter = $this->_getReadAdapter();
+
+ $linkTable = $this->getTable('cms/page_store');
+ $mainTable = $this->getMainTable();
+ $byLinkTable = $byLinkTable ? $byLinkTable : $linkTable;
+
+ // Select all page ids of $fromStoreId that have identifiers as some pages in $byStoreId
+ $select = $readAdapter->select()
+ ->from(array('from_link' => $linkTable), 'page_id')
+ ->join(
+ array('from_entity' => $mainTable),
+ $readAdapter->quoteInto(
+ 'from_entity.page_id = from_link.page_id AND from_link.store_id = ?',
+ $fromStoreId
+ ),
+ array()
+ )->join(
+ array('by_entity' => $mainTable),
+ 'from_entity.identifier = by_entity.identifier AND from_entity.page_id != by_entity.page_id',
+ array()
+ )->join(
+ array('by_link' => $byLinkTable),
+ $readAdapter->quoteInto('by_link.page_id = by_entity.page_id AND by_link.store_id = ?', $byStoreId),
+ array()
+ );
+ $pageIds = $readAdapter->fetchCol($select);
+
+ // Unlink found pages
+ if ($pageIds) {
+ $writeAdapter = $this->_getWriteAdapter();
+ $where = array(
+ 'page_id IN (?)' => $pageIds,
+ 'AND store_id = ?' => $fromStoreId
+ );
+ $writeAdapter->delete($linkTable, $where);
+ }
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Cms/Model/Template/Filter.php b/app/code/core/Mage/Cms/Model/Template/Filter.php
index d6611092..5afef175 100644
--- a/app/code/core/Mage/Cms/Model/Template/Filter.php
+++ b/app/code/core/Mage/Cms/Model/Template/Filter.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
index 6cfb33d2..2b703d04 100644
--- a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
+++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -39,6 +39,7 @@ class Mage_Cms_Model_Wysiwyg_Config extends Varien_Object
const WYSIWYG_ENABLED = 'enabled';
const WYSIWYG_HIDDEN = 'hidden';
const WYSIWYG_DISABLED = 'disabled';
+ const IMAGE_DIRECTORY = 'wysiwyg';
/**
* Return Wysiwyg config as Varien_Object
@@ -68,19 +69,27 @@ public function getConfig($data = array())
'add_widgets' => true,
'no_display' => false,
'translator' => Mage::helper('cms'),
- 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg_images/index'),
- 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
- 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
'encode_directives' => true,
'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg/directive'),
- 'popup_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
- 'content_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
+ 'popup_css' =>
+ Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
+ 'content_css' =>
+ Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
'width' => '100%',
'plugins' => array()
));
$config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
+ if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
+ $config->addData(array(
+ 'add_images' => true,
+ 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg_images/index'),
+ 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
+ 'files_browser_window_height'=> (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
+ ));
+ }
+
if (is_array($data)) {
$config->addData($data);
}
@@ -95,11 +104,11 @@ public function getConfig($data = array())
*
* @return string
*/
- public function getSkinImagePlaceholderUrl()
+ public function getSkinImagePlaceholderUrl()
{
return Mage::getDesign()->getSkinUrl('images/wysiwyg/skin_image.png');
}
-
+
/**
* Check whether Wysiwyg is enabled or not
*
@@ -107,7 +116,13 @@ public function getSkinImagePlaceholderUrl()
*/
public function isEnabled()
{
- return in_array(Mage::getStoreConfig('cms/wysiwyg/enabled'), array(self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN));
+ $storeId = $this->getStoreId();
+ if (!is_null($storeId)) {
+ $wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
+ } else {
+ $wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled');
+ }
+ return in_array($wysiwygState, array(self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN));
}
/**
diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
index 1c0a0490..a8f0c52c 100644
--- a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
+++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -59,6 +59,16 @@ class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
*/
public function getDirsCollection($path)
{
+ if (Mage::helper('core/file_storage_database')->checkDbUsage()) {
+ $subDirectories = Mage::getModel('core/file_storage_directory_database')->getSubdirectories($path);
+ foreach ($subDirectories as $directory) {
+ $fullPath = rtrim($path, DS) . DS . $directory['name'];
+ if (!file_exists($fullPath)) {
+ mkdir($fullPath, 0777, true);
+ }
+ }
+ }
+
$conditions = array('reg_exp' => array(), 'plain' => array());
foreach ($this->getConfig()->dirs->exclude->children() as $dir) {
@@ -97,6 +107,15 @@ public function getDirsCollection($path)
*/
public function getFilesCollection($path, $type = null)
{
+ if (Mage::helper('core/file_storage_database')->checkDbUsage()) {
+ $files = Mage::getModel('core/file_storage_database')->getDirectoryFiles($path);
+
+ $fileStorageModel = Mage::getModel('core/file_storage_file');
+ foreach ($files as $file) {
+ $fileStorageModel->saveFile($file);
+ }
+ }
+
$collection = $this->getCollection($path)
->setCollectDirs(false)
->setCollectFiles(true)
@@ -180,6 +199,11 @@ public function createDirectory($name, $path)
$io = new Varien_Io_File();
if ($io->mkdir($newPath)) {
+ if (Mage::helper('core/file_storage_database')->checkDbUsage()) {
+ $relativePath = Mage::helper('core/file_storage_database')->getMediaRelativePath($newPath);
+ Mage::getModel('core/file_storage_directory_database')->createRecursive($relativePath);
+ }
+
$result = array(
'name' => $name,
'short_name' => $this->getHelper()->getShortFilename($name),
@@ -209,6 +233,9 @@ public function deleteDirectory($path)
$io = new Varien_Io_File();
+ if (Mage::helper('core/file_storage_database')->checkDbUsage()) {
+ Mage::getModel('core/file_storage_directory_database')->deleteDirectory($path);
+ }
if (!$io->rmdir($path, true)) {
Mage::throwException(Mage::helper('cms')->__('Cannot delete directory %s.', $path));
}
@@ -228,9 +255,12 @@ public function deleteFile($target)
{
$io = new Varien_Io_File();
$io->rm($target);
+ Mage::helper('core/file_storage_database')->deleteFile($target);
+
$thumb = $this->getThumbnailPath($target, true);
if ($thumb) {
$io->rm($thumb);
+ Mage::helper('core/file_storage_database')->deleteFile($thumb);
}
return $this;
}
@@ -246,7 +276,7 @@ public function deleteFile($target)
*/
public function uploadFile($targetPath, $type = null)
{
- $uploader = new Varien_File_Uploader('image');
+ $uploader = new Mage_Core_Model_File_Uploader('image');
if ($allowed = $this->getAllowedExtensions($type)) {
$uploader->setAllowedExtensions($allowed);
}
diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php
index d8efa81c..52ac19a2 100644
--- a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php
+++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Cms/controllers/IndexController.php b/app/code/core/Mage/Cms/controllers/IndexController.php
index fbd2ef9c..b0eaa72c 100644
--- a/app/code/core/Mage/Cms/controllers/IndexController.php
+++ b/app/code/core/Mage/Cms/controllers/IndexController.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Cms/controllers/PageController.php b/app/code/core/Mage/Cms/controllers/PageController.php
index 4419a373..48d9b7da 100644
--- a/app/code/core/Mage/Cms/controllers/PageController.php
+++ b/app/code/core/Mage/Cms/controllers/PageController.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Cms/data/cms_setup/data-install-1.6.0.0.php b/app/code/core/Mage/Cms/data/cms_setup/data-install-1.6.0.0.php
new file mode 100644
index 00000000..92c25128
--- /dev/null
+++ b/app/code/core/Mage/Cms/data/cms_setup/data-install-1.6.0.0.php
@@ -0,0 +1,99 @@
+ 'Footer Links',
+ 'identifier' => 'footer_links',
+ 'content' => "",
+ 'is_active' => 1,
+ 'stores' => 0
+ )
+);
+
+$cmsPages = array(
+ array(
+ 'title' => '404 Not Found 1',
+ 'root_template' => 'two_columns_right',
+ 'meta_keywords' => 'Page keywords',
+ 'meta_description'
+ => 'Page description',
+ 'identifier' => 'no-route',
+ 'content' => "Whoops, our bad...
\r\n\r\n- The page you requested was not found, and we have a fine guess why.
\r\n- \r\n
\r\n- If you typed the URL directly, please make sure the spelling is correct.
\r\n- If you clicked on a link to get here, the link is outdated.
\r\n
\r\n
\r\n\r\n- What can you do?
\r\n- Have no fear, help is near! There are many ways you can get back on track with Magento Store.
\r\n- \r\n
\r\n- Go back to the previous page.
\r\n- Use the search bar at the top of the page to search for your products.
\r\n- Follow these links to get you back on track!
Store Home | My Account
\r\n",
+ 'is_active' => 1,
+ 'stores' => array(0),
+ 'sort_order' => 0
+ ),
+ array(
+ 'title' => 'Home page',
+ 'root_template' => 'two_columns_right',
+ 'identifier' => 'home',
+ 'content' => "Home Page
\r\n",
+ 'is_active' => 1,
+ 'stores' => array(0),
+ 'sort_order' => 0
+ ),
+ array(
+ 'title' => 'About Us',
+ 'root_template' => 'two_columns_right',
+ 'identifier' => 'about-magento-demo-store',
+ 'content' => "\r\n
About Magento Store
\r\n\r\n\r\n
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede.
\r\n
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta.
\r\n
\r\n
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit.
\r\n
Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n
Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus. Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi. Vestibulum sapien dolor, aliquet nec, porta ac, malesuada a, libero. Praesent feugiat purus eget est. Nulla facilisi. Vestibulum tincidunt sapien eu velit. Mauris purus. Maecenas eget mauris eu orci accumsan feugiat. Pellentesque eget velit. Nunc tincidunt.
\r\n
\r\n
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper
\r\n
Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus.
\r\n
Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi.
\r\n
\r\n
To all of you, from all of us at Magento Store - Thank you and Happy eCommerce!
\r\n
John Doe
Some important guy
\r\n
",
+ 'is_active' => 1,
+ 'stores' => array(0),
+ 'sort_order' => 0
+ ),
+ array(
+ 'title' => 'Customer Service',
+ 'root_template' => 'three_columns',
+ 'identifier' => 'customer-service',
+ 'content' => "\r\n
Customer Service
\r\n\r\n\r\n\r\n- Shipping & Delivery
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Privacy & Security
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Returns & Replacements
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Ordering
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Payment, Pricing & Promotions
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Viewing Orders
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n- Updating Account Information
\r\n- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
\r\n
",
+ 'is_active' => 1,
+ 'stores' => array(0),
+ 'sort_order' => 0
+ ),
+ array(
+ 'title' => 'Enable Cookies',
+ 'root_template' => 'one_column',
+ 'identifier' => 'enable-cookies',
+ 'content' => "\r\n
\r\n - \r\n
\r\n - Please enable cookies in your web browser to continue.
\r\n
\r\n \r\n
\r\n
\r\n
What are Cookies?
\r\n
\r\n
Cookies are short pieces of data that are sent to your computer when you visit a website. On later visits, this data is then returned to that website. Cookies allow us to recognize you automatically whenever you visit our site so that we can personalize your experience and provide you with better service. We also use cookies (and similar browser data, such as Flash cookies) for fraud prevention and other purposes. If your web browser is set to refuse cookies from our website, you will not be able to complete a purchase or take advantage of certain features of our website, such as storing items in your Shopping Cart or receiving personalized recommendations. As a result, we strongly encourage you to configure your web browser to accept cookies from our website.
\r\n
Enabling Cookies
\r\n
\r\n
Internet Explorer 7.x
\r\n
\r\n - \r\n
Start Internet Explorer
\r\n \r\n - \r\n
Under the Tools menu, click Internet Options
\r\n \r\n \r\n - \r\n
Click the Privacy tab
\r\n \r\n \r\n - \r\n
Click the Advanced button
\r\n \r\n \r\n - \r\n
Put a check mark in the box for Override Automatic Cookie Handling, put another check mark in the Always accept session cookies box
\r\n \r\n \r\n - \r\n
Click OK
\r\n \r\n \r\n - \r\n
Click OK
\r\n \r\n \r\n - \r\n
Restart Internet Explore
\r\n \r\n
\r\n
Back to Top
\r\n
Internet Explorer 6.x
\r\n
\r\n - \r\n
Select Internet Options from the Tools menu
\r\n \r\n \r\n - \r\n
Click on the Privacy tab
\r\n \r\n - \r\n
Click the Default button (or manually slide the bar down to Medium) under Settings. Click OK
\r\n \r\n \r\n
\r\n
Back to Top
\r\n
Mozilla/Firefox
\r\n
\r\n - \r\n
Click on the Tools-menu in Mozilla
\r\n \r\n - \r\n
Click on the Options... item in the menu - a new window open
\r\n \r\n - \r\n
Click on the Privacy selection in the left part of the window. (See image below)
\r\n \r\n \r\n - \r\n
Expand the Cookies section
\r\n \r\n - \r\n
Check the Enable cookies and Accept cookies normally checkboxes
\r\n \r\n - \r\n
Save changes by clicking Ok.
\r\n \r\n
\r\n
Back to Top
\r\n
Opera 7.x
\r\n
\r\n - \r\n
Click on the Tools menu in Opera
\r\n \r\n - \r\n
Click on the Preferences... item in the menu - a new window open
\r\n \r\n - \r\n
Click on the Privacy selection near the bottom left of the window. (See image below)
\r\n \r\n \r\n - \r\n
The Enable cookies checkbox must be checked, and Accept all cookies should be selected in the "Normal cookies" drop-down
\r\n \r\n - \r\n
Save changes by clicking Ok
\r\n \r\n
\r\n
Back to Top
\r\n
\r\n",
+ 'is_active' => 1,
+ 'stores' => array(0)
+ )
+);
+
+/**
+ * Insert default blocks
+ */
+foreach ($cmsBlocks as $data) {
+ Mage::getModel('cms/block')->setData($data)->save();
+}
+
+/**
+ * Insert default and system pages
+ */
+foreach ($cmsPages as $data) {
+ Mage::getModel('cms/page')->setData($data)->save();
+}
diff --git a/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
new file mode 100644
index 00000000..32588aeb
--- /dev/null
+++ b/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
@@ -0,0 +1,272 @@
+
+ Please replace this text with you Privacy Policy.
+ Please add any additional cookies your website uses below (e.g., Google Analytics)
+
+
+ This privacy policy sets out how {{config path="general/store_information/name"}} uses and protects any information
+ that you give {{config path="general/store_information/name"}} when you use this website.
+ {{config path="general/store_information/name"}} is committed to ensuring that your privacy is protected.
+ Should we ask you to provide certain information by which you can be identified when using this website,
+ then you can be assured that it will only be used in accordance with this privacy statement.
+ {{config path="general/store_information/name"}} may change this policy from time to time by updating this page.
+ You should check this page from time to time to ensure that you are happy with any changes.
+
+What we collect
+We may collect the following information:
+
+ - name
+ - contact information including email address
+ - demographic information such as postcode, preferences and interests
+ - other information relevant to customer surveys and/or offers
+
+
+ For the exhaustive list of cookies we collect see the List of cookies we collect section.
+
+What we do with the information we gather
+
+ We require this information to understand your needs and provide you with a better service,
+ and in particular for the following reasons:
+
+
+ - Internal record keeping.
+ - We may use the information to improve our products and services.
+ -
+ We may periodically send promotional emails about new products, special offers or other information which we
+ think you may find interesting using the email address which you have provided.
+
+ -
+ From time to time, we may also use your information to contact you for market research purposes.
+ We may contact you by email, phone, fax or mail. We may use the information to customise the website
+ according to your interests.
+
+
+Security
+
+ We are committed to ensuring that your information is secure. In order to prevent unauthorised access or disclosure,
+ we have put in place suitable physical, electronic and managerial procedures to safeguard and secure
+ the information we collect online.
+
+How we use cookies
+
+ A cookie is a small file which asks permission to be placed on your computer's hard drive.
+ Once you agree, the file is added and the cookie helps analyse web traffic or lets you know when you visit
+ a particular site. Cookies allow web applications to respond to you as an individual. The web application
+ can tailor its operations to your needs, likes and dislikes by gathering and remembering information about
+ your preferences.
+
+
+ We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page traffic
+ and improve our website in order to tailor it to customer needs. We only use this information for statistical
+ analysis purposes and then the data is removed from the system.
+
+
+ Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find useful
+ and which you do not. A cookie in no way gives us access to your computer or any information about you,
+ other than the data you choose to share with us. You can choose to accept or decline cookies.
+ Most web browsers automatically accept cookies, but you can usually modify your browser setting
+ to decline cookies if you prefer. This may prevent you from taking full advantage of the website.
+
+Links to other websites
+
+ Our website may contain links to other websites of interest. However, once you have used these links
+ to leave our site, you should note that we do not have any control over that other website.
+ Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst
+ visiting such sites and such sites are not governed by this privacy statement.
+ You should exercise caution and look at the privacy statement applicable to the website in question.
+
+Controlling your personal information
+You may choose to restrict the collection or use of your personal information in the following ways:
+
+ -
+ whenever you are asked to fill in a form on the website, look for the box that you can click to indicate
+ that you do not want the information to be used by anybody for direct marketing purposes
+
+ -
+ if you have previously agreed to us using your personal information for direct marketing purposes,
+ you may change your mind at any time by writing to or emailing us at
+ {{config path="trans_email/ident_general/email"}}
+
+
+
+ We will not sell, distribute or lease your personal information to third parties unless we have your permission
+ or are required by law to do so. We may use your personal information to send you promotional information
+ about third parties which we think you may find interesting if you tell us that you wish this to happen.
+
+
+ You may request details of personal information which we hold about you under the Data Protection Act 1998.
+ A small fee will be payable. If you would like a copy of the information held on you please write to
+ {{config path="general/store_information/address"}}.
+
+
+ If you believe that any information we are holding on you is incorrect or incomplete,
+ please write to or email us as soon as possible, at the above address.
+ We will promptly correct any information found to be incorrect.
+
+List of cookies we collect
+The table below lists the cookies we collect and what information they store.
+
+
+
+ COOKIE name |
+ COOKIE Description |
+
+
+
+
+ CART |
+ The association with your shopping cart. |
+
+
+ CATEGORY_INFO |
+ Stores the category info on the page, that allows to display pages more quickly. |
+
+
+ COMPARE |
+ The items that you have in the Compare Products list. |
+
+
+ CURRENCY |
+ Your preferred currency |
+
+
+ CUSTOMER |
+ An encrypted version of your customer id with the store. |
+
+
+ CUSTOMER_AUTH |
+ An indicator if you are currently logged into the store. |
+
+
+ CUSTOMER_INFO |
+ An encrypted version of the customer group you belong to. |
+
+
+ CUSTOMER_SEGMENT_IDS |
+ Stores the Customer Segment ID |
+
+
+ EXTERNAL_NO_CACHE |
+ A flag, which indicates whether caching is disabled or not. |
+
+
+ FRONTEND |
+ You sesssion ID on the server. |
+
+
+ GUEST-VIEW |
+ Allows guests to edit their orders. |
+
+
+ LAST_CATEGORY |
+ The last category you visited. |
+
+
+ LAST_PRODUCT |
+ The most recent product you have viewed. |
+
+
+ NEWMESSAGE |
+ Indicates whether a new message has been received. |
+
+
+ NO_CACHE |
+ Indicates whether it is allowed to use cache. |
+
+
+ PERSISTENT_SHOPPING_CART |
+ A link to information about your cart and viewing history if you have asked the site. |
+
+
+ POLL |
+ The ID of any polls you have recently voted in. |
+
+
+ POLLN |
+ Information on what polls you have voted on. |
+
+
+ RECENTLYCOMPARED |
+ The items that you have recently compared. |
+
+
+ STF |
+ Information on products you have emailed to friends. |
+
+
+ STORE |
+ The store view or language you have selected. |
+
+
+ USER_ALLOWED_SAVE_COOKIE |
+ Indicates whether a customer allowed to use cookies. |
+
+
+ VIEWED_PRODUCT_IDS |
+ The products that you have recently viewed. |
+
+
+ WISHLIST |
+ An encrypted list of products added to your Wishlist. |
+
+
+ WISHLIST_CNT |
+ The number of items in your Wishlist. |
+
+
+
+EOD;
+
+$privacyPageData = array(
+ 'title' => 'Privacy Policy',
+ 'content_heading' => 'Privacy Policy',
+ 'root_template' => 'one_column',
+ 'identifier' => 'privacy-policy-cookie-restriction-mode',
+ 'content' => $pageContent,
+ 'is_active' => 1,
+ 'stores' => array(0),
+ 'sort_order' => 0
+);
+
+Mage::getModel('cms/page')->setData($privacyPageData)->save();
+
+$footerLinksBlock = Mage::getModel('cms/block')->load('footer_links','identifier');
+
+if ($footerLinksBlock->getId()) {
+ $content = $footerLinksBlock->getContent();
+ if (preg_match('/(.*?)<\\/ul>/ims',$content, $matches)) {
+ $content = preg_replace('/- /ims', '
- ',$content);
+ $replacment = '
- '
+ . ""
+ . "Privacy Policy
\r\n
";
+ $content = preg_replace('/<\\/ul>/ims', $replacment, $content);
+ $footerLinksBlock->setContent($content)->save();
+ }
+}
diff --git a/app/code/core/Mage/Cms/etc/adminhtml.xml b/app/code/core/Mage/Cms/etc/adminhtml.xml
index 7d0d1f70..57673a7a 100644
--- a/app/code/core/Mage/Cms/etc/adminhtml.xml
+++ b/app/code/core/Mage/Cms/etc/adminhtml.xml
@@ -21,7 +21,7 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
@@ -70,6 +70,10 @@
+
+ Media Gallery
+ 20
+
diff --git a/app/code/core/Mage/Cms/etc/config.xml b/app/code/core/Mage/Cms/etc/config.xml
index d93c8400..f8264af1 100644
--- a/app/code/core/Mage/Cms/etc/config.xml
+++ b/app/code/core/Mage/Cms/etc/config.xml
@@ -21,25 +21,25 @@
*
* @category Mage
* @package Mage_Cms
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
- 0.7.13
+ 1.6.0.0.1
-
-
-
- Mage_Cms
- cms
-
-
+
+
+
+ Mage_Cms
+ cms
+
+
@@ -68,13 +68,13 @@
-
-
-
- cms.xml
-
-
-
+
+
+
+ cms.xml
+
+
+
@@ -97,15 +97,15 @@
- catalog
- downloadable
+
+
-
+
@@ -140,10 +140,11 @@
Mage_Cms_Model
- cms_mysql4
+ cms_resource
-
- Mage_Cms_Model_Mysql4
+
+ Mage_Cms_Model_Resource
+ cms_mysql4
@@ -158,7 +159,7 @@
-
+
@@ -168,7 +169,9 @@
- Mage_Cms_Block
+
+ Mage_Cms_Block
+
@@ -189,7 +192,6 @@