$includeImgs = 0;
        $dwcaManager->setIncludeImgs(0);
    }
    if (!array_key_exists('redact', $_POST)) {
        $redactLocalities = 0;
        $dwcaManager->setRedactLocalities(0);
    }
    $dwcaManager->setTargetPath($serverRoot . (substr($serverRoot, -1) == '/' ? '' : '/') . 'collections/datasets/dwc/');
}
$isEditor = 0;
if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collId, $userRights["CollAdmin"])) {
    $isEditor = 1;
}
$collArr = array();
if ($collId) {
    $dwcaManager->setCollArr($collId);
    $collArr = $dwcaManager->getCollArr();
}
if ($isEditor) {
    if (array_key_exists('colliddel', $_POST)) {
        $dwcaManager->deleteArchive($_POST['colliddel']);
    }
}
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $charset;
?>
">
	<title>Darwin Core Archiver Publisher</title>
示例#2
0
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: text/html; charset=" . $charset);
$collid = $_REQUEST["collid"];
$cntStr = '';
if ($collid && is_numeric($collid)) {
    $isEditor = false;
    if ($IS_ADMIN || array_key_exists("CollAdmin", $USER_RIGHTS) && in_array($collid, $USER_RIGHTS["CollAdmin"])) {
        $isEditor = true;
    }
    if ($isEditor) {
        $processingStatus = array_key_exists('ps', $_REQUEST) ? $_REQUEST['ps'] : '';
        $customField1 = array_key_exists('cf1', $_POST) ? $_POST['cf1'] : '';
        $customField2 = array_key_exists('cf2', $_POST) ? $_POST['cf2'] : '';
        $dwcaHandler = new DwcArchiverOccurrence();
        $dwcaHandler->setCollArr($collid);
        $dwcaHandler->setVerbose(0);
        $dwcaHandler->addCondition('decimallatitude', 'NULL');
        $dwcaHandler->addCondition('decimallongitude', 'NULL');
        $dwcaHandler->addCondition('catalognumber', 'NOTNULL');
        $dwcaHandler->addCondition('locality', 'NOTNULL');
        if ($processingStatus) {
            $dwcaHandler->addCondition('processingstatus', 'EQUALS', $processingStatus);
        }
        if ($customField1) {
            $dwcaHandler->addCondition($customField1, $_POST['ct1'], $_POST['cv1']);
        }
        if ($customField2) {
            $dwcaHandler->addCondition($customField2, $_POST['ct2'], $_POST['cv2']);
        }
        $cntStr = $dwcaHandler->getOccurrenceCnt();
 $dwcaHandler = new DwcArchiverOccurrence();
 $dwcaHandler->setCharSetOut($cSet);
 $dwcaHandler->setSchemaType($schema);
 $dwcaHandler->setExtended($extended);
 $dwcaHandler->setDelimiter($format);
 $dwcaHandler->setVerbose(0);
 $dwcaHandler->setRedactLocalities($redactLocalities);
 if ($rareReaderArr) {
     $dwcaHandler->setRareReaderArr($rareReaderArr);
 }
 if (array_key_exists("publicsearch", $_POST) && $_POST["publicsearch"]) {
     $occurManager = new OccurrenceManager();
     $dwcaHandler->setCustomWhereSql($occurManager->getSqlWhere());
 } else {
     //Request is coming from exporter.php for collection manager tools
     $dwcaHandler->setCollArr($_POST['targetcollid']);
     if (array_key_exists('processingstatus', $_POST) && $_POST['processingstatus']) {
         $dwcaHandler->addCondition('processingstatus', 'EQUALS', $_POST['processingstatus']);
     }
     if (array_key_exists('customfield1', $_POST) && $_POST['customfield1']) {
         $dwcaHandler->addCondition($_POST['customfield1'], $_POST['customtype1'], $_POST['customvalue1']);
     }
     if (array_key_exists('customfield2', $_POST) && $_POST['customfield2']) {
         $dwcaHandler->addCondition($_POST['customfield2'], $_POST['customtype2'], $_POST['customvalue2']);
     }
     if (array_key_exists('customfield3', $_POST) && $_POST['customfield3']) {
         $dwcaHandler->addCondition($_POST['customfield3'], $_POST['customtype3'], $_POST['customvalue3']);
     }
     if (array_key_exists('newrecs', $_POST) && $_POST['newrecs'] == 1) {
         $dwcaHandler->addCondition('dbpk', 'NULL');
         $dwcaHandler->addCondition('catalognumber', 'NOTNULL');
示例#4
0
    $searchStArr = json_decode($stArrSearchJson, true);
    $stArr = array_merge($searchStArr, $collStArr);
    $occurManager->setSearchTermsArr($stArr);
}
if ($schema == "backup") {
    $collid = $_POST["collid"];
    if ($collid && is_numeric($collid)) {
        //check permissions due to sensitive localities not being redacted
        if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collid, $userRights["CollAdmin"])) {
            $dwcaHandler->setSchemaType('backup');
            $dwcaHandler->setCharSetOut($cSet);
            $dwcaHandler->setVerbose(0);
            $dwcaHandler->setIncludeDets(1);
            $dwcaHandler->setIncludeImgs(1);
            $dwcaHandler->setRedactLocalities(0);
            $dwcaHandler->setCollArr($collid);
            $archiveFile = $dwcaHandler->createDwcArchive();
            if ($archiveFile) {
                //ob_start();
                header('Content-Description: Symbiota Occurrence Backup File (DwC-Archive data package)');
                header('Content-Type: application/zip');
                header('Content-Disposition: attachment; filename=' . basename($archiveFile));
                header('Content-Transfer-Encoding: binary');
                header('Expires: 0');
                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                header('Pragma: public');
                header('Content-Length: ' . filesize($archiveFile));
                //od_end_clean();
                readfile($archiveFile);
                unlink($archiveFile);
            } else {
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/DwcArchiverOccurrence.php';
$action = array_key_exists("action", $_REQUEST) ? $_REQUEST["action"] : '';
$collid = array_key_exists("collid", $_REQUEST) ? $_REQUEST["collid"] : 0;
$cond = array_key_exists("cond", $_REQUEST) ? $_REQUEST["cond"] : '';
$collType = array_key_exists("colltype", $_REQUEST) ? $_REQUEST["colltype"] : 'specimens';
$includeDets = array_key_exists("dets", $_REQUEST) ? $_REQUEST["dets"] : 1;
$includeImgs = array_key_exists("imgs", $_REQUEST) ? $_REQUEST["imgs"] : 1;
if ($collid) {
    $dwcaHandler = new DwcArchiverOccurrence();
    $dwcaHandler->setVerbose(0);
    $dwcaHandler->setCollArr($collid, $collType);
    if ($cond) {
        //String of cond-key/value pairs (e.g. country:USA,United States;stateprovince:Arizona,New Mexico;county-start:Pima,Eddy
        $cArr = explode(';', $cond);
        foreach ($cArr as $rawV) {
            $tok = explode(':', $rawV);
            if ($tok) {
                $field = $tok[0];
                $cond = 'EQUALS';
                $valueArr = array();
                if ($p = strpos($tok[0], '-')) {
                    $field = substr($tok[0], 0, $p);
                    $cond = strtoupper(substr($tok[0], $p + 1));
                }
                if (isset($tok[1]) && $tok[1]) {
                    $valueArr = explode(',', $tok[1]);
                }
                if ($valueArr) {