Skip to content

Commit

Permalink
Merge pull request egbot#90 from BioKIC/master
Browse files Browse the repository at this point in the history
Merge BioKIC/Symbiota light devolepments
  • Loading branch information
egbot authored Nov 18, 2022
2 parents b946a70 + ffc5159 commit 05c733b
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 70 deletions.
65 changes: 50 additions & 15 deletions classes/DwcArchiverCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public function getAsTurtle(){
break;
case "rights":
// RDF Guide Section 3.3 dcterms:licence for IRI, xmpRights:UsageTerms for literal
if (stripos("http://creativecommons.org/licenses/", $value) == 0) {
if (stripos('creativecommons.org/licenses/', $value)) {
$returnvalue .= "$separator dcterms:license <$value>";
} else {
$returnvalue .= "$separator dc:$key \"$value\"";
Expand Down Expand Up @@ -614,7 +614,7 @@ public function getAsRdfXml(){
break;
case "rights":
// RDF Guide Section 3.3 dcterms:licence for IRI, xmpRights:UsageTerms for literal
if (stripos("http://creativecommons.org/licenses/", $value) == 0) {
if (stripos('creativecommons.org/licenses/', $value)) {
$elem = $newDoc->createElement("dcterms:license");
$elem->setAttribute("rdf:resource", "$value");
} else {
Expand Down Expand Up @@ -1213,7 +1213,33 @@ private function writeEmlFile(){
* USED BY: this class, and emlhandler.php
*/
public function getEmlDom($emlArr = null){
global $RIGHTS_TERMS_DEFS;
$RIGHTS_TERMS_DEFS = array(
'https://creativecommons.org/publicdomain/zero/1.0/' => array(
'title' => 'CC0 1.0 (Public-domain)',
'url' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
'def' => 'Users can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.'
),
'https://creativecommons.org/licenses/by/4.0/' => array(
'title' => 'CC BY (Attribution)',
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'https://creativecommons.org/licenses/by-nc/4.0/' => array(
'title' => 'CC BY-NC (Attribution-Non-Commercial)',
'url' => 'https://creativecommons.org/licenses/by-nc/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'https://creativecommons.org/licenses/by/4.0/' => array(
'title' => 'CC BY (Attribution)',
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'https://creativecommons.org/licenses/by-nc/4.0/' => array(
'title' => 'CC BY-NC (Attribution-Non-Commercial)',
'url' => 'https://creativecommons.org/licenses/by-nc/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material. The licensor cannot revoke these freedoms as long as you follow the license terms.'
)
);

if (!$emlArr) $emlArr = $this->getEmlArr();

Expand Down Expand Up @@ -1851,7 +1877,8 @@ private function writeImageFile(){
$localDomain = '';
if (isset($GLOBALS['IMAGE_DOMAIN']) && $GLOBALS['IMAGE_DOMAIN']) {
$localDomain = $GLOBALS['IMAGE_DOMAIN'];
} else {
}
else {
$localDomain = $this->serverDomain;
}
$previousImgID = 0;
Expand All @@ -1867,19 +1894,23 @@ private function writeImageFile(){
if ($r['goodQualityAccessURI'] == 'empty' || substr($r['goodQualityAccessURI'], 0, 10) == 'processing') $r['goodQualityAccessURI'] = '';
if (substr($r['thumbnailAccessURI'], 0, 10) == 'processing') $r['thumbnailAccessURI'] = '';
if ($this->schemaType != 'backup') {
if (stripos($r['rights'], 'http://creativecommons.org') === 0) {
if (stripos($r['rights'], 'creativecommons.org') === 0) {
$r['webstatement'] = $r['rights'];
$r['rights'] = '';
if (!$r['usageterms']) {
if ($r['webstatement'] == 'http://creativecommons.org/publicdomain/zero/1.0/') {
if (strpos($r['webstatement'], '/zero/1.0/')) {
$r['usageterms'] = 'CC0 1.0 (Public-domain)';
} elseif ($r['webstatement'] == 'http://creativecommons.org/licenses/by/3.0/') {
}
elseif (strpos($r['webstatement'], '/by/')) {
$r['usageterms'] = 'CC BY (Attribution)';
} elseif ($r['webstatement'] == 'http://creativecommons.org/licenses/by-sa/3.0/') {
}
elseif (strpos($r['webstatement'], '/by-sa/')) {
$r['usageterms'] = 'CC BY-SA (Attribution-ShareAlike)';
} elseif ($r['webstatement'] == 'http://creativecommons.org/licenses/by-nc/3.0/') {
$r['usageterms'] = 'CC BY-NC (Attribution-Non-Commercial)';
} elseif ($r['webstatement'] == 'http://creativecommons.org/licenses/by-nc-sa/3.0/') {
}
elseif (strpos($r['webstatement'], '/by-nc/')) {
$r['usageterms'] = 'CC BY-NC (Attribution-NonCommercial-ShareAlike)';
}
elseif (strpos($r['webstatement'], '/by-nc-sa/')) {
$r['usageterms'] = 'CC BY-NC-SA (Attribution-NonCommercial-ShareAlike)';
}
}
Expand All @@ -1894,13 +1925,17 @@ private function writeImageFile(){
if ($r['format'] == '') {
if ($extStr == 'jpg' || $extStr == 'jpeg') {
$r['format'] = 'image/jpeg';
} elseif ($extStr == 'gif') {
}
elseif ($extStr == 'gif') {
$r['format'] = 'image/gif';
} elseif ($extStr == 'png') {
}
elseif ($extStr == 'png') {
$r['format'] = 'image/png';
} elseif ($extStr == 'tiff' || $extStr == 'tif') {
}
elseif ($extStr == 'tiff' || $extStr == 'tif') {
$r['format'] = 'image/tiff';
} else {
}
else {
$r['format'] = '';
}
}
Expand Down
4 changes: 2 additions & 2 deletions classes/DwcArchiverImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public static function getImageArr($schemaType){
$fieldArr['Owner'] = 'IFNULL(c.rightsholder,CONCAT(c.collectionname," (",CONCAT_WS("-",c.institutioncode,c.collectioncode),")")) AS owner';
$termArr['creator'] = 'http://purl.org/dc/elements/1.1/creator';
$fieldArr['creator'] = 'IF(i.photographeruid IS NOT NULL,CONCAT_WS(" ",u.firstname,u.lastname),i.photographer) AS creator';
$termArr['UsageTerms'] = 'http://ns.adobe.com/xap/1.0/rights/UsageTerms'; //Creative Commons BY-SA 3.0 license
$termArr['UsageTerms'] = 'http://ns.adobe.com/xap/1.0/rights/UsageTerms'; //Creative Commons BY-SA 4.0 license
$fieldArr['UsageTerms'] = 'i.copyright AS usageterms';
$termArr['WebStatement'] = 'http://ns.adobe.com/xap/1.0/rights/WebStatement'; //http://creativecommons.org/licenses/by-nc-sa/3.0/us/
$termArr['WebStatement'] = 'http://ns.adobe.com/xap/1.0/rights/WebStatement'; //https://creativecommons.org/licenses/by-nc-sa/4.0/us/
$fieldArr['WebStatement'] = 'c.accessrights AS webstatement';
$termArr['caption'] = 'http://rs.tdwg.org/ac/terms/caption';
$fieldArr['caption'] = 'i.caption';
Expand Down
39 changes: 23 additions & 16 deletions classes/ImInventories.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ public function insertChecklist($fieldArr){
$clid = false;
if($fieldArr['name']){
$clName = $fieldArr['name'];
$authors = (isset($fieldArr['authors'])?$fieldArr['authors']:NULL);
$type = (isset($fieldArr['type'])?$fieldArr['type']:'static');
$locality = (isset($fieldArr['locality'])?$fieldArr['locality']:NULL);
$publication = (isset($fieldArr['publication'])?$fieldArr['publication']:NULL);
$abstract = (isset($fieldArr['abstract'])?strip_tags($fieldArr['abstract'], '<i><u><b><a>'):NULL);
$notes = (isset($fieldArr['notes'])?$fieldArr['notes']:NULL);
$latCentroid = (isset($fieldArr['latcentroid'])?$fieldArr['latcentroid']:NULL);
$longCentroid = (isset($fieldArr['longcentroid'])?$fieldArr['longcentroid']:NULL);
$pointRadiusMeters = (isset($fieldArr['pointradiusmeters'])?$fieldArr['pointradiusmeters']:NULL);
$access = (isset($fieldArr['access'])?$fieldArr['access']:'private');
$defaultSettings = (isset($fieldArr['defaultsettings'])?$fieldArr['defaultsettings']:NULL);
$dynamicSql = (isset($fieldArr['dynamicsql'])?$fieldArr['dynamicsql']:NULL);
$uid = (isset($fieldArr['uid'])?$fieldArr['uid']:NULL);
$footprintWkt = (isset($fieldArr['type'])?$fieldArr['type']:NULL);
$sortSequence = (isset($fieldArr['sortsequence'])?$fieldArr['sortsequence']:50);
$authors = (!empty($fieldArr['authors']) ? $fieldArr['authors'] : NULL);
$type = (!empty($fieldArr['type']) ? $fieldArr['type'] : 'static');
$locality = (!empty($fieldArr['locality']) ? $fieldArr['locality'] : NULL);
$publication = (!empty($fieldArr['publication']) ? $fieldArr['publication'] : NULL);
$abstract = (!empty($fieldArr['abstract']) ? strip_tags($fieldArr['abstract'], '<i><u><b><a>') : NULL);
$notes = (!empty($fieldArr['notes']) ? $fieldArr['notes'] : NULL);
$latCentroid = (is_numeric($fieldArr['latcentroid']) ? $fieldArr['latcentroid'] : NULL);
$longCentroid = (is_numeric($fieldArr['longcentroid']) ? $fieldArr['longcentroid'] : NULL);
$pointRadiusMeters = (is_numeric($fieldArr['pointradiusmeters']) ? $fieldArr['pointradiusmeters'] : NULL);
$access = (!empty($fieldArr['access']) ? $fieldArr['access'] : 'private');
$defaultSettings = (!empty($fieldArr['defaultsettings']) ? $fieldArr['defaultsettings'] : NULL);
$dynamicSql = (!empty($fieldArr['dynamicsql']) ? $fieldArr['dynamicsql'] : NULL);
$uid = (is_numeric($fieldArr['uid']) && $fieldArr['uid'] ? $fieldArr['uid'] : NULL);
$footprintWkt = (!empty($fieldArr['footprintwkt']) ? $fieldArr['footprintwkt'] : NULL);
$sortSequence = (is_numeric($fieldArr['sortsequence']) ? $fieldArr['sortsequence'] : 50);
$sql = 'INSERT INTO fmchecklists(name, authors, type, locality, publication, abstract, notes, latcentroid, longcentroid, pointradiusmeters, access, defaultsettings, dynamicsql, uid, footprintWkt, sortsequence) '.
'VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ';
if($stmt = $this->conn->prepare($sql)){
Expand All @@ -112,7 +112,14 @@ public function updateChecklist($inputArr){
$paramArr = array();
foreach($inputArr as $fieldName => $fieldValue){
$fieldName = strtolower($fieldName);
if(array_key_exists($fieldName, $fieldArr) && $fieldValue !== ''){
if(array_key_exists($fieldName, $fieldArr)){
if($fieldArr[$fieldName] == 'i' || $fieldArr[$fieldName] == 'd'){
if(!is_numeric($fieldValue)) $fieldValue = NULL;
if($fieldName == 'sortsequence' && !$fieldValue) $fieldValue = 50;
}
else{
if(!$fieldValue) $fieldValue = NULL;
}
$sqlFrag .= $fieldName.' = ?, ';
$paramArr[] = $fieldValue;
$typeStr .= $fieldArr[$fieldName];
Expand Down
28 changes: 0 additions & 28 deletions config/symbbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,4 @@

//Sanitization
if($LANG_TAG != 'en' && !in_array($LANG_TAG, $AVAILABLE_LANGS)) $LANG_TAG = 'en';

$RIGHTS_TERMS_DEFS = array(
'http://creativecommons.org/publicdomain/zero/1.0/' => array(
'title' => 'CC0 1.0 (Public-domain)',
'url' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
'def' => 'Users can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.'
),
'http://creativecommons.org/licenses/by/3.0/' => array(
'title' => 'CC BY (Attribution)',
'url' => 'http://creativecommons.org/licenses/by/3.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'http://creativecommons.org/licenses/by-nc/3.0/' => array(
'title' => 'CC BY-NC (Attribution-Non-Commercial)',
'url' => 'http://creativecommons.org/licenses/by-nc/3.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'http://creativecommons.org/licenses/by/4.0/' => array(
'title' => 'CC BY (Attribution)',
'url' => 'http://creativecommons.org/licenses/by/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms.'
),
'http://creativecommons.org/licenses/by-nc/4.0/' => array(
'title' => 'CC BY-NC (Attribution-Non-Commercial)',
'url' => 'http://creativecommons.org/licenses/by-nc/4.0/legalcode',
'def' => 'Users can copy, redistribute the material in any medium or format, remix, transform, and build upon the material. The licensor cannot revoke these freedoms as long as you follow the license terms.'
)
);
?>
7 changes: 4 additions & 3 deletions config/symbini_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@
//$SMTP_ARR = array('host'=>'','port'=>587,'username'=>'','password'=>'','timeout'=>60); //Host is requiered, others are optional and can be removed

$RIGHTS_TERMS = array(
'CC0 1.0 (Public-domain)' => 'http://creativecommons.org/publicdomain/zero/1.0/',
'CC BY (Attribution)' => 'http://creativecommons.org/licenses/by/4.0/',
'CC BY-NC (Attribution-Non-Commercial)' => 'http://creativecommons.org/licenses/by-nc/4.0/'
'CC0 1.0 (Public-domain)' => 'https://creativecommons.org/publicdomain/zero/1.0/',
'CC BY (Attribution)' => 'https://creativecommons.org/licenses/by/4.0/',
'CC BY-NC (Attribution-Non-Commercial)' => 'https://creativecommons.org/licenses/by-nc/4.0/',
'CC BY-NC-SA (Attribution-NonCommercial-ShareAlike)' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
);

/*
Expand Down
25 changes: 19 additions & 6 deletions includes/usagepolicy_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@
<?php
if (file_exists($SERVER_ROOT . '/includes/citationportal.php')) {
include($SERVER_ROOT . '/includes/citationportal.php');
} else {
}
else {
echo 'Biodiversity occurrence data published by: ';
if ($DEFAULT_TITLE) {
echo $DEFAULT_TITLE;
} else {
}
else {
echo 'Name of people or institutional reponsible for maintaining the portal';
};
echo ' (accessed through the ';
if ($DEFAULT_TITLE) {
echo $DEFAULT_TITLE;
} else {
}
else {
echo 'Name of people or institutional reponsible for maintaining the portal';
};
echo ' Portal, ' . $serverHost . $CLIENT_ROOT . ', ' . date('Y-m-d') . ').';
Expand Down Expand Up @@ -91,14 +94,24 @@
</div>

<h2>Images</h2>
<p>Images within this website have been generously contributed by their owners to promote education and research. These contributors retain the full copyright for their images. Unless stated otherwise, images are made available under the Creative Commons Attribution-ShareAlike (<a href="http://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC BY-SA</a>). Users are allowed to copy, transmit, reuse, and/or adapt content, as long as attribution regarding the source of the content is made. If the content is altered, transformed, or enhanced, it may be re-distributed only under the same or similar license by which it was acquired.
<p>Images within this website have been generously contributed by their owners to promote education and research. These contributors retain the full copyright for their images.
Unless stated otherwise, images are made available under the Creative Commons Attribution-ShareAlike
(<a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">CC BY-SA</a>).
Users are allowed to copy, transmit, reuse, and/or adapt content, as long as attribution regarding the source of the content is made. If the content is altered, transformed,
or enhanced, it may be re-distributed only under the same or similar license by which it was acquired.
</p>

<h2>Notes on Specimen Records and Images</h2>
<p>Specimens are used for scientific research and because of skilled preparation and careful use they may last for hundreds of years. Some collections have specimens that were collected over 100 years ago that are no longer occur within the area. By making these specimens available on the web as images, their availability and value improves without an increase in inadvertent damage caused by use. Note that if you are considering making specimens, remember collecting normally requires permission of the landowner and, in the case of rare and endangered plants, additional permits may be required. It is best to coordinate such efforts with a regional institution that manages a publically accessible collection.
<p>Specimens are used for scientific research and because of skilled preparation and careful use they may last for hundreds of years. Some collections have specimens that were
collected over 100 years ago that are no longer occur within the area. By making these specimens available on the web as images, their availability and value improves without
an increase in inadvertent damage caused by use. Note that if you are considering making specimens, remember collecting normally requires permission of the landowner and,
in the case of rare and endangered plants, additional permits may be required. It is best to coordinate such efforts with a regional institution that manages a publically
accessible collection.
</p>

<p><b>Disclaimer:</b> This data portal may contain specimens and historical records that are culturally sensitive. The collections include specimens dating back over 200 years collected from all around the world. Some records may also include offensive language. These records do not reflect the portal community's current viewpoint but rather the social attitudes and circumstances of the time period when specimens were collected or cataloged.
<p><b>Disclaimer:</b> This data portal may contain specimens and historical records that are culturally sensitive. The collections include specimens dating back over 200 years
collected from all around the world. Some records may also include offensive language. These records do not reflect the portal community's current viewpoint but rather the
social attitudes and circumstances of the time period when specimens were collected or cataloged.
</p>
</div>
<?php
Expand Down

0 comments on commit 05c733b

Please sign in to comment.