Skip to content

Commit

Permalink
Merge pull request #22 from mandrewj/revert-20-revert-19-master
Browse files Browse the repository at this point in the history
Revert "Revert "code update""
  • Loading branch information
mandrewj authored Feb 16, 2022
2 parents b5aed43 + 8b6eb15 commit a7df3aa
Show file tree
Hide file tree
Showing 6,771 changed files with 849,204 additions and 1,507 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/config/symbini.php
.project
.settings/org.eclipse.core.resources.prefs
content/lang/header.fr.php
.settings/org.eclipse.php.ui.prefs
141 changes: 141 additions & 0 deletions admin/portalindex.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php
require_once('../config/symbini.php');
require_once($SERVER_ROOT.'/classes/PortalIndex.php');
//include_once($SERVER_ROOT.'/content/lang/admin/portalindex.'.$LANG_TAG.'.php');
header("Content-Type: text/html; charset=".$CHARSET);

if(!$SYMB_UID) header('Location: '.$CLIENT_ROOT.'/profile/index.php?refurl=../admin/portalindex.php?'.htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES));

$portalID = array_key_exists('portalid',$_REQUEST)?$_REQUEST['portalid']:0;
$collID = array_key_exists('collid',$_REQUEST)?$_REQUEST['collid']:0;
$formSubmit = array_key_exists('formsubmit',$_POST)?$_POST['formsubmit']:'';

//Sanitation
if(!is_numeric($portalID)) $portalID = 0;
if(!is_numeric($collID)) $collID = 0;

$portalManager = new PortalIndex();

$isEditor = 0;
if($IS_ADMIN) $isEditor = 1;
?>
<html>
<head>
<title><?php echo $DEFAULT_TITLE; ?> Portal Index Control Panel</title>
<?php
$activateJQuery = true;
include_once($SERVER_ROOT.'/includes/head.php');
?>
<script src="<?php echo $CLIENT_ROOT; ?>/js/jquery.js" type="text/javascript"></script>
<script src="<?php echo $CLIENT_ROOT; ?>/js/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
<style type="text/css">
fieldset{ margin:20px; padding:15px; }
legend{ font-weight: bold; }
label{ font-weight: bold; }
hr{ margin-top: 15px; margin-bottom: 15px; }
</style>
</head>
<body>
<?php
$displayLeftMenu = true;
include($SERVER_ROOT.'/includes/header.php');
?>
<div class="navpath">
<a href="../../index.php">Home</a> &gt;&gt;
<b>Portal Index Control Panel</b>
</div>
<div id="innertext">
<?php
if($isEditor){
if($formSubmit == ''){
//$portalManager->;
}
$indexArr = $portalManager->getPortalIndexArr($portalID);
?>
<fieldset>
<legend>Portal Index</legend>
<?php
foreach($indexArr as $portalID => $portalArr){
foreach($portalArr as $fieldName => $fieldValue){
if($fieldValue){
echo '<div><label>'.$fieldName.'</label>: ';
$href = '';
if($fieldName=='urlRoot') $href = $fieldValue;
elseif($fieldName=='guid') $href = $portalArr['urlRoot'].'/api/v2/installation/ping';
if($href) echo '<a href="'.$href.'" target="_blank">';
echo $fieldValue;
if($href) echo '</a>';
echo '</div>';
}
}
echo '<hr/>';
if($collID){
$url = $portalArr['urlRoot'].'/api/v2/collection/'.$collID;
$collectArr = $portalManager->getAPIResponce($url);
$collTitle = $collectArr['collectionName'].' ('.$collectArr['institutionCode'].($collectArr['collectionCode']?':'.$collectArr['collectionCode']:'').')';
echo '<div style="font-weight:bold">#'.$collID.': '.$collTitle.'</div>';
unset($collectArr['collID']);
unset($collectArr['collectionName']);
unset($collectArr['institutionCode']);
unset($collectArr['collectionCode']);
echo '<div style="margin:15px 30px;">';
foreach($collectArr as $fName => $fValue){
if($fValue) echo '<div><label>'.$fName.'</label>: '.$fValue.'</div>';
}
echo '</div>';
?>
<form name="collPubForm" method="post" action="portalindex.php">
<input name="portalid" type="hidden" value="<?php echo $portalID; ?>" />
<input name="collid" type="hidden" value="<?php echo $collID; ?>" />
<button ></button>
</form>
<?php
}
elseif($formSubmit == 'listCollections'){
$url = $portalArr['urlRoot'].'/api/v2/collection/';
$collList = $portalManager->getAPIResponce($url);
if(isset($collList['count'])){
echo '<div><label>Collection Count</label>: '.$collList['count'].'</div>';
if($collList['count']){
echo '<table class="styledtable">';
echo '<tr><th>ID</th><th>Institution Code</th><th>Collection Code</th><th>Collection Name</th><th>Dataset Type</th><th>Management</th></tr>';
foreach($collList['results'] as $collArr){
echo '<tr>';
echo '<td><a href="portalindex.php?portalid='.$portalID.'&collid='.$collArr['collID'].'">'.$collArr['collID'].'</a></td>';
echo '<td>'.$collArr['institutionCode'].'</td>';
echo '<td>'.$collArr['collectionCode'].'</td>';
echo '<td>'.$collArr['collectionName'].'</td>';
echo '<td>'.$collArr['collType'].'</td>';
echo '<td>'.$collArr['managementType'].'</td>';
echo '</tr>';
}
echo '</table>';
}
}
}
else{
?>
<div>
<form name="portalActionForm" method="post" action="portalindex.php">
<input name="portalid" type="hidden" value="<?php echo $portalID; ?>" />
<button name="formsubmit" type="submit" value="listCollections">List Collections</button>
</form>
</div>
<?php
}
echo '<hr/>';
}
?>
</fieldset>
<?php
}
else echo '<h2>ERROR: access denied</h2>';
?>
</div>
<?php
include($SERVER_ROOT.'/includes/footer.php');
?>
</body>
</html>
15 changes: 15 additions & 0 deletions api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
19 changes: 19 additions & 0 deletions api/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
APP_NAME=Lumen
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=
APP_TIMEZONE=UTC

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

CACHE_DRIVER=file
QUEUE_CONNECTION=sync
19 changes: 19 additions & 0 deletions api/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
APP_NAME=Lumen
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=UTC

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
QUEUE_CONNECTION=sync
23 changes: 23 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules/
npm-debug.log
yarn-error.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot

# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot

storage/*.key
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
/.idea

21 changes: 21 additions & 0 deletions api/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
6 changes: 6 additions & 0 deletions api/.styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
php:
preset: laravel
disabled:
- unused_use
js: true
css: true
23 changes: 23 additions & 0 deletions api/app/Collection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace App;

use Illuminate\Database\Eloquent\Model;

class Collection extends Model{

protected $table = 'omcollections';
protected $primaryKey = 'collid';
public $timestamps = false;

protected $fillable = [
'InstitutionCode', 'CollectionCode', 'CollectionName', 'collectionId', 'datasetID', 'datasetName', 'fulldescription', 'resourceJson', 'IndividualUrl', 'contactJson',
'latitudedecimal', 'longitudedecimal', 'icon', 'CollType', 'ManagementType', 'PublicEdits', 'collectionguid', 'rightsHolder', 'rights', 'usageTerm', 'dwcaUrl',
'bibliographicCitation', 'accessrights', 'SortSeq'
];

protected $hidden = ['securitykey', 'guidtarget', 'aggKeysStr', 'dwcTermJson', 'publishToGbif', 'publishToIdigbio', 'dynamicProperties'];

public function occurrence(){
return $this->hasMany(Occurrence::class, 'collid', 'collid');
}
}
Empty file.
29 changes: 29 additions & 0 deletions api/app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//
}
}
10 changes: 10 additions & 0 deletions api/app/Events/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Events;

use Illuminate\Queue\SerializesModels;

abstract class Event
{
use SerializesModels;
}
16 changes: 16 additions & 0 deletions api/app/Events/ExampleEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Events;

class ExampleEvent extends Event
{
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
}
54 changes: 54 additions & 0 deletions api/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Exceptions;

use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Validation\ValidationException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
Loading

0 comments on commit a7df3aa

Please sign in to comment.