Skip to content

Commit

Permalink
Merge pull request #35 from BioKIC/master
Browse files Browse the repository at this point in the history
Merge Symbiota-light developments into BioKIC Symbiota-light code repository
  • Loading branch information
egbot authored Mar 19, 2021
2 parents 0ee45b9 + c557188 commit de2d85e
Show file tree
Hide file tree
Showing 34 changed files with 498 additions and 377 deletions.
36 changes: 18 additions & 18 deletions checklists/dynamicmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
$tid = array_key_exists('tid',$_REQUEST)?$_REQUEST['tid']:0;
$taxa = array_key_exists('taxa',$_REQUEST)?$_REQUEST['taxa']:'';
$interface = array_key_exists('interface',$_REQUEST)&&$_REQUEST['interface']?$_REQUEST['interface']:'checklist';
$latCen = array_key_exists('lat',$_REQUEST)?$_REQUEST['lat']:'';
$longCen = array_key_exists('long',$_REQUEST)?$_REQUEST['long']:'';
$zoomInt = array_key_exists('zoom',$_REQUEST)?$_REQUEST['zoom']:'';

//Sanitation
if(!is_numeric($tid)) $tid = 0;
$taxa = filter_var($taxa,FILTER_SANITIZE_STRING);
if($interface && $interface != 'key') $interface = 'checklist';

//$dynClManager = new DynamicChecklistManager();

$latCen = 41.0;
$longCen = -95.0;
$coorArr = explode(";",$MAPPING_BOUNDARIES);
if($coorArr && count($coorArr) == 4){
$latCen = ($coorArr[0] + $coorArr[2])/2;
$longCen = ($coorArr[1] + $coorArr[3])/2;
}
$coordRange = 50;
if($coorArr && count($coorArr) == 4) $coordRange = ($coorArr[0] - $coorArr[2]);
$zoomInt = 5;
if($coordRange < 20){
$zoomInt = 6;
}
elseif($coordRange > 35 && $coordRange < 40){
$zoomInt = 4;
if(!$latCen || !$longCen){
$latCen = 41.0;
$longCen = -95.0;
$coorArr = explode(";",$MAPPING_BOUNDARIES);
if($coorArr && count($coorArr) == 4){
$latCen = ($coorArr[0] + $coorArr[2])/2;
$longCen = ($coorArr[1] + $coorArr[3])/2;
}
}
elseif($coordRange > 40){
$zoomInt = 3;
if(!$zoomInt){
$zoomInt = 5;
$coordRange = 50;
if($coorArr && count($coorArr) == 4) $coordRange = ($coorArr[0] - $coorArr[2]);
if($coordRange < 20) $zoomInt = 6;
elseif($coordRange > 35 && $coordRange < 40) $zoomInt = 4;
elseif($coordRange > 40) $zoomInt = 3;
}
?>
<html>
Expand Down
64 changes: 30 additions & 34 deletions checklists/index.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
include_once('../config/symbini.php');
include_once($SERVER_ROOT.'/classes/ChecklistManager.php');
include_once($SERVER_ROOT.'/content/lang/checklists/index.'.$LANG_TAG.'.php');
header("Content-Type: text/html; charset=".$CHARSET);

$pid = array_key_exists("pid",$_REQUEST)?$_REQUEST["pid"]:0;
$pid = array_key_exists('pid',$_REQUEST)?$_REQUEST['pid']:0;

$clManager = new ChecklistManager();
$clManager->setProj($pid);
Expand All @@ -21,57 +22,52 @@
echo '<link href="'.$CLIENT_ROOT.'/css/base.css?ver=1" type="text/css" rel="stylesheet" />';
echo '<link href="'.$CLIENT_ROOT.'/css/main.css?ver=1" type="text/css" rel="stylesheet" />';
}
include_once($SERVER_ROOT.'/includes/googleanalytics.php');
?>
<script type="text/javascript">
<?php include_once($SERVER_ROOT.'/includes/googleanalytics.php'); ?>
</script>
</head>
<body>
<?php
$displayLeftMenu = (isset($checklists_indexMenu)?$checklists_indexMenu:"true");
include($SERVER_ROOT."/includes/header.php");
echo "<div class='navpath'>";
echo "<a href='../index.php'>Home</a> &gt;&gt; ";
if(isset($checklists_indexCrumbs) && $checklists_indexCrumbs) echo $checklists_indexCrumbs.' &gt;&gt;';
echo " <b>Species Checklists</b>";
echo "</div>";
$displayLeftMenu = (isset($checklists_indexMenu)?$checklists_indexMenu:'true');
include($SERVER_ROOT.'/includes/header.php');
?>
<!-- This is inner text! -->
<div class="navpath">
<a href="../index.php"><?php echo (isset($LANG['NAV_HOME'])?$LANG['NAV_HOME']:'Home'); ?></a> &gt;&gt;
<b><?php echo (isset($LANG['SPECIES_INVENTORIES'])?$LANG['SPECIES_INVENTORIES']:'Species Inventories'); ?></b>
</div>
<div id="innertext">
<h1>Species Checklists</h1>
<div style='margin:20px;'>
<h1><?php echo (isset($LANG['SPECIES_INVENTORIES'])?$LANG['SPECIES_INVENTORIES']:'Species Inventories'); ?></h1>
<div style="margin:20px;">
<?php
$researchArr = $clManager->getChecklists();
if($researchArr){
foreach($researchArr as $pid => $projArr){
?>
<div style='margin:3px 0px 0px 15px;'>
<h3><?php echo $projArr['name']; ?>
<a href="<?php echo "clgmap.php?pid=".$pid; ?>" title='Show checklists on map'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
</h3>
<div>
<ul>
<?php
foreach($projArr['clid'] as $clid => $clName){
echo "<li><a href='checklist.php?clid=".$clid."&pid=".$pid."'>".$clName."</a></li>\n";
}
?>
</ul>
</div>
</div>
<h3>
<?php
$projName = $projArr['name'];
if($projName == 'Miscellaneous Inventories') $projName = (isset($LANG['MISC_INVENTORIES'])?$LANG['MISC_INVENTORIES']:'Miscellaneous Inventories');
echo $projName;
?>
<a href="<?php echo "clgmap.php?pid=".$pid; ?>" title='<?php echo (isset($LANG['SHOW_MAP'])?$LANG['SHOW_MAP']:'Show inventories on map'); ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
</h3>
<ul>
<?php
foreach($projArr['clid'] as $clid => $clName){
echo '<li><a href="checklist.php?clid='.$clid.'&pid='.$pid.'">'.$clName.'</a></li>';
}
?>
</ul>
<?php
}
}
else{
echo '<div><b>No Checklists returned</b></div>';
}
else echo '<div><b>'.(isset($LANG['NO_INVENTORIES'])?$LANG['NO_INVENTORIES']:'No inventories returned').'</b></div>';
?>
</div>
</div>
<?php
include($SERVER_ROOT."/includes/footer.php");
include($SERVER_ROOT.'/includes/footer.php');
?>
</body>
</html>
19 changes: 14 additions & 5 deletions classes/ImageCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ public function buildThumbnailImages(){

private function setCollectionCode(){
if($this->collid && !$this->collMetaArr){
$sql = 'SELECT collid, CONCAT_WS("_",institutioncode, collectioncode) AS code, collectionname FROM omcollections WHERE collid = '.$this->collid;
$sql = 'SELECT collid, CONCAT_WS("_",institutioncode, collectioncode) AS code, collectionname, managementType FROM omcollections WHERE collid = '.$this->collid;
$rs = $this->conn->query($sql);
while($r = $rs->fetch_object()){
$this->collMetaArr[$r->collid]['code'] = $r->code;
$this->collMetaArr[$r->collid]['name'] = $r->collectionname;
$this->collMetaArr[$r->collid]['managementType'] = $r->managementType;
}
$rs->free();
}
Expand Down Expand Up @@ -278,9 +279,8 @@ private function getTropicosWebUrl2($url){
$imageID = $m[1];
$imgDisplayUrl = 'http://www.tropicos.org/Image/'.$imageID;
$ip = $_SERVER['HTTP_HOST'];

$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header = array();
$header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
Expand Down Expand Up @@ -520,7 +520,7 @@ public function recycleImagesFromFile($filePath){
$this->setRecycleBin();
if(!$filePath) exit('Image identifier file path IS NULL');
if(!file_exists($filePath)) exit('Image identifier file Not Found');
if(($imgidHandler = fopen($imgidFile, 'r')) !== FALSE){
if(($imgidHandler = fopen($filePath, 'r')) !== FALSE){
while(($data = fgets($imgidHandler)) !== FALSE){
$this->recycleImage($data[0]);
}
Expand Down Expand Up @@ -660,6 +660,15 @@ public function getCollectionName(){
return $retStr;
}

public function getManagementType(){
$retStr = '';
if($this->collid){
if(!$this->collMetaArr) $this->setCollectionCode();
$retStr = $this->collMetaArr[$this->collid]['managementType'];
}
return $retStr;
}

public function setBuildMediumDerivative($bool){
if($bool) $this->buildMediumDerivative = true;
else $this->buildMediumDerivative = false;
Expand Down
11 changes: 7 additions & 4 deletions classes/ImageShared.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,13 @@ public function processImage(){
if(!$this->imgWebUrl && $this->createWebDerivative){
if($this->sourceWidth < ($this->webPixWidth*1.2) && $this->sourceFileSize < $this->webFileSizeLimit){
//Source image width and file size is small enough to serve as web image
if(strtolower(substr($this->sourcePath,0,7)) == 'http://' || strtolower(substr($this->sourcePath,0,8)) == 'https://'){
if(strtolower(substr($this->sourcePath,0,4)) == 'http'){
if(copy($this->sourcePath, $this->targetPath.$this->imgName.$this->imgExt, $this->context)){
$this->imgWebUrl = $this->imgName.$this->imgExt;
}
}
else{
$this->imgWebUrl = $this->imgName.$this->imgExt;
}
elseif($this->imgLgUrl) $this->imgWebUrl = $this->imgLgUrl;
else $this->imgWebUrl = basename($this->sourcePath);
}
else{
//Image width or file size is too large
Expand Down Expand Up @@ -910,6 +909,10 @@ public function setSourceUrl($v){
$this->sourceUrl = $this->cleanInStr($v);
}

public function setImgLgUrl($v){
$this->imgLgUrl = $this->cleanInStr($v);
}

public function setImgWebUrl($v){
$this->imgWebUrl = $this->cleanInStr($v);
}
Expand Down
5 changes: 2 additions & 3 deletions classes/OccurrenceEditorImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,11 @@ public function addImage($postArr){
if(array_key_exists('copytoserver',$postArr) && $postArr['copytoserver']){
if(!$imgManager->copyImageFromUrl()) $status = false;
}
else $imgManager->setImgLgUrl($sourceImgUri);
}
else{
//Image is a file upload
if(!$imgManager->uploadImage()){
$status = false;
}
if(!$imgManager->uploadImage()) $status = false;
}
$imgManager->setOccid($this->occid);
if(isset($this->occurrenceMap[$this->occid]['tidinterpreted'])) $imgManager->setTid($this->occurrenceMap[$this->occid]['tidinterpreted']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
include_once($SERVER_ROOT.'/config/dbconnection.php');

class ExsiccatiManager {
class OccurrenceExsiccatae {

private $conn;

Expand Down Expand Up @@ -38,7 +38,7 @@ public function getTitleObj($ometid){
//echo $sql;
if($rs = $this->conn->query($sql)){
while($r = $rs->fetch_object()){
$retArr['sourceIdentifier'] = $this->cleanOutStr($r->sourceIdentifier);
$retArr['sourceidentifier'] = $this->cleanOutStr($r->sourceIdentifier);
}
$rs->free();
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function getExsNumberObj($omenid){
$sql = 'SELECT et.sourceIdentifier FROM omexsiccatititles et INNER JOIN omexsiccatinumbers en ON et.ometid = en.ometid WHERE en.omenid = '.$omenid;
if($rs = $this->conn->query($sql)){
while($r = $rs->fetch_object()){
$retArr['sourceIdentifier'] = $this->cleanOutStr($r->sourceIdentifier);
$retArr['sourceidentifier'] = $this->cleanOutStr($r->sourceIdentifier);
}
$rs->free();
}
Expand Down Expand Up @@ -267,13 +267,14 @@ public function exportExsiccatiAsCsv($searchTerm, $specimenOnly, $imagesOnly, $c
//Exsiccati edit functions
public function addTitle($pArr,$editedBy){
$con = MySQLiConnectionFactory::getCon("write");
$sql = 'INSERT INTO omexsiccatititles(title, abbreviation, editor, exsrange, startdate, enddate, source, notes,lasteditedby) '.
$sql = 'INSERT INTO omexsiccatititles(title, abbreviation, editor, exsrange, startdate, enddate, source, sourceIdentifier, notes,lasteditedby) '.
'VALUES("'.$this->cleanInStr($pArr['title']).'","'.$this->cleanInStr($pArr['abbreviation']).'","'.
$this->cleanInStr($pArr['editor']).'",'.
($pArr['exsrange']?'"'.$this->cleanInStr($pArr['exsrange']).'"':'NULL').','.
($pArr['startdate']?'"'.$this->cleanInStr($pArr['startdate']).'"':'NULL').','.
($pArr['enddate']?'"'.$this->cleanInStr($pArr['enddate']).'"':'NULL').','.
($pArr['source']?'"'.$this->cleanInStr($pArr['source']).'"':'NULL').','.
($pArr['sourceidentifier']?'"'.$this->cleanInStr($pArr['sourceidentifier']).'"':'NULL').','.
($pArr['notes']?'"'.$this->cleanInStr($pArr['notes']).'"':'NULL').',"'.
$editedBy.'")';
//echo $sql;
Expand All @@ -290,6 +291,7 @@ public function editTitle($pArr,$editedBy){
', startdate = '.($pArr['startdate']?'"'.$this->cleanInStr($pArr['startdate']).'"':'NULL').
', enddate = '.($pArr['enddate']?'"'.$this->cleanInStr($pArr['enddate']).'"':'NULL').
', source = '.($pArr['source']?'"'.$this->cleanInStr($pArr['source']).'"':'NULL').
', sourceIdentifier = '.($pArr['sourceidentifier']?'"'.$this->cleanInStr($pArr['sourceidentifier']).'"':'NULL').
', notes = '.($pArr['notes']?'"'.$this->cleanInStr($pArr['notes']).'"':'NULL').' '.
', lasteditedby = "'.$editedBy.'" '.
'WHERE (ometid = '.$pArr['ometid'].')';
Expand Down Expand Up @@ -695,8 +697,7 @@ public function getExsiccatiSuggest($term){
//Misc
public function getCollArr($ometid = 0){
$retArr = array();
$sql ='SELECT DISTINCT c.collid, c.collectionname, c.institutioncode, c.collectioncode '.
'FROM omcollections c ';
$sql ='SELECT DISTINCT c.collid, c.collectionname, c.institutioncode, c.collectioncode FROM omcollections c ';
if($ometid){
if($ometid == 'all'){
$sql .= 'INNER JOIN omoccurrences o ON c.collid = o.collid '.
Expand Down
Loading

0 comments on commit de2d85e

Please sign in to comment.