/** * Validate and Match Cms Page and modify request * * @param Zend_Controller_Request_Http $request * @return bool * * @SuppressWarnings(PHPMD.ExitExpression) */ public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true)); Mage::dispatchEvent('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition)); $identifier = $condition->getIdentifier(); if ($condition->getRedirectUrl()) { Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse(); $request->setDispatched(true); return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse()); } if (!$condition->getContinue()) { return null; } $page = Mage::getModel('Mage_Cms_Model_Page'); $pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId()); if (!$pageId) { return null; } $request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse()); }
/** * match the route * @param Zend_Controller_Request_Http $request * @return bool */ public function match(Zend_Controller_Request_Http $request) { //if magento is not installed redirect to install if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } //get the url key $urlKey = trim($request->getPathInfo(), '/'); //explode by slash $parts = explode('/', $urlKey); //if there are not 2 parts (tag/something) in the url we don't care about it. //return false and let the rest of the application take care of the url. if (count($parts) != 2) { return false; } //if the first part of the url key is not 'tag' we don't care about it //return false and let the rest of the application take care of the url if ($parts[0] != 'tag') { return false; } $tagName = urldecode($parts[1]); //tag name //load the tag model $tag = Mage::getModel('tag/tag')->loadByName($tagName); //if there is no tag with this name available in the current store just do nothing if (!$tag->getId() || !$tag->isAvailableInStore()) { return false; } //but if the tag is valid //say to magento that the request should be mapped to `tag/product/list/tagId/ID_HERE` - the original url $request->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $tag->getId()); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey); return true; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $baseHost = parse_url(Mage::getBaseUrl(), PHP_URL_HOST); $curHost = $_SERVER['HTTP_HOST']; if ($curHost != $baseHost) { // Get the florist id $floristId = explode('.', $curHost); $floristId = $floristId[0]; $vendor = Mage::helper('udropship')->getVendorBySubdomain($floristId); // Check if vendor exists with this subdomain if ($cat = Mage::helper('udropship')->getCategoryByVendor($vendor)) { // Register necessary values if (!Mage::registry('current_subdomain')) { Mage::register('current_subdomain', $floristId); } if (!Mage::registry('current_svendor')) { Mage::register('current_svendor', $vendor); } if (!Mage::registry('subdomain')) { Mage::register('subdomain', true); } if (!Mage::registry('current_subd_category')) { Mage::register('current_subd_category', $cat); } } else { header("Location: http://" . $baseHost); exit; } } return false; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } /* @var $core Mana_Core_Helper_Data */ $core = Mage::helper('mana_core'); if ($core->getRoutePath() != '//') { return false; } /* @var $routerHelper Mana_Core_Helper_Router */ $routerHelper = Mage::helper('mana_core/router'); $path = ltrim($request->getPathInfo(), '/'); $urlKey = Mage::getStoreConfig('mana/ajax/url_key_filter'); $routeSeparator = Mage::getStoreConfig('mana/ajax/route_separator_filter'); if ($core->startsWith($path, $urlKey . '/') && ($pos = strpos($path, '/' . $routeSeparator . '/')) > strlen($urlKey . '/')) { $this->_route = substr($path, strlen($urlKey . '/'), $pos - strlen($urlKey . '/')); $path = substr($path, $pos + strlen('/' . $routeSeparator)); $routerHelper->changePath($path)->processWithoutRendering($this, 'render'); $baseUrl = parse_url(Mage::getUrl(null, array('_nosid' => true))); Mage::register('m_original_request_uri', $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = $baseUrl['path'] . ($path ? ltrim($path, '/') : '/') . (($queryPos = strpos($_SERVER['REQUEST_URI'], '?')) !== false ? substr($_SERVER['REQUEST_URI'], $queryPos) : ''); Mage::register('manapro_filterajax_request', 1); $this->getCatalogSession()->setData('manapro_filterajax_request', 1); if ($core->isEnterpriseUrlRewriteInstalled()) { $this->_getRequestRewriteController()->rewrite(); } else { Mage::getModel('core/url_rewrite')->rewrite(); } } return false; }
/** * Render Zkilleman_Notify messages if enabled, else render standard * * @return string Html output */ public function getGroupedHtml() { if (!Mage::isInstalled() || !Mage::getStoreConfig(self::CONFIG_REPLACE_STANDARD) || Mage::app()->getStore()->isAdmin()) { return parent::getGroupedHtml(); } return $this->renderView(); }
/** * See if any product matches * * @param Zend_Controller_Request_Http $request * @return bool */ public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } // Clear session to make sure users can add products and the shopping cart clears properly if (isset($_GET['zipcode'])) { Mage::helper('urls')->clearSession($_GET['zipcode']); } // Get basic data $identifier = urldecode(strtolower(trim($request->getPathInfo(), '/'))); $vendorsCollection = Mage::helper('urls')->getVendors(); $vendorId = false; $productSlug = ''; // Get vendor id $vendorId = $this->_detectVendorId($identifier, $vendorsCollection); // Get product slug preg_match('/.*\\/(.*).html$/', $identifier, $matches); $productSlug = $matches[1]; if ($vendorId) { Mage::register('vendorId', $vendorId); $productId = Mage::helper('urls')->getProductIdBySlug($productSlug, $vendorId); if ('' == $productId || empty($productId)) { return false; } // Point to correct product $request->setModuleName('catalog')->setControllerName('product')->setActionName('view')->setParam('id', $productId); return true; } return false; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); /* @var $parser Hackathon_Layeredlanding_Model_Layeredlanding */ $landingPage = Mage::getModel('layeredlanding/layeredlanding')->loadByUrl($identifier); if (!$landingPage->getId()) { return false; } Mage::register('current_landingpage', $landingPage); Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Category::XML_PATH_USE_CATEGORY_CANONICAL_TAG, 0); // disable canonical tag // if successfully gained url parameters, use them and dispatch ActionController action $categoryIdsValue = $landingPage->getCategoryIds(); $categoryIds = explode(',', $categoryIdsValue); $firstCategoryId = $categoryIds[0]; $request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $firstCategoryId); /** @var $attribute Hackathon_Layeredlanding_Model_Attributes */ foreach ($landingPage->getAttributes() as $attribute) { $attr = Mage::getModel('eav/entity_attribute')->load($attribute->getAttributeId()); $request->setParam($attr->getAttributeCode(), $attribute->getValue()); } $controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category'); $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse()); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); // dispatch action $request->setDispatched(true); $controllerInstance->dispatch('view'); return true; }
/** * Validate and match entities and modify request * * @access public * @param Zend_Controller_Request_Http $request * @return bool * @author Ultimate Module Creator */ public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $urlKey = trim($request->getPathInfo(), '/'); $check = array(); $check['trainevent'] = new Varien_Object(array('prefix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_prefix'), 'suffix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_suffix'), 'list_key' => Mage::getStoreConfig('wage_trainevent/trainevent/url_rewrite_list'), 'list_action' => 'index', 'model' => 'wage_trainevent/trainevent', 'controller' => 'trainevent', 'action' => 'view', 'param' => 'id', 'check_path' => 0)); foreach ($check as $key => $settings) { if ($settings->getListKey()) { if ($urlKey == $settings->getListKey()) { $request->setModuleName('wage_trainevent')->setControllerName($settings->getController())->setActionName($settings->getListAction()); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey); return true; } } if ($settings['prefix']) { $parts = explode('/', $urlKey); if ($parts[0] != $settings['prefix'] || count($parts) != 2) { continue; } $urlKey = $parts[1]; } if ($settings['suffix']) { $urlKey = substr($urlKey, 0, -strlen($settings['suffix']) - 1); } $model = Mage::getModel($settings->getModel()); } return false; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); $parts = explode('/', $identifier); if (isset($parts[1]) && $parts[1] == 'reviews') { $product = Mage::getModel('catalog/product')->loadByAttribute('url_key', $parts[0]); if (isset($parts[2])) { $p = explode('-', $parts[2]); $id = (int) end($p); $request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('view')->setParam('id', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews'); return true; } else { if ($product) { $request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('list')->setParam('id', $product->getId())->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews'); return true; } } } elseif ($parts[0] == 'tag' && isset($parts[1])) { $p = explode('-', $parts[1]); $id = (int) end($p); $request->setRouteName('tag')->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'tags'); return true; } return false; }
public function isCurrentlySecure() { $standardRule = !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS']; $offloaderHeader = trim((string) Mage::getConfig()->getNode(self::XML_PATH_OFFLOADER_HEADER, 'default')); if (!empty($offloaderHeader) && !empty($_SERVER[$offloaderHeader]) || $standardRule) { return true; } if (Mage::isInstalled()) { $secureBaseUrl = ''; if (!$this->isAdmin()) { $secureBaseUrl = Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL); } else { $secureBaseUrl = (string) Mage::getConfig()->getNode(Mage_Core_Model_Url::XML_PATH_SECURE_URL, 'default'); } if (!$secureBaseUrl) { return false; } if (false !== strpos($secureBaseUrl, '{{base_url}}')) { $secureBaseUrl = Mage::getConfig()->substDistroServerVars('{{base_url}}'); } $uri = Zend_Uri::factory($secureBaseUrl); $port = $uri->getPort(); $isSecure = $uri->getScheme() == 'https' && isset($_SERVER['SERVER_PORT']) && $port == $_SERVER['SERVER_PORT']; return $isSecure; } else { $isSecure = isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT']; return $isSecure; } }
/** * Rewritten function of the standard controller. Tries to match the pathinfo on url parameters. * * @see Mage_Core_Controller_Varien_Router_Standard::match() * @param Zend_Controller_Request_Http $request The http request object that needs to be mapped on Action Controllers. */ public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = urldecode(trim($request->getPathInfo(), '/')); // try to gather url parameters from parser. $parser = Mage::getModel('seofilter/parser'); $parsedRequestInfo = $parser->parseFilterInformationFromRequest($identifier, Mage::app()->getStore()->getId()); if (!$parsedRequestInfo) { return false; } // if successfully gained url parameters, use them and dispatch ActionController action $request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $parsedRequestInfo['categoryId']); $pathInfo = 'catalog/category/view/id/' . $parsedRequestInfo['categoryId']; $requestUri = '/' . $pathInfo . '?'; foreach ($parsedRequestInfo['additionalParams'] as $paramKey => $paramValue) { //@dva fix if (is_array($paramValue)) { $paramValue = implode($paramValue, '_'); } $requestUri .= $paramKey . '=' . $paramValue . '&'; } $controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category'); $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse()); $request->setRequestUri(substr($requestUri, 0, -1)); $request->setPathInfo($pathInfo); // dispatch action $request->setDispatched(true); $controllerInstance->dispatch('view'); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); return true; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true)); Mage::dispatchEvent('magicproduct_controller_router_match_before', array('router' => $this, 'condition' => $condition)); $identifier = $condition->getIdentifier(); if ($condition->getRedirectUrl()) { Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse(); $request->setDispatched(true); return true; } if (!$condition->getContinue()) { return false; } if (!in_array($identifier, $this->router)) { return false; } $request->setModuleName('magicproduct')->setControllerName('index')->setActionName('product')->setParam('type', $identifier); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); return true; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $pathInfo = trim($request->getPathInfo(), '/'); $params = explode('/', $pathInfo); if (isset($params[0]) && $params[0] == 'miembro' || isset($params[0]) && $params[0] == 'member') { //redirect to mymodule/brands/index/brand_name/addidas $request->setModuleName('member')->setControllerName('index')->setActionName('index'); if (isset($params[1])) { $request->setParam('member_url', $params[1]); } $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo); return true; } if (isset($params[0]) && $params[0] == 'mwcon') { $request->setModuleName('member')->setControllerName('index')->setActionName('signin'); if (isset($params[1])) { $request->setParam('member_id', $params[1]); } $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo); return true; } return false; }
public function _construct() { // Check to make sure Magento is installed if (!Mage::isInstalled()) { echo "Application is not installed yet, please complete install wizard first."; exit; } // Initialize database connection $this->_db = Mage::getSingleton('core/resource')->getConnection($this->config['connectiontype']); // Process custom tables if ($this->getArg('custom')) { $cliCustomTables = array_map('trim', explode(',', $this->getArg('custom'))); $this->customTables = $cliCustomTables; } if ($this->getArg('customfile') && is_readable($this->getArg('customfile'))) { $fileCustomTables = array_map('trim', file($this->getArg('customfile'))); $this->customTables = array_merge($this->customTables, $fileCustomTables); } // Configuration $this->config['databaseconfig'] = Mage::getConfig()->getResourceConnectionConfig($this->config['connectiontype']); $this->config['tableprefix'] = (string) Mage::getConfig()->getTablePrefix(); if ($this->getArg('clean')) { $this->config['cleandata'] = true; } if ($this->getArg('exclude-config')) { $this->config['exclude-config'] = true; } }
/** * Validate and Match Manufacturer Page and modify request * * @param Zend_Controller_Request_Http $request * @return bool */ public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $router = 'manufacturers'; $identifier = trim(str_replace('/manufacturers/', '', $request->getPathInfo()), '/'); $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true)); Mage::dispatchEvent('manufacturer_controller_router_match_before', array('router' => $this, 'condition' => $condition)); $identifier = $condition->getIdentifier(); if ($condition->getRedirectUrl()) { Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse(); $request->setDispatched(true); return true; } if (!$condition->getContinue()) { return false; } $manufacturer = Mage::getModel('zeon_manufacturer/manufacturer'); $manufacturerId = $manufacturer->checkIdentifier($identifier, Mage::app()->getStore()->getId()); if (trim($identifier) && $manufacturerId) { $request->setModuleName('manufacturers')->setControllerName('index')->setActionName('view')->setParam('manufacturer_id', $manufacturerId); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $router . '/' . $identifier); return true; } return false; }
/** * Dispatch event before action * * @return void */ public function preDispatch() { $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true); if (!Mage::isInstalled()) { Mage::helper('Mage_Install_Helper_Data')->cleanVarFolder(); } return parent::preDispatch(); }
/** * checking if we installed or not and doing redirect * * @return bool */ protected function _afterModuleMatch() { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } return true; }
/** * Load config data from DB * * @return Mage_Core_Model_Config */ public function loadDb() { if ($this->_isLocalConfigLoaded && Mage::isInstalled() && empty($this->_scopeSnapshot)) { $this->saveScopeSnapshot(); } parent::loadDb(); return $this; }
public function getWelcomeMessage() { if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $welcome = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName())); } else { $welcome = Mage::getStoreConfig('design/header/welcome'); } return $welcome; }
/** * Init session * * @return \Magento\Downloader\Model\Session */ public function start() { if (class_exists('Magento') && \Mage::isInstalled()) { $this->_session = \Mage::getSingleton('Magento\\Backend\\Model\\Auth\\Session'); } else { session_start(); } return $this; }
public function preDispatch() { if (Mage::isInstalled()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); $this->_redirect('/'); return; } $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true); return parent::preDispatch(); }
/** * Init session * * @return Maged_Model_Session */ public function start() { if (class_exists('Mage') && Mage::isInstalled()) { // initialize Magento Config Mage::app(); $this->_session = Mage::getSingleton('admin/session'); } else { session_start(); } return $this; }
/** * Get block messsage * * @return string */ protected function _toHtml() { if (empty($this->_data['welcome'])) { if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName())); } else { $this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome'); } } return $this->_data['welcome']; }
/** * @return mixed */ public function getWelcome() { if (empty($this->_data['welcome'])) { if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName())); } else { $this->_data['welcome'] = "Hi there! Nice to see you here!"; //Mage::getStoreConfig('design/header/welcome'); } } return $this->_data['welcome']; }
/** * Retrieve store configuration data * * @param string $path * @param string $scope * @return string|null */ public function getConfig($path) { $origPath = $path; $path = $this->preparePath($path); if (isset($this->_configCache[$path])) { return $this->_configCache[$path]; } $config = Mage::getConfig(); /* Check Vendor wise/group wise/default */ $fullPath = 'stores/' . $this->getCode() . '/' . $path; $data = $config->getNode($fullPath); if (!$data && !Mage::isInstalled()) { $data = $config->getNode('default/' . $path); } /* Check Group Wise */ if (!$data) { $path = $this->preparePath($origPath, null, 2); $fullPath = 'stores/' . $this->getCode() . '/' . $path; $data = $config->getNode($fullPath); if (!$data && !Mage::isInstalled()) { $data = $config->getNode('default/' . $path); } /* if(preg_match('/ced_/i',$path)) { $id = 0; if(Mage::registry('current_order_vendor')) $id = Mage::registry('current_order_vendor'); Mage::log($id.'=='.$path."--val: ".print_r($data, true),null,'cscommission_path.log'); } */ /* $path = $origPath; */ } /* Check Default Value*/ if (!$data) { $fullPath = 'stores/' . $this->getCode() . '/' . $origPath; $data = $config->getNode($fullPath); if (!$data && !Mage::isInstalled()) { $data = $config->getNode('default/' . $origPath); } $path = $origPath; } if (!$data) { return null; } if (strpos($path, 'ced_') !== false && !Mage::app()->getStore()->isAdmin()) { $result = new Varien_Object(); Mage::dispatchEvent('ced_csgroup_config_data_change_after', array('result' => $result, 'path' => $path, 'groupdata' => $this->_processConfigValue($fullPath, $path, $data))); if ($result->getResult()) { return $result->getResult(); } } return $this->_processConfigValue($fullPath, $path, $data); }
public function getWelcome() { if (empty($this->_data['welcome'])) { if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName())); if ($this->helper('facebookfree')->isActive() && ($user_id = $this->helper('facebookfree')->getFbUserId())) { $this->_data['welcome'] .= ' <img src="https://graph.facebook.com/' . $user_id . '/picture" height="20"/>'; } } else { $this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome'); } } return $this->_data['welcome']; }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $pathInfo = $request->getPathInfo(); $result = Mage::helper('mstcore/urlrewrite')->match($pathInfo); if ($result) { $request->setRouteName($result->getRouteName())->setModuleName($result->getModuleName())->setControllerName($result->getControllerName())->setActionName($result->getActionName())->setParam('id', $result->getEntityId())->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $result->getRouteName()); return true; } return false; }
/** * Do not install module if Magento is not installed yet. * This prevents error during Mage_Cms data install. * * @see Mage_Core_Model_Resource_Setup::applyUpdates() */ public function applyUpdates() { if (!Mage::isInstalled()) { $modules = Mage::getConfig()->getNode('modules')->children(); $myModule = substr(__CLASS__, 0, strpos(__CLASS__, '_Model')); foreach ($modules as $moduleName => $moduleNode) { if ($moduleName != $myModule) { Mage::getConfig()->addAllowedModules($moduleName); } } Mage::getConfig()->reinit(); return $this; } return parent::applyUpdates(); }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); $page = Mage::getModel('cms/page'); $pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId()); if (!$pageId) { return false; } $request->setModuleName(isset($d[0]) ? $d[0] : 'cms')->setControllerName(isset($d[1]) ? $d[1] : 'page')->setActionName(isset($d[2]) ? $d[2] : 'view')->setParam('page_id', $pageId); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); return true; }
public function getWelcome() { $name = Mage::getSingleton('customer/session')->getCustomer()->getName(); $helper = Mage::helper('cminds_multiuseraccounts'); if ($subAccount = $helper->isSubAccountMode()) { $name = $subAccount->getName(); } if (empty($this->_data['welcome'])) { if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml($name)); } else { $this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome'); } } return $this->_data['welcome']; }