Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung |
dienste:wiki [29.12.2020 13:23] – Plugins und Einstellungen für 2FA ergänzt bernd | dienste:wiki [05.04.2022 22:12] (aktuell) – Registrieren unterbinden mape2k |
---|
</code> | </code> |
| |
Der Raum-Status und die Social-Media-Links liegen in folgender Datei | Der Raum-Status und die Social-Media-Links liegen in der Datei lib/tpl/bootstrap3/sidebarfooter.html. Der PHP-Code des Raum-Status ist identisch mit dem im [[wp_tkev#raumstatus|Wordpress]] verwendeten. |
| |
<file|lib/tpl/bootstrap3/sidebarfooter.html> | <file|lib/tpl/bootstrap3/sidebarfooter.html> |
</div> | </div> |
<!-- ***** Raumstatus ***** --> | <!-- ***** Raumstatus ***** --> |
<a href="https://status.bytespeicher.org/"> | <div class="well" style="color: #999; padding: 10px;"> |
<?php | <?php |
$context = stream_context_create(array('http'=> array('timeout' => 3))); | |
$status = json_decode(file_get_contents('https://status.bytespeicher.org/status.json', false, $context)); | // Spaces |
if($status && isset($status->state->open) && $status->state->open === true) { | $spaces = [ |
echo '<img src='.$status->icon->open.' style="max-width: 100%;" alt="Raumstatus des Bytespeicher, offen" title="Der Bytespeicher ist offen!" />'; | 'Bytespeicher' => 'http://status.bytespeicher.org', |
} else { | 'Makerspace' => 'http://status.makerspace-erfurt.de', |
echo '<img src='.$status->icon->closed.' style="max-width: 100%;" alt="Raumstatus des Bytespeicher, geschlossen" title="Der Bytespeicher ist geschlossen!" />'; | ]; |
| |
| // Max width of icon (small = 100, large = 200) |
| $cssMaxWidth = 100; |
| |
| // JSON path for URI |
| $statusJsonPath = '/status-minimal.json'; |
| |
| // Create stream context with low timeout |
| $context = stream_context_create([ |
| 'http' => [ |
| 'method' => "GET", |
| 'timeout' => 1 |
| ] |
| ]); |
| |
| // Check every space |
| // No output on errors |
| foreach ($spaces as $spaceName => $statusUrl) { |
| // Get minimal status from spacestatus webpage |
| $jsonContent = file_get_contents($statusUrl . $statusJsonPath, false, $context); |
| if ($jsonContent === false) { |
| // Status could not be received, skip it |
| continue; |
} | } |
?> | |
</a> | // Decode JSON with max depth of 2 |
<a href="https://status.makerspace-erfurt.de/"> | $jsonContent = json_decode($jsonContent, false, 2); |
<?php | if (is_null($jsonContent) || !isset($jsonContent->open) || !isset($jsonContent->icon)) { |
$context = stream_context_create(array('http'=> array('timeout' => 3))); | // JSON could not be decoded or entries missing |
$status = json_decode(file_get_contents('https://status.makerspace-erfurt.de/status.json', false, $context)); | continue; |
if($status && isset($status->state->open) && $status->state->open === true) { | |
echo '<img src='.$status->icon->open.' style="max-width: 100%;" alt="Raumstatus des Makerspace, offen" title="Der Makerspace ist offen!" />'; | |
} else { | |
echo '<img src='.$status->icon->closed.' style="max-width: 100%;" alt="Raumstatus des Makerspace, geschlossen" title="Der Makerspace ist geschlossen!" />'; | |
} | } |
?> | |
</a> | // Output spaces |
| $text = 'Der ' . $spaceName . ' ist ' . ($jsonContent->open === true ? 'offen' : 'geschlossen') . '!'; |
| echo '<a href=\'' . $statusUrl . '\'>'; |
| echo '<img src=\'' . $jsonContent->icon . '\' title=\'' . $text . '\' alt=\'Raumstatus des ' . $spaceName . '\' style=\'width:100%;max-width:' . $cssMaxWidth . 'px;\' />'; |
| echo '</a>'; |
| } |
| |
| ?> |
| </div> |
</file> | </file> |
| |
$conf['passcrypt'] = 'sha512'; | $conf['passcrypt'] = 'sha512'; |
$conf['superuser'] = '@admin'; | $conf['superuser'] = '@admin'; |
| $conf['disableactions'] = 'register'; |
$conf['mediarevisions'] = 0; | $conf['mediarevisions'] = 0; |
$conf['mailfrom'] = 'noreply@technikkultur-erfurt.de'; | $conf['mailfrom'] = 'noreply@technikkultur-erfurt.de'; |