<?php

// ----------------------------------------------
// vlozit XML-RPC tridy
require_once $cfg['Path']['admin_to_root'].$cfg['Path']['shared_class'].'xmlrpc/xmlrpc.inc.php';
require_once $cfg['Path']['admin_to_root'].$cfg['Path']['shared_class'].'xmlrpc/xmlrpcs.inc.php';
// ----------------------------------------------

$script = '';
if (isset($_GET['s'])) {
    $script = $_GET['s'];

    // odstraneni relativnich adres
    $script = preg_replace('@^(\\.{0,2}/)+@', '', $script);
    $script = preg_replace('@\\.{1,2}/@', '', $script);

    // odstraneni HTTP ze zacatku
    $script = preg_replace('@^(http|ftp|https|mms)\\://@', '', $script);

    // pridani koncovky .php
    $script .= '.php';
}

if ($script == '') {
    $script = 'Pohoda.php';
}

if (file_exists($script)) {
    require_once $script;
} else {
    $script = $cfg['Path']['admin_to_root'].$cfg['Path']['shared_version'].'socket/'.$script;
    if (file_exists($script)) {
        require_once $script;
    } else {
        // zalogovat chybu
        logError(__FILE__, __LINE__, 'SOCKET/LAUNCH.PHP INCLUDE ERROR s='.$_GET['s']);

        $script = $cfg['Path']['admin_to_root'].$cfg['Path']['shared_version'].'socket/Pohoda.php';
        require_once $script;
    }
}

// ##############################################################
