Commit:    fe351f79ddc962b22235f00e66a13d8b4f4034f5
Author:    Peter Kokot <[email protected]>         Wed, 22 May 2019 20:12:38 
+0200
Parents:   03e280e9bcc6fb964e6c7b8fc9e54ab93d6b14f4
Branches:  master

Link:       
http://git.php.net/?p=web/bugs.git;a=commitdiff;h=fe351f79ddc962b22235f00e66a13d8b4f4034f5

Log:
Move quick fix reasons list to template

Changed paths:
  A  templates/pages/quick_fix_desc.php
  M  www/quick-fix-desc.php


Diff:
diff --git a/templates/pages/quick_fix_desc.php 
b/templates/pages/quick_fix_desc.php
new file mode 100644
index 0000000..608cb8b
--- /dev/null
+++ b/templates/pages/quick_fix_desc.php
@@ -0,0 +1,29 @@
+<?php $this->extends('layout.php', ['title' => 'Quick fix descriptions']) ?>
+
+<?php $this->start('content') ?>
+
+<table border="1" cellpadding="3" cellspacing="1">
+<?php foreach ($reasons as $key => $reason): ?>
+    <?php if (!empty($reason['package_name'])): ?>
+        <?php $reason['title'] = $reason['title'].' 
('.$reason['package_name'].')'; ?>
+    <?php endif ?>
+
+    <tr>
+        <td><?= $this->e($reason['title']) ?></td>
+        <td>Status: <?= $this->e($reason['status']) ?></td>
+        <td><pre><?= $this->e($reason['message']) ?></pre></td>
+    </tr>
+
+    <?php if (isset($variations[$key])): ?>
+        <?php foreach ($variations[$key] as $type => $variation): ?>
+            <tr>
+                <td><?= $this->e($reason['title']) ?> (<?= $this->e($type) 
?>)</td>
+                <td>Status: <?= $this->e($reason['status']) ?></td>
+                <td><pre><?= $this->e($variation) ?></pre></td>
+            </tr>
+        <?php endforeach ?>
+    <?php endif ?>
+<?php endforeach ?>
+</table>
+
+<?php $this->end('content') ?>
diff --git a/www/quick-fix-desc.php b/www/quick-fix-desc.php
index c360379..5aad03f 100644
--- a/www/quick-fix-desc.php
+++ b/www/quick-fix-desc.php
@@ -1,47 +1,22 @@
 <?php
 
+/**
+ * List of all quick fix responses.
+ */
+
 use App\Repository\ReasonRepository;
 
-session_start();
+// Application bootstrap
+require __DIR__.'/../include/prepend.php';
 
-// Obtain common includes
-require_once '../include/prepend.php';
+// Authentication
+require_once __DIR__.'/../include/auth.php';
 
 $reasonRepository = $container->get(ReasonRepository::class);
-list($RESOLVE_REASONS, $FIX_VARIATIONS) = 
$reasonRepository->findByProject($site);
-
-// Authenticate
-bugs_authenticate($user, $pw, $logged_in, $user_flags);
-
-response_header('Quick Fix Descriptions');
-
-?>
-<table border="1" cellpadding="3" cellspacing="1">
-<?php
-
-foreach ($RESOLVE_REASONS as $key => $reason) {
-    if (!empty($reason['package_name']))
-        $reason['title'] = "{$reason['title']} ({$reason['package_name']})";
-
-    echo "
-        <tr>
-            <td>{$reason['title']}</td>
-            <td>Status: {$reason['status']}</td>
-            <td><pre>{$reason['message']}</pre></td>
-        </tr>
-    ";
-    if (isset($FIX_VARIATIONS[$key])) {
-        foreach ($FIX_VARIATIONS[$key] as $type => $variation) {
-            echo "
-                <tr>
-                    <td>{$reason['title']} ({$type})</td>
-                    <td>Status: {$reason['status']}</td>
-                    <td><pre>{$variation}</pre></td>
-                </tr>";
-        }
-    }
-}
-?>
-</table>
+list($reasons, $variations) = $reasonRepository->findByProject('php');
 
-<?php response_footer();
+// Output template with given template variables.
+echo $template->render('pages/quick_fix_desc.php', [
+    'reasons' => $reasons,
+    'variations' => $variations,
+]);


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to