1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
websites_kartontage-de/index.php

199 lines
6.4 KiB
PHP
Raw Normal View History

2018-04-13 21:35:16 +02:00
<?php
try {
2019-02-16 00:22:58 +01:00
include 'config.php';
$conn = new PDO("mysql:dbname=$MYSQL_DBNAME;host=$MYSQL_HOST", $MYSQL_USERNAME, $MYSQL_PASSWORD);
2018-04-13 21:35:16 +02:00
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo "Webseite wird momentan überarbeitet";
}
function fetch_text($id) {
global $conn;
$stmt = $conn->prepare('select text from text where id = :id LIMIT 1;');
$stmt->bindParam(':id', $id);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
return $result['text'];
}
function timeformat($time) {
$t = strtotime($time);
if(date('i', $t) != 0) {
return strftime("%d.%m (%H.%M h)", $t);
}
return strftime("%d.%m (%H h)", $t);
}
$stmt = $conn->prepare('select DISTINCT LPAD( month(time), 2, \'0\') as `nr` from events_onwebsite');
$stmt->execute();
$first = true;
$timetitle = '';
$sitetitle = '';
foreach($stmt->fetchAll() as $month) {
if(!$first){
$timetitle .= '/';
$sitetitle .= '/';
}
$timetitle .= '<span>'.$month['nr'].'</span>';
$sitetitle .= $month['nr'];
$first = false;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
-->
<meta name="google-site-verification" content="<?=fetch_text('google-site-verification');?>" />
<meta charset="utf-8">
<title>Kartontage: <?=$sitetitle;?></title>
<meta name="description" content="<?=fetch_text('meta_description');?>">
<meta name="format-detection" content="telephone=no">
<meta name="author" content="">
<!-- Mobile Specific Metas
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
-->
2019-02-11 20:06:46 +01:00
<link rel="stylesheet" href="./static/css/fontawesome.min.css">
2018-04-13 21:35:16 +02:00
<!-- CSS
-->
<link rel="stylesheet" href="./static/css/normalize.css">
<link rel="stylesheet" href="./static/css/skeleton.css">
<link rel="stylesheet" href="./static/css/custom.css">
<!-- Scripts
-->
2019-02-11 20:06:46 +01:00
<script type="text/javascript" src="./static/jquery.min.js"></script>
2018-04-13 21:35:16 +02:00
<script type="text/javascript" src="./static/app.js"></script>
<!-- Favicon
-->
<link rel="icon" type="image/png" href="./static/img/favicon.png">
</head>
<body>
<!-- Primary Page Layout
-->
<div class="section">
<div class="container header">
<div class="row">
<?php
$stmt = $conn->prepare('select * from places');
$stmt->execute();
$first = true;
foreach($stmt->fetchAll() as $place) {
?>
<?php if(!$first){ ?>
<div class="c-space"><a href="?"><img class="spacer" src="./static/img/spacer.png"/></a></div>
<?php } $first = false;?>
<div class="c"><a href="?places_id=<?=$place['id']?>"><img id="<?=$place['id']?>" src="./static/img/<?=$place['id']?>.png"/></a></div>
<?php } ?>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="row">
<?php
$stmt = $conn->prepare('select * from places');
if(isset($_GET["places_id"])){
$stmt = $conn->prepare('select * from places where id = :id');
$stmt->bindParam(':id', $_GET["places_id"]);
}
$stmt->execute();
// set the resulting array to associative
foreach($stmt->fetchAll() as $place) {
?>
<div class="one-half column<?php if(isset($_GET["places_id"])){echo " one";} if($place["id"] % 2){ echo " odd"; }else{ echo " even"; } ?>">
<h3 class="title"><?=$timetitle;?></h3>
<?php
$stmt = $conn->prepare('select * from events_onwebsite where places_id = :id');
$stmt->bindParam(':id', $place["id"]);
$stmt->execute();
foreach($stmt->fetchAll() as $event) {
?>
<div class="seperator">
<div class="time"><?=timeformat($event['time']);?></div>
<div class="head">
<span>
<?php if(strlen($event['url']) > 1 ) { ?>
2019-02-11 21:54:00 +01:00
<a href="<?=$event['url'];?>"><?=$event['title'];?>&nbsp;<i class="fas fa-link"></i></a>
2018-04-13 21:35:16 +02:00
<?php
} else {
echo $event['title'];
}
?>
</span>
<?php if(strlen($event['ticket']) > 1 ) { ?>
2019-02-11 21:54:00 +01:00
<a href="<?=$event['ticket'];?>"><i class="fas fa-ticket-alt" aria-hidden="true"></i></a>
2018-04-13 21:35:16 +02:00
<?php } ?>
</div>
<div class="desc"><?=$event['description'];?></div>
</div>
<?php } ?>
<div class="seperator">
<?php if(strlen($place['time']) > 1 ) { ?>
<div class="maintime"><?=$place['time'];?></div>
<br/>
<?php }
2019-02-11 20:06:05 +01:00
if(strlen($place['mastodon']) > 1 ) { ?>
2019-02-11 20:06:46 +01:00
&nbsp;
2019-02-11 20:06:05 +01:00
<a href="<?=$place['mastodon'];?>" target="_blank">
2019-02-11 20:06:46 +01:00
<i class="fab fa-mastodon fa-2x"></i>
2019-02-11 20:06:05 +01:00
</a>
<?php }
if(strlen($place['pixelfed']) > 1 ) { ?>
2019-02-11 20:06:46 +01:00
&nbsp;
2019-02-11 20:06:05 +01:00
<a href="<?=$place['pixelfed'];?>" target="_blank">
2019-02-11 20:06:46 +01:00
<i class="fab fa-pixelfed fa-2x"></i>
2019-02-11 20:06:05 +01:00
</a>
<?php }
2019-02-11 19:49:32 +01:00
if(strlen($place['facebook']) > 1 ) { ?>
2019-02-11 20:06:46 +01:00
&nbsp;
2019-02-11 19:49:32 +01:00
<a href="<?=$place['facebook'];?>" target="_blank">
2019-02-11 20:06:46 +01:00
<i class="fab fa-facebook fa-2x"></i>
2018-04-13 21:35:16 +02:00
</a>
2019-02-11 19:49:32 +01:00
<?php }
if(strlen($place['instagram']) > 1 ) { ?>
2019-02-11 20:06:46 +01:00
&nbsp;
2019-02-11 19:49:32 +01:00
<a href="<?=$place['instagram'];?>" target="_blank">
2019-02-11 20:06:46 +01:00
<i class="fab fa-instagram fa-2x"></i>
2019-02-11 19:49:32 +01:00
</a>
2018-04-13 21:35:16 +02:00
<?php } ?>
</div>
&nbsp;
</div>
<?php } ?>
</div>
</div>
</div>
<div class="section">
<div class="container footer">
<div class="text">
<?=fetch_text('impressum'); ?>
</div>
<div class="title">
Impressum
</div>
</div>
</div>
</body>
</html>
<?php
$conn = null;
?>