ProgramsList+ProgramsView+ProgramsDownload
This commit is contained in:
parent
cdec6903f6
commit
e1851fce69
@ -12,7 +12,14 @@ require_once (__DIR__ . '/../internals/website.php');
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo ($FRAME_OPTIONS->title !== '') ? htmlspecialchars('Mikescher.com - ' . $FRAME_OPTIONS->title) : 'Mikescher.com'; ?></title>
|
||||
<?php
|
||||
if ($FRAME_OPTIONS->title !== '' && $FRAME_OPTIONS->title !== null)
|
||||
echo '<title>' . htmlspecialchars('Mikescher.com - ' . $FRAME_OPTIONS->title) . '</title>';
|
||||
else if ($FRAME_OPTIONS->title === '')
|
||||
echo '<title>Mikescher.com</title>';
|
||||
else
|
||||
echo '';
|
||||
?>
|
||||
<meta name="google-site-verification" content="pZOhmjeJcQbRMNa8xRLam4dwJ2oYwMwISY1lRKreSSs"/>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<?php
|
||||
|
9
www/frames/nocontent_frame.php
Normal file
9
www/frames/nocontent_frame.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
// echo nothing
|
@ -49,12 +49,12 @@ class Programs
|
||||
private static function readSingle($a)
|
||||
{
|
||||
$a['mainimage_url'] = '/data/images/program_img/' . $a['internal_name'] . '.png';
|
||||
$a['mainimage_path'] = __DIR__ . '/../data/images/program_img/' . $a['internal_name'] . '.png';
|
||||
$a['mainimage_path'] = __DIR__ . '/../../data/images/program_img/' . $a['internal_name'] . '.png';
|
||||
|
||||
$a['preview_url'] = '/data/dynamic/progprev_' . $a['internal_name'] . '.png';
|
||||
$a['preview_path'] = __DIR__ . '/../data/dynamic/progprev_' . $a['internal_name'] . '.png';
|
||||
$a['preview_path'] = __DIR__ . '/../../data/dynamic/progprev_' . $a['internal_name'] . '.png';
|
||||
|
||||
$a['file_longdescription'] = (__DIR__ . '/../statics/programs/' . $a['internal_name'] . '_description.md');
|
||||
$a['file_longdescription'] = (__DIR__ . '/../../statics/programs/' . $a['internal_name'] . '_description.md');
|
||||
|
||||
$a['url'] = '/programs/view/' . $a['internal_name'];
|
||||
|
||||
@ -277,4 +277,16 @@ class Programs
|
||||
else
|
||||
smart_resize_image($src, 250, 0, true, $dst);
|
||||
}
|
||||
|
||||
public function convertLanguageToFlag($lang) {
|
||||
$lang = trim(strtolower($lang));
|
||||
|
||||
if ($lang === 'italian') return '/data/images/flags/013-italy.svg';
|
||||
if ($lang === 'english') return '/data/images/flags/226-united-states.svg';
|
||||
if ($lang === 'french') return '/data/images/flags/195-france.svg';
|
||||
if ($lang === 'german') return '/data/images/flags/162-germany.svg';
|
||||
if ($lang === 'spanish') return '/data/images/flags/128-spain.svg';
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -18,6 +18,12 @@ class PageFrameOptions
|
||||
/** @var string */
|
||||
public $force_404_message = '';
|
||||
|
||||
/** @var bool */
|
||||
public $force_redirect = false;
|
||||
|
||||
/** @var string */
|
||||
public $force_redirect_url = '';
|
||||
|
||||
/** @var string */
|
||||
public $frame = 'default_frame.php';
|
||||
|
||||
@ -64,4 +70,10 @@ class PageFrameOptions
|
||||
$this->force_404 = true;
|
||||
$this->force_404_message = $err;
|
||||
}
|
||||
|
||||
public function setForcedRedirect(string $url)
|
||||
{
|
||||
$this->force_redirect = true;
|
||||
$this->force_redirect_url = $url;
|
||||
}
|
||||
}
|
@ -68,44 +68,6 @@ function isProd() {
|
||||
return $CONFIG['prod'];
|
||||
}
|
||||
|
||||
function convertCountryToFlag($country) {
|
||||
$country = trim(strtolower($country));
|
||||
|
||||
if ($country === 'italy') return '/data/images/flags/013-italy.svg';
|
||||
if ($country === 'china') return '/data/images/flags/034-china.svg';
|
||||
if ($country === 'japan') return '/data/images/flags/063-japan.svg';
|
||||
if ($country === 'un') return '/data/images/flags/082-united-nations.svg';
|
||||
if ($country === 'south korea') return '/data/images/flags/094-south-korea.svg';
|
||||
if ($country === 'spain') return '/data/images/flags/128-spain.svg';
|
||||
if ($country === 'norway') return '/data/images/flags/143-norway.svg';
|
||||
if ($country === 'Czech') return '/data/images/flags/149-czech-republic.svg';
|
||||
if ($country === 'germany') return '/data/images/flags/162-germany.svg';
|
||||
if ($country === 'sweden') return '/data/images/flags/184-sweden.svg';
|
||||
if ($country === 'france') return '/data/images/flags/195-france.svg';
|
||||
if ($country === 'switzerland') return '/data/images/flags/205-switzerland.svg';
|
||||
if ($country === 'england') return '/data/images/flags/216-england.svg';
|
||||
if ($country === 'usa') return '/data/images/flags/226-united-states.svg';
|
||||
if ($country === 'america') return '/data/images/flags/226-united-states.svg';
|
||||
if ($country === 'canada') return '/data/images/flags/243-canada.svg';
|
||||
if ($country === 'russia') return '/data/images/flags/248-russia.svg';
|
||||
if ($country === 'eu') return '/data/images/flags/259-european-union.svg';
|
||||
if ($country === 'uk') return '/data/images/flags/260-united-kingdom.svg';
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function convertLanguageToFlag($lang) {
|
||||
$lang = trim(strtolower($lang));
|
||||
|
||||
if ($lang === 'italian') return '/data/images/flags/013-italy.svg';
|
||||
if ($lang === 'english') return '/data/images/flags/226-united-states.svg';
|
||||
if ($lang === 'french') return '/data/images/flags/195-france.svg';
|
||||
if ($lang === 'german') return '/data/images/flags/162-germany.svg';
|
||||
if ($lang === 'spanish') return '/data/images/flags/128-spain.svg';
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* easy image resize function
|
||||
* @author http://www.nimrodstech.com/php-image-resize/
|
||||
|
@ -65,6 +65,12 @@ class Website
|
||||
|
||||
$result = $route->get($this);
|
||||
|
||||
if ($result->force_redirect)
|
||||
{
|
||||
header('Location: ' . $result->force_redirect_url);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($result->force_404)
|
||||
{
|
||||
$this->serveCustom404($route->full_url, $result, $result->force_404_message);
|
||||
|
@ -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; }
|
||||
}
|
||||
?>
|
||||
|
@ -1,40 +1,34 @@
|
||||
<!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">
|
||||
$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';
|
||||
|
||||
|
||||
$allprograms = $SITE->modules->Programs()->listAllNewestFirst($filter);
|
||||
?>
|
||||
|
||||
<div class="blockcontent">
|
||||
|
||||
<div class="contentheader"><h1>My programs</h1><hr/></div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
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.'" />';
|
||||
foreach (explode('|', $prog['ui_language']) as $lang) $uilang .= '<img src="' . $SITE->modules->Programs()->convertLanguageToFlag($lang).'" alt="'.$lang.'" />';
|
||||
|
||||
echo '<a class="prgl_elem" href="'.$prog['url'].'">';
|
||||
echo ' <div class="prgl_elem_left">';
|
||||
@ -57,13 +51,3 @@ $allprograms = Programs::listAllNewestFirst($filter);
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
<?php printAdditionalScripts(); ?>
|
||||
<?php printAdditionalStylesheets(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1,32 +1,23 @@
|
||||
<!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; }
|
||||
|
||||
$FRAME_OPTIONS->title = $prog['name'];
|
||||
$FRAME_OPTIONS->canonical_url =$prog['url'];
|
||||
$FRAME_OPTIONS->activeHeader = 'programs';
|
||||
|
||||
if ($prog['has_extra_images']) $FRAME_OPTIONS->addScript('/data/javascript/ms_basic.js', true);
|
||||
?>
|
||||
|
||||
<div class="blockcontent">
|
||||
|
||||
@ -47,7 +38,7 @@ if ($prog === NULL) httpError(404, 'Program not found');
|
||||
|
||||
<?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>
|
||||
<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; ?>
|
||||
|
||||
<div class="prgv_right_key" style="grid-row:4">Category:</div>
|
||||
@ -58,7 +49,7 @@ if ($prog === NULL) httpError(404, 'Program not found');
|
||||
|
||||
<div class="prgv_right_comb" style="grid-row:6">
|
||||
<?php
|
||||
foreach (Programs::getURLs($prog) as $xurl)
|
||||
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">';
|
||||
@ -74,7 +65,7 @@ if ($prog === NULL) httpError(404, 'Program not found');
|
||||
<?php
|
||||
foreach (explode('|', $prog['ui_language']) as $lang)
|
||||
{
|
||||
echo '<img src="'.convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
|
||||
echo '<img src="'.$SITE->modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@ -102,22 +93,9 @@ if ($prog === NULL) httpError(404, 'Program not found');
|
||||
<hr class="prgv_sep" />
|
||||
|
||||
<div class="prgv_center base_markdown">
|
||||
<?php
|
||||
$pd = new ParsedownCustom();
|
||||
echo $pd->text(Programs::getProgramDescription($prog));
|
||||
?>
|
||||
<?php echo $SITE->renderMarkdown($SITE->modules->Programs()->getProgramDescription($prog)); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
<?php printAdditionalScripts(); ?>
|
||||
<?php printAdditionalStylesheets(); ?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user