Added discussion page
This commit is contained in:
parent
692ba38598
commit
02c9b8bc07
@ -21,4 +21,9 @@ server {
|
|||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /storage/records {
|
||||||
|
autoindex on;
|
||||||
|
autoindex_exact_size on;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
20
public/analytics/owa.php
Normal file
20
public/analytics/owa.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!-- Start Open Web Analytics Tracker -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
var owa_baseUrl = 'https://owa.ortion.xyz/';
|
||||||
|
var owa_cmds = owa_cmds || [];
|
||||||
|
owa_cmds.push(['setSiteId', '3ac90ef71ec02f86b4e72262bc3513b1']);
|
||||||
|
owa_cmds.push(['trackPageView']);
|
||||||
|
owa_cmds.push(['trackClicks']);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
|
||||||
|
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
|
||||||
|
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
|
||||||
|
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
|
||||||
|
}());
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<!-- End Open Web Analytics Code -->
|
||||||
|
|
||||||
|
|
69
public/database/messages.sql
Normal file
69
public/database/messages.sql
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 5.1.0
|
||||||
|
-- https://www.phpmyadmin.net/
|
||||||
|
--
|
||||||
|
-- Host: localhost
|
||||||
|
-- Generation Time: Apr 17, 2021 at 10:08 AM
|
||||||
|
-- Server version: 10.4.18-MariaDB
|
||||||
|
-- PHP Version: 7.4.16
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
START TRANSACTION;
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Database: `chirocanto`
|
||||||
|
--
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `messages`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `messages` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`message_content` varchar(500) NOT NULL,
|
||||||
|
`message_by` int(8) NOT NULL,
|
||||||
|
`message_to` int(8) NOT NULL,
|
||||||
|
`message_datetime` datetime NOT NULL DEFAULT current_timestamp()
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `messages`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `messages` (`id`, `message_content`, `message_by`, `message_to`, `message_datetime`) VALUES
|
||||||
|
(1, 'dsfqsfd', 9, 9, '2021-04-17 10:48:43'),
|
||||||
|
(2, 'dsfqsfd', 9, 9, '2021-04-17 10:49:50');
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for dumped tables
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `messages`
|
||||||
|
--
|
||||||
|
ALTER TABLE `messages`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for dumped tables
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `messages`
|
||||||
|
--
|
||||||
|
ALTER TABLE `messages`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
107
public/discussion/messages/index.php
Normal file
107
public/discussion/messages/index.php
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
session_reset();
|
||||||
|
session_start();
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
$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());
|
||||||
|
}
|
||||||
|
if (isset($_SESSION['username'])) {
|
||||||
|
$req = $db->prepare('SELECT id FROM `authors` WHERE username=:username');
|
||||||
|
$req->execute(array(
|
||||||
|
"username"=>$_SESSION['username']
|
||||||
|
));
|
||||||
|
if ($data = $req->fetch()) {
|
||||||
|
$user_id = $data['id'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$_SESSION['error_msg'] = "You must be logged in to receive an send message.";
|
||||||
|
header('Location: /auth/login');
|
||||||
|
}
|
||||||
|
if (isset($_GET['author'])) {
|
||||||
|
$req = $db->prepare('SELECT * FROM `messages` WHERE message_by=:user_id AND message_to=:author_id OR message_by=:author_id AND message_to=:user_id ORDER BY message_datetime ASC');
|
||||||
|
$req->execute(array(
|
||||||
|
"author_id"=>$user_id,
|
||||||
|
"user_id"=>$_GET['author']
|
||||||
|
));
|
||||||
|
$result = $req->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
$req = $db->prepare('SELECT username FROM `authors` WHERE id=:id');
|
||||||
|
$req->execute(array(
|
||||||
|
"id"=>$_GET['author']
|
||||||
|
));
|
||||||
|
if ($data = $req->fetch()) {
|
||||||
|
$destinator = $data['username'];
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Explore | Chiro - Canto</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/styles/style.css">
|
||||||
|
</head>
|
||||||
|
<?php
|
||||||
|
include("$root/analytics/owa.php");
|
||||||
|
include("$root/analytics/matomo.php");
|
||||||
|
?>
|
||||||
|
<body>
|
||||||
|
<?php include("$root/menu.php");?>
|
||||||
|
<?php include("$root/header.php");?>
|
||||||
|
<section>
|
||||||
|
<h2>Discussion</h2>
|
||||||
|
<div class="messages">
|
||||||
|
<div class="author">
|
||||||
|
<?=$destinator?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
foreach($result as $message) {
|
||||||
|
if ($message['message_by'] == $_SESSION['username']) {
|
||||||
|
$class = "right";
|
||||||
|
} else {
|
||||||
|
$class = "left";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="message <?=$class?>">
|
||||||
|
<div class="datetime">
|
||||||
|
<?=$message['message_datetime']?>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<?=$message['message_content']?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
if (isset($user_id) and isset($_GET['author'])) {
|
||||||
|
?>
|
||||||
|
<form action="sendmessage.php" method="post">
|
||||||
|
<input type="hidden" name="message_by" value="<?=$user_id?>">
|
||||||
|
<input type="hidden" name="message_to" value="<?=$_GET['author']?>">
|
||||||
|
<input type="text" name="message_content" id="message_content" placeholder="Enter your message..">
|
||||||
|
<input type="submit" name="submit" value="Send">
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
<?php include("$root/footer.php");?>
|
||||||
|
</body>
|
||||||
|
<script src="/scripts/script.js"></script>
|
||||||
|
</html>
|
54
public/discussion/messages/sendmessage.php
Normal file
54
public/discussion/messages/sendmessage.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function sendmessage($message_content, $message_by, $message_to) {
|
||||||
|
global $db;
|
||||||
|
$req = $db->prepare('INSERT INTO `messages` (message_content, message_by, message_to, message_datetime) VALUES (:message_content, :message_by, :message_to, NOW())');
|
||||||
|
$req->execute(array(
|
||||||
|
"message_content"=>$message_content,
|
||||||
|
"message_by"=>$message_by,
|
||||||
|
"message_to"=>$message_to
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
session_reset();
|
||||||
|
session_start();
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
$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());
|
||||||
|
}
|
||||||
|
$_SESSION['error_msg'] = "";
|
||||||
|
if (isset($_POST['submit'])) {
|
||||||
|
if (isset($_POST['message_by'])) {
|
||||||
|
$message_by = $_POST['message_by'];
|
||||||
|
} else {
|
||||||
|
$_SESSION['error_msg'] .= "Error: No message author.\n";
|
||||||
|
}
|
||||||
|
if (isset($_POST['message_to'])) {
|
||||||
|
$message_to = $_POST['message_to'];
|
||||||
|
} else {
|
||||||
|
$_SESSION['error_msg'] .= "Error: No message destinator.\n";
|
||||||
|
} if (isset($_POST['message_content'])) {
|
||||||
|
$message_content = $_POST['message_content'];
|
||||||
|
} else {
|
||||||
|
$_SESSION['error_msg'] .= "Error: No message content.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_SESSION['error_msg']) and $_SESSION['error_msg'] != "") {
|
||||||
|
header('Location: /discussion');
|
||||||
|
} else {
|
||||||
|
sendmessage($message_content, $message_by, $message_to);
|
||||||
|
header('Location: /discussion/messages/?author='.$message_to);
|
||||||
|
}
|
||||||
|
}
|
@ -53,9 +53,9 @@ include("$root/analytics/matomo.php");
|
|||||||
foreach($result as $row) {
|
foreach($result as $row) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?=$row['firstname']?> <?=$row['lastname']?></th>
|
<td><?=$row['firstname']?> <?=$row['lastname']?></td>
|
||||||
<th><?=$row['username']?></th>
|
<td><?=$row['username']?></td>
|
||||||
<th><a href="/discussion/messages/?author=<?=$row['id']?>"><img src="/media/icons/bubble.png" alt="message bubble"></a></th>
|
<td><a href="/discussion/messages/?author=<?=$row['id']?>"><img src="/media/icons/bubble.png" alt="message bubble"></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|||||||
<title>Chiro - Canto</title>
|
<title>Chiro - Canto</title>
|
||||||
<link rel="stylesheet" type="text/css" href="styles/style.css">
|
<link rel="stylesheet" type="text/css" href="styles/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
<?php
|
||||||
|
include("$root/analytics/owa.php");
|
||||||
|
include("$root/analytics/matomo.php");
|
||||||
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php include("menu.php");?>
|
<?php include("menu.php");?>
|
||||||
<?php include("header.php");?>
|
<?php include("header.php");?>
|
||||||
|
@ -65,7 +65,7 @@ function measure(x, y) {
|
|||||||
x = (x - spectro_x);
|
x = (x - spectro_x);
|
||||||
y = -(-(-y + spectro_y) - spectro_height);
|
y = -(-(-y + spectro_y) - spectro_height);
|
||||||
let t = (x / spectro_width) * audio.duration;
|
let t = (x / spectro_width) * audio.duration;
|
||||||
let f = (y / spectro_height) * 24;
|
let f = (y / spectro_height) * 12;
|
||||||
let frequency_factor = 1;
|
let frequency_factor = 1;
|
||||||
if (document.getElementById('exp_x10').checked) {
|
if (document.getElementById('exp_x10').checked) {
|
||||||
frequency_factor = 10;
|
frequency_factor = 10;
|
||||||
|
0
public/storage/records/PaRecAR628069_20200526_040726.wav
Executable file → Normal file
0
public/storage/records/PaRecAR628069_20200526_040726.wav
Executable file → Normal file
@ -233,13 +233,13 @@ iframe html body {
|
|||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.row {
|
/* .container.row {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.column {
|
.container.column {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
} */
|
||||||
|
|
||||||
h3,
|
h3,
|
||||||
p {
|
p {
|
||||||
@ -357,8 +357,9 @@ table#replies td {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
width: 1840px;
|
max-width: 100vw;
|
||||||
height: 500px;
|
height: 10vh;
|
||||||
|
text-align: center;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,10 +367,6 @@ table#replies td {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#larynx {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#larynx .license {
|
#larynx .license {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
@ -626,3 +623,11 @@ i, .fa {
|
|||||||
height: 0.1em;
|
height: 0.1em;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message .content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: auto;
|
||||||
|
background-color: lightgreen;
|
||||||
|
border-radius: 8px 8px 0px 8px;
|
||||||
|
}
|
||||||
|
@ -142,9 +142,9 @@ if (isset($_POST['submit']))
|
|||||||
|
|
||||||
if ($_SESSION['error_msg'] == "")
|
if ($_SESSION['error_msg'] == "")
|
||||||
{
|
{
|
||||||
// header('Location: '.'index.php?step=verify');
|
header('Location: '.'index.php?step=verify');
|
||||||
} else{
|
} else{
|
||||||
$_SESSION['error_msg'] .= "Please try again.\n";
|
$_SESSION['error_msg'] .= "Please try again.\n";
|
||||||
// header('Location: '.'index.php?step=metadata');
|
header('Location: '.'index.php?step=metadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user