Merge remote-tracking branch 'origin/wkParticipo' into homepage

This commit is contained in:
marko
2021-10-19 17:56:05 +02:00
360 changed files with 55515 additions and 29 deletions

View File

@@ -4,8 +4,8 @@ require_once('machs.php');
PHPCount::AddHit("Achievementsystem (".htmlspecialchars($_SESSION['user']['username']).")");
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
@@ -21,20 +21,21 @@ processPostData($dbConnection, $_POST);
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/js/materialize.min.js"></script>
<!-- inits for the materializeCss -->
<?php include("lib/machs/materializeInit.php");?>
<title>Achievements</title>
<meta name="description" content="Achievements">
<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>
<body>
@@ -52,7 +53,7 @@ processPostData($dbConnection, $_POST);
echo("</div>" );
}
?>
<?php // show the achievements of each kid
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
foreach($usersKids as $k){
@@ -68,4 +69,3 @@ processPostData($dbConnection, $_POST);
?>
</body>
</html>

View File

@@ -7,8 +7,8 @@ return (is_numeric($str) && $str > 0 && $str == round($str));
function getPdoDbConnection($hostname, $dbName, $user, $password){
try{
$dbConnection = new PDO(
'mysql:host='.$hostname.';dbname='.$dbName,
$user,
'mysql:host='.$hostname.';dbname='.$dbName,
$user,
$password
);
}
@@ -23,8 +23,8 @@ global $cwsvJudoConfig;
// Datenbankverbindung bereit stellen
try{
$db_connection = new PDO(
'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"],//.';charset=utf8',
$cwsvJudoConfig["db"]["user"],
'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"],//.';charset=utf8',
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
}
@@ -47,7 +47,7 @@ if (is_array($somePossibleEmptyStuff) || $somePossibleEmptyStuff instanceof Trav
return null;
}
/// Eine als String gegebene Liste kommagetrennter key=value Paare in
/// Eine als String gegebene Liste kommagetrennter key=value Paare in
/// ein assoziatives Array überführen
function getKeyValueArray($aKeyValueStringList){
$retKeyValueArray = array();
@@ -87,7 +87,7 @@ if( empty($optionsArray['outCharset']) ) $optionsArray['outCharset'] = "UTF-8";
);
$pdoStatementForQuerryingZitat->execute();
$retZitat = $pdoStatementForQuerryingZitat->fetchAll(PDO::FETCH_ASSOC);
// Zeichensatzkonvertierung
foreach($retZitat as &$entry){
array_walk(
@@ -127,8 +127,8 @@ if( !file_exists($aJsonFileName) ) return null;
if( !(is_array( $someLinkNames ) || is_object( $someLinkNames )) ) return null;
return arrayKeyFilter(
json_decode(
file_get_contents($aJsonFileName),
json_decode(
file_get_contents($aJsonFileName),
true
),
$someLinkNames
@@ -162,14 +162,14 @@ function toAscii($str, $replace=array(), $delimiter='-') {
return $clean;
}
/// Wrapper function for a query to the
/// $aDbConnection connection to a db
function dbQuery($aDbConnection, $aQueryString, $aBindArray = array(), $someOptions = array( "dbCharset" => "ISO-8859-1", "outCharset" => "UTF-8" ) ){
//echo("Doing ".$aQueryString);
var_dump($aBindArray);
if( empty($someOptions['dbCharset']) ) $someOptions['dbCharset'] = "ISO-8859-1";
if( empty($someOptions['outCharset']) ) $someOptions['outCharset'] = "UTF-8";
/// @toDo: Bisher wird nur die Rückgabe konvertiert. Eigentlich muss
/// doch auch die Eingabe konvertiert werden. Aber das jetzt
/// umzustellen wird schwer! Die User m Wettkampfplaner sind ja z.B.
/// @toDo: Bisher wird nur die Rückgabe konvertiert. Eigentlich muss
/// doch auch die Eingabe konvertiert werden. Aber das jetzt
/// umzustellen wird schwer! Die User m Wettkampfplaner sind ja z.B.
/// als UTF8 in latin1(?) gespeichert.
try{
$pdoStatement = $aDbConnection->prepare( $aQueryString );
@@ -187,7 +187,7 @@ if( empty($someOptions['outCharset']) ) $someOptions['outCharset'] = "UTF-8";
print "Error!: " . $db_error->getMessage() . "<br/>";
return null;
}
//var_dump($ret);
// Zeichensatzkonvertierung
if( is_array($ret) ){
foreach($ret as &$entry){

Submodule homepage/redesign2018/markdownExperiment/phpLib/phpcount deleted from f1d3b543d2

View File

@@ -0,0 +1,46 @@
<?php
// CREATE TABLE `cwsvjudo`.`achievements` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id/primary key' , `name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT 'name/caption of the Achivement' , `previousId` INT NOT NULL COMMENT 'id of the previous achievement' , `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'full descriptiopn in markdown' , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = 'eine Liste mit Achievements'; require_once('./local/db.php.inc');
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once('./local/wkParticipoConf.php.inc');
require_once('./auth.php');
require_once('./local/db.php.inc');
require_once('./lib/wkParticipoLib.inc.php');
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
$dbConnection = getCwsvJudoDbConn();
try{
$results = dbQuery(
$dbConnection,
//"INSERT INTO `wkParticipo_user<=>userAttributes` (userId, attributeId) VALUES (:userId, :attributeId);",
"SELECT * FROM cwsvjudo.achievements;"
//array(
// ':userId' => array('value'=>$anUserId, 'data_type'=>PDO::PARAM_INT),
// ':attributeId'=> array('value'=>$anAttributeId, 'data_type'=>PDO::PARAM_INT)
//)
);
}
catch(PDOException $db_error){
print "Error!: " . $db_error->getMessage() . "<br/>queryString: ".$queryString."<br />"; var_dump($bindArray);
}
// $query = "WITH SortedList (id, previousId, name, Level) AS ( SELECT Id, ParentId, SomeData, 0 as Level FROM cwsvjudo.achievements WHERE `id` IS 1 UNION ALL SELECT ll.id, ll.previousId, ll.name, Level+1 as Level FROM cwsvjudo.achievements ll INNER JOIN SortedList as s ON ll.previousId = s.Id ); SELECT id, previousId, name FROM SortedList ORDER BY Level ";
// $query = "SELECT (id, name, rootId, level) FROM cwsvjudo.achievements WHERE `id` = 1 ORDER BY `level`;";
// $query = "SELECT * FROM cwsvjudo.achievements;";
// $results = $mysqlConn->query($query);
// var_dump($results);
?>
<html>
<body>
<?php echo( arrayKeyed2htmlTableString($results, ["id", "name", "rootId", "level", "description"], $withCaption = true) );?>
</body>
</html>

View File

@@ -18,6 +18,31 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
if ($mysqlConn->connect_error) {
$sqlMessage['error'] .= 'Datenbankverbindung fehlgeschlagen: ' . $mysqlConn->connect_error;
}
// var_dump($_SESSION);
/// Stellt den cssCode mit den Variablendefinitionen bereit
/*
function colorThemeCss($colorArray = array('backgroundColor'=>"#FFAE00", 'highlightColor'=>"#FF8100", 'buttonColor'=>"#291670")){
//$colorTypes = ["backgroundColor", "highlightColor", "buttonColor"];
$defaultColors =['backgroundColor'=> "#FFAE00", 'highlightColor'=>"#FF8100", 'buttonColor'=>"#291670"];
//echo("DBG: colorArray:"); var_dump($colorArray);
// Inputdatenvalidierung
foreach($defaultColors as $key=>$value){
if( !preg_match("/^#(?:[0-9a-fA-F]{3}){1,2}$/", $colorArray[$key]) ){
$colorArray[$key] = $defaultColors[$key];
}
}
$ret = ":root{";
foreach($colorArray as $key=>$value){
$ret .= "--".$key.": ".$value."; ";
}
$ret .= "}";
return $ret;
}*/
?>
<!DOCTYPE html>
<html>
@@ -47,6 +72,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<nav class="navBar">
<ul>
<li><a href="/machs">Achievementsystem</a></li>
<li><a href="./infoZettel.php">Infozettel</a></li>
<li>
<a href ="./eventKalender.php">alle geplanten Wettkämpfe als Liste</a>

View File

@@ -2,6 +2,11 @@
require_once('./local/db.php.inc');
require_once('./local/wkParticipoConf.php.inc');
require_once('./lib/wkParticipoLib.inc.php');
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
if (isset($_SESSION['login'])) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php');
} else {
@@ -36,7 +41,7 @@ if (isset($_SESSION['login'])) {
),
);
$message['success'] = 'Anmeldung erfolgreich, <a href="index.php">weiter zum Inhalt.';
// PHPCount::AddHit("wkParticipo-Login ".$_POST['f']['username']);
PHPCount::AddHit("wkParticipo-Login ".$_POST['f']['username']);
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/pages/desktop/wkParticipo/index.php?user=' . $_POST['f']['username']);
} else {
sleep(1);