1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24:26 +01:00

Code style

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
Ralf Ramsauer 2015-09-22 20:28:57 +02:00
parent 48565ef37e
commit a522f1b70f

View File

@ -1,5 +1,5 @@
<?php <?php
function tellLock( $pAction, $pUser, $pPass, $pToken, $pIp ){ function tellLock($pAction, $pUser, $pPass, $pToken, $pIp) {
$json = '{ $json = '{
"user":' . json_encode( $pUser ) . ', "user":' . json_encode( $pUser ) . ',
@ -98,7 +98,7 @@
$isApi = true; $isApi = true;
} }
$lSuccess = tellLock( $pAction, $pUser, $pPass, $pToken, $pIp ); $lSuccess = tellLock($pAction, $pUser, $pPass, $pToken, $pIp);
if ($lSuccess == 0) { if ($lSuccess == 0) {
$showSuccess = true; $showSuccess = true;
@ -114,7 +114,7 @@
} else { } else {
// This is done by apache mod_rewrite // This is done by apache mod_rewrite
$pToken = $_GET[ 'token' ]; $pToken = $_GET[ 'token' ];
$lToken = preg_replace( '/[^0-9a-fA-F]/i', "", $pToken ); $lToken = preg_replace('/[^0-9a-fA-F]/i', "", $pToken);
if(strlen($lToken) != 16) { if(strlen($lToken) != 16) {
$showFailure = true; $showFailure = true;
@ -166,7 +166,7 @@ if ($isApi == false) {
} }
</style> </style>
<?php if( $showLoginForm ): ?> <?php if ($showLoginForm): ?>
<form name="login" method="post" action="/"> <form name="login" method="post" action="/">
<label for="user">User</label> <label for="user">User</label>
@ -183,11 +183,11 @@ if ($isApi == false) {
<button name="action" value="lock">Lock</button> <button name="action" value="lock">Lock</button>
</form> </form>
<?php elseif( $showSuccess ): ?> <?php elseif($showSuccess): ?>
<h1>Welcome Cpt. Cook</h1> <h1>Welcome Cpt. Cook</h1>
<?php elseif( $showFailure ): ?> <?php elseif ($showFailure): ?>
<h1>Something went wrong: <?php echo $failureMsg; ?></h1> <h1>Something went wrong: <?php echo $failureMsg; ?></h1>