Example #1
0
<?php

include dirname(__FILE__) . "/resources/Validator.php";
$data = $_REQUEST['xml'];
$url = $_REQUEST['url'];
$type = htmlspecialchars($_REQUEST['type']);
$short = $_REQUEST['short'] == 'on';
$reqLang = htmlspecialchars($_COOKIE['GUEST_LANGUAGE_ID']);
if ($_REQUEST['validator'] == "jrc") {
    include "/../lite/resources/Kote.php";
    define("JRC_VALIDATOR", "http://inspire-geoportal.ec.europa.eu/GeoportalProxyWebServices/resources/INSPIREResourceTester");
    echo Kote::postFileForm(JRC_VALIDATOR, $xml);
    exit;
}
switch ($reqLang) {
    case "cs_CZ":
        $language = "cze";
        break;
    default:
        $language = "eng";
}
// --- main ---
$validator = new Validator($type, $language);
if (!$data) {
    if ($_FILES['dataFile']['tmp_name']) {
        $data = file_get_contents($_FILES['dataFile']['tmp_name']);
    }
}
if (!$data) {
    $purl = parse_url($url);
    if ($purl['scheme'] != 'http' && $purl['scheme'] != 'https') {
Example #2
0
<?php

// priklad nacteni formulare
require dirname(__FILE__) . "/../include/application/CswClient.php";
require dirname(__FILE__) . "/resources/Kote.php";
$cswClient = new CSWClient();
// zobrazeni XML
if ($_REQUEST['action']) {
    $input = Kote::processForm($_REQUEST);
    $params = array('datestamp' => date('Y-m-d'), 'lang' => 'cze');
    header("Content-type: application/xml");
    echo $cswClient->processTemplate($input, dirname(__FILE__) . '/resources/kote2iso.xsl', $params);
} else {
    $params = array('recno' => 1, 'select_profil' => 5);
    $s = file_get_contents("resources/priklad_inspire.xml");
    echo $cswClient->processTemplate($s, dirname(__FILE__) . '/resources/kote-micka.xsl', $params);
}
Example #3
0
function mainSave($post)
{
    $rs = array();
    $rs['akce'] = 'error';
    $rs['ok'] = FALSE;
    $rs['report'] = '';
    $rs['data'] = '';
    $recno = isset($post['recno']) ? htmlspecialchars($_POST['recno']) : -1;
    $uuid = $post['uuid'] != '' ? htmlspecialchars($post['uuid']) : '';
    $block = $post['block'] != '' ? htmlspecialchars($post['block']) : -2;
    $nextblock = $post['nextblock'] != '' ? htmlspecialchars($post['nextblock']) : -2;
    $profil = $post['profil'] != '' ? htmlspecialchars($post['profil']) : -2;
    $nexprofil = $post['nextprofil'] != '' ? htmlspecialchars($post['nextprofil']) : -2;
    $mds = $post['mds'] != '' ? htmlspecialchars($post['mds']) : -2;
    $data_type = isset($post['data_type']) ? htmlspecialchars($post['data_type']) : -1;
    $edit_group = isset($post['edit_group']) ? htmlspecialchars($post['edit_group']) : '';
    $view_group = isset($post['view_group']) ? htmlspecialchars($post['view_group']) : '';
    $ende = array_key_exists('ende', $post) ? htmlspecialchars($post['ende']) : 0;
    if ($recno == '' || $recno < 1 || $ende == 0 || count($post) < 6 || $mds < 0) {
        Debugger::log('[micka_main_lib.mainSave] ' . "Not complete input data! recno={$recno}, mds={$mds}, ende={$ende}, count=" . count($post), 'ERROR');
        require PHPINC_DIR . '/templates/404_record.php';
    }
    // odstranění ošetření dat způsobeného direktivou magic_quotes_gpc
    if (get_magic_quotes_gpc()) {
        $process = array(&$post);
        while (list($key, $val) = each($process)) {
            foreach ($val as $k => $v) {
                unset($process[$key][$k]);
                if (is_array($v)) {
                    $process[$key][$key < 5 ? $k : stripslashes($k)] = $v;
                    $process[] =& $process[$key][$key < 5 ? $k : stripslashes($k)];
                } else {
                    $process[$key][stripslashes($k)] = stripslashes($v);
                }
            }
        }
    }
    if (array_key_exists('fileIdentifier_0_TXT', $post)) {
        // Micka Lite
        require PHPPRG_DIR . '/CswClient.php';
        require WWW_DIR . '/lite/resources/Kote.php';
        require PHPPRG_DIR . '/micka_lib_php5.php';
        require PHPPRG_DIR . '/MdImport.php';
        $cswClient = new CSWClient();
        $input = Kote::processForm(beforeSaveRecord($post));
        $params = array('datestamp' => date('Y-m-d'), 'lang' => 'cze');
        $xmlstring = $cswClient->processTemplate($input, WWW_DIR . '/lite/resources/kote2iso.xsl', $params);
        $importer = new MetadataImport();
        $importer->setTableMode('tmp');
        $md = array();
        $md['file_type'] = 'WMS';
        $md['edit_group'] = MICKA_USER;
        $md['view_group'] = MICKA_USER;
        $md['mds'] = 0;
        $md['lang'] = 'cze';
        $lang_main = 'cze';
        $md['update_type'] = 'lite';
        $report = $importer->import($xmlstring, $md['file_type'], MICKA_USER, $md['edit_group'], $md['view_group'], $md['mds'] = 0, $md['lang'], $lang_main, $params = false, $md['update_type']);
        $md_record = new MdRecord();
        $md_record->setTableMode('tmp');
        $record = $md_record->getMd('recno', $recno);
        // Administrace záznamu
        if ($record['right'] == 'w') {
            $data = array();
            $data['data_type'] = $data_type;
            if ($edit_group != '') {
                $data['edit_group'] = $edit_group;
            }
            if ($view_group != '') {
                $data['view_group'] = $view_group;
            }
            $md_record->updateMdFromImport($recno, $data);
        }
    } else {
        // Micka
        $md_record = new MdRecord();
        $pom = $md_record->setTmpMdValues($post);
        if ($pom['ok'] === FALSE) {
            $rs['report'] = $pom['report'];
            return $rs;
        }
        $record = $md_record->getMd('recno', $recno);
    }
    if ($nextblock == -1) {
        // -1: Ukončit editaci
        $rs['data'] = $record['md'];
        $md_record->copyTmpRecordToMd();
        $md_record->deleteTmpRecords();
        $rs['akce'] = 'search';
        $rs['ok'] = TRUE;
    } elseif ($nextblock == -2) {
        // -2: Uložení do MD a pokračování v editaci
        $md_record->copyTmpRecordToMd();
    } elseif ($nextblock == -20 || $nextblock == -22) {
        // -20: průběžné uložení a xml
        // -22: průběžné uložení a nabídka uložení xml
        $rs['akce'] = $nextblock == -22 ? 'sxml' : 'xml';
        $rs['data'] = $record['md']['PXML'];
        return $rs;
    } elseif ($nextblock == -21) {
        // -21: průběžné uložení a validace
        $rs['akce'] = 'valid';
        $rs['data'] = $record['md']['UUID'];
        return $rs;
    } elseif ($nextblock == -19) {
        // -19: validace
        $rs['valid'] = TRUE;
    }
    if ($nextblock != -1) {
        // průběžné uložení, jiný profil
        if ($nexprofil > -1 && $nexprofil != '-19') {
            $profil = $nexprofil;
        }
        if ($nextblock > -1) {
            $block = $nextblock;
        }
        setEditId2Session('profil', $profil);
        setEditId2Session('package', $block);
        $rs['akce'] = 'edit';
        $rs['ok'] = TRUE;
        $rs['data']['recno'] = $recno;
        $rs['data']['uuid'] = '';
        $rs['data']['package'] = $block;
        $rs['data']['profil'] = $profil;
    }
    if ($rs['akce'] == 'edit') {
        $redirectUrl = getUrlEditFromSession();
    } else {
        unsetEditValue2Session();
        $redirectUrl = getUrlSearchFromSession();
    }
    //return $rs;
    return $redirectUrl;
}
Example #4
0
 static function processForm($data)
 {
     $out = "";
     while (list($key, $val) = each($data)) {
         $out .= '$' . 'md' . Kote::getMdPath(htmlspecialchars($key)) . "='" . htmlspecialchars(str_replace('\\', '\\\\', $val), ENT_QUOTES) . "';\n\t\t\t";
     }
     //die($out);
     eval($out);
     //var_dump($md);
     $md["keywords"] = isset($data["keywords"]) ? explode("\n", $data["keywords"]) : '';
     $md["gemet"] = isset($data["gemet"]) ? explode("\n", $data["gemet"]) : '';
     //$md["inspire"] = isset($data["inspire"]) ? explode("\n",$data["inspire"]) : '';
     $md["x"] = '';
     $xmlString = '<?xml version="1.0" encoding="utf-8" ?' . '><md>';
     $xmlString .= Kote::array2xml('', $md) . "</md>";
     //header('Content-Type: application/xml');
     //echo $xmlString;  exit;
     return $xmlString;
 }