From 512e357e77cb08ad692550b0c7e365528a1d5730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Fri, 26 Jan 2018 21:49:09 +0100 Subject: [PATCH] show prog license --- www/data/binaries/.gitkeep | 0 www/data/css/styles.css | 2 +- www/data/css/styles.min.css | 2 +- www/data/css/styles_programsview.scss | 2 +- www/index.php | 1 - www/internals/programs.php | 49 +++++++++++++++++++++++++++ www/pages/programs_view.php | 21 ++++++++---- www/statics/programs/__all.php | 38 ++++++++++++++++++++- 8 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 www/data/binaries/.gitkeep diff --git a/www/data/binaries/.gitkeep b/www/data/binaries/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/www/data/css/styles.css b/www/data/css/styles.css index d2b25e9..55d57cb 100644 --- a/www/data/css/styles.css +++ b/www/data/css/styles.css @@ -808,7 +808,7 @@ html, body { min-width: 200px; display: grid; grid-template-columns: auto 1fr; - grid-template-rows: auto auto auto auto auto 1fr auto; + grid-template-rows: auto auto auto auto auto auto 1fr auto; grid-column-gap: 15px; grid-row-gap: 2px; } diff --git a/www/data/css/styles.min.css b/www/data/css/styles.min.css index f41c2ac..7ed6495 100644 --- a/www/data/css/styles.min.css +++ b/www/data/css/styles.min.css @@ -202,7 +202,7 @@ html,body{margin:0;padding:0;height:100%} .prgv_top{display:flex;flex-direction:row;margin-top:15px} .prgv_left{display:inline-flex;justify-content:center;flex-grow:1;margin-left:10px;margin-top:auto;margin-bottom:auto} .prgv_left img{max-height:100%;max-width:100%} -.prgv_right{background:#BBB;border:1px solid #666;margin:0 10px;padding:8px 5px 2px 5px;min-height:250px;min-width:200px;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto auto auto auto 1fr auto;grid-column-gap:15px;grid-row-gap:2px} +.prgv_right{background:#BBB;border:1px solid #666;margin:0 10px;padding:8px 5px 2px 5px;min-height:250px;min-width:200px;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto auto auto auto auto 1fr auto;grid-column-gap:15px;grid-row-gap:2px} .prgv_right_key{font-weight:bold} .prgv_right_value a{color:#333;text-decoration:none} .prgv_right_value a:hover{color:#339;text-decoration:none} diff --git a/www/data/css/styles_programsview.scss b/www/data/css/styles_programsview.scss index 5b0280a..ab21661 100644 --- a/www/data/css/styles_programsview.scss +++ b/www/data/css/styles_programsview.scss @@ -56,7 +56,7 @@ display: grid; grid-template-columns: auto 1fr; - grid-template-rows: auto auto auto auto auto 1fr auto; + grid-template-rows: auto auto auto auto auto auto 1fr auto; grid-column-gap: 15px; grid-row-gap: 2px; } diff --git a/www/index.php b/www/index.php index 60691f2..f400d49 100644 --- a/www/index.php +++ b/www/index.php @@ -188,5 +188,4 @@ try { //TODO euler best of on top of list (?) //TODO optimize image sizes for display/download (? - auto?) //TODO send cache header (?) -//TODO programs add [license] //TODO global uncached error logger -> send by mail diff --git a/www/internals/programs.php b/www/internals/programs.php index 9cb6389..9454ade 100644 --- a/www/internals/programs.php +++ b/www/internals/programs.php @@ -2,6 +2,31 @@ class Programs { + const URL_ORDER = + [ + 'github', + 'sourceforge', + + 'download', + 'playstore', + 'amazonappstore', + 'windowsstore', + 'itunesstore', + + 'homepage', + 'wiki', + 'alternativeto', + ]; + + const LICENSES = + [ + 'MIT' => 'https://choosealicense.com/licenses/mit/', + 'Unlicense' => 'https://choosealicense.com/licenses/unlicense/', + 'GPL-3.0' => 'https://choosealicense.com/licenses/gpl-3.0/', + 'Apache-2.0' => 'https://choosealicense.com/licenses/apache-2.0/', + 'Mozilla-2.0' => 'https://choosealicense.com/licenses/mpl-2.0/', + ]; + public static function readSingle($a) { $a['thumbnail_url'] = '/data/images/program_thumbnails/' . $a['internal_name'] . '.png'; @@ -45,4 +70,28 @@ class Programs { return file_get_contents($prog['file_longdescription']); } + + public static function urlComparator($a, $b) + { + $ia = array_search($a, Programs::URL_ORDER); + $ib = array_search($b, Programs::URL_ORDER); + + if ($ia === false && $ib === false) return strcasecmp($a, $b); + if ($ia === false && $ib !== false) return +1; // sort [IA | IB] + if ($ia !== false && $ib === false) return -1; // sort [IB | IA] + + return ($ia < $ib) ? -1 : +1; + + } + + public static function sortUrls($urls) + { + uksort($urls, 'self::urlComparator'); + return $urls; + } + + public static function getLicenseUrl($license) + { + return self::LICENSES[$license]; + } } \ No newline at end of file diff --git a/www/pages/programs_view.php b/www/pages/programs_view.php index 760409c..884fbb6 100644 --- a/www/pages/programs_view.php +++ b/www/pages/programs_view.php @@ -42,16 +42,23 @@ if ($prog === NULL) httpError(404, 'Program not found');
Language:
-
Category:
-
+ +
License:
+
'.$prog['license'].'' ?>
+ -
Date:
-
+
Category:
+
-
+
Date:
+
+ +
$url) + foreach (Programs::sortUrls($prog['urls']) as $type => $url) { + if ($type === 'download' && $url === 'direkt') $url = '/data/binaries/'.$prog['internal_name'].'.zip'; + if ($type === 'download') echo 'Download'; if ($type === 'github') echo 'Github'; if ($type === 'homepage') echo 'Homepage'; @@ -66,7 +73,7 @@ if ($prog === NULL) httpError(404, 'Program not found'); ?>
-
+
'Java', 'short_description' => 'A powerful 2D Tiled-Game-Engine for java. Completely in canvas and with network support.', 'add_date' => '2012-05-28', + 'license' => 'GPL-3.0', 'urls' => [ 'download' => 'direkt', + 'github' => 'https://github.com/Mikescher/AbsCanvas', ], ], @@ -29,6 +31,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'A little "swiss army knife" programm with over 100 different functionalities', 'add_date' => '2008-11-26', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -46,6 +49,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Annoy your teachers/freinds with a very high pitched sound, even without external speakers.', 'add_date' => '2008-06-04', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -63,6 +67,7 @@ return 'prog_language' => 'C#', 'short_description' => 'My collection of befunge93 tools. Including an interpreter, a transpiler, an compiler, an highlighter and more', 'add_date' => '2014-08-04', + 'license' => 'MIT', 'urls' => [ 'github' => 'https://github.com/Mikescher/BefunUtils', @@ -81,6 +86,7 @@ return 'prog_language' => 'C#', 'short_description' => 'A (very) simple visual Befunge-93 commandline interpreter', 'add_date' => '2013-05-03', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -98,6 +104,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Hoax you teachers/friends with flashing lights on your monitor.', 'add_date' => '2008-05-05', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -115,6 +122,7 @@ return 'prog_language' => 'Java', 'short_description' => 'A improved Space-Invaders clone - programmed from the Java-AG, Oken.', 'add_date' => '2012-05-24', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -133,6 +141,7 @@ return 'prog_language' => 'Java', 'short_description' => 'A challenging, tactical mini-game in blueprint-style.', 'add_date' => '2013-01-03', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -150,6 +159,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'A digital version of the same-named german tv-show game.', 'add_date' => '2008-10-08', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -167,6 +177,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Program your own KI and let it fight against others in a brutal deathmatch.', 'add_date' => '2010-12-04', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -184,6 +195,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'A simple tool to copy all files of a specific extension from a folder.', 'add_date' => '2008-03-26', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -201,6 +213,7 @@ return 'prog_language' => 'PHP', 'short_description' => 'A simple php module to display an overview of you github commits', 'add_date' => '2014-06-08', + 'license' => 'MIT', 'urls' => [ 'download' => 'https://github.com/Mikescher/extendedGitGraph/', @@ -218,6 +231,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'A little tool to rename multiple files with increasing numbers.', 'add_date' => '2008-10-01', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -235,6 +249,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Try creating the biggest chain reaction and see yourself climb up in the global leaderboard.', 'add_date' => '2009-01-24', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -252,6 +267,7 @@ return 'prog_language' => 'C#', 'short_description' => 'An automatic parser and solver for Hexcells, Hexcells Plus and Hexcells Infinite.', 'add_date' => '2015-05-06', + 'license' => 'MIT', 'urls' => [ 'github' => 'https://github.com/Mikescher/HexSolver', @@ -270,6 +286,7 @@ return 'prog_language' => 'Java', 'short_description' => 'A never ending Tower Defense where you fight against your own score.', 'add_date' => '2012-04-14', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -287,6 +304,7 @@ return 'prog_language' => 'Java', 'short_description' => 'A fully featured logical circuit simulator with many prebuild components', 'add_date' => '2011-12-16', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -305,6 +323,7 @@ return 'prog_language' => 'Java', 'short_description' => 'Organize your movies and series on an external hard drive.', 'add_date' => '2012-10-28', + 'license' => 'GPL-3.0', 'urls' => [ 'download' => 'https://github.com/Mikescher/jClipCorn/releases', @@ -324,6 +343,7 @@ return 'prog_language' => 'Java', 'short_description' => 'A little tool to find the "line of codes" of multiple projects', 'add_date' => '2014-04-27', + 'license' => 'Unlicense', 'urls' => [ 'github' => 'https://github.com/Mikescher/jQCCounter', @@ -342,6 +362,7 @@ return 'prog_language' => 'Delphi', 'short_description' => '40 of the best keygen themes together with a funny little keygen dance animation.', 'add_date' => '2010-03-16', + 'license' => null, 'urls' => [ //TODO url @@ -359,6 +380,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Controll essential features of an other computer over the LAN', 'add_date' => '2011-07-05', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -376,6 +398,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Turn you keyboard LED\'s into a little lightshow', 'add_date' => '2008-10-12', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -393,6 +416,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Find the trick to escape the seemingly escape-proof maze.', 'add_date' => '2008-12-20', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -410,6 +434,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Send anonymous messages over the Windows Messenger service to other pc\'s in your LAN', 'add_date' => '2009-02-11', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -427,6 +452,7 @@ return 'prog_language' => 'C#', 'short_description' => 'A texteditor for encrypted textfiles (AES, Twofish, Blowfish, ...)', 'add_date' => '2015-11-26', + 'license' => 'GPL-3.0', 'urls' => [ 'download' => 'https://github.com/Mikescher/Passpad/releases', @@ -445,6 +471,7 @@ return 'prog_language' => 'C++', 'short_description' => 'A crazy little snake with an "console" style', 'add_date' => '2013-07-08', + 'license' => 'Unlicense', 'urls' => [ 'download' => 'direkt', @@ -463,6 +490,7 @@ return 'prog_language' => 'C++', 'short_description' => 'A simple implementation of the Wa-Tor cellular automaton', 'add_date' => '2013-07-12', + 'license' => 'Unlicense', 'urls' => [ 'github' => 'https://github.com/Mikescher/SharkSim', @@ -480,6 +508,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Visualize the prime number calculation with the Sieve Of Erastothenes algorithm.', 'add_date' => '2009-01-22', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -497,6 +526,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'List all files in a folder that match a specific pattern and export them in plaintext.', 'add_date' => '2010-01-12', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -514,6 +544,7 @@ return 'prog_language' => 'C#', 'short_description' => 'A clone of all original SuperMarioBros (NES) levels, with a few tweaks.', 'add_date' => '2013-10-17', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -532,6 +563,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'The classical Tic-Tac-Toe, complete with perfect KI and Sourcecode.', 'add_date' => '2011-01-19', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -549,6 +581,7 @@ return 'prog_language' => 'Delphi', 'short_description' => 'Simulate the popular Monty Hall problem (ger: Ziegenproblem) with this program for yourself.', 'add_date' => '2008-04-10', + 'license' => null, 'urls' => [ 'download' => 'direkt', @@ -566,6 +599,7 @@ return 'prog_language' => 'C#', 'short_description' => 'Quickly toggle the explorer option "Show hidden files/folders" via the taskbar', 'add_date' => '2016-01-03', + 'license' => 'Unlicense', 'urls' => [ 'download' => 'https://github.com/Mikescher/QuickHiddenFolderToggle/releases', @@ -577,13 +611,14 @@ return [ 'name' => 'Cannon Conquest', 'internal_name' => 'CannonConquest', - 'internal_name_alt' => null, + 'internal_name_alt' => 'GridDominance', 'category' => 'Game', 'stars' => 5, 'ui_language' => 'English|German|French|Italian|Spanish', 'prog_language' => 'C#', 'short_description' => 'A 2D tactical puzzler, free with over 100 levels. Made with Xamarin for android/iPhone/WinPhone', 'add_date' => '2017-09-01', + 'license' => null, 'urls' => [ 'playstore' => 'https://play.google.com/store/apps/details?id=com.blackforestbytes.griddominance.iab', @@ -605,6 +640,7 @@ return 'prog_language' => 'C#', 'short_description' => 'Lightweight note taking client for Simplenote/Standard-Notes/Nextcloud/Local', 'add_date' => '2017-02-26', + 'license' => 'MIT', 'urls' => [ 'download' => 'https://github.com/Mikescher/AlephNote/releases',