some bugfixes machs

This commit is contained in:
marko
2021-12-20 19:10:55 +01:00
parent f7d2e699ff
commit 0c4334990e
9 changed files with 46 additions and 33 deletions

View File

@@ -0,0 +1,3 @@
order deny,allow
deny from all
allow from localhost

View File

@@ -0,0 +1,6 @@
<?php
$cwsvJudoConfig["db"]["host"] = "127.0.0.1";
$cwsvJudoConfig["db"]["name"] = "cwsvjudo";
$cwsvJudoConfig["db"]["user"] = "cwsvjudo";
$cwsvJudoConfig["db"]["password"] = "***REMOVED***";
?>

View File

@@ -0,0 +1,10 @@
<?php
$phpcountConfig["db"]["host"] = "localhost";
$phpcountConfig["db"]["name"] = "cwsvjudo";
$phpcountConfig["db"]["user"] = "cwsvjudo";
$phpcountConfig["db"]["password"] = "***REMOVED***";
$phpcountConfig["db"]["hitsTable"] = "phpcount_hits";
$phpcountConfig["db"]["nodupesTable"] = "phpcount_nodupes";
$phpcountConfig["db"]["pagehitsTable"] = "phpcount_pageHits";
?>

View File

@@ -8,30 +8,22 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once("./lib/db.php");
require_once("./lib/achievementsLib.php");
require_once("./lib/api.php");
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
require_once("./auth.php");
require_once("./lib/machs/achievementGroup.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();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
require_once("./auth.php");
$achievementGroups = getAchievementGroups($dbConnection);
achievementGroup::setDbConnection($dbConnection);
$achievementGroups = achievementGroup::getAllAchievementGroups();
processPostData($dbConnection, $_POST);
@@ -58,12 +50,12 @@ processPostData($dbConnection, $_POST);
</head>
<body>
<?php echo $login_status; ?>
<?php include("lib/machs/sidenav.php");?>
<?php
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
echo( "<h2>Eigene Achievements</h2>" );
echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
// echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
echo(htmlAchievementListForUser(
$dbConnection,
$achievementGroups,
@@ -78,7 +70,7 @@ processPostData($dbConnection, $_POST);
foreach($usersKids as $k){
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) and ($k['kidId']!=$_SESSION['user']['userId']) ){
echo( "<h2>".$k['vorname']." ".$k['name']."</h2>" );
echo( htmlUsersUploadBox($dbConnection, $k['kidId']) );
// echo( htmlUsersUploadBox($dbConnection, $k['kidId']) );
echo(htmlAchievementListForUser(
$dbConnection,
$achievementGroups,
@@ -100,9 +92,11 @@ processPostData($dbConnection, $_POST);
echo( htmlUpdateAchievementBox(
$a['id'],
$a['name'],
$a['description'],
$a['rootId'],
$a['level']
$a['achievementGroupId'],
$a['level'],
$a['description'],
$a['imgUrl']
));
echo("<hr />");
}

View File

@@ -141,7 +141,7 @@ return $html;
}
function htmlAchievementListForUser($db, $achievementGroups, $userId, $usersAchievmentIds, $noForm=false){
//var_dump($db, $achievementGroups, $userId, $usersAchievmentIds);
// var_dump($db, $achievementGroups, $userId, $usersAchievmentIds);
$ids=[];
foreach($usersAchievmentIds as $a){
$ids[]=$a['achievementId'];
@@ -154,12 +154,16 @@ $retHtml = "";
}
$retHtml .= "<div class=\"row\">";
foreach($achievementGroups as $g){
$records = record::getGroupsRecords($g->getId(), record::birthday2ageClass($userData[0]['gebDatum']));
$records = (
($userData[0]['gebDatum']!=null)?
(record::getGroupsRecords($g->getId(), record::birthday2ageClass($userData[0]['gebDatum']))):
[]
);
$retHtml .= "<div class=\"col s12 m6 l4 xl3\">";
$retHtml .= "<ul class=\"card\">";
// see, if there is a record for this group
$imgUrl = null;
foreach($g->achievements as $a){
foreach($g->getAchievements() as $a){
if($a['imgUrl'] != null){
$imgUrl = $a['imgUrl'];
}
@@ -256,6 +260,8 @@ $html = "";
$html .= "<input style=\"width:100%;display:block;\" name=\"level\" type=\"text\" value=\"".$level."\"/>";
$html .= "<label for=\"description\">description</label>";
$html .= "<input style=\"width:100%;display:block;\" name=\"description\" type=\"textarea\" value=\"".$description."\"/>";
$html .= "<label for=\"imgUrl\">imgUrl</label>";
$html .= "<input style=\"width:100%;display:block;\" name=\"imgUrl\" type=\"text\" value=\"".$imgUrl."\"/>";
$html .= "<input type=\"submit\"/>";
$html .= "</form>";
return $html;

View File

@@ -10,6 +10,7 @@ function getPdoDbConnection($hostname, $dbName, $user, $password){
}
catch(PDOException $dbError){
echo( "Error whilst getting a dbConnection!: " . $dbError->getMessage() );
var_dump($hostname, $dbName, $user, $password);
}
return $dbConnection;
}

View File

@@ -100,8 +100,9 @@ SQL;
$retHtml.= "Die Rekorde der jüngeren gelten auch für die älteren, aber nicht umgekehrt. ";
$retHtml.= "Damit ein Rekord auch eingetragen wird, muss er mit einem Nachweis in Videoform gemeldet werden.";
$retHtml.= "<h4>Rekord melden</h4>";
$retHtml.= "Um einen Rekord zu melden, lade ein Video des Rekordes hoch:";
$retHtml.= htmlUsersUploadBox(self::$db, $u['id']);
$retHtml.= "Um einen Rekord zu melden, schickt als Nachweis ein Video des Rekordes hoch an <a href=\"mailto:cwsvJudo@arcor.de\">cwsvJudo@arcor.de</a>.";
// $retHtml.= "Um einen Rekord zu melden, lade ein Video des Rekordes hoch:";
// $retHtml.= htmlUsersUploadBox(self::$db, $u['id']);
$retHtml.= "<strong>Anschließend</strong> kannst Du den Rekord melden:";
$retHtml.= "<form action=\".\" method=\"POST\">";
if(isUserAdmin(record::$db, $_SESSION['user']['userId'])){
@@ -121,12 +122,12 @@ SQL;
$retHtml.= "<input id=\"submit\" style=\"width:100%\" name=\"submit\" type=\"submit\" value=\"Rekord melden\">";
}
$retHtml.= "</form>";
$retHtml.= "<p>Sobald das Nachweisvideo gesichtet ist und es eine neue Bestleistung darstellt, wird der Rekord dann eingetragen und damit offiziell.</p>";
$retHtml.= "</div>";
$retHtml.= "<div class=\"modal-footer\">";
$retHtml.= "<a href=\"#!\" class=\"modal-close waves-effect waves-green btn-flat\">Zurück</a>";
$retHtml.= "</div>";
$retHtml.= "</div>";
// $retHtml.= "</div>";
return $retHtml;
}
@@ -160,7 +161,7 @@ COLLAPSIBLE;
$group->loadAchievementGroupFromDb($gid);
$retHtml.= "";
var_dump($group->canHaveRecords());
// var_dump($group->canHaveRecords());
if($group->canHaveRecords()){
$retHtml = "<".$frameTag." class=\"card\">";
$retHtml.= "<div class=\"card-content\">";

View File

@@ -17,10 +17,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
PHPCount::AddHit("Achievementsystem (".htmlspecialchars($_SESSION['user']['username']).")");
// require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
// $dbConnection = getCwsvJudoDbConn();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],

View File

@@ -15,12 +15,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
$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");
PHPCount::AddHit("Achievementsystem setUserData(".htmlspecialchars($_SESSION['user']['username']).")");
// require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
// $dbConnection = getCwsvJudoDbConn();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
@@ -66,7 +61,7 @@ processPostData($dbConnection, $_POST);
foreach($usersKids as $k){
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) ){
echo( "<h2 >".$k['vorname']." ".$k['name']."</h2>" );
echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
// echo( htmlUsersUploadBox($dbConnection, $k['kidId']) );
echo( setUserDataBox($k['kidId']) );
}
}