Compare commits
7 Commits
1d9deebd58
...
49b49d87a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49b49d87a8 | ||
|
|
5c3b4af1bd | ||
|
|
6fb6ea9983 | ||
|
|
41e95d6228 | ||
|
|
3b31b112a7 | ||
|
|
6e52d452eb | ||
|
|
b9b47c069a |
13
homepage/cwsvJudo/participo/Makefile
Normal file
13
homepage/cwsvJudo/participo/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
MAKE=make
|
||||
|
||||
.PHONY: TESTS
|
||||
TESTS:
|
||||
$(MAKE) --print-directory --directory ./test
|
||||
|
||||
.PHONY: INSTALL
|
||||
INSTALL:
|
||||
$(MAKE) --print-directory --directory ./test INSTALL
|
||||
|
||||
.PHONY: CLEAN
|
||||
CLEAN:
|
||||
$(MAKE) --print-directory --directory ./test CLEAN
|
||||
@@ -20,7 +20,7 @@ dbConnector::connect(
|
||||
);
|
||||
|
||||
// authentication of the current user
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
if (!participo::isUserAdmin()) {
|
||||
header('Location: /participo', true, 301);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
$eventId = $_POST['eventId'] ?? null;
|
||||
$startingTypeId = $_POST['type'] ?? null;
|
||||
|
||||
@@ -14,7 +14,7 @@ dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
$starterId = $_POST['starterId'] ?? null;
|
||||
$returnToUrl = $_POST['returnToUrl'] ?? 'participo/';
|
||||
|
||||
@@ -15,7 +15,7 @@ dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
$loginName = $_POST['loginName'] ?? null;
|
||||
$name = $_POST['name'] ?? null;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
/// @file common settings and includes for the participo api
|
||||
/// - set locale to german
|
||||
setlocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge");
|
||||
/// - extend the include search path for
|
||||
/// - extend the include search path for:
|
||||
set_include_path(implode(
|
||||
PATH_SEPARATOR,
|
||||
[
|
||||
get_include_path(),
|
||||
/// - user defined libs (e.g. participo)
|
||||
/// - user defined libs (e.g. participo)
|
||||
"../lib",
|
||||
/// - config files (we reuse the participo-wide configuration)
|
||||
/// - config files (we reuse the participo-wide configuration)
|
||||
".."
|
||||
]
|
||||
));
|
||||
|
||||
@@ -11,8 +11,8 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
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';
|
||||
require_once $config["home"] . "/.local/cwsvJudo.config.php";
|
||||
// require_once $config['basePath'] . '/.local/phpcount.config.php';
|
||||
|
||||
dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['host'],
|
||||
@@ -21,7 +21,7 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
$user = participo::sessionUser();
|
||||
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
@@ -123,7 +123,7 @@ setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
private static $Types = [
|
||||
AttendanceType::Training => 'Training', AttendanceType::Excused => 'Entschuldigt', AttendanceType::Ill => 'Krank', AttendanceType::SpecialTraining => 'SonderTraining', AttendanceType::Competition => 'Wettkampf'
|
||||
];
|
||||
private static $NameOfMonth = [1 => 'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 4 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember'];
|
||||
private static $NameOfMonth = [1 => 'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember'];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
<?php
|
||||
/// @file some variable definitions
|
||||
|
||||
$config['basePath'] = '/users/cwsvjudo/www';
|
||||
$config['baseUrl'] = 'http://cwsvjudo.bplaced.net';
|
||||
$config['ressourceUrl'] = 'http://cwsvjudo.bplaced.net/ressourcen';
|
||||
# define variable holding the config
|
||||
if (!isset($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
||||
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/']
|
||||
));
|
||||
$config["home"] = "/home/cwsvjudo";
|
||||
$config["basePath"] = "/home/cwsvjudo/httpdocs";
|
||||
$config["baseUrl"] = "http://cwsvjudo.bplaced.net";
|
||||
$config["ressourceUrl"] = "http://cwsvjudo.bplaced.net/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/",
|
||||
])
|
||||
);
|
||||
|
||||
@@ -6,7 +6,8 @@ require_once 'participoLib/event.php';
|
||||
|
||||
// Configs
|
||||
require_once 'config/participo.php';
|
||||
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
|
||||
// @todo Switch to json saved settings
|
||||
require_once $config['home'] . '/.local/cwsvJudo.config.php';
|
||||
|
||||
participo::init($cwsvJudoConfig);
|
||||
|
||||
@@ -24,12 +25,12 @@ participo::init($cwsvJudoConfig);
|
||||
<!-- inits for the materializeCss -->
|
||||
<script src="events.js"></script>
|
||||
|
||||
<title><?php echo($meta['title']); ?></title>
|
||||
<title><?php echo ($meta['title'] ?? "title missing"); ?></title>
|
||||
<meta name="description"
|
||||
content="<?php echo($meta['description']); ?>" />
|
||||
content="<?php echo ($meta['description'] ?? "description missing"); ?>" />
|
||||
|
||||
<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="<? echo ($config['ressourceUrl']); ?>/graphiken/icons/cwsv.ico" />
|
||||
<link rel="apple-touch-icon" href="<? echo ($config['baseUrl']); ?>/apple-touch-icon.png">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -44,4 +45,4 @@ participo::init($cwsvJudoConfig);
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,30 +1,31 @@
|
||||
<?php
|
||||
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . './lib/');
|
||||
setlocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge");
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . "./lib/");
|
||||
|
||||
require_once 'participoLib/participo.php';
|
||||
require_once 'participoLib/planer.php';
|
||||
require_once "participoLib/participo.php";
|
||||
require_once "participoLib/planer.php";
|
||||
|
||||
require_once 'config/participo.php';
|
||||
require_once "config/participo.php";
|
||||
|
||||
require_once './local/dbConf.php';
|
||||
require_once './local/cwsvJudo.php';
|
||||
require_once "./local/dbConf.php";
|
||||
require_once "./local/cwsvJudo.php";
|
||||
|
||||
require_once './lib/db.php';
|
||||
require_once './lib/api.php';
|
||||
require_once "./lib/db.php";
|
||||
require_once "./lib/api.php";
|
||||
|
||||
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
|
||||
require_once $config["home"] . "/.local/cwsvJudo.config.php";
|
||||
|
||||
dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['host'],
|
||||
$cwsvJudoConfig['db']['name'],
|
||||
$cwsvJudoConfig['db']['user'],
|
||||
$cwsvJudoConfig['db']['password']
|
||||
$cwsvJudoConfig["db"]["host"],
|
||||
$cwsvJudoConfig["db"]["name"],
|
||||
$cwsvJudoConfig["db"]["user"],
|
||||
$cwsvJudoConfig["db"]["password"]
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
$meta = [
|
||||
'title' => 'Event Planer',
|
||||
'description' => 'Planung von (Nicht-)Teilnahmen an Wettkämpfen und anderen Veranstaltungen'
|
||||
"title" => "Event Planer",
|
||||
"description" =>
|
||||
"Planung von (Nicht-)Teilnahmen an Wettkämpfen und anderen Veranstaltungen",
|
||||
];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="nav-wrapper">
|
||||
<a href="/participo" class="breadcrumb">cwsvJudo-Apps</a>
|
||||
<a href="/participo/events" class="breadcrumb">
|
||||
<?php echo($meta['title']); ?>
|
||||
<?php echo($meta['title'] ?? "missing title"); ?>
|
||||
</a>
|
||||
<a class="right top-nav sidenav-trigger waves-effect waves-light hide-on-large-only" href="#"
|
||||
data-target="nav-mobile">
|
||||
|
||||
@@ -32,4 +32,4 @@ dbConnector::connect(
|
||||
);
|
||||
|
||||
// authentication of the current user
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
require_once './lib/api.php';
|
||||
|
||||
$basePath = $config['basePath'];
|
||||
require_once $basePath . '/config/cwsvJudo.config.php';
|
||||
require_once $config["home"] . "/.local/cwsvJudo.config.php";
|
||||
require_once $basePath . '/ressourcen/phpLib/parsedown/Parsedown.php';
|
||||
require_once $basePath . '/ressourcen/phpLib/Spyc/Spyc.php';
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
|
||||
// get a list of all infoZettel
|
||||
$fileList = glob($basePath . '/infoZettel/*.md');
|
||||
@@ -84,19 +84,9 @@ foreach ($years as $year) {?>
|
||||
<!-- List of Infos -->
|
||||
<div class="row" id="infoList">
|
||||
<?php
|
||||
$currentYear = (int)substr(basename($fileList[0]), 0, 4);
|
||||
echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
|
||||
|
||||
foreach ($fileList as $file) {
|
||||
$thisYear = (int)substr(basename($file), 0, 4);
|
||||
if ($thisYear != $currentYear) {
|
||||
$currentYear = $thisYear;
|
||||
echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
|
||||
}
|
||||
|
||||
// get a list of all infoZettel
|
||||
$fileList = glob($basePath . '/infoZettel/*.md');
|
||||
rsort($fileList);
|
||||
if (!empty($fileList)){
|
||||
$currentYear = (int)substr(basename($fileList[0]), 0, 4);
|
||||
echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
|
||||
|
||||
foreach ($fileList as $file) {
|
||||
$thisYear = (int)substr(basename($file), 0, 4);
|
||||
@@ -105,18 +95,31 @@ foreach ($fileList as $file) {
|
||||
echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
|
||||
}
|
||||
|
||||
$infoZettel = loadMarkdownFile($file);
|
||||
echo(
|
||||
AppCard::fromArray([
|
||||
'title' => $infoZettel['yaml']['title'],
|
||||
'description' => Parsedown::instance()->text($infoZettel['mdText']),
|
||||
])->htmlCode(['extraClass' => 'parsedownCard'])
|
||||
);
|
||||
} ?>
|
||||
// get a list of all infoZettel
|
||||
$fileList = glob($basePath . '/infoZettel/*.md');
|
||||
rsort($fileList);
|
||||
|
||||
foreach ($fileList as $file) {
|
||||
$thisYear = (int)substr(basename($file), 0, 4);
|
||||
if ($thisYear != $currentYear) {
|
||||
$currentYear = $thisYear;
|
||||
echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
|
||||
}
|
||||
|
||||
$infoZettel = loadMarkdownFile($file);
|
||||
echo(
|
||||
AppCard::fromArray([
|
||||
'title' => $infoZettel['yaml']['title'],
|
||||
'description' => Parsedown::instance()->text($infoZettel['mdText']),
|
||||
])->htmlCode(['extraClass' => 'parsedownCard'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo("Keine Infos gefunden!");
|
||||
} ?>
|
||||
</div><!-- End of Infos -->
|
||||
</main>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -24,7 +24,7 @@ class EventPage
|
||||
public function getHtmlNotFound()
|
||||
{
|
||||
return '<div>Der Event "' .
|
||||
$this->id .
|
||||
$this->eventId .
|
||||
'" existiert leider nicht!</div>' .
|
||||
"<h2>Anstehende Termine</h2>" .
|
||||
eventPlaner::getHtmlEventTable(eventPlaner::getComingWkEvents());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
require_once 'config/participo.php';
|
||||
require_once $config['home'] . '/.local/cwsvJudo.config.php';
|
||||
|
||||
require_once 'participoLib/participo.php';
|
||||
require_once 'participoLib/apiKey.php';
|
||||
|
||||
require_once './local/dbConf.php';
|
||||
|
||||
require_once $config['home'] . '/.local/cwsvJudo.config.php';
|
||||
|
||||
$dbConnection = dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['host'],
|
||||
@@ -14,9 +12,9 @@ $dbConnection = dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['user'],
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
// Check, if the login is already set. If so move to the main page (or the returnToUrl)
|
||||
if (isset($_SESSION['login'])) {
|
||||
if (isset($_SESSION) && isset($_SESSION['login'])) {
|
||||
// @todo prevent self redirection
|
||||
header('Location: http://' . ($_POST['returnToUrl'] ?? '.'), true, 301);
|
||||
}
|
||||
|
||||
@@ -46,53 +44,60 @@ else {
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<!-- includes of neccessary libs -->
|
||||
<!-- includes of necessary libs -->
|
||||
<?php readfile('./shared/imports.php'); ?>
|
||||
|
||||
<title>cwsvJudo Online Apps</title>
|
||||
<meta name="description" content="Loginseite der Online-Apps der Judoka des CWSV">
|
||||
<meta name="description" content="Login-Seite der Online-Apps der Judoka des CWSV">
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1>Loginseite der Online-Apps der Judoka des CWSV</h1>
|
||||
<?php echo(htmlRetMessage(participo::getMessages())); ?>
|
||||
<form action="./login.php" method="post">
|
||||
<fieldset>
|
||||
<legend>Benutzerdaten</legend>
|
||||
<div>
|
||||
<label for="username">Benutzername</label>
|
||||
<input id="username" type="text" name="f[username]" <?php echo isset($_POST['f']['username']) ? ' value="' . htmlspecialchars($_POST['f']['username']) . '"' : '' ?> />
|
||||
</div>
|
||||
<div>
|
||||
<label for="password">Kennnwort</label>
|
||||
<input id="password" type="password" name="f[password]" />
|
||||
</div>
|
||||
<?php if (isset($_GET['returnToUrl'])) {
|
||||
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_GET['returnToUrl']) . '" />');
|
||||
} ?>
|
||||
<?php if (isset($_POST['returnToUrl'])) {
|
||||
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_POST['returnToUrl']) . '" />');
|
||||
} ?>
|
||||
<input id="fragment" type="hidden" name="fragment" />
|
||||
<!-- add the fragment to the post data-->
|
||||
<script>
|
||||
if(window.location.hash){
|
||||
document.getElementById("fragment").value=window.location.hash;
|
||||
}
|
||||
</script>
|
||||
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div>
|
||||
<input type="submit" name="submit" value="Anmelden" />
|
||||
<body>
|
||||
<h1>Login-Seite der Online-Apps der Judoka des CWSV</h1>
|
||||
|
||||
<?php echo(htmlRetMessage(participo::getMessages())); ?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col s6 offset-s3 z-depth-1">
|
||||
<h2 id="title">Benutzerdaten</h2>
|
||||
|
||||
<form id="loginForm" action="./login.php" method="post">
|
||||
<div class="input-field">
|
||||
<input id="username" type="text" name="f[username]" <?php echo isset($_POST['f']['username']) ? ' value="' . htmlspecialchars($_POST['f']['username']) . '"' : '' ?> />
|
||||
<label for="username">Benutzername</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input id="password" type="password" name="f[password]" />
|
||||
<label for="password">Kennwort</label>
|
||||
</div>
|
||||
<?php # If a return url was given, add it as input to the form
|
||||
if (isset($_GET['returnToUrl'])) {
|
||||
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_GET['returnToUrl']) . '" />');
|
||||
}
|
||||
?>
|
||||
<input id="fragment" type="hidden" name="fragment" />
|
||||
<!-- add the fragment (stuff behind the # in the url) to the post data -->
|
||||
<script>
|
||||
if(window.location.hash){
|
||||
document.getElementById("fragment").value=window.location.hash;
|
||||
}
|
||||
</script>
|
||||
<!-- <p>
|
||||
<input type="checkbox" id="remember"/>
|
||||
<label for="remember" id="checkbox" >Remember me</label>
|
||||
</p> -->
|
||||
<input type="submit" name="submit" value="Anmelden" class="waves-effect waves-light btn" id="submitButton" />
|
||||
<fieldset class="notice"><legend>Hinweise</legend>
|
||||
<ul style="padding-left: inherit;">
|
||||
<li style="list-style-type: circle;" >Logindaten sollten vom Übungsleiter vergeben worden sein.</li>
|
||||
<ul><li style="list-style-type: circle;">Verlorene oder vergessene Logins oder Passwörter können über den Übungsleiter neu vergeben werden.</li></ul>
|
||||
<li style="list-style-type: circle;" >Dieses Projekt ist in mehr oder weniger aktiven Entwicklung. Sollte mal was nicht funktionieren, kann es sein, dass ich gerade daran herum schreibe. Also ruhig zu einem späteren Zeitpunkt noch einmal probieren.</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="notice"><legend>Hinweise</legend>
|
||||
<ul style="padding-left: inherit;">
|
||||
<li style="list-style-type: circle;" >Logindaten sollten vom Übungsleiter vergeben worden sein.</li>
|
||||
<ul><li style="list-style-type: circle;">Verlorene oder vergessene Logins oder Passwörter können über den Übungsleiter neu vergeben werden.</li></ul>
|
||||
<li style="list-style-type: circle;" >Dieses Projekt ist in mehr oder weniger aktiven Entwicklung. Sollte mal was nicht funktionieren, kann es sein, dass ich gerade daran herumschreibe. Also ruhig zu einem späteren Zeitpunkt noch einmal probieren.</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
if (ini_get('session.use_cookies')) {
|
||||
$params = session_get_cookie_params();
|
||||
setcookie(
|
||||
session_name(),
|
||||
$name=session_name(),
|
||||
'',
|
||||
time() - 42000,
|
||||
$params['path'],
|
||||
$params['domain'],
|
||||
$params['secure"'],
|
||||
$params['httponly']
|
||||
$expires=(time() - 42000),
|
||||
$path=$params['path'] ?? "",
|
||||
$domain=$params['domain'] ?? "",
|
||||
$params['secure"'] ?? false,
|
||||
$params['httponly'] ?? false
|
||||
);
|
||||
}
|
||||
session_destroy();
|
||||
|
||||
@@ -9,8 +9,8 @@ require_once './lib/participoLib/participo.php';
|
||||
require_once './lib/db.php';
|
||||
require_once './lib/api.php';
|
||||
|
||||
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
|
||||
require_once $config['basePath'] . '/config/phpcount.config.php';
|
||||
require_once $config["home"] . "/.local/cwsvJudo.config.php";
|
||||
// require_once $config['basePath'] . '/config/phpcount.config.php';
|
||||
|
||||
dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['host'],
|
||||
@@ -19,7 +19,7 @@ dbConnector::connect(
|
||||
$cwsvJudoConfig['db']['password']
|
||||
);
|
||||
|
||||
participo::authentificate();
|
||||
participo::authenticate();
|
||||
$user = participo::sessionUser();
|
||||
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@ services:
|
||||
# nginx config file
|
||||
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf
|
||||
# the app itself
|
||||
- ./cwsvjudo@bplaced/www/participo:/home/cwsvjudo/httpdocs/participo
|
||||
- ./cwsvjudo@bplaced/www/participo:/home/cwsvjudo/httpdocs/participo:rw
|
||||
# the apps config files
|
||||
- ./config-heliohost/cwsvJudo.config.php:/home/cwsvjudo/.local/cwsvJudo.config.php
|
||||
# ressourcen
|
||||
- /home/marko/cwsvJudo/submodules/materialize/dist:/home/cwsvjudo/httpdocs/ressourcen/materializeCss
|
||||
- /home/marko/cwsvJudo/homepage/cwsvJudo/build/graphiken:/home/cwsvjudo/httpdocs/ressourcen/graphiken
|
||||
# libs
|
||||
- /home/marko/cwsvJudo/submodules/parsedown:/home/cwsvjudo/httpdocs/ressourcen/phpLib/parsedown
|
||||
- /home/marko/cwsvJudo/submodules/spyc:/home/cwsvjudo/httpdocs/ressourcen/phpLib/Spyc
|
||||
# php and extensions
|
||||
php:
|
||||
# use pre-build image from docker..
|
||||
@@ -37,6 +40,9 @@ services:
|
||||
- ./cwsvjudo@bplaced/www/participo:/home/cwsvjudo/httpdocs/participo
|
||||
# the apps config files
|
||||
- ./config-heliohost/cwsvJudo.config.php:/home/cwsvjudo/.local/cwsvJudo.config.php
|
||||
# libs
|
||||
- /home/marko/cwsvJudo/submodules/parsedown/Parsedown.php:/home/cwsvjudo/httpdocs/ressourcen/phpLib/parsedown/Parsedown.php
|
||||
- /home/marko/cwsvJudo/submodules/spyc/Spyc.php:/home/cwsvjudo/httpdocs/ressourcen/phpLib/Spyc/Spyc.php
|
||||
# @todo Maybe use postgre instead?
|
||||
database:
|
||||
image: mariadb:latest
|
||||
@@ -45,8 +51,8 @@ services:
|
||||
# @todo Should credentials be placed here? Even if it is just a test environment
|
||||
environment:
|
||||
# MYSQL_TCP_PORT: 1433
|
||||
MYSQL_USER: 'cwsvjudo'
|
||||
MYSQL_DATABASE: 'cwsvjudo'
|
||||
MYSQL_USER: "cwsvjudo"
|
||||
MYSQL_DATABASE: "cwsvjudo"
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
|
||||
MYSQL_PASSWORD_FILE: /run/secrets/db_password
|
||||
volumes:
|
||||
@@ -64,6 +70,7 @@ services:
|
||||
restart: always
|
||||
depends_on:
|
||||
- database
|
||||
- php
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
|
||||
3
homepage/cwsvJudo/participo/test/.gitignore
vendored
Normal file
3
homepage/cwsvJudo/participo/test/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.venv
|
||||
__pycache__
|
||||
|
||||
15
homepage/cwsvJudo/participo/test/Makefile
Normal file
15
homepage/cwsvJudo/participo/test/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
PY=python
|
||||
|
||||
.PHONY: RUN
|
||||
RUN: INSTALL
|
||||
. ./run-tests
|
||||
|
||||
.PHONY: INSTALL
|
||||
INSTALL: .venv
|
||||
|
||||
.PHONY: CLEAN
|
||||
CLEAN:
|
||||
rm -rf .venv
|
||||
|
||||
.venv: requirements.txt
|
||||
. ./init-venv
|
||||
3
homepage/cwsvJudo/participo/test/config-template.toml
Normal file
3
homepage/cwsvJudo/participo/test/config-template.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[credentials]
|
||||
user = "____"
|
||||
password = "****"
|
||||
10
homepage/cwsvJudo/participo/test/config.toml
Normal file
10
homepage/cwsvJudo/participo/test/config.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[credentials]
|
||||
username = "marko"
|
||||
password = "kodokan"
|
||||
|
||||
[url]
|
||||
home = "http://127.0.0.1/participo"
|
||||
# home = "http://cwsvjudo.bplaced.net/participo"
|
||||
|
||||
[settings]
|
||||
headless = true
|
||||
86
homepage/cwsvJudo/participo/test/helper.py
Normal file
86
homepage/cwsvJudo/participo/test/helper.py
Normal file
@@ -0,0 +1,86 @@
|
||||
import logging
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
|
||||
def load_config(config_path: str = "config.toml"):
|
||||
from tomllib import load
|
||||
|
||||
with open(file=config_path, mode="rb") as config_file:
|
||||
return load(config_file)
|
||||
|
||||
|
||||
class Participo:
|
||||
def __init__(self) -> None:
|
||||
from selenium.webdriver import Firefox, FirefoxOptions
|
||||
|
||||
self.config = load_config()
|
||||
|
||||
options = FirefoxOptions()
|
||||
if self.config["settings"]["headless"]:
|
||||
options.add_argument("-headless")
|
||||
|
||||
self.driver = Firefox(options=options)
|
||||
|
||||
self.delay = 5
|
||||
|
||||
def __enter__(self):
|
||||
self.get_home()
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.driver.quit()
|
||||
|
||||
def get_home(self):
|
||||
self.driver.get(url=self.config["url"]["home"])
|
||||
|
||||
def load_section(self, section: str):
|
||||
from urllib3.exceptions import ReadTimeoutError
|
||||
|
||||
section_url = "/".join((self.config["url"]["home"], section))
|
||||
try:
|
||||
self.driver.get(url=section_url)
|
||||
except ReadTimeoutError as e:
|
||||
logging.warning(
|
||||
"\n".join(
|
||||
(
|
||||
f"TimeoutError loading {section} ({e} - {repr(e)})",
|
||||
f"- Check for missing resources on section/page {section}",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def login(self):
|
||||
credentials = self.config["credentials"]
|
||||
|
||||
self.driver.find_element(by=By.ID, value="username").send_keys(
|
||||
credentials["username"]
|
||||
)
|
||||
self.driver.find_element(by=By.ID, value="password").send_keys(
|
||||
credentials["password"]
|
||||
)
|
||||
self.driver.find_element(by=By.TAG_NAME, value="form").submit()
|
||||
|
||||
def check_login(self):
|
||||
return self.check_for(By.LINK_TEXT, "Logout")
|
||||
|
||||
def check_for_xdebug_msgs(self):
|
||||
classes = ("xdebug-error", "xe-warning")
|
||||
|
||||
return any((self.check_for(By.CLASS_NAME, c) for c in classes))
|
||||
|
||||
def check_for(self, selector: str, value: str) -> bool:
|
||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
|
||||
try:
|
||||
_ = WebDriverWait(driver=self.driver, timeout=self.delay).until(
|
||||
EC.presence_of_element_located(locator=(selector, value))
|
||||
)
|
||||
return True
|
||||
except NoSuchElementException:
|
||||
logging.info(f"No such element ({selector}, {value})")
|
||||
return False
|
||||
except TimeoutException:
|
||||
return False
|
||||
8
homepage/cwsvJudo/participo/test/init-venv
Normal file
8
homepage/cwsvJudo/participo/test/init-venv
Normal file
@@ -0,0 +1,8 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
PY=python
|
||||
|
||||
${PY} -m venv .venv
|
||||
. .venv/bin/activate
|
||||
${PY} -m pip install --upgrade pip
|
||||
${PY} -m pip install --requirement requirements.txt
|
||||
1
homepage/cwsvJudo/participo/test/requirements.txt
Normal file
1
homepage/cwsvJudo/participo/test/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
selenium
|
||||
7
homepage/cwsvJudo/participo/test/run-tests
Normal file
7
homepage/cwsvJudo/participo/test/run-tests
Normal file
@@ -0,0 +1,7 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
PY=python
|
||||
|
||||
. .venv/bin/activate
|
||||
${PY} test_main.py
|
||||
deactivate
|
||||
34
homepage/cwsvJudo/participo/test/test_main.py
Normal file
34
homepage/cwsvJudo/participo/test/test_main.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# testing the participo app
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
from helper import Participo
|
||||
|
||||
|
||||
class TestParticipo(unittest.TestCase):
|
||||
def test_login(self):
|
||||
with Participo() as participo:
|
||||
participo.login()
|
||||
self.assertTrue(participo.check_login(), "Login failed")
|
||||
|
||||
def test_sub_pages(self):
|
||||
with Participo() as participo:
|
||||
participo.login()
|
||||
self.assertTrue(participo.check_login())
|
||||
|
||||
sections = ("events", "infoZettel", "attendance", "user", "logout")
|
||||
for section in sections:
|
||||
with self.subTest(msg=f"- {section}"):
|
||||
participo.load_section(section=section)
|
||||
|
||||
self.assertFalse(
|
||||
expr=participo.check_for_xdebug_msgs(),
|
||||
msg=f"php errors on section {section}",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
unittest.main()
|
||||
@@ -21,3 +21,8 @@ buildMaterialize: updateSubmodules
|
||||
deployMaterialize: buildMaterialize
|
||||
# @todo correctly check the cert
|
||||
lftp -e "set ftp:ssl-allow no; mirror -R 'materialize/dist' 'www/ressourcen/materializeCss'; bye;" -u cwsvjudo,$(ftpPassword) cwsvjudo.bplaced.net
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
git submodule foreach git clean -xdf
|
||||
git submodule foreach git restore .
|
||||
|
||||
Submodule submodules/lite-youtube-embed updated: 217b3cde1a...8728048ebe
Submodule submodules/materialize updated: 93e673c19f...dda2c95aee
Submodule submodules/parsedown updated: 1ff0382739...999fcf7886
Submodule submodules/zopfli updated: 831773bc28...ccf9f0588d
Reference in New Issue
Block a user