heliohost adjustments
This commit is contained in:
@@ -4,6 +4,8 @@ CSSO = node_modules/csso-cli/bin/csso
|
||||
|
||||
RES_LIST = 64 128 256 512
|
||||
|
||||
ANDROID_CHROME_ICON_RES_LIST
|
||||
|
||||
cssFiles = $(wildcard src/css/*.css)
|
||||
mdFiles = $(wildcard src/md/*.md)
|
||||
phpFiles = $(patsubst src/md/%.md, build/%.php, $(mdFiles))
|
||||
@@ -162,7 +164,7 @@ build/graphiken/cwsvLogoWappen/cwsvLogoWappen.%w.png: build/graphiken/cwsvLogoWa
|
||||
|
||||
|
||||
.PHONY: favIcons
|
||||
favIcons: build/graphiken/favIcons/favicon.ico
|
||||
favIcons: build/graphiken/favIcons/favicon.ico build/graphiken/favIcons/apple-touch-icon.png
|
||||
|
||||
build/graphiken/favIcons/favicon.ico: build/graphiken/cwsvJudoLogoWappen/cwsvJudoLogoWappen.png
|
||||
mkdir -p $(dir $@)
|
||||
@@ -173,3 +175,15 @@ build/graphiken/favIcons/favicon.ico: build/graphiken/cwsvJudoLogoWappen/cwsvJud
|
||||
-alpha on \
|
||||
-define icon:auto-resize=64,48,32,16 \
|
||||
$@
|
||||
|
||||
build/graphiken/favIcons/apple-touch-icon.png: build/graphiken/cwsvJudoLogoWappen/cwsvJudoLogoWappen.png
|
||||
mkdir -p $(dir $@)
|
||||
convert $< \
|
||||
-background transparent \
|
||||
-gravity center \
|
||||
-resize 180x180 \
|
||||
-extent 180x180 \
|
||||
$@
|
||||
pngquant --speed 1 --ext .png --force $@
|
||||
zopflipng -y --iterations=500 --filters=01234mepb --lossy_8bit --lossy_transparent $@ $@
|
||||
|
||||
|
||||
7
homepage/cwsvJudo/mirror-heliohost-graphics.sh
Normal file
7
homepage/cwsvJudo/mirror-heliohost-graphics.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
open cwsvjudo@cwsvjudo.helioho.st
|
||||
set ssl:verify-certificate no
|
||||
set ftp:ssl-allow off
|
||||
mirror --verbose --continue --parallel=8 --reverse ./build/graphiken/cwsvJudoLogoWappen /httpdocs/ressourcen/graphiken/logos
|
||||
mirror --verbose --continue --parallel=8 --reverse ./build/graphiken/cwsvLogoWappen /httpdocs/ressourcen/graphiken/logos
|
||||
put -e -O /httpdocs/ ./build/graphiken/favIcons/apple-touch-icon.png
|
||||
exit
|
||||
3
homepage/cwsvJudo/participo/config-heliohost/.htaccess
Normal file
3
homepage/cwsvJudo/participo/config-heliohost/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
||||
order deny,allow
|
||||
deny from all
|
||||
allow from localhost
|
||||
13
homepage/cwsvJudo/participo/config-heliohost/participo.php
Normal file
13
homepage/cwsvJudo/participo/config-heliohost/participo.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/// @file some variable definitions
|
||||
|
||||
$config["home"] = "/home/cwsvjudo.helioho.st";
|
||||
$config['basePath'] = $config["home"] . '/httpdocs';
|
||||
$config['baseUrl'] = 'https://cwsvjudo.helioho.st';
|
||||
$config['ressourceUrl'] = 'https://cwsvjudo.helioho.st/ressourcen';
|
||||
|
||||
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
set_include_path(implode(
|
||||
PATH_SEPARATOR,
|
||||
[get_include_path(), $config['basePath'], $config['basePath'] . '/ressourcen', $config['basePath'] . '/ressourcen/phpLib', './lib/']
|
||||
));
|
||||
@@ -0,0 +1,3 @@
|
||||
order deny,allow
|
||||
deny from all
|
||||
allow from localhost
|
||||
@@ -3,8 +3,8 @@
|
||||
<nav class="indigo darken-4">
|
||||
<div class="nav-wrapper">
|
||||
<div class="col s12">
|
||||
<a href="http://cwsvjudo.bplaced.net/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="http://cwsvjudo.bplaced.net/participo/admin" class="breadcrumb">
|
||||
<a href="/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="/participo/admin" class="breadcrumb">
|
||||
<?php echo($meta['title']); ?>
|
||||
</a>
|
||||
<a class="right top-nav sidenav-trigger waves-effect waves-light hide-on-large-only" href="#"
|
||||
@@ -24,7 +24,7 @@
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img"
|
||||
src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<!-- brings its own li -->
|
||||
|
||||
@@ -9,6 +9,7 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
require_once './lib/db.php';
|
||||
require_once './lib/api.php';
|
||||
require_once './lib/participoLib/participo.php';
|
||||
require_once './lib/participoLib/user.php';
|
||||
|
||||
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
|
||||
require_once $config['basePath'] . '/config/phpcount.config.php';
|
||||
@@ -21,7 +22,7 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
$user = participo::sessionUser();
|
||||
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
abstract class AttendanceType
|
||||
@@ -265,23 +266,23 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
|
||||
<header>
|
||||
<nav class="indigo darken-4">
|
||||
<a href="http://cwsvjudo.bplaced.net/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="http://cwsvjudo.bplaced.net/participo/attendance" class="breadcrumb">Anwesenheit</a>
|
||||
<a href="/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="/participo/attendance" class="breadcrumb">Anwesenheit</a>
|
||||
<a class="right top-nav sidenav-trigger waves-effect waves-light hide-on-large-only" href="#" data-target="nav-mobile"><i class="material-icons">menu</i></a>
|
||||
</nav>
|
||||
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<?php require_once 'sidenav/loginStatus.php'; ?><!-- brings its own li -->
|
||||
<li class="bold">
|
||||
<a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($userData['id']); ?>">Selber</a>
|
||||
<a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($user->getId()); ?>">Selber</a>
|
||||
</li>
|
||||
<?php
|
||||
foreach ($usersKids as $k) {
|
||||
if ($userData['id'] == $k['id']) {
|
||||
if ($user->getId() == $k['id']) {
|
||||
continue;
|
||||
} ?>
|
||||
<li class="bold">
|
||||
@@ -301,8 +302,8 @@ if ($_SESSION['login']) {
|
||||
$ownAttendances = Attendance::getUsersAttendance(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
if (!empty($ownAttendances)) {
|
||||
echo(
|
||||
'<h2 id="attendance-' . $userData['id'] . '">Eigene Anwesenheiten</h2>' .
|
||||
Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $userData['id'])
|
||||
'<h2 id="attendance-' . $user->getId() . '">Eigene Anwesenheiten</h2>' .
|
||||
Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $user->getId())
|
||||
);
|
||||
require_once './lib/participoLib/participo.php';
|
||||
}
|
||||
@@ -310,7 +311,7 @@ if ($_SESSION['login']) {
|
||||
if (!empty($usersKids)) {
|
||||
echo('<h2>Anwesenheit der Kinder</h2>');
|
||||
foreach ($usersKids as $k) {
|
||||
if ($userData['id'] == $k['kidId']) {
|
||||
if ($user->getId() == $k['kidId']) {
|
||||
continue;
|
||||
}
|
||||
echo(
|
||||
|
||||
@@ -24,8 +24,6 @@ dbConnector::connect(
|
||||
|
||||
participo::authentificate();
|
||||
|
||||
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
$meta = [
|
||||
'title' => 'Event Planer',
|
||||
'description' => 'Planung von (Nicht-)Teilnahmen an Wettkämpfen und anderen Veranstaltungen'
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div>
|
||||
<nav class="indigo darken-4">
|
||||
<div class="nav-wrapper">
|
||||
<a href="http://cwsvjudo.bplaced.net/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="http://cwsvjudo.bplaced.net/participo/events" class="breadcrumb">
|
||||
<a href="/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="/participo/events" class="breadcrumb">
|
||||
<?php echo($meta['title']); ?>
|
||||
</a>
|
||||
<a class="right top-nav sidenav-trigger waves-effect waves-light hide-on-large-only" href="#"
|
||||
@@ -22,7 +22,7 @@
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img"
|
||||
src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<!-- brings its own li -->
|
||||
|
||||
@@ -6,7 +6,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . "./lib/");
|
||||
// @todo Check and replace obsolete ones
|
||||
require_once 'config/participo.php';
|
||||
// require_once 'config/phpcount.config.php';
|
||||
require_once 'local/cwsvJudo.php';
|
||||
require_once $config['home'] . '/.local/cwsvJudo.config.php';
|
||||
|
||||
// legacy lib usage
|
||||
// @todo remove unused libraries
|
||||
@@ -33,6 +33,3 @@ dbConnector::connect(
|
||||
|
||||
// authentication of the current user
|
||||
participo::authentificate();
|
||||
|
||||
// load the userData
|
||||
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<title>participo</title>
|
||||
<meta name="description" content="Online-Apps der Judoka des Chemnitzer WSV">
|
||||
|
||||
<link rel="icon" href="<?echo($config['ressourceUrl']);?>/graphiken/icons/cwsv.ico" />
|
||||
<link rel="apple-touch-icon" href="<?echo($config['baseUrl']);?>/apple-touch-icon.png">
|
||||
<link rel="icon" href="<?php echo($config['ressourceUrl']);?>/graphiken/icons/cwsv.ico" />
|
||||
<link rel="apple-touch-icon" href="<?php echo($config['baseUrl']);?>/apple-touch-icon.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -29,7 +29,7 @@
|
||||
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="<?php echo($config['ressourceUrl']);?>/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<?php require_once 'sidenav/loginStatus.php'; ?><!-- brings its own li -->
|
||||
@@ -45,7 +45,7 @@
|
||||
<li class="bold">
|
||||
<a class="waves-effect waves-teal right-align" href="#configApps">Einstellen<i class="material-icons">settings</i></a>
|
||||
</li>
|
||||
<?php if (participo::isUserAdmin($userData['id'])) {?>
|
||||
<?php if (participo::isUserAdmin()) {?>
|
||||
<li class="bold">
|
||||
<a class="waves-effect waves-teal right-align" href="#admiStuff">adminStuff</a>
|
||||
</li>
|
||||
@@ -101,7 +101,7 @@ echo(
|
||||
'link' => 'attendance',
|
||||
'title' => 'Teilnahme',
|
||||
'description' => 'Eine kleine Übersicht, wie wie oft man beim Training war',
|
||||
'imgUrl' => 'http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/calendarIcon.svg',
|
||||
'imgUrl' => $config['ressourceUrl'].'/graphiken/icons/calendarIcon.svg',
|
||||
'actions' => [
|
||||
AppCardAction::fromArray(['caption' => 'Anwesenheit', 'link' => 'attendance']),
|
||||
],
|
||||
@@ -127,7 +127,7 @@ echo(
|
||||
'link' => '/JudoWiki',
|
||||
'title' => 'JudoWiki',
|
||||
'description' => 'Ein Wiki zum Thema Judo',
|
||||
'imgUrl' => 'http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/wikipediaW.svg',
|
||||
'imgUrl' => $config['ressourceUrl'].'/graphiken/icons/wikipediaW.svg',
|
||||
'actions' => [
|
||||
AppCardAction::fromArray(['caption' => 'JudoWiki', 'link' => '/JudoWiki']),
|
||||
],
|
||||
@@ -154,10 +154,10 @@ echo(
|
||||
</div> <!-- configApps -->
|
||||
<?php
|
||||
// AdminStuff, thats only visible for Admins
|
||||
if (participo::isUserAdmin($userData['id'])) {
|
||||
if (participo::isUserAdmin()) {
|
||||
echo(
|
||||
'<h2>AdminStuff</h2>' .
|
||||
'<div id="admiStuff" class="row">' .
|
||||
'<div id="adminStuff" class="row">' .
|
||||
AppCard::fromArray([
|
||||
'title' => 'lastLogins',
|
||||
'description' => '</p>' . lastLoginTable() . '</p>'
|
||||
|
||||
@@ -62,7 +62,7 @@ $years = array_unique($years);
|
||||
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
<img style="max-width:100%;height:12vh;" class="responsive-img" src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<li><?php require_once 'sidenav/loginStatus.php'; ?></li>
|
||||
|
||||
@@ -234,7 +234,7 @@ function ytLightEmbed($item){
|
||||
<li>
|
||||
<a
|
||||
title="Seite auf HTML 5 Konformität prüfen"
|
||||
href="http://validator.w3.org/check?uri=<?php echo(urlencode(getCurPagesUrl()));?>"
|
||||
href="https://validator.w3.org/check?uri=<?php echo(urlencode(getCurPagesUrl()));?>"
|
||||
rel="nofollow"
|
||||
>Valid <img
|
||||
src="/ressourcen/graphiken/icons/HTML5_1Color_Black.svg"
|
||||
|
||||
@@ -144,15 +144,14 @@ function changePassword($db, $changerId, $changeeId, $changerPassword, $newPassw
|
||||
{
|
||||
// we need a dbConnection
|
||||
if (!$db) {
|
||||
// echo("No DB!");
|
||||
return false;
|
||||
}
|
||||
// echo("No DB!");
|
||||
return false;
|
||||
}
|
||||
|
||||
$changerInfo = getUserData($db, $changerId);
|
||||
$changer = User::loadFromDb($db, $changerId);
|
||||
|
||||
// check the password of the changer
|
||||
if (!password_verify($changerPassword, $changerInfo['pwHash'])) {
|
||||
// echo("Wrong changerPasswod");
|
||||
if (!password_verify($changerPassword, $changer->getPwHash())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,17 +254,6 @@ function isUserAdmin($dbConn, $userId){
|
||||
return false;
|
||||
}
|
||||
|
||||
function getUserData($db, $userId){
|
||||
$query = <<<SQL
|
||||
SELECT *
|
||||
FROM `cwsvjudo`.`wkParticipo_Users`
|
||||
WHERE `id` = :userId;
|
||||
SQL;
|
||||
$params = [':userId'=>['value'=>$userId, 'data_type'=>PDO::PARAM_INT]];
|
||||
$userData = dbQuery($db, $query, $params);
|
||||
return $userData[0];
|
||||
}
|
||||
|
||||
function getAchievements($db){
|
||||
$query = <<<SQL
|
||||
SELECT *
|
||||
@@ -380,24 +369,6 @@ SQL;
|
||||
return;
|
||||
}
|
||||
|
||||
function setRecord($db, $userId, $achievementGroupId, $value){
|
||||
$u = getUserData($db, $userId);
|
||||
$query = <<<SQL
|
||||
INSERT `cwsvjudo`.`machs_records`
|
||||
SET achievementGroupId=:achievementGroupId, ageClass=:ageClass, userId=:userId, value=:value
|
||||
SQL;
|
||||
$params=[
|
||||
':achievementGroupId' => ['value'=>$achievementGroupId, 'data_type'=>PDO::PARAM_INT],
|
||||
':ageClass' => ['value'=>record::birthday2ageClass($u['gebDatum']), 'data_type'=>PDO::PARAM_INT],
|
||||
':userId' => ['value'=>$userId, 'data_type'=>PDO::PARAM_INT],
|
||||
':value' => ['value'=>$value, 'data_type'=>PDO::PARAM_INT],
|
||||
];
|
||||
dbQuery($db, $query, $params, ['dontFetch'=>true]);
|
||||
//var_dump($userId, $achievementGroupId, $value);
|
||||
//var_dump($query, $params);
|
||||
return;
|
||||
}
|
||||
|
||||
function canUserGetAchievementToday($db, $userId){
|
||||
$achievements = getUsersAchievements($db, $userId);
|
||||
foreach($achievements as $a){
|
||||
|
||||
@@ -83,7 +83,7 @@ class AgeGroup
|
||||
|
||||
preg_match($akUmatchString, $label, $matches);
|
||||
// The found match should cover the whole string. Otherwise it isn't applicable.
|
||||
if ($matches[0] == $label) {
|
||||
if (!empty($matches) && $matches[0] == $label) {
|
||||
// The x in Ux should be a positive integer.
|
||||
$ageLimit = filterPosInt($matches[2]);
|
||||
if ($ageLimit) {
|
||||
@@ -121,7 +121,7 @@ class AgeGroup
|
||||
preg_match($akUmatchString, $label, $matches);
|
||||
// The found match should cover the whole string. Otherwise it isn't applicable.
|
||||
|
||||
if ($matches[0] == $label) {
|
||||
if (!empty($matches) && $matches[0] == $label) {
|
||||
$lowerYear = filterPosInt($matches[1]);
|
||||
$upperYear = filterPosInt($matches[2]);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class Event
|
||||
*/
|
||||
private static function loadFromDbById(int $id)
|
||||
{
|
||||
$query = 'SELECT * FROM `cwsvjudo`.`wkParticipo_Events` WHERE `id` = :id;';
|
||||
$query = 'SELECT * FROM `wkParticipo_Events` WHERE `id` = :id;';
|
||||
$params = [':id' => ['value' => $id, 'data_type' => PDO::PARAM_INT]];
|
||||
$response = dbConnector::query($query, $params);
|
||||
|
||||
@@ -342,7 +342,7 @@ class Event
|
||||
|
||||
public static function getSeatCountOf(int $id)
|
||||
{
|
||||
$query = 'SELECT SUM(plaetze) AS sumSeats FROM `cwsvjudo`.`wkParticipo_Fahrten` WHERE eventId = :eventId;';
|
||||
$query = 'SELECT SUM(plaetze) AS sumSeats FROM `wkParticipo_Fahrten` WHERE eventId = :eventId;';
|
||||
$params = [
|
||||
'eventId' => ['value' => $id, 'data_type' => PDO::PARAM_INT]
|
||||
];
|
||||
|
||||
@@ -129,7 +129,7 @@ class Shiai
|
||||
$id = filterId($id);
|
||||
|
||||
$query =
|
||||
"SELECT * FROM `cwsvjudo`.`wettkampfkalender` WHERE `lfdeNr` = :id;";
|
||||
"SELECT * FROM `wettkampfkalender` WHERE `lfdeNr` = :id;";
|
||||
$params = [":id" => ["value" => $id, "data_type" => PDO::PARAM_INT]];
|
||||
$response = dbConnector::query($query, $params);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class Starter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->$result = filter_var($r, FILTER_VALIDATE_INT, ['options' => ['default' => null, 'min_range' => 0]]);
|
||||
$this->$result = filter_var($result, FILTER_VALIDATE_INT, ['options' => ['default' => null, 'min_range' => 0]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,10 +254,19 @@ class User
|
||||
public function getDateOfBirth(){
|
||||
return $this->dateOfBirth;
|
||||
}
|
||||
|
||||
public function getStrBirthday(){
|
||||
return $this->dateOfBirth->format("Y-m-d");
|
||||
}
|
||||
|
||||
public function getEmail(){
|
||||
return $this->eMail;
|
||||
}
|
||||
|
||||
public function getPwHash(){
|
||||
return $this->pwHash;
|
||||
}
|
||||
|
||||
// static functions
|
||||
|
||||
/** Create a User from an assoziative array like it is returned from db requests
|
||||
|
||||
@@ -6,7 +6,7 @@ require_once 'participoLib/apiKey.php';
|
||||
|
||||
require_once './local/dbConf.php';
|
||||
|
||||
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
|
||||
require_once $config['home'] . '/.local/cwsvJudo.config.php';
|
||||
|
||||
$dbConnection = dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['host'],
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
/*
|
||||
* phpcount.php Ver.1.1- An "anoymizing" hit counter.
|
||||
* Copyright (C) 2013 Taylor Hornby
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This PHP Class provides a hit counter that is able to track unique hits
|
||||
* without recording the visitor's IP address in the database. It does so by
|
||||
* recording the hash of the IP address and page name.
|
||||
*
|
||||
* By hashing the IP address with page name as salt, you prevent yourself from
|
||||
* being able to track a user as they navigate your site. You also prevent
|
||||
* yourself from being able to recover anyone's IP address without brute forcing
|
||||
* through all of the assigned IP address blocks in use by the internet.
|
||||
*
|
||||
* Contact: havoc AT defuse.ca
|
||||
* WWW: https://defuse.ca/
|
||||
*
|
||||
* USAGE:
|
||||
* In your script, use reqire_once() to import this script, then call the
|
||||
* functions like PHPCount::AddHit(...); See each function for help.
|
||||
*
|
||||
* NOTE: You must set the database credentials in the InitDB method.
|
||||
*/
|
||||
|
||||
// global $phpcountConfig;
|
||||
// var_dump($phpcountConfig);
|
||||
|
||||
|
||||
class PHPCount
|
||||
{
|
||||
/*
|
||||
* Defines how many seconds a hit should be rememberd for. This prevents the
|
||||
* database from perpetually increasing in size. Thirty days (the default)
|
||||
* works well. If someone visits a page and comes back in a month, it will be
|
||||
* counted as another unique hit.
|
||||
*/
|
||||
const HIT_OLD_AFTER_SECONDS = 2592000; // default: 30 days.
|
||||
|
||||
// Don't count hits from search robots and crawlers.
|
||||
const IGNORE_SEARCH_BOTS = true;
|
||||
|
||||
// Don't count the hit if the browser sends the DNT: 1 header.
|
||||
const HONOR_DO_NOT_TRACK = false;
|
||||
|
||||
private static $IP_IGNORE_LIST = array(
|
||||
'127.0.0.1',
|
||||
);
|
||||
|
||||
private static $DB = false;
|
||||
|
||||
private static function InitDB()
|
||||
{
|
||||
global $phpcountConfig;
|
||||
// var_dump($phpcountConfig);
|
||||
|
||||
if(self::$DB)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: Set the database login credentials.
|
||||
//echo("<!--");
|
||||
// var_dump($phpcountConfig);
|
||||
self::$DB = new PDO(
|
||||
'mysql:host='.$phpcountConfig["db"]["host"] .';dbname='.$phpcountConfig["db"]["name"],
|
||||
$phpcountConfig["db"]["user"], // Username
|
||||
$phpcountConfig["db"]["password"]//, // Password
|
||||
//array(PDO::ATTR_PERSISTENT => true)
|
||||
);
|
||||
//echo("-->");
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
self::$DB = false;
|
||||
echo("Failed to connect to phpcount database (".$e->getMessage().")\n");
|
||||
// die('Failed to connect to phpcount database ('.$e->getMessage().')');
|
||||
}
|
||||
}
|
||||
|
||||
public static function setDBAdapter($db)
|
||||
{
|
||||
self::$DB = $db;
|
||||
return $db;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a hit to a page specified by a unique $pageID string.
|
||||
*/
|
||||
public static function AddHit($pageID)
|
||||
{
|
||||
if(self::IGNORE_SEARCH_BOTS && self::IsSearchBot())
|
||||
return false;
|
||||
if(in_array($_SERVER['REMOTE_ADDR'], self::$IP_IGNORE_LIST))
|
||||
return false;
|
||||
if(
|
||||
self::HONOR_DO_NOT_TRACK &&
|
||||
isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == "1"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::InitDB();
|
||||
|
||||
self::Cleanup();
|
||||
if(self::UniqueHit($pageID))
|
||||
{
|
||||
self::CountHit($pageID, true);
|
||||
self::LogHit($pageID);
|
||||
}
|
||||
self::CountHit($pageID, false);
|
||||
|
||||
self::LogPageHit($pageID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns (int) the amount of hits a page has
|
||||
* $pageID - the page identifier
|
||||
* $unique - true if you want unique hit count
|
||||
*/
|
||||
public static function GetHits($pageID, $unique = false){
|
||||
global $phpcountConfig;
|
||||
self::InitDB();
|
||||
|
||||
try{
|
||||
$q = self::$DB->prepare(
|
||||
'SELECT hitcount FROM '.$phpcountConfig["db"]["hitsTable"].'
|
||||
WHERE pageid = :pageid AND isunique = :isunique'
|
||||
);
|
||||
$q->bindParam(':pageid', $pageID);
|
||||
$q->bindParam(':isunique', $unique);
|
||||
$q->execute();
|
||||
}
|
||||
catch(Exeption $e){
|
||||
echo("Failed to getHits from phpcount database (".$e->getMessage().")\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(($res = $q->fetch()) !== FALSE)
|
||||
{
|
||||
return (int)$res['hitcount'];
|
||||
}
|
||||
else
|
||||
{
|
||||
//die("Missing hit count from database!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the total amount of hits to the entire website
|
||||
* When $unique is FALSE, it returns the sum of all non-unique hit counts
|
||||
* for every page. When $unique is TRUE, it returns the sum of all unique
|
||||
* hit counts for every page, so the value that's returned IS NOT the
|
||||
* amount of site-wide unique hits, it is the sum of each page's unique
|
||||
* hit count.
|
||||
*/
|
||||
public static function GetTotalHits($unique = false){
|
||||
global $phpcountConfig;
|
||||
|
||||
self::InitDB();
|
||||
|
||||
$q = self::$DB->prepare(
|
||||
'SELECT hitcount FROM '.$phpcountConfig["db"]["hitsTable"].' WHERE isunique = :isunique'
|
||||
);
|
||||
$q->bindParam(':isunique', $unique);
|
||||
$q->execute();
|
||||
$rows = $q->fetchAll();
|
||||
|
||||
$total = 0;
|
||||
foreach($rows as $row)
|
||||
{
|
||||
$total += (int)$row['hitcount'];
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
/*====================== PRIVATE METHODS =============================*/
|
||||
|
||||
private static function IsSearchBot()
|
||||
{
|
||||
// Of course, this is not perfect, but it at least catches the major
|
||||
// search engines that index most often.
|
||||
$keywords = array(
|
||||
'bot',
|
||||
'spider',
|
||||
'spyder',
|
||||
'crawler',
|
||||
'walker',
|
||||
'search',
|
||||
'yahoo',
|
||||
'holmes',
|
||||
'htdig',
|
||||
'archive',
|
||||
'tineye',
|
||||
'yacy',
|
||||
'yeti',
|
||||
'Chrome-Lighthouse',
|
||||
'Barkrowler',
|
||||
);
|
||||
|
||||
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
foreach($keywords as $keyword)
|
||||
{
|
||||
if(strpos($agent, $keyword) !== false)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function UniqueHit($pageID){
|
||||
global $phpcountConfig;
|
||||
|
||||
$ids_hash = self::IDHash($pageID);
|
||||
|
||||
$q = self::$DB->prepare(
|
||||
'SELECT `time` FROM '.$phpcountConfig["db"]["nodupesTable"].' WHERE ids_hash = :ids_hash'
|
||||
);
|
||||
$q->bindParam(':ids_hash', $ids_hash);
|
||||
$q->execute();
|
||||
|
||||
if(($res = $q->fetch()) !== false)
|
||||
{
|
||||
if($res['time'] > time() - self::HIT_OLD_AFTER_SECONDS)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static function LogHit($pageID){
|
||||
global $phpcountConfig;
|
||||
|
||||
$ids_hash = self::IDHash($pageID);
|
||||
|
||||
$q = self::$DB->prepare(
|
||||
'SELECT `time` FROM '.$phpcountConfig["db"]["nodupesTable"].' WHERE ids_hash = :ids_hash'
|
||||
);
|
||||
$q->bindParam(':ids_hash', $ids_hash);
|
||||
$q->execute();
|
||||
|
||||
$curTime = time();
|
||||
|
||||
if(($res = $q->fetch()) !== false)
|
||||
{
|
||||
$s = self::$DB->prepare(
|
||||
'UPDATE '.$phpcountConfig["db"]["nodupesTable"].' SET `time` = :time WHERE ids_hash = :ids_hash'
|
||||
);
|
||||
$s->bindParam(':time', $curTime);
|
||||
$s->bindParam(':ids_hash', $ids_hash);
|
||||
$s->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$s = self::$DB->prepare(
|
||||
'INSERT INTO '.$phpcountConfig["db"]["nodupesTable"].' (ids_hash, `time`)
|
||||
VALUES( :ids_hash, :time )'
|
||||
);
|
||||
$s->bindParam(':time', $curTime);
|
||||
$s->bindParam(':ids_hash', $ids_hash);
|
||||
$s->execute();
|
||||
}
|
||||
}
|
||||
|
||||
private static function LogPageHit($pageId){
|
||||
global $phpcountConfig;
|
||||
|
||||
try{
|
||||
$q = self::$DB->prepare(
|
||||
'INSERT INTO '.$phpcountConfig["db"]["pagehitsTable"].' (userHash, pageId, userAgentString) VALUES (:idsHash, :pageId, :userAgentString);'
|
||||
);
|
||||
$q->bindParam(':idsHash', self::userHash());
|
||||
$q->bindParam(':pageId', $pageId);
|
||||
$q->bindParam(':userAgentString', $_SERVER['HTTP_USER_AGENT']);
|
||||
$q->execute();
|
||||
}
|
||||
catch(Exeption $e){
|
||||
echo("Failed to logPageHits to phpcount database (".$e->getMessage().")\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static function CountHit($pageID, $unique){
|
||||
global $phpcountConfig;
|
||||
|
||||
//echo("DEBUG: Counting Hit on ".$pageID."\n");
|
||||
try{
|
||||
$q = self::$DB->prepare(
|
||||
"INSERT INTO ".$phpcountConfig["db"]["hitsTable"]." (pageid, isunique, hitcount) VALUES (:pageid, :isunique, 1) " .
|
||||
"ON DUPLICATE KEY UPDATE hitcount = hitcount + 1"
|
||||
);
|
||||
$q->bindParam(':pageid', $pageID);
|
||||
$unique = $unique ? '1' : '0';
|
||||
$q->bindParam(':isunique', $unique);
|
||||
$q->execute();
|
||||
}
|
||||
catch(Exception $e){
|
||||
die('phpcount failed to CountHit ('.$e->getMessage().')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static function IDHash($pageID)
|
||||
{
|
||||
$visitorID = $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'];
|
||||
return hash("SHA256", $pageID . $visitorID);
|
||||
}
|
||||
|
||||
private static function userHash()
|
||||
{
|
||||
$visitorID = $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'];
|
||||
return hash("SHA256", $visitorID);
|
||||
}
|
||||
|
||||
private static function Cleanup(){
|
||||
global $phpcountConfig;
|
||||
|
||||
$last_interval = time() - self::HIT_OLD_AFTER_SECONDS;
|
||||
|
||||
$q = self::$DB->prepare(
|
||||
'DELETE FROM '.$phpcountConfig["db"]["nodupesTable"].' WHERE `time` < :time'
|
||||
);
|
||||
$q->bindParam(':time', $last_interval);
|
||||
$q->execute();
|
||||
|
||||
$q = self::$DB->prepare(
|
||||
'DELETE FROM '.$phpcountConfig["db"]["pageHitsTable"].' WHERE `timeStamp` < :time'
|
||||
);
|
||||
$q->bindParam(':time', $last_interval);
|
||||
$q->execute();
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<?php require_once "sidenav/loginStatus.php"; ?><!-- brings its own li -->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<?php require_once("sidenav/loginStatus.php");?><!-- brings its own li -->
|
||||
|
||||
@@ -20,7 +20,7 @@ dbConnector::connect(
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
$user = participo::sessionUser();
|
||||
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
processPostData(dbConnector::getDbConnection(), $_POST);
|
||||
@@ -63,7 +63,7 @@ processPostData(dbConnector::getDbConnection(), $_POST);
|
||||
<li class="logo">
|
||||
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
|
||||
<img style="max-width:100%;height:12vh;" class="responsive-img"
|
||||
src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
|
||||
src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png" />
|
||||
</a>
|
||||
</li>
|
||||
<li><?php require_once 'sidenav/loginStatus.php'; ?>
|
||||
@@ -103,18 +103,18 @@ if ($_SESSION['login']) {
|
||||
<div style="margin:1%;" class="card blue-grey darken-1">
|
||||
<div class="card-content white-text">
|
||||
<span
|
||||
class="card-title"><?php echo($userData['name']); ?>,
|
||||
<?php echo($userData['vorname']); ?></span>
|
||||
class="card-title"><?php echo($user->getName()); ?>,
|
||||
<?php echo($user->getFirstName()); ?></span>
|
||||
<img style="max-height:10vh;" class="responsive-img" src="images/account.svg" />
|
||||
<dl>
|
||||
<dt>Name</dt>
|
||||
<dd><?php echo($userData['name']); ?>
|
||||
<dd><?php echo($user->getName()); ?>
|
||||
</dd>
|
||||
<dt>Vorname</dt>
|
||||
<dd><?php echo($userData['vorname']); ?>
|
||||
<dd><?php echo($user->getFirstName()); ?>
|
||||
</dd>
|
||||
<dt>Email</dt>
|
||||
<dd><?php echo($userData['eMail']); ?>
|
||||
<dd><?php echo($user->getEmail()); ?>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
@@ -138,9 +138,9 @@ if ($_SESSION['login']) {
|
||||
<input name="action" type="hidden" value="changePassword" />
|
||||
<input name="redirectLocation" type="hidden" value="./user" />
|
||||
<input name="changerId" type="hidden"
|
||||
value="<?php echo($userData['id']); ?>" />
|
||||
value="<?php echo($user->getId()); ?>" />
|
||||
<input name="changeeId" type="hidden"
|
||||
value="<?php echo($userData['id']); ?>" />
|
||||
value="<?php echo($user->getId()); ?>" />
|
||||
<fieldset>
|
||||
<legend>Neues Passwort vergeben</legend>
|
||||
<div>
|
||||
@@ -215,7 +215,7 @@ if ($_SESSION['login']) {
|
||||
<input name="action" type="hidden" value="changePassword" />
|
||||
<input name="redirectLocation" type="hidden" value="./user" />
|
||||
<input name="changerId" type="hidden"
|
||||
value="<?php echo($userData['id']); ?>" />
|
||||
value="<?php echo($user->getId()); ?>" />
|
||||
<input name="changeeId" type="hidden"
|
||||
value="<?php echo($kid['kidId']); ?>" />
|
||||
<input name="newPassword" type="hidden" value="" />
|
||||
@@ -238,7 +238,7 @@ if ($_SESSION['login']) {
|
||||
<input name="action" type="hidden" value="changePassword" />
|
||||
<input name="redirectLocation" type="hidden" value="./user" />
|
||||
<input name="changerId" type="hidden"
|
||||
value="<?php echo($userData['id']); ?>" />
|
||||
value="<?php echo($user->getId()); ?>" />
|
||||
<input name="changeeId" type="hidden"
|
||||
value="<?php echo($kid['kidId']); ?>" />
|
||||
<fieldset>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
open cwsvjudo@cwsvjudo.helioho.st
|
||||
set ssl:verify-certificate no
|
||||
set ftp:ssl-allow off
|
||||
mirror --verbose --continue --parallel=8 --reverse ./cwsvjudo@bplaced/www /httpdocs
|
||||
exit
|
||||
|
||||
mirror --verbose --continue --parallel=8 --reverse ./cwsvjudo@bplaced/www/participo /httpdocs/participo
|
||||
put -e -O /httpdocs/participo/config ./config-heliohost/participo.php
|
||||
put -e -O /.local ./config-heliohost/cwsvJudo.config.php
|
||||
# exit
|
||||
|
||||
Reference in New Issue
Block a user