diff --git a/www/frames/default_frame.php b/www/frames/default_frame.php index 9f4a928..9b16bbe 100644 --- a/www/frames/default_frame.php +++ b/www/frames/default_frame.php @@ -12,7 +12,14 @@ require_once (__DIR__ . '/../internals/website.php'); - <?php echo ($FRAME_OPTIONS->title !== '') ? htmlspecialchars('Mikescher.com - ' . $FRAME_OPTIONS->title) : 'Mikescher.com'; ?> + title !== '' && $FRAME_OPTIONS->title !== null) + echo '' . htmlspecialchars('Mikescher.com - ' . $FRAME_OPTIONS->title) . ''; + else if ($FRAME_OPTIONS->title === '') + echo 'Mikescher.com'; + else + echo ''; + ?> force_404 = true; $this->force_404_message = $err; } + + public function setForcedRedirect(string $url) + { + $this->force_redirect = true; + $this->force_redirect_url = $url; + } } \ No newline at end of file diff --git a/www/internals/utils.php b/www/internals/utils.php index 0c0a993..ef90b1d 100644 --- a/www/internals/utils.php +++ b/www/internals/utils.php @@ -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/ diff --git a/www/internals/website.php b/www/internals/website.php index 5751c78..c8900a4 100644 --- a/www/internals/website.php +++ b/www/internals/website.php @@ -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); diff --git a/www/pages/programs_download.php b/www/pages/programs_download.php index 9a41f91..aaf93c9 100644 --- a/www/pages/programs_download.php +++ b/www/pages/programs_download.php @@ -1,21 +1,29 @@ -$prog = Programs::getProgramByInternalName($internalname); -if ($prog === NULL) httpError(404, 'Program not found'); +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; } -} \ No newline at end of file + 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; } +} +?> diff --git a/www/pages/programs_list.php b/www/pages/programs_list.php index e836906..e337c78 100644 --- a/www/pages/programs_list.php +++ b/www/pages/programs_list.php @@ -1,69 +1,53 @@ - - - - - Mikescher.com - Programs - - - - - -
- +parameter['categoryfilter']; -
- -
- -

My programs


+$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'; - modules->Programs()->listAllNewestFirst($filter); +?> - echo '' . "\n"; + + ?>
- - - - \ No newline at end of file diff --git a/www/pages/programs_view.php b/www/pages/programs_view.php index a5e1a44..91b98bc 100644 --- a/www/pages/programs_view.php +++ b/www/pages/programs_view.php @@ -1,123 +1,101 @@ - - - - - Mikescher.com - <?php echo $prog['name']; ?> - - - - - - -
- +parameter['id']; -
+$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); +?> -


+
-
+
-
Thumbnail (<?php echo $prog['name'] ?>)
+


-
-
Name:
-
+
-
Language:
-
+
Thumbnail (<?php echo $prog['name'] ?>)
- -
License:
-
'.$prog['license'].'' ?>
- +
+
Name:
+
-
Category:
-
- -
Date:
-
- -
- '; - echo ''; - echo ''; - echo ''; - echo ''.$xurl['caption'].''; - echo ''; - } - ?> -
- -
- ' . "\n"; - } - ?> -
-
-
- - - - +
Language:
+
+ +
License:
+
modules->Programs()->getLicenseUrl($prog['license']).'">'.$prog['license'].'' ?>
-
+
Category:
+
-
+
Date:
+
+ +
text(Programs::getProgramDescription($prog)); + foreach ($SITE->modules->Programs()->getURLs($prog) as $xurl) + { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''.$xurl['caption'].''; + echo ''; + } ?> -
+
-
+
+ modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n"; + } + ?> +
+
+
-
+ -
+ - + + +
+ +
+ renderMarkdown($SITE->modules->Programs()->getProgramDescription($prog)); ?> +
+ +
- - - - \ No newline at end of file