<?php
if (!class_exists('crm_hardlock')) require_once("common_cadline_libraries/crm_hardlock.class.php");

$function_id = $_GET['fnid'];
$returnedUrl = '';

switch ($function_id) {
    case '0': // Crash riport
        $returnedUrl = 'https://www.archlinexp.com/crash/';
        break;

    case '1': // Email sending
        if ($_GET['cnt'] == 39) $returnedUrl = 'https://www.cadlinesw.com/manager/archline_support/emailsending.php';
        else $returnedUrl = 'https://www.archlinexp.com/maintenance/emailsending.php';
        break;

    case '2': // Update-nel lekeri a sorozatszamot
        $urlQuery   = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        $params     = substr($urlQuery, strpos($urlQuery, 'data=') + 5);

        $returnedUrl = 'https://www.archlinexp.com/maintenance/al.php?action=selectprogram&' . $params;
        break;

    case '3': // Email kuldese
        $urlQuery   = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        $params     = substr($urlQuery, strpos($urlQuery, 'data=') + 5);

        $returnedUrl = 'https://www.archlinexp.com/maintenance/al.php?action=email&' . $params;
        break;

    case '4': // NonProfit program ellenorzese
        $urlQuery   = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        $params     = substr($urlQuery, strpos($urlQuery, 'data=') + 5);

        $returnedUrl = 'https://www.archlinexp.com/maintenance/al.php?action=checknonprofitexists&' . $params;
        break;

    case '5': // Telemetria felkuldese
        $urlQuery   = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        $params     = substr($urlQuery, strpos($urlQuery, 'fnid=') + 6);

        $returnedUrl = 'https://www.archlinexp.com/maintenance/tm.php?' . $params;
        break;

    case '6': // Dealer dialog
        $urlQuery   = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        $params     = substr($urlQuery, strpos($urlQuery, 'data=') + 7);

        $returnedUrl = 'https://www.archlinexp.com/maintenance/webform/select_dealer.php?' . $params;
        break;

    default:
        break;
}

echo $returnedUrl;
