Jump to content

unknown override - what does it do, where does it belong?


Recommended Posts

I upgraded to 1.6.0.9 and looked into my override folder and noticed some files I can not remember where they may belong to....

 

overrides/classes:

 

1. Dispatcher.php

<?php
class Dispatcher extends  DispatcherCore
{
	protected function loadRoutes()
        {
		parent::loadRoutes();
		$orderby = (isset($_REQUEST['orderby']) && $_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'position' ;
		$orderway= (isset($_REQUEST['orderway']) && $_REQUEST['orderway']) ? $_REQUEST['orderway'] : 'asc' ;
		$results = Db::getInstance()->executeS('
                        SELECT s.id_searchterm, s.term,s.url,s.title,s.description 
                        FROM '._DB_PREFIX_.'searchterm s ');
		foreach($results as $result)
			foreach (Language::getLanguages() as $lang)
				$this->addRoute('search_'.$result['id_searchterm'],$result['url'],'search',$lang['id_lang'],array(), array('search_query' =>$result['term'], 'orderby' => $orderby, 'orderway' => $orderway));
	}
}

2. Meta.php

<?php
class Meta extends MetaCore
{
	public static function getMetaTags($id_lang, $page_name, $title = '')
        {
                global $maintenance;
                if (!(isset($maintenance) && (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))))
                {
                        if ($page_name == 'product' && ($id_product = Tools::getValue('id_product')))
                                return Meta::getProductMetas($id_product, $id_lang, $page_name);
                        elseif ($page_name == 'category' && ($id_category = Tools::getValue('id_category')))
                                return Meta::getCategoryMetas($id_category, $id_lang, $page_name, $title);
                        elseif ($page_name == 'manufacturer' && ($id_manufacturer = Tools::getValue('id_manufacturer')))
                                return Meta::getManufacturerMetas($id_manufacturer, $id_lang, $page_name);
                        elseif ($page_name == 'supplier' && ($id_supplier = Tools::getValue('id_supplier')))
                                return Meta::getSupplierMetas($id_supplier, $id_lang, $page_name);
                        elseif ($page_name == 'cms' && ($id_cms = Tools::getValue('id_cms')))
                                return Meta::getCmsMetas($id_cms, $id_lang, $page_name);
                        elseif ($page_name == 'cms' && ($id_cms_category = Tools::getValue('id_cms_category')))
                                return Meta::getCmsCategoryMetas($id_cms_category, $id_lang, $page_name);
                        elseif ($page_name == 'search')
                                return Meta::getSearchMetas($id_lang, $page_name);
                }

                return Meta::getHomeMetas($id_lang, $page_name);
        }
	public static function getSearchMetas($id_lang, $page_name){
		$sql = 'SELECT term as name, `title` as meta_title, `description` as meta_description, `keywords` as  `meta_keywords`
                        	FROM '._DB_PREFIX_.'searchterm s
                                WHERE term = \''.pSQL($_GET['search_query']).'\'';
                if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql))
                {
                        if (empty($row['meta_description']))
                                $row['meta_description'] = strip_tags($row['meta_description']);
                        if (!empty($row['meta_title']))
                                $row['meta_title'] = $row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
                        return Meta::completeMetaTags($row, $row['name']);
                }

                return Meta::getHomeMetas($id_lang, $page_name);
        }
}

overrides/controller/front

3. SearchController.php

<?php
class Dispatcher extends  DispatcherCore
{
	protected function loadRoutes()
        {
		parent::loadRoutes();
		$orderby = (isset($_REQUEST['orderby']) && $_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'position' ;
		$orderway= (isset($_REQUEST['orderway']) && $_REQUEST['orderway']) ? $_REQUEST['orderway'] : 'asc' ;
		$results = Db::getInstance()->executeS('
                        SELECT s.id_searchterm, s.term,s.url,s.title,s.description 
                        FROM '._DB_PREFIX_.'searchterm s ');
		foreach($results as $result)
			foreach (Language::getLanguages() as $lang)
				$this->addRoute('search_'.$result['id_searchterm'],$result['url'],'search',$lang['id_lang'],array(), array('search_query' =>$result['term'], 'orderby' => $orderby, 'orderway' => $orderway));
	}
}

Can somebody enlighten me, please?

Btw., is it safe to delete / rename (ext like .off) override php's`?

 

thanks alot

Edited by B.Köring (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...
×
×
  • Create New...