Ejemplo n.º 1
0
 /**
  * Main Run method - runs the CSW server
  * 
  */
 function run($params, $processParams = true)
 {
     $this->startTime = microtime(true);
     if ($processParams) {
         $this->processParams($params);
     }
     if ($params['user'] || $this->params['TOKEN']) {
         prihlaseni(htmlspecialchars($params['user']), htmlspecialchars($params['pwd']), $this->params['TOKEN']);
         getProj();
         define("MICKA_USER", $params['user']);
     }
     $this->params['timestamp'] = gmdate("Y-m-d\\TH:i:s");
     if (MICKA_URL) {
         $this->params['thisURL'] = MICKA_URL . "/csw/index.php";
     } else {
         $this->params['thisURL'] = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['SCRIPT_NAME'];
     }
     $this->params['thisPath'] = dirname($this->params['thisURL']);
     if (!$this->params['CB']) {
         $this->params['CB'] = "" . $_SESSION["micka"]["cb"];
     }
     //
     if (!$this->params['LANGUAGE']) {
         $this->params['LANGUAGE'] = MICKA_LANG;
     }
     if ($this->params['DEBUG']) {
         if ($this->params['DEBUG'] == 1) {
             var_dump($this->params);
             echo "<hr>";
         }
     } else {
         if ($this->params['SOAP']) {
             $this->header = HTTP_SOAP;
         }
     }
     $remoteIP = $this->getIP();
     $this->logText = date("Y-m-d\\TH:i:s") . "|" . $_SESSION['u'] . "|" . $_SERVER['REQUEST_METHOD'] . "|" . $remoteIP . "| |";
     //reset($this->params);
     //if($this->params['ID']) $this->logText .= "[ID=".$this->params['ID']."]";
     //else if($this->params['QSTR']) $this->logText .= @json_encode($this->params['QSTR']); //TODO zmenit
     $request = $this->getParamL('REQUEST');
     /*if($request=="rss") { 
       	return $this->rss(); 
       }*/
     if (!$this->params['SERVICE']) {
         $this->exception(2, "SERVICE", "Missing 'SERVICE' parameter");
     }
     if ($this->getParamL('SERVICE') != 'csw') {
         $this->exception(3, "service", "Service MUST be CSW");
     }
     if (!$request) {
         $this->exception(2, "REQUEST", "Missing 'REQUEST' parameter");
     }
     if ($request != 'getcapabilities') {
         if (!$this->params['VERSION']) {
             $this->exception(2, "VERSION", "Missing 'VERSION' parameter");
         }
         if ($this->params['VERSION'] != "2.0.2") {
             $this->exception(3, "VERSION", "Only 2.0.2 version currently supported");
         }
     }
     // trideni podle request
     switch ($request) {
         case 'getcapabilities':
             $result = $this->getCapabilities();
             break;
         case 'describerecord':
             $result = $this->describeRecord();
             break;
         case 'getrecords':
             $result = $this->getRecords();
             break;
         case 'getrecordbyid':
             $result = $this->getRecordById();
             break;
         case 'transaction':
             $result = $this->transaction();
             break;
         case 'harvest':
             prihlaseni(null, null);
             getProj();
             if (canAction('w')) {
                 $result = $this->harvest(true);
             }
             break;
         case 'getharvest':
             $result = $this->harvest(false);
             break;
         default:
             $this->exception(3, "request", $this->params['REQUEST'] . " is not supported request value.");
             break;
     }
     if ($this->params['SOAP']) {
         $result = SOAP_HEADER . $result . SOAP_FOOTER;
     }
     if ($this->isXML) {
         $result = XML_HEADER . $result;
     }
     $this->logText .= "|500|" . (microtime(true) - $this->startTime);
     $this->saveLog();
     return $result;
 }
Ejemplo n.º 2
0
        }
        require PHPPRG_DIR . '/redirect.php';
    }
    getProj();
    require PHPPRG_DIR . '/redirect.php';
} else {
    if (isset($_SESSION["u"]) === FALSE || empty($_SESSION['ms_groups'])) {
        // guest
        if (!prihlaseni('guest', '')) {
            if (isset($hlaska) && $hlaska != '') {
                Debugger::log('[micka_auth.php] ' . "hlaska: {$hlaska}", 'INFO');
            }
            Debugger::log('[micka_auth.php] ' . 'Not available for guest.', 'INFO');
            require PHPINC_DIR . '/templates/403.php';
        }
        getProj();
        //require PHPPRG_DIR . '/redirect.php';
    }
}
if (!canMap(MICKA_PROJECT)) {
    // kontrola, zda uzivatel smi k projektu
    Debugger::log('[micka_auth.php] ' . 'Not right to project ' . MICKA_PROJECT, 'INFO');
    require PHPINC_DIR . '/templates/403.php';
}
if ($_SESSION["u"] == '') {
    Debugger::log('[micka_auth.php] ' . 'LOGIN error, Not right to Micka.', 'INFO');
    require PHPINC_DIR . '/templates/403.php';
} else {
    define('MICKA_USER', $_SESSION['u']);
    define('MICKA_USER_GROUPS', $_SESSION['ms_groups']);
    define('MICKA_USER_RIGHT', $_SESSION['maplist'][MICKA_PROJECT]['users'][MICKA_USER]);