From 72b569691f540147381f37fb25d03fb97ab23c98 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Thu, 24 Sep 2020 17:48:50 +0200
Subject: [PATCH] refs #18044 [master] fix casting error in admin module

---
 themes/finc/templates/admin/home.phtml | 52 ++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 themes/finc/templates/admin/home.phtml

diff --git a/themes/finc/templates/admin/home.phtml b/themes/finc/templates/admin/home.phtml
new file mode 100644
index 00000000000..5e8aa62a4df
--- /dev/null
+++ b/themes/finc/templates/admin/home.phtml
@@ -0,0 +1,52 @@
+<!-- finc: admin/home -->
+<?php
+  /** @deprecated since v6.1
+  *  #18044 template needed to FIX bootstrap casting error in uptime display with '(int)' instead of '(string)'
+  */
+
+  // Set page title.
+  $this->headTitle($this->translate('VuFind Administration - Home'));
+
+  // Set up map of core name => label
+  $coreLabels = [
+    'biblio' => $this->translate('Bibliographic Index'),
+    'authority' => $this->translate('Authority Index'),
+  ];
+?>
+<div class="<?=$this->layoutClass('mainbody')?>">
+  <h2><?=$this->transEsc('VuFind Administration')?></h2>
+  <?php $cores = is_object($this->xml) ? $this->xml->xpath('/response/lst[@name="status"]/lst') : []; ?>
+  <?php foreach ($cores as $core): ?>
+    <?php $coreName = (string)$core['name']; ?>
+    <?php $coreLabel = $coreLabels[$coreName] ?? ucwords($coreName) . ' Index'; ?>
+    <h3><?=$this->transEsc($coreLabel)?></h3>
+    <table class="table table-striped">
+      <tr>
+        <th><?=$this->transEsc('Record Count')?>: </th>
+        <?php $recordCount = $core->xpath('//lst[@name="' . $coreName . '"]/lst/int[@name="numDocs"]') ?>
+        <td><?=$this->escapeHtml((string)array_pop($recordCount))?></td>
+      </tr>
+      <tr>
+        <th><?=$this->transEsc('Start Time')?>: </th>
+        <?php $startTime = $core->xpath('//lst[@name="' . $coreName . '"]/date[@name="startTime"]') ?>
+        <td><?=$this->escapeHtml(strftime("%b %d, %Y %l:%M:%S%p", strtotime((string)array_pop($startTime))))?></td>
+      </tr>
+      <tr>
+        <th><?=$this->transEsc('Last Modified')?>: </th>
+        <?php $lastModified = $core->xpath('//lst[@name="' . $coreName . '"]/lst/date[@name="lastModified"]') ?>
+        <td><?=$this->escapeHtml(strftime("%b %d, %Y %l:%M:%S%p", strtotime((string)array_pop($lastModified))))?></td>
+      </tr>
+      <tr>
+        <th><?=$this->transEsc('Uptime')?>: </th>
+        <?php $uptime = $core->xpath('//lst[@name="' . $coreName . '"]/long[@name="uptime"]') ?>
+        <?php /* #18044 fix casting error in uptime display - solved in Vufind 6 */ ?>
+        <td><?=$this->printms((int)array_pop($uptime))?></td>
+      </tr>
+    </table>
+  <?php endforeach; ?>
+</div>
+
+<div class="<?=$this->layoutClass('sidebar')?>">
+  <?=$this->render("admin/menu.phtml")?>
+</div>
+<!-- finc: admin/home - END -->
-- 
GitLab