[Scummvm-git-logs] scummvm-web master -> 82f2d49d38e5403aa60c7d26862043d6c262651e

Mataniko mataniko at gmail.com
Sat Apr 3 02:49:01 UTC 2021


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
ef20da2ede WEB: Fix PHP array key warnings
e683a6da6f WEB: Fix screenshot pages for various games
82f2d49d38 ICONS: Rename journeyman project icon


Commit: ef20da2edec9528e82926dc859ac0a2c579ad14e
    https://github.com/scummvm/scummvm-web/commit/ef20da2edec9528e82926dc859ac0a2c579ad14e
Author: Mataniko (mataniko at gmail.com)
Date: 2021-04-02T22:01:06-04:00

Commit Message:
WEB: Fix PHP array key warnings

Changed paths:
    include/Models/CompatibilityModel.php
    include/Models/DownloadsModel.php
    include/Models/GameDownloadsModel.php
    include/Objects/Article.php
    include/Objects/BasicObject.php
    include/Objects/File.php
    include/Pages/CompatibilityPage.php
    include/Pages/NewsPage.php
    include/Pages/ScreenshotsPage.php
    templates/components/box.tpl
    templates/components/roundbox.tpl
    templates/pages/index.tpl


diff --git a/include/Models/CompatibilityModel.php b/include/Models/CompatibilityModel.php
index 2d283700..4150707f 100644
--- a/include/Models/CompatibilityModel.php
+++ b/include/Models/CompatibilityModel.php
@@ -29,6 +29,7 @@ class CompatibilityModel extends BasicModel
             if ($version === 'DEV') {
                 $version = "99.99.99";
             }
+            $cachekey = $version;
             $version = \explode('.', $version);
             $data = CompatibilityQuery::create()
                 ->withColumn("max(release_date)")
@@ -44,7 +45,7 @@ class CompatibilityModel extends BasicModel
                     ->filterByReleaseDate($releaseDate, Criteria::LESS_EQUAL)
                 ->endUse()
                 ->find();
-            $this->saveToCache($data, $version);
+            $this->saveToCache($data, $cachekey);
         }
         return $data;
     }
diff --git a/include/Models/DownloadsModel.php b/include/Models/DownloadsModel.php
index 20e39efc..0ae23eb5 100644
--- a/include/Models/DownloadsModel.php
+++ b/include/Models/DownloadsModel.php
@@ -27,7 +27,7 @@ class DownloadsModel extends BasicModel
                     $sections[$category] = new DownloadsSection([
                         'anchor' => $category,
                         'title' => $sectionsData[$category]['title'],
-                        'notes' => $sectionsData[$category]['notes']
+                        'notes' => $sectionsData[$category]['notes'] ?? null
                     ]);
                 }
 
@@ -37,7 +37,7 @@ class DownloadsModel extends BasicModel
                     $sections[$category]->addSubsection(new DownloadsSection([
                         'anchor' => $subCategory,
                         'title' => $sectionsData[$subCategory]['title'],
-                        'notes' => $sectionsData[$subCategory]['notes']
+                        'notes' => $sectionsData[$subCategory]['notes'] ?? null
                     ]));
                 }
 
diff --git a/include/Models/GameDownloadsModel.php b/include/Models/GameDownloadsModel.php
index d149a282..c986c911 100644
--- a/include/Models/GameDownloadsModel.php
+++ b/include/Models/GameDownloadsModel.php
@@ -25,7 +25,7 @@ class GameDownloadsModel extends BasicModel
                 $sections[$category] = new DownloadsSection([
                         'anchor' => $category,
                         'title' => $sectionsData[$category]['title'],
-                        'notes' => $sectionsData[$category]['notes']
+                        'notes' => $sectionsData[$category]['notes'] ?? null
                     ]);
             }
 
@@ -43,7 +43,7 @@ class GameDownloadsModel extends BasicModel
                     $sections[$category]->addSubsection(new DownloadsSection([
                         'anchor' => $gameId,
                         'title' => $gameName,
-                        'notes' => $sectionsData[$gameId]['notes']
+                        'notes' => $sectionsData[$gameId]['notes'] ?? null
                     ]));
                 }
 
diff --git a/include/Objects/Article.php b/include/Objects/Article.php
index 534d2eb0..e7df7e87 100644
--- a/include/Objects/Article.php
+++ b/include/Objects/Article.php
@@ -16,10 +16,10 @@ class Article extends BasicObject
     public function __construct($data)
     {
         parent::__construct($data);
-        $this->url = $data['url'];
-        $this->language = $data['language'];
-        $this->source = $data['source'];
-        $this->date = $data['date'];
+        $this->url = $data['url'] ?? null;
+        $this->language = $data['language'] ?? null;
+        $this->source = $data['source'] ?? null;
+        $this->date = $data['date'] ?? null;
     }
 
     /* Get the URL. */
diff --git a/include/Objects/BasicObject.php b/include/Objects/BasicObject.php
index ae0236e0..8ae77ae4 100644
--- a/include/Objects/BasicObject.php
+++ b/include/Objects/BasicObject.php
@@ -12,8 +12,8 @@ abstract class BasicObject
 
     public function __construct($data)
     {
-        $this->description = $data['description'];
-        $this->name = $data['name'];
+        $this->description = $data['description'] ?? null;
+        $this->name = $data['name'] ?? null;
     }
 
     public function __toString()
diff --git a/include/Objects/File.php b/include/Objects/File.php
index 3a3366f1..36c8bbd1 100644
--- a/include/Objects/File.php
+++ b/include/Objects/File.php
@@ -16,8 +16,8 @@ class File extends BasicObject
     {
         parent::__construct($data);
         $this->category_icon = $data['category_icon'];
-        $this->extra_info = $data['extra_info'];
-        $this->type = strtolower($data['type']);
+        $this->extra_info = $data['extra_info'] ?? null;
+        $this->type = strtolower($data['type'] ?? '');
         $this->user_agent = isset($data["user_agent"]) ? $data["user_agent"] : "";
 
         $fname = "";
@@ -93,7 +93,8 @@ class File extends BasicObject
          * Get the filesize/last modified information and put it in
          * $this->extra_info.
          */
-        if ($attributes['extra_info'] == 'true') {
+        if (isset($attributes['extra_info'])
+            && $attributes['extra_info'] == 'true') {
             if (is_file($fname) && is_readable($fname)) {
                 $this->extra_info['date'] = date('F j, Y, g:i a', @filemtime($fname));
                 if (!is_null($data['extra_info'])) {
diff --git a/include/Pages/CompatibilityPage.php b/include/Pages/CompatibilityPage.php
index 442bae0f..b5e999ba 100644
--- a/include/Pages/CompatibilityPage.php
+++ b/include/Pages/CompatibilityPage.php
@@ -52,8 +52,8 @@ class CompatibilityPage extends Controller
     /* Display the index page. */
     public function index($args)
     {
-        $version = $args['version'];
-        $target = $args['game'];
+        $version = $args['version'] ?? null;
+        $target = $args['game'] ?? null;
 
         $versions = VersionQuery::create()
             ->orderByMajor('desc')
diff --git a/include/Pages/NewsPage.php b/include/Pages/NewsPage.php
index 3f905622..2797c2ce 100644
--- a/include/Pages/NewsPage.php
+++ b/include/Pages/NewsPage.php
@@ -22,7 +22,7 @@ class NewsPage extends Controller
     /* Display the index page. */
     public function index($args)
     {
-        $filename = $args['date'];
+        $filename = $args['date'] ?? null;
 
         if ($filename != null) {
             if (strtolower($filename) == 'archive' || $filename == '') {
diff --git a/include/Pages/ScreenshotsPage.php b/include/Pages/ScreenshotsPage.php
index 584d18a4..c9726b82 100644
--- a/include/Pages/ScreenshotsPage.php
+++ b/include/Pages/ScreenshotsPage.php
@@ -18,8 +18,8 @@ class ScreenshotsPage extends Controller
     /* Display the index page. */
     public function index($args)
     {
-        $category = $args['category'];
-        $game = $args['game'];
+        $category = $args['category'] ?? null;
+        $game = $args['game'] ?? null;
 
         $this->addJSFiles(
             array(
@@ -27,7 +27,7 @@ class ScreenshotsPage extends Controller
             )
         );
 
-        if (!empty($category)) {
+        if ($category) {
             return $this->getCategory($category, $game);
         }
 
diff --git a/templates/components/box.tpl b/templates/components/box.tpl
index 617868d4..ca046706 100644
--- a/templates/components/box.tpl
+++ b/templates/components/box.tpl
@@ -1,10 +1,10 @@
-<{if $article}article{else}section{/if} class="box" {if $id}id="{$id}" {/if}>
-    {if $head}
+<{if isset($article)}article{else}section{/if} class="box" {if isset($id)}id="{$id}" {/if}>
+    {if isset($head)}
         <header class="head">
             {$head}
         </header>
     {/if}
-    {if $intro}
+    {if isset($intro)}
         <section class="intro">
             {$intro}
         </section>
@@ -12,4 +12,4 @@
     <section class="content">
         {$content}
     </section>
-</{if $article}article{else}section{/if}>
\ No newline at end of file
+</{if isset($article)}article{else}section{/if}>
diff --git a/templates/components/roundbox.tpl b/templates/components/roundbox.tpl
index e99af406..0c659ce8 100644
--- a/templates/components/roundbox.tpl
+++ b/templates/components/roundbox.tpl
@@ -1,10 +1,10 @@
 <section class="round-box">
-    {if $header}
+    {if isset($header)}
         <header class="header">
             {$header}
         </header>
     {/if}
-    <section class="content{if $class} {$class}{/if}">
+    <section class="content{if isset($class)} {$class}{/if}">
         {$content}
     </section>
-</section>
\ No newline at end of file
+</section>
diff --git a/templates/pages/index.tpl b/templates/pages/index.tpl
index a3dcbcb9..21361495 100644
--- a/templates/pages/index.tpl
+++ b/templates/pages/index.tpl
@@ -41,7 +41,7 @@
     <link rel="stylesheet" href="/css/{$filename}">
     {/foreach}
 
-    {if $smarty.cookies.cookie_consent == "true"}
+    {if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "true"}
     <!-- Matomo -->
     <script type="text/javascript">
         var _paq = _paq || [];
@@ -155,7 +155,7 @@
             }
         })
     </script>
-    {if $smarty.cookies.cookie_consent == "true"}
+    {if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "true"}
     {* Google analytics javascript. *}
     <script src="https://www.google-analytics.com/urchin.js" type="text/javascript"></script>
     <script type="text/javascript">
@@ -164,7 +164,7 @@
         urchinTracker();
     </script>
     {* End Google analytics javascript. *}
-    {else if $smarty.cookies.cookie_consent == "false"}
+    {else if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "false"}
     {* Do nothing *}
     {else}
     {include file='components/cookie.tpl'}


Commit: e683a6da6fce0b794da5c28639bcd4491534996b
    https://github.com/scummvm/scummvm-web/commit/e683a6da6fce0b794da5c28639bcd4491534996b
Author: Mataniko (mataniko at gmail.com)
Date: 2021-04-02T22:48:10-04:00

Commit Message:
WEB: Fix screenshot pages for various games

This fixes bug #12356 where games with only one screenshot type would not work.

Changed paths:
    include/Models/ScreenshotsModel.php


diff --git a/include/Models/ScreenshotsModel.php b/include/Models/ScreenshotsModel.php
index f40129fd..ec3388d6 100644
--- a/include/Models/ScreenshotsModel.php
+++ b/include/Models/ScreenshotsModel.php
@@ -94,6 +94,7 @@ class ScreenshotsModel extends BasicModel
             return false;
         } elseif ($count === 1) {
             $screenshots[0]->getFiles();
+            return $screenshots[0];
         } else {
             $shot = $screenshots[0];
             $shot->getFiles();


Commit: 82f2d49d38e5403aa60c7d26862043d6c262651e
    https://github.com/scummvm/scummvm-web/commit/82f2d49d38e5403aa60c7d26862043d6c262651e
Author: Mataniko (mataniko at gmail.com)
Date: 2021-04-02T22:48:37-04:00

Commit Message:
ICONS: Rename journeyman project icon

Changed paths:
  A public_html/images/icons/games/journeyman.png
  R public_html/images/icons/games/pegasus.png


diff --git a/public_html/images/icons/games/pegasus.png b/public_html/images/icons/games/journeyman.png
similarity index 100%
rename from public_html/images/icons/games/pegasus.png
rename to public_html/images/icons/games/journeyman.png




More information about the Scummvm-git-logs mailing list