HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/app/controllers/legacyRouteController.php
<?php

/**
 * This controller will handle the routes from the old website.
 *
 * @author      Tim Van Samang <timvansamang@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */
class LegacyRouteController extends \BaseController
{

    public function redirectUrl($lang_iso)
    {
        $objectPath = \Input::get('ObjectPath');

        $parts = explode('/', $objectPath);
        if (!isset($parts[3])) {
            return \Redirect::to('/', 301);
        }
        switch ($parts[3]) {
            case 'Products':
                return $this->productRoute($parts[4], $lang_iso);
                break;
        }

    }

    /**
     * This will handle the old product routes
     * @param $t_number , internal_article_number
     * @param $lang_iso , iso2 of the language
     * @return redirect
     */
    public function productRoute($t_number, $lang_iso)
    {
        $productService = \App::make('KommaApp\Shop\Products\ProductService');
        if (!$route = $productService->getProductRouteByInternalArticleNumber($t_number, $lang_iso)) {
            return \App::make('BaseController')->abort($lang_iso);
        }
        if ($lang_iso == 'de') {
            $url = '';
            $url .= (\Config::get('komma.tops.https') ? 'https://.' : 'http://');
            $url .= (\Config::get('komma.tops.www') ? 'www.' : '');
            $url .= 'topskwlfilter.de' . '/';
            $url .= $route->route;
            return $url;

        }
        $url = '';
        $url .= (\Config::get('komma.tops.https') ? 'https://.' : 'http://');
        $url .= (\Config::get('komma.tops.www') ? 'www.' : '');
        $url .= \Request::server('HTTP_HOST') . '/';
        $url .= $route->route;
        return $url;
    }

}