Skip to content

Commit

Permalink
Merge pull request #508 from BioKIC/temp_resolve_conflict
Browse files Browse the repository at this point in the history
Update from BioKIC Development
  • Loading branch information
GregoryPost authored Aug 6, 2024
2 parents 2c015f0 + 351a9c8 commit 6be4e28
Show file tree
Hide file tree
Showing 112 changed files with 1,131 additions and 982 deletions.
48 changes: 19 additions & 29 deletions checklists/clgmap.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?php
include_once('../config/symbini.php');
include_once($SERVER_ROOT.'/classes/ChecklistManager.php');
if($LANG_TAG != 'en' && file_exists($SERVER_ROOT.'/content/lang/checklists/clgmap.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/checklists/clgmap.' . $LANG_TAG . '.php');
else include_once($SERVER_ROOT.'/content/lang/checklists/clgmap.en.php');
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/checklists/clgmap.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/checklists/clgmap.en.php');
else include_once($SERVER_ROOT.'/content/lang/checklists/clgmap.' . $LANG_TAG . '.php');
header("Content-Type: text/html; charset=".$CHARSET);

$pid = $_REQUEST['pid'];
$target = array_key_exists('target',$_REQUEST)?$_REQUEST['target']:'checklists';

//Sanitation
$pid = htmlspecialchars($pid, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE);
if(!is_numeric($pid)) $pid = 0;
$pid = filter_var($_REQUEST['pid'], FILTER_SANITIZE_NUMBER_INT);

$clManager = new ChecklistManager();
$clManager->setProj($pid);
Expand All @@ -22,11 +15,11 @@
<!DOCTYPE html>
<html lang="<?php echo $LANG_TAG ?>">
<head>
<?php
include_once($SERVER_ROOT.'/includes/leafletMap.php');
include_once($SERVER_ROOT.'/includes/googleMap.php');
?>
<title><?php echo $DEFAULT_TITLE.' - '.(isset($LANG['H_INVENTORIES'])?$LANG['H_INVENTORIES']:'Species Checklists'); ?></title>
<?php
include_once($SERVER_ROOT.'/includes/leafletMap.php');
include_once($SERVER_ROOT.'/includes/googleMap.php');
?>
<title><?= $DEFAULT_TITLE . ' - ' . $LANG['TITLE'] ?></title>

<script type="text/javascript">

Expand All @@ -48,7 +41,7 @@ function leafletInit() {
markers.push(L.marker(latlng)
.bindTooltip(checklist.name)
.bindPopup(`<div style=\'width:300px;\'>
<b>${checklist.name}</b><br/><?php echo (isset($LANG['DOUBLE_CLICK'])?$LANG['DOUBLE_CLICK']:'Double Click to open'); ?>
<b>${checklist.name}</b><br/><?= $LANG['DOUBLE_CLICK'] ?>
</div>`)
.on('dblclick', () => navigateToCheckList(checklistId, pid)));
}
Expand Down Expand Up @@ -81,7 +74,7 @@ function closeAllInfoWins(){
})
const infoWin = new google.maps.InfoWindow({
content: `<div style=\'width:300px;\'>
<b>${checklist.name}</b><br/><?php echo (isset($LANG['DOUBLE_CLICK'])?$LANG['DOUBLE_CLICK']:'Double Click to open'); ?>
<b>${checklist.name}</b><br/><?= $LANG['DOUBLE_CLICK'] ?>
</div>`
});

Expand Down Expand Up @@ -109,7 +102,7 @@ function initialize(){
pid = data.getAttribute('data-pid');
checklists = JSON.parse(data.getAttribute('data-checklists'));
} catch (err) {
alert("<?php echo (isset($LANG['FAILED_TO_LOAD'])?$LANG['FAILED_TO_LOAD']:'Failed to load checklist data'); ?>");
alert("<?= $LANG['FAILED_TO_LOAD'] ?>");
}

<?php if(empty($GOOGLE_MAP_KEY)) { ?>
Expand All @@ -126,24 +119,21 @@ function initialize(){
margin: 0;
padding: 0;
}
.screen-reader-only {
.screen-reader-only {
position: absolute;
left: -10000px;
}
</style>
</head>
<body style="background-color:#ffffff;" onload="initialize()">
<?php
// if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimalheader.php');
<?php
// if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimalheader.php');
?>
<h1 class="page-heading screen-reader-only" style="margin-top:30px;">Checklist Map</h1>
<h1 class="page-heading screen-reader-only" style="margin-top:30px;">Checklist Map</h1>
<div id="map_canvas"></div>
<div
id="service-container"
class="service-container"
data-checklists="<?= htmlspecialchars(json_encode($clManager->getResearchPoints()))?>"
data-pid="<?= htmlspecialchars($pid)?>"
>
</div>
<div id="service-container"
class="service-container"
data-checklists="<?= htmlspecialchars(json_encode($clManager->getResearchPoints()))?>"
data-pid="<?= $pid ?>"></div>
</body>
</html>
38 changes: 17 additions & 21 deletions checklists/clsppeditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$tabIndex = array_key_exists('tabindex', $_POST) ? filter_var($_POST['tabindex'], FILTER_SANITIZE_NUMBER_INT) : 0;
$action = array_key_exists('action', $_POST) ? htmlspecialchars($_POST['action'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
$cltype = array_key_exists('cltype', $_POST) ? htmlspecialchars($_POST['cltype'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
$renametid = array_key_exists('renametid', $_POST) ? htmlspecialchars($_POST['renametid'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
$renametid = array_key_exists('renametid', $_POST) ? filter_var($_POST['renametid'], FILTER_SANITIZE_NUMBER_INT) : '';
$locality = array_key_exists('locality', $_POST) ? htmlspecialchars($_POST['locality'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
$habitat = array_key_exists('habitat', $_POST) ? htmlspecialchars($_POST['habitat'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
$abundance = array_key_exists('abundance', $_POST) ? htmlspecialchars($_POST['abundance'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) : '';
Expand Down Expand Up @@ -101,6 +101,15 @@
$( "#renamesciname" ).val(ui.item.value);
$( "#renametid" ).val(ui.item.id);
}
},
change: function( event, ui ) {
if(ui.item === null) {
$( "#renametid" ).val("");
if($( "#renamesciname" ).val() != ""){
alert('<?= $LANG['SELECT_TAXON'] ?>');
f.renamesciname.focus();
}
}
}
});

Expand All @@ -111,32 +120,19 @@
});

function validateRenameForm(f){
if(f.renamesciname.value == ""){
if (f.renamesciname.value !== "" && f.renametid.value !== ""){
f.submit();
}
else if(f.renamesciname.value == ""){
alert("<?php echo $LANG['NAME_BLANK']; ?>");
}
else{
checkScinameExistence(f);
else {
alert('<?= $LANG['SELECT_TAXON'] ?>');
}
f.renamesciname.focus();
return false;
}

function checkScinameExistence(f){
$.ajax({
type: "POST",
url: "rpc/gettid.php",
data: { sciname: f.renamesciname.value }
}).done(function( renameTid ) {
if(renameTid){
if(f.renametid.value == "") f.renametid.value = renameTid;
f.submit();
}
else{
alert("<?php echo $LANG['SCINAME_ERROR']; ?>");
f.renametid.value = "";
}
});
}

function openPopup(urlStr,windowName){
newWindow = window.open(urlStr,windowName,'scrollbars=1,toolbar=0,resizable=1,width=800,height=650,left=20,top=20');
if (newWindow.opener == null) newWindow.opener = self;
Expand Down
13 changes: 11 additions & 2 deletions checklists/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,20 @@
<h2 class="checklist-header">
<?php
$projName = $projArr['name'];
if($pid) echo '<a href="../projects/index.php?pid=' . $pid . '">';
if($projName == 'Miscellaneous Inventories') $projName = $LANG['MISC_INVENTORIES'];
echo $projName;
if($pid) echo '</a>';
if(!empty($projArr['displayMap'])){
?>
<a href="<?php echo "clgmap.php?pid=" . $pid; ?>" title='<?= $LANG['SHOW_MAP'] ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
<?php
}
?>
<a class="button button-tertiary btn-medium-font" style="gap:0.5rem" href="<?php echo "clgmap.php?pid=" . htmlspecialchars($pid, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?>" title='<?php echo htmlspecialchars($LANG['SHOW_MAP'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?>'>
<?php echo $LANG['MAP']; ?> <img src='../images/world.png' style='width:1em;border:0' alt='<?php echo $LANG['IMG_OF_GLOBE']; ?>' />
<a class="button button-tertiary btn-medium-font" style="gap:0.5rem" href="<?= "clgmap.php?pid=" . $pid ?>" title='<?= $LANG['SHOW_MAP'] ?>'>
<?= $LANG['MAP'] ?> <img src='../images/world.png' style='width:1em;border:0' alt='<?= $LANG['IMG_OF_GLOBE'] ?>' />
</a>
</h2>
<ul class="checklist-ul">
Expand Down
25 changes: 0 additions & 25 deletions checklists/rpc/gettid.php

This file was deleted.

22 changes: 11 additions & 11 deletions checklists/tools/mappointaid.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
include_once('../../config/symbini.php');
include_once($SERVER_ROOT.'/content/lang/collections/tools/mapaids.'.$LANG_TAG.'.php');
header("Content-Type: text/html; charset=".$CHARSET);
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');

$formName = array_key_exists("formname",$_REQUEST)?$_REQUEST["formname"]:"";
$latName = array_key_exists("latname",$_REQUEST)?$_REQUEST["latname"]:"";
$longName = array_key_exists("longname",$_REQUEST)?$_REQUEST["longname"]:"";
$latDef = array_key_exists("latdef",$_REQUEST)?$_REQUEST["latdef"]:0;
$lngDef = array_key_exists("lngdef",$_REQUEST)?$_REQUEST["lngdef"]:0;
$zoom = array_key_exists("zoom",$_REQUEST)&&$_REQUEST["zoom"]?$_REQUEST["zoom"]:5;
header('Content-Type: text/html; charset=' . $CHARSET);
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/collections/tools/mapaids.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/collections/tools/mapaids.en.php');
else include_once($SERVER_ROOT . '/content/lang/collections/tools/mapaids.' . $LANG_TAG . '.php');

$formName = array_key_exists('formname', $_REQUEST) ? htmlspecialchars($_REQUEST['formname'], HTML_SPECIAL_CHARS_FLAGS) : '';
$latName = array_key_exists('latname', $_REQUEST) ? htmlspecialchars($_REQUEST['latname'], HTML_SPECIAL_CHARS_FLAGS) : '';
$longName = array_key_exists('longname', $_REQUEST) ? htmlspecialchars($_REQUEST['longname'], HTML_SPECIAL_CHARS_FLAGS) : '';
$latDef = array_key_exists('latdef', $_REQUEST) ? filter_var($_REQUEST['latdef'], FILTER_SANITIZE_NUMBER_FLOAT) : 0;
$lngDef = array_key_exists('lngdef', $_REQUEST) ? filter_var($_REQUEST['lngdef'], FILTER_SANITIZE_NUMBER_FLOAT) : 0;
$zoom = !empty($_REQUEST['zoom']) ? filter_var($_REQUEST['zoom'], FILTER_SANITIZE_NUMBER_INT) : 5;

if($latDef == 0 && $lngDef == 0){
$latDef = '';
$lngDef = '';
Expand Down
23 changes: 16 additions & 7 deletions classes/ChecklistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,17 +685,22 @@ public function addNewSpecies($postArr){
//Checklist index page functions
public function getChecklists($limitToKey=false){
$retArr = Array();
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, COUNT(l.tid) AS sppcnt
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, c.latCentroid
FROM fmchecklists c LEFT JOIN fmchklstprojlink cpl ON c.clid = cpl.clid
INNER JOIN fmchklsttaxalink l ON c.clid = l.clid
LEFT JOIN fmprojects p ON cpl.pid = p.pid
WHERE ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']) $sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
WHERE c.type != "excludespp" AND ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']){
$sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
}
$sql .= ') AND ((p.pid IS NULL) OR (p.ispublic = 1) ';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']) $sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']){
$sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
}
$sql .= ') ';
if($this->pid) $sql .= 'AND (p.pid = '.$this->pid.') ';
$sql .= 'GROUP BY p.projname, c.Name HAVING sppcnt > 10';
//Following line limits result to only checklists that have a linked taxon or is a parent checklist with possible inherited taxa
$sql .= 'AND c.clid IN(SELECT clid FROM fmchklsttaxalink UNION DISTINCT SELECT clid FROM fmchklstchildren) ';
$sql .= 'ORDER BY p.projname, c.name';
$rs = $this->conn->query($sql);
while($row = $rs->fetch_object()){
if($limitToKey){
Expand All @@ -709,6 +714,7 @@ public function getChecklists($limitToKey=false){
$pid = 0;
$projName = 'Miscellaneous Inventories';
}
if($row->latCentroid) $retArr[$pid]['displayMap'] = 1;
$retArr[$pid]['name'] = $this->cleanOutStr($projName);
$retArr[$pid]['clid'][$row->clid] = $this->cleanOutStr($row->name).($row->access=='private'?' (Private)':'');
}
Expand Down Expand Up @@ -774,11 +780,14 @@ public function getSpeciesSearch($term){
$term = preg_replace('/[^a-zA-Z\-\. ]+/', '', $term);
$term = preg_replace('/\s{1}x{1}\s{0,1}$/i', ' _ ', $term);
$term = preg_replace('/\s{1}[\D]{1}\s{1}/i', ' _ ', $term);

if($term){

$sql = 'SELECT tid, sciname, author FROM taxa WHERE (rankid > 179) AND (sciname LIKE "'.$term.'%")';
$rs = $this->conn->query($sql);
while($r = $rs->fetch_object()){
$retArr[] = $r->sciname . ' ' . $r->author;
$retArr[] = (object) [ 'value' => $r->sciname . ' ' . $r->author,
'id' => $r->tid];
}
$rs->free();
}
Expand Down
25 changes: 15 additions & 10 deletions classes/DwcArchiverPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,27 @@ private function aasort(&$array, $key){
}

public function humanFileSize($filePath) {
$x = false;
if(substr($filePath,0,4)=='http') {
$x = array_change_key_case(get_headers($filePath, 1),CASE_LOWER);
if( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) {
$x = $x['content-length'][1];
}
else {
$x = $x['content-length'];
if($headerArr = @get_headers($filePath, 1)){
$x = array_change_key_case($headerArr, CASE_LOWER);
if( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) {
$x = $x['content-length'][1];
}
else {
$x = $x['content-length'];
}
}
}
else {
$x = @filesize($filePath);
}
$x = round($x/1000000, 1);
if(!$x) $x = 0.1;

return $x.'M ';
if($x !== false){
$x = round($x/1000000, 1);
if(!$x) $x = 0.1;
return $x.'M';
}
return '?M';
}
}
?>
4 changes: 2 additions & 2 deletions classes/OccurrenceIndividual.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private function setDeterminations(){

private function setImages(){
global $IMAGE_DOMAIN;
$sql = 'SELECT i.imgid, i.url, i.thumbnailurl, i.originalurl, i.sourceurl, i.notes, i.caption,
$sql = 'SELECT i.imgid, i.url, i.thumbnailurl, i.originalurl, i.sourceurl, i.notes, i.caption,
CONCAT_WS(" ",u.firstname,u.lastname) as innerPhotographer, i.photographer, i.rights, i.accessRights, i.copyright
FROM images i LEFT JOIN users u ON i.photographeruid = u.uid
WHERE (i.occid = ?) ORDER BY i.sortoccurrence,i.sortsequence';
Expand All @@ -275,7 +275,7 @@ private function setImages(){
if($IMAGE_DOMAIN){
if(substr($url,0,1)=='/') $url = $IMAGE_DOMAIN . $url;
if($lgUrl && substr($lgUrl, 0, 1) == '/') $lgUrl = $IMAGE_DOMAIN . $lgUrl;
if($tnUrl && substr($tnUrl, 0, 1) == '/') $tnUrl = $imageDomain . $tnUrl;
if($tnUrl && substr($tnUrl, 0, 1) == '/') $tnUrl = $IMAGE_DOMAIN . $tnUrl;
}
if((!$url || $url == 'empty') && $lgUrl) $url = $lgUrl;
if(!$tnUrl && $url) $tnUrl = $url;
Expand Down
4 changes: 2 additions & 2 deletions classes/OccurrenceMapManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public function writeKMLFile($recLimit, $extraFieldArr = null){
$cnt = 0;
$coordArr = $this->getMappingData($recLimit, $extraFieldArr);
if($coordArr){
$this->googleIconArr = array('pushpin/ylw-pushpin','pushpin/blue-pushpin','pushpin/grn-pushpin','pushpin/ltblu-pushpin',
$googleIconArr = array('pushpin/ylw-pushpin','pushpin/blue-pushpin','pushpin/grn-pushpin','pushpin/ltblu-pushpin',
'pushpin/pink-pushpin','pushpin/purple-pushpin', 'pushpin/red-pushpin','pushpin/wht-pushpin','paddle/blu-blank',
'paddle/grn-blank','paddle/ltblu-blank','paddle/pink-blank','paddle/wht-blank','paddle/blu-diamond','paddle/grn-diamond',
'paddle/ltblu-diamond','paddle/pink-diamond','paddle/ylw-diamond','paddle/wht-diamond','paddle/red-diamond','paddle/purple-diamond',
Expand All @@ -359,7 +359,7 @@ public function writeKMLFile($recLimit, $extraFieldArr = null){
foreach($coordArr as $sciname => $snArr){
unset($snArr['tid']);
$cnt++;
$iconStr = $this->googleIconArr[$cnt%44];
$iconStr = $googleIconArr[$cnt%44];
echo "<Style id='sn_".$iconStr."'>\n";
echo "<IconStyle><scale>1.1</scale><Icon>";
echo "<href>http://maps.google.com/mapfiles/kml/" . htmlspecialchars($iconStr, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) . ".png</href>";
Expand Down
Loading

0 comments on commit 6be4e28

Please sign in to comment.