1
0

ProgramsList+ProgramsView+ProgramsDownload

This commit is contained in:
2020-01-16 11:34:01 +01:00
parent cdec6903f6
commit e1851fce69
9 changed files with 186 additions and 208 deletions

View File

@@ -1,21 +1,29 @@
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/programs.php');
require_once (__DIR__ . '/../internals/ParsedownCustom.php');
require_once (__DIR__ . '/../internals/website.php');
$internalname = $OPTIONS['id'];
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
?>
$prog = Programs::getProgramByInternalName($internalname);
if ($prog === NULL) httpError(404, 'Program not found');
<?php
$progid = $ROUTE->parameter['id'];
// This page is only for old links.
// Current version does use direct links
$prog = $SITE->modules->Programs()->getProgramByInternalName($progid);
if ($prog === null) { $FRAME_OPTIONS->setForced404("Program not found"); return; }
foreach (Programs::getURLs($prog) as $xurl)
$FRAME_OPTIONS->title = null;
$FRAME_OPTIONS->canonical_url = null;
$FRAME_OPTIONS->activeHeader = null;
$FRAME_OPTIONS->frame = 'nocontent_frame.php';
foreach ($SITE->modules->Programs()->getURLs($prog) as $xurl)
{
if ($xurl['type'] === 'download') { header('Location: ' . $xurl['href']); exit; }
if ($xurl['type'] === 'playstore') { header('Location: ' . $xurl['href']); exit; }
if ($xurl['type'] === 'amazonappstore') { header('Location: ' . $xurl['href']); exit; }
if ($xurl['type'] === 'windowsstore') { header('Location: ' . $xurl['href']); exit; }
if ($xurl['type'] === 'itunesstore') { header('Location: ' . $xurl['href']); exit; }
}
if ($xurl['type'] === 'download') { $FRAME_OPTIONS->setForcedRedirect($xurl['href']); return; }
if ($xurl['type'] === 'playstore') { $FRAME_OPTIONS->setForcedRedirect($xurl['href']); return; }
if ($xurl['type'] === 'amazonappstore') { $FRAME_OPTIONS->setForcedRedirect($xurl['href']); return; }
if ($xurl['type'] === 'windowsstore') { $FRAME_OPTIONS->setForcedRedirect($xurl['href']); return; }
if ($xurl['type'] === 'itunesstore') { $FRAME_OPTIONS->setForcedRedirect($xurl['href']); return; }
}
?>

View File

@@ -1,69 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/programs.php');
$filter = $OPTIONS['categoryfilter'];
$allprograms = Programs::listAllNewestFirst($filter);
require_once (__DIR__ . '/../internals/website.php');
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
?>
<head>
<meta charset="utf-8">
<title>Mikescher.com - Programs</title>
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
<link rel="canonical" href="https://www.mikescher.com/programs"/>
<?php printHeaderCSS(); ?>
</head>
<body>
<div id="mastercontainer">
<?php $HEADER_ACTIVE = 'programs'; include (__DIR__ . '/../fragments/header.php'); ?>
<?php
$filter = $ROUTE->parameter['categoryfilter'];
<div id="content" class="content-responsive">
<div class="blockcontent">
<div class="contentheader"><h1>My programs</h1><hr/></div>
$FRAME_OPTIONS->title = 'Programs';
$FRAME_OPTIONS->canonical_url = ($filter === '') ? ('https://www.mikescher.com/programs') : ('https://www.mikescher.com/programs/cat/' . $filter);
$FRAME_OPTIONS->activeHeader = 'programs';
<?php
$allprograms = $SITE->modules->Programs()->listAllNewestFirst($filter);
?>
echo '<div class="prgl_parent">' . "\n";
foreach ($allprograms as $prog)
{
$uilang = '';
foreach (explode('|', $prog['ui_language']) as $lang) $uilang .= '<img src="'.convertLanguageToFlag($lang).'" alt="'.$lang.'" />';
<div class="blockcontent">
echo '<a class="prgl_elem" href="'.$prog['url'].'">';
echo ' <div class="prgl_elem_left">';
echo ' <img src="' . $prog['preview_url'] . '" alt="Thumbnail ' . $prog['name'] . '" />';
echo ' </div>';
echo ' <div class="prgl_elem_right">';
echo ' <div class="prgl_elem_title">' . htmlspecialchars($prog['name']) . '</div>';
echo ' <div class="prgl_elem_sdesc">' . htmlspecialchars($prog['short_description']) . '</div>';
echo ' <div class="prgl_elem_info">';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Date:</span><span class="prgl_elem_subinfo_data">'.$prog['add_date'].'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Language:</span><span class="prgl_elem_subinfo_data">'.$prog['prog_language'].'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">UI Language:</span><span class="prgl_elem_subinfo_data">'.$uilang.'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Category:</span><span class="prgl_elem_subinfo_data">'.$prog['category'].'</span></div>';
echo ' </div>';
echo ' </div>';
echo '</a>' . "\n";
}
echo '</div>' . "\n";
<div class="contentheader"><h1>My programs</h1><hr/></div>
?>
<?php
</div>
echo '<div class="prgl_parent">' . "\n";
</div>
foreach ($allprograms as $prog)
{
$uilang = '';
foreach (explode('|', $prog['ui_language']) as $lang) $uilang .= '<img src="' . $SITE->modules->Programs()->convertLanguageToFlag($lang).'" alt="'.$lang.'" />';
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
echo '<a class="prgl_elem" href="'.$prog['url'].'">';
echo ' <div class="prgl_elem_left">';
echo ' <img src="' . $prog['preview_url'] . '" alt="Thumbnail ' . $prog['name'] . '" />';
echo ' </div>';
echo ' <div class="prgl_elem_right">';
echo ' <div class="prgl_elem_title">' . htmlspecialchars($prog['name']) . '</div>';
echo ' <div class="prgl_elem_sdesc">' . htmlspecialchars($prog['short_description']) . '</div>';
echo ' <div class="prgl_elem_info">';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Date:</span><span class="prgl_elem_subinfo_data">'.$prog['add_date'].'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Language:</span><span class="prgl_elem_subinfo_data">'.$prog['prog_language'].'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">UI Language:</span><span class="prgl_elem_subinfo_data">'.$uilang.'</span></div>';
echo ' <div class="prgl_elem_subinfo"><span class="prgl_elem_subinfo_caption">Category:</span><span class="prgl_elem_subinfo_data">'.$prog['category'].'</span></div>';
echo ' </div>';
echo ' </div>';
echo '</a>' . "\n";
}
echo '</div>' . "\n";
?>
</div>
<?php printAdditionalScripts(); ?>
<?php printAdditionalStylesheets(); ?>
</body>
</html>

View File

@@ -1,123 +1,101 @@
<!DOCTYPE html>
<html lang="en">
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/programs.php');
require_once (__DIR__ . '/../internals/ParsedownCustom.php');
$internalname = $OPTIONS['id'];
$prog = Programs::getProgramByInternalName($internalname);
if ($prog === NULL) httpError(404, 'Program not found');
require_once (__DIR__ . '/../internals/website.php');
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
?>
<head>
<meta charset="utf-8">
<title>Mikescher.com - <?php echo $prog['name']; ?></title>
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
<link rel="canonical" href="<?php echo $prog['url']; ?>"/>
<?php printHeaderCSS(); ?>
<?php if ($prog['has_extra_images']) includeAdditionalScript("/data/javascript/ms_basic.js", 'defer', true) ?>
</head>
<body>
<div id="mastercontainer">
<?php $HEADER_ACTIVE = 'programs'; include (__DIR__ . '/../fragments/header.php'); ?>
<?php
$id = $ROUTE->parameter['id'];
<div id="content" class="content-responsive">
$prog = $SITE->modules->Programs()->getProgramByInternalName($id);
if ($prog === null) { $FRAME_OPTIONS->setForced404("Program not found"); return; }
<div class="blockcontent">
$FRAME_OPTIONS->title = $prog['name'];
$FRAME_OPTIONS->canonical_url =$prog['url'];
$FRAME_OPTIONS->activeHeader = 'programs';
<div class="prgv_content">
if ($prog['has_extra_images']) $FRAME_OPTIONS->addScript('/data/javascript/ms_basic.js', true);
?>
<div class="contentheader" id="prgv_header"><h1><?php echo htmlspecialchars($prog['name']); ?></h1><hr/></div>
<div class="blockcontent">
<div class="prgv_top">
<div class="prgv_content">
<div class="prgv_left"><img src="<?php echo $prog['mainimage_url']; ?>" alt="Thumbnail (<?php echo $prog['name'] ?>)" /></div>
<div class="contentheader" id="prgv_header"><h1><?php echo htmlspecialchars($prog['name']); ?></h1><hr/></div>
<div class="prgv_right">
<div class="prgv_right_key" style="grid-row:1">Name:</div>
<div class="prgv_right_value" style="grid-row:1"><a href="<?php echo $prog['url']; ?>"><?php echo htmlspecialchars($prog['name']) ?></a></div>
<div class="prgv_top">
<div class="prgv_right_key" style="grid-row:2">Language:</div>
<div class="prgv_right_value" style="grid-row:2"><?php echo htmlspecialchars($prog['prog_language']) ?></div>
<div class="prgv_left"><img src="<?php echo $prog['mainimage_url']; ?>" alt="Thumbnail (<?php echo $prog['name'] ?>)" /></div>
<?php if ($prog['license'] !== null): ?>
<div class="prgv_right_key" style="grid-row:3">License:</div>
<div class="prgv_right_value" style="grid-row:3"><?php echo '<a href="'.Programs::getLicenseUrl($prog['license']).'">'.$prog['license'].'</a>' ?></div>
<?php endif; ?>
<div class="prgv_right">
<div class="prgv_right_key" style="grid-row:1">Name:</div>
<div class="prgv_right_value" style="grid-row:1"><a href="<?php echo $prog['url']; ?>"><?php echo htmlspecialchars($prog['name']) ?></a></div>
<div class="prgv_right_key" style="grid-row:4">Category:</div>
<div class="prgv_right_value" style="grid-row:4"><?php echo htmlspecialchars($prog['category']) ?></div>
<div class="prgv_right_key" style="grid-row:5">Date:</div>
<div class="prgv_right_value" style="grid-row:5"><?php echo htmlspecialchars($prog['add_date']) ?></div>
<div class="prgv_right_comb" style="grid-row:6">
<?php
foreach (Programs::getURLs($prog) as $xurl)
{
echo '<a class="iconbutton '.$xurl['css'].'" href="'.$xurl['href'].'">';
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">';
echo '<use xlink:href="/data/images/icons.svg#'.$xurl['svg'].'"/>';
echo '</svg>';
echo '<span>'.$xurl['caption'].'</span>';
echo '</a>';
}
?>
</div>
<div class="prgv_right_comb prgv_right_lang" style="grid-row:8">
<?php
foreach (explode('|', $prog['ui_language']) as $lang)
{
echo '<img src="'.convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
}
?>
</div>
</div>
</div>
<?php if ($prog['has_extra_images']): ?>
<div class="progv_extra imgcarousel_parent" data-imgcarousel-index="0" data-imgcarousel-images="<?php echo htmlspecialchars(json_encode($prog['extraimages_urls'])); ?>" >
<a class="imgcarousel_prev">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<use xlink:href="/data/images/icons.svg#arrow_left"/>
</svg>
</a>
<div class="imgcarousel_content" style="background-image: url(<?php echo $prog['extraimages_urls'][0]; ?>);"></div>
<a class="imgcarousel_next">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<use xlink:href="/data/images/icons.svg#arrow_right"/>
</svg>
</a>
</div>
<div class="prgv_right_key" style="grid-row:2">Language:</div>
<div class="prgv_right_value" style="grid-row:2"><?php echo htmlspecialchars($prog['prog_language']) ?></div>
<?php if ($prog['license'] !== null): ?>
<div class="prgv_right_key" style="grid-row:3">License:</div>
<div class="prgv_right_value" style="grid-row:3"><?php echo '<a href="'.$SITE->modules->Programs()->getLicenseUrl($prog['license']).'">'.$prog['license'].'</a>' ?></div>
<?php endif; ?>
<hr class="prgv_sep" />
<div class="prgv_right_key" style="grid-row:4">Category:</div>
<div class="prgv_right_value" style="grid-row:4"><?php echo htmlspecialchars($prog['category']) ?></div>
<div class="prgv_center base_markdown">
<div class="prgv_right_key" style="grid-row:5">Date:</div>
<div class="prgv_right_value" style="grid-row:5"><?php echo htmlspecialchars($prog['add_date']) ?></div>
<div class="prgv_right_comb" style="grid-row:6">
<?php
$pd = new ParsedownCustom();
echo $pd->text(Programs::getProgramDescription($prog));
foreach ($SITE->modules->Programs()->getURLs($prog) as $xurl)
{
echo '<a class="iconbutton '.$xurl['css'].'" href="'.$xurl['href'].'">';
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">';
echo '<use xlink:href="/data/images/icons.svg#'.$xurl['svg'].'"/>';
echo '</svg>';
echo '<span>'.$xurl['caption'].'</span>';
echo '</a>';
}
?>
</div>
</div>
</div>
<div class="prgv_right_comb prgv_right_lang" style="grid-row:8">
<?php
foreach (explode('|', $prog['ui_language']) as $lang)
{
echo '<img src="'.$SITE->modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
}
?>
</div>
</div>
</div>
</div>
<?php if ($prog['has_extra_images']): ?>
</div>
<div class="progv_extra imgcarousel_parent" data-imgcarousel-index="0" data-imgcarousel-images="<?php echo htmlspecialchars(json_encode($prog['extraimages_urls'])); ?>" >
<a class="imgcarousel_prev">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<use xlink:href="/data/images/icons.svg#arrow_left"/>
</svg>
</a>
<div class="imgcarousel_content" style="background-image: url(<?php echo $prog['extraimages_urls'][0]; ?>);"></div>
<a class="imgcarousel_next">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<use xlink:href="/data/images/icons.svg#arrow_right"/>
</svg>
</a>
</div>
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
<?php endif; ?>
<hr class="prgv_sep" />
<div class="prgv_center base_markdown">
<?php echo $SITE->renderMarkdown($SITE->modules->Programs()->getProgramDescription($prog)); ?>
</div>
</div>
</div>
<?php printAdditionalScripts(); ?>
<?php printAdditionalStylesheets(); ?>
</body>
</html>