com web/bugs: bug.php - thanks messages: include/functions.php www/bug.php
| From: | Maciej Sobaczewski | Date: | Tue, 24 Jan 2017 06:21:14 +0000 |
| Subject: | com web/bugs: bug.php - thanks messages: include/functions.php www/bug.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-25548@lists.php.net to get a copy of this message | ||
Commit: 79d0754201fb88e50048d60923bdcb249cc6ed58
Author: Sobak <msobaczewski@gmail.com> Tue, 24 Jan 2017 07:21:14 +0100
Parents: d7aecd6490d6045f8e9fda943c99dd7701c88b45
Branches: redesign
Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=79d0754201fb88e50048d60923bdcb249cc6ed58
Log:
bug.php - thanks messages
Changed paths:
M include/functions.php
M www/bug.php
Diff:
diff --git a/include/functions.php b/include/functions.php
index c1fc408..0e01ede 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1697,7 +1697,7 @@ function bugs_mail($to, $subject, $message, $headers = '', $params =
'')
* @param string $title a string to go into the header's <title>
* @return void
*/
-function response_header($title, $extraHeaders = '')
+function response_header($title, $extraHeaders = '', $preContent = '')
{
global $_header_done, $self, $auth_user, $logged_in, $siteBig, $site_method, $site_url, $basedir;
@@ -1755,6 +1755,8 @@ function response_header($title, $extraHeaders = '')
</div>
</nav>
+<?= $preContent ?>
+
<div id="layout" class="clearfix">
<section id="layout-content">
@@ -1941,6 +1943,10 @@ function esc($string) {
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
}
+function flash_message($text, $type = 'success') {
+ return "<div class='headsup {$type}'>{$text}</div>";
+}
+
if (!function_exists('apc_fetch')) {
function apc_fetch($key, &$success = false) {
return apcu_fetch($key, $success);
diff --git a/www/bug.php b/www/bug.php
index 060b043..a6400d2 100644
--- a/www/bug.php
+++ b/www/bug.php
@@ -567,54 +567,51 @@ switch (txfield('bug_type', $bug, isset($_POST['in']) ?
$_POST['in'] : null))
break;
}
-response_header(
- $show_bug_info ? "{$bug_type} #{$bug_id} :: " .
htmlspecialchars($bug['sdesc']) : "You must be logged in",
- ($bug_id != 'PREVIEW') ? "
- <link rel='alternate' type='application/rss+xml'
title='{$bug['package_name']} Bug #{$bug['id']} - RDF'
href='rss/bug.php?id={$bug_id}'>
- <link rel='alternate' type='application/rss+xml'
title='{$bug['package_name']} Bug #{$bug['id']} - RSS 2.0'
href='rss/bug.php?id={$bug_id}&format=rss2'>
- " : ''
-);
-
// DISPLAY BUG
$thanks = (isset($_GET['thanks'])) ? (int) $_GET['thanks'] : 0;
switch ($thanks)
{
case 1:
case 2:
- display_bug_success('The bug was updated successfully.');
+ $flash = 'The bug was updated successfully.';
break;
case 3:
- display_bug_success('Your comment was added to the bug successfully.');
+ $flash = 'Your comment was added to the bug successfully.';
break;
case 4:
- $bug_url = "{$site_method}://{$site_url}{$basedir}/bug.php?id={$bug_id}";
- display_bug_success("
- Thank you for your help!
- If the status of the bug report you submitted changes, you will be notified.
- You may return here and check the status or update your report at any time.<br>
- The URL for your bug report is: <a href='{$bug_url}'>{$bug_url}</a>.
- ");
+ $flash = 'Thank you for your help! You will be notified of any changes regarding your
report.';
break;
case 6:
- display_bug_success('Thanks for voting! Your vote should be reflected in the statistics
below.');
+ $flash = 'Thanks for voting! Your vote should be reflected in the statistics below.';
break;
case 7:
- display_bug_success('Your subscribe request has been processed.');
+ $flash = 'Your subscribe request has been processed.';
break;
case 8:
- display_bug_success('Your unsubscribe request has been processed, please check your
email.');
+ $flash = 'Your unsubscribe request has been processed, please check your email.';
break;
case 9:
- display_bug_success('You have successfully unsubscribed.');
+ $flash = 'You have successfully unsubscribed.';
break;
case 10:
- display_bug_success('Your vote has been updated.');
+ $flash = 'Your vote has been updated.';
break;
default:
break;
}
+$flash = isset($flash) ? flash_message($flash) : '';
+
+response_header(
+ $show_bug_info ? "{$bug_type} #{$bug_id} :: " .
htmlspecialchars($bug['sdesc']) : "You must be logged in",
+ ($bug_id != 'PREVIEW') ? "
+ <link rel='alternate' type='application/rss+xml'
title='{$bug['package_name']} Bug #{$bug['id']} - RDF'
href='rss/bug.php?id={$bug_id}'>
+ <link rel='alternate' type='application/rss+xml'
title='{$bug['package_name']} Bug #{$bug['id']} - RSS 2.0'
href='rss/bug.php?id={$bug_id}&format=rss2'>
+ " : '',
+ $flash
+);
+
display_bug_error($errors);
if ($show_bug_info) {