summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-12-02 00:13:10 +0100
committersteckbrief <steckbrief@chefmail.de>2017-12-02 00:13:10 +0100
commit4173577f3f5ebfdc48727cd6065b5de5ac6c4383 (patch)
tree73fc8fc78f71f4f1c3b5c2db9cd13103cbe1acfd /index.php
parent248eb1accdf7e92dd0572cb61bac523141662a69 (diff)
admin enhanced; list all stories if no current story is set
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 26 insertions, 7 deletions
diff --git a/index.php b/index.php
index 6ccf8d7..85b72ff 100644
--- a/index.php
+++ b/index.php
@@ -15,7 +15,8 @@ $characters = array();
foreach ($storiesDirContent as $storyName) {
$storyPath = $storiesDir.DIRECTORY_SEPARATOR.$storyName;
if (is_dir($storyPath)) {
- array_push($stories, $storyName);
+ $storyDescription = file_get_contents($storyPath.DIRECTORY_SEPARATOR.'description.txt');
+ $stories[$storyName] = $storyDescription;
if ($currentStoryIsSet && $currentStory == $storyName) {
$charactersDirContent = array_diff(scandir($storyPath), array('..', '.'));
foreach ($charactersDirContent as $character) {
@@ -72,22 +73,23 @@ $currentStoryName = visibleName($currentStory);
<ul class="nav navbar-nav">
<?php
foreach ($stories as $storyName) {
- $cssClass = ($storyName == $currentStory) ? " class=\"active\"" : "";
$visibleName = visibleName($storyName);
+ $cssClass = ($visibleName == $currentStoryName) ? " class=\"active\"" : "";
?>
- <li<?=$cssClass;?>><a href="index.php?story=<?=$storyName;?>"><?=$visibleName;?></a></li>
+ <li<?=$cssClass;?>><a href="index.php?story=<?=$storyName;?>"><?=$visibleName;?></a></li>
<?php
}
?>
-</ul>
+ </ul>
</div>
</div>
</nav>
<div class="spacer"></div>
<div class="container">
+<?php if ($currentStoryIsSet) { ?>
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid mb-3 mb-md-0 story-logo" src="<?=$currentStory?>/logo.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
+ <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($currentStory)?>/logo.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
</div>
</div>
<?php
@@ -97,7 +99,7 @@ $currentStoryName = visibleName($currentStory);
<!-- <?=$characterName;?> -->
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="<?=$currentStory?>/<?=$character;?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>">
+ <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="stories/<?=urlencode($currentStory)?>/<?=urlencode($character);?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>">
</div>
<div class="col-md-5">
<h3><?=$characterName;?></h3>
@@ -109,7 +111,24 @@ $currentStoryName = visibleName($currentStory);
<hr>
<?php
}
- ?>
+} else {
+ foreach ($stories as $story=>$storyDescription) {
+ $storyName = visibleName($story);
+?>
+ <div class="row">
+ <div class="col-md-7 text-center">
+ <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($story);?>/logo.png" alt="<?=$storyName;?>" title="<?=$storyName;?>">
+ </div>
+ <div class="col-md-5">
+ <h3><?=$storyName;?></h3>
+ <p class="figure-desc"><?=$storyDescription;?></p>
+ </div>
+ </div>
+ </div>
+<?
+ }
+}
+?>
</div>
</body>
</html>