Added free space stat on home page

This commit is contained in:
Samuel ORTION 2021-04-15 12:29:53 +02:00
parent 01c7ce508e
commit 0384e3ee48
265 changed files with 3597 additions and 473 deletions

0
.gitignore vendored Normal file → Executable file
View File

18
INSTALL.md Normal file → Executable file
View File

@ -24,7 +24,23 @@ upload_max_filesize = 20M
## Setup nginx ## Setup nginx
```sudo apt install nginx ```bash
sudo apt install nginx
sudo cp /var/Www/chiro-canto/chiro-canto.conf /etc/nginx/sites-available/chiro-canto.conf sudo cp /var/Www/chiro-canto/chiro-canto.conf /etc/nginx/sites-available/chiro-canto.conf
``` ```
Adapt parameter to configuration. Adapt parameter to configuration.
## Create self-signed certifcates
```bash
sudo dnf install openssl
cd /etc/nginx/ssl/
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privkey.pem -out cert.pem
```
## Install PhpMyAdmin
```bash
sudo dnf -y install phpMyAdmin
sudo mv
```

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
chiro-canto.conf Normal file → Executable file
View File

0
node_modules/colormap/.travis.yml generated vendored Normal file → Executable file
View File

0
node_modules/colormap/README.md generated vendored Normal file → Executable file
View File

0
node_modules/colormap/colorScale.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/colormaps.png generated vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

0
node_modules/colormap/example.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/index.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/license.md generated vendored Normal file → Executable file
View File

0
node_modules/colormap/night.jpg generated vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 234 KiB

0
node_modules/colormap/package.json generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/draw.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/CDOM.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/PAR.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/bathymetry.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/chlorophyll.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/cool.png generated vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
node_modules/colormap/res/res/density.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/freesurface-blue.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/freesurface-red.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/inferno.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/magma.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/oxygen.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/phase.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/plasma.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/rainbow.png generated vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
node_modules/colormap/res/res/salinity.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/temperature.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/turbidity.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/velocity-blue.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/velocity-green.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/viridis.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/vorticity-pink.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/vorticity-turquoise.js generated vendored Normal file → Executable file
View File

0
node_modules/colormap/res/res/warm.png generated vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
node_modules/colormap/test.js generated vendored Normal file → Executable file
View File

0
node_modules/fs/README.md generated vendored Normal file → Executable file
View File

0
node_modules/fs/package.json generated vendored Normal file → Executable file
View File

0
node_modules/lerp/.npmignore generated vendored Normal file → Executable file
View File

0
node_modules/lerp/.travis.yml generated vendored Normal file → Executable file
View File

0
node_modules/lerp/LICENSE.md generated vendored Normal file → Executable file
View File

0
node_modules/lerp/README.md generated vendored Normal file → Executable file
View File

0
node_modules/lerp/index.js generated vendored Normal file → Executable file
View File

0
node_modules/lerp/package.json generated vendored Normal file → Executable file
View File

0
package-lock.json generated Normal file → Executable file
View File

0
public/about/index.php Normal file → Executable file
View File

0
public/analytics/matomo.php Normal file → Executable file
View File

0
public/api/v1/doc/index.php Normal file → Executable file
View File

57
public/api/v1/doc/md/QUERY.md Normal file → Executable file
View File

@ -1,6 +1,57 @@
# Queries | Chiro-Canto API v1 # Queries | Chiro-Canto API v1
## /api/v1/species ## `/api/v1/species`
Retrieve informations on species present in Chiro-Canto database Retrieve informations on species present in Chiro-Canto database
### Method: GET ### Method: `GET`
### Results: JSON ### Results: `JSON`
## `/api/v1/records`
### Method: `GET`
#### `cURL` command
```bash
curl -X GET https://chiro-canto.ortion.xyz/api/v1/records
```
### Results: `JSON`
#### Result sample
```json
{
"records": [
{
"id": 1,
"author_id": 9,
"recordist_name": "Samuel ORTION",
"file_name": "PaRecAR628069_20200526_040726.wav",
"url": "https://chiro-canto.ortion.xyz/storage/records/PaRecAR628069_20200526_040726.wav",
"license": "CC-by-nc-sa-4.0",
"species": "Pipistrellus pipistrellus",
"subspecies": "pipistrellus",
"sound": {
"types": [
"echolocation", "buzz"
],
"duration": "00:22",
"sample_rate": 384,
"time_expansion": 10
},
"recorder": {
"make": "TeensyRecorder",
"model": "ActiveRecorder",
"serial": "AR628069",
},
"location": {
"country": "France",
"lat": "47.87840601525087",
"lng": "0.21813243633005192"
},
"datetime": {
"date": "2020-05-26",
"time": "04:07:00"
},
"remarks": ""
},
{
...
}
]
}
```

0
public/api/v1/doc/md/README.md Normal file → Executable file
View File

0
public/api/v1/index.php Normal file → Executable file
View File

15
public/api/v1/oauth2/index.php Executable file
View File

@ -0,0 +1,15 @@
<?php
define("CALLBACK_URL", "https://chiro-canto.ortion.xyz/api/v1/oauth2/oauth2client.php");
define("AUTH_URL", "https://chiro-canto.ortion.xyz/api/v1/oauth2/authorize");
define("ACCESS_TOKEN_URL", "https://chiro-canto.ortion.xyz/api/v1/oauth2/token");
define("CLIENT_ID", "wsdfdcjdfvsfdvqwdi86Ubdf0");
define("CLIENT_SECRET", "g2OKQ9isj2pcaextQdjx5xW3KoAa");
define("SCOPE", ""); // optional
$url = AUTH_URL."?"
."response_type=code"
."&client_id".urlencode(CLIENT_ID)
."&scope=".urlencode(SCOPE)
."&redirect_uri".urlencode(CALLBACK_URL)
;
?>

View File

@ -0,0 +1,42 @@
<?php
function getToken(){
$curl = curl_init();
$params = array(
CURLOPT_URL => ACCESS_TOKEN_URL."?"
."code=".$code
."&grant_type=authorization_code"
."&client_id=". CLIENT_ID
."&client_secret=". CLIENT_SECRET
."&redirect_uri=". CALLBACK_URL,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_NOBODY => false,
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
"accept: *",
"accept-encoding: gzip, deflate",
),
);
curl_setopt_array($curl, $params);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #01: " . $err;
} else {
$response = json_decode($response, true);
if(array_key_exists("access_token", $response)) return $response;
if(array_key_exists("error", $response)) echo $response["error_description"];
echo "cURL Error #02: Something went wrong! Please contact admin.";
}
}

75
public/api/v1/records/index.php Executable file
View File

@ -0,0 +1,75 @@
<?php
function fill_record($id, $data) {
global $response;
$response['records'][$id] = array();
$response['records'][$id]['id'] = $data['id'];
$response['records'][$id]['author_id'] = $data['author_id'];
$response['records'][$id]['recordist_name'] = $data['recordist_name'];
$response['records'][$id]['file_name'] = $data['file_name'];
$response['records'][$id]['url'] = "https://".$_SERVER['SERVER_NAME']."/storage/records/".$data['file_name'];
$response['records'][$id]['license'] = $data['license'];
$response['records'][$id]['species'] = $data['species'];
$response['records'][$id]['subspecies'] = $data['subspecies'];
$response['records'][$id]['sound'] = array();
$response['records'][$id]['sound']['type'] = $data['sound_type'];
$response['records'][$id]['sound']['duration'] = $data['duration'];
$response['records'][$id]['sound']['sample_rate'] = $data['sample_rate'];
$response['records'][$id]['sound']['time_expansion'] = $data['time_expansion'];
$response['records'][$id]['recorder'] = array();
$response['records'][$id]['recorder']['make'] = $data['make'];
$response['records'][$id]['recorder']['model'] = $data['model'];
$response['records'][$id]['recorder']['serial'] = $data['serial'];
$response['records'][$id]['location'] = array();
$response['records'][$id]['location']['country'] = $data['country'];
$response['records'][$id]['location']['lat'] = $data['lat'];
$response['records'][$id]['location']['lng'] = $data['lng'];
$response['records'][$id]['datetime'] = array();
$response['records'][$id]['datetime']['date'] = $data['date'];
$response['records'][$id]['datetime']['time'] = $data['time'];
$response['records'][$id]['remarks'] = $data['remarks'];
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
header("Content-Type: application/json");
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require "$root/database/credentials.php";
// Connect the database
try{
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
$user,
$password,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
}catch (Exception $e){
die("Error : ".$e->getMessage());
}
$response = array();
if (isset($_GET['id'])) {
$req = $db->prepare('SELECT * FROM records WHERE id=:id');
$req->execute(array(
"id"=>$_GET['id']
));
if ($data = $req->fetch()) {
$response['records'] = array();
fill_record(0, $data);
} else {
$response['status'] = "Not found";
$response['message'] = "Can't fetch data for this record id.";
}
} else {
$req = $db->prepare('SELECT * FROM records');
$req->execute();
$result = $req->fetchAll();
$i = 0;
foreach($result as $row) {
fill_record($i, $row);
$i++;
}
}
echo json_encode($response);

0
public/articles/Article.php Normal file → Executable file
View File

0
public/articles/admin.php Normal file → Executable file
View File

0
public/articles/archive.php Normal file → Executable file
View File

0
public/articles/config.php Normal file → Executable file
View File

0
public/articles/edit.php Normal file → Executable file
View File

0
public/articles/home.php Normal file → Executable file
View File

0
public/articles/index.php Normal file → Executable file
View File

0
public/articles/list.php Normal file → Executable file
View File

0
public/articles/view.php Normal file → Executable file
View File

0
public/auth/login/index.php Normal file → Executable file
View File

0
public/auth/login/login.php Normal file → Executable file
View File

0
public/auth/register/index.php Normal file → Executable file
View File

0
public/auth/register/register.php Normal file → Executable file
View File

0
public/composer.json Normal file → Executable file
View File

0
public/composer.lock generated Normal file → Executable file
View File

0
public/contact/index.php Normal file → Executable file
View File

0
public/contact/sendmail.php Normal file → Executable file
View File

0
public/database/.~lock.TAXREF14.0_ORTHO.csv# Normal file → Executable file
View File

0
public/database/TAXREF14.0_CHIRO.csv Normal file → Executable file
View File

0
public/database/TAXREF14.0_ORTHO.csv Normal file → Executable file
View File

Can't render this file because it is too large.

0
public/database/articles.sql Normal file → Executable file
View File

0
public/database/authors.sql Normal file → Executable file
View File

0
public/database/categories.sql Normal file → Executable file
View File

0
public/database/create_authors.sql Normal file → Executable file
View File

0
public/database/create_record.sql Normal file → Executable file
View File

0
public/database/credentials.php Normal file → Executable file
View File

0
public/database/database entries.txt Normal file → Executable file
View File

0
public/database/records.sql Normal file → Executable file
View File

0
public/database/replies.sql Normal file → Executable file
View File

0
public/database/taxa.sql Normal file → Executable file
View File

0
public/database/topics.sql Normal file → Executable file
View File

0
public/explore/guano/index.php Normal file → Executable file
View File

25
public/explore/index.php Normal file → Executable file
View File

@ -21,8 +21,27 @@ include("$root/analytics/matomo.php");
<?php include("$root/menu.php");?> <?php include("$root/menu.php");?>
<?php include("$root/header.php");?> <?php include("$root/header.php");?>
<section> <section>
<h3>Explore</h3> <h2>Explore</h2>
<ul> <div class="explore wrapper">
<div class="list">
<a href="/explore/list"><img src="/media/icons/list.png" alt="list"></a>
</div>
<div class="spectro">
<a href="/explore/spectrograms"><img src="/media/pictures/spectrogram.png" alt="spectrogram"></a>
</div>
<div class="mystery">
<a href="/explore/mysteries"><img src="/media/icons/mystery.png" alt=""></a>
</div>
<div class="larynx">
<a href="/larynx"><img src="/media/icons/larynx.png" alt="human larynx"></a>
</div>
<div class="search">
<a href="/explore/search"><img src="/media/icons/search.png" alt="search"></a>
</div>
</div>
<!-- <ul>
<a href="list"> <a href="list">
<li>List Uploaded Recording</li> <li>List Uploaded Recording</li>
</a> </a>
@ -38,7 +57,7 @@ include("$root/analytics/matomo.php");
<a href="random"> <a href="random">
<li>Random Recording</li> <li>Random Recording</li>
</a> </a>
</ul> </ul> -->
</section> </section>
<?php include("$root/footer.php");?> <?php include("$root/footer.php");?>
</body> </body>

0
public/explore/list/index.php Normal file → Executable file
View File

0
public/explore/map/index.php Normal file → Executable file
View File

0
public/explore/map/scripts/map.js Normal file → Executable file
View File

0
public/explore/mysteries/index.php Normal file → Executable file
View File

0
public/explore/random/index.php Normal file → Executable file
View File

0
public/explore/search/index.php Normal file → Executable file
View File

0
public/explore/search/searchrecord.php Normal file → Executable file
View File

0
public/explore/spectrograms/index.php Normal file → Executable file
View File

0
public/explore/spectrograms/scripts/script.js Normal file → Executable file
View File

0
public/explore/spectrograms/scripts/spectro.js Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More