[geeklog-cvs] geeklog: Introduced COM_showMessageText (for feature request #00...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Oct 4 11:28:23 EDT 2008
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/86e95e048be4
changeset: 6421:86e95e048be4
user: Dirk Haun <dirk at haun-online.de>
date: Sat Oct 04 17:28:09 2008 +0200
description:
Introduced COM_showMessageText (for feature request #0000676) and COM_showMessageFromParameter (for bug #0000618)
diffstat:
15 files changed, 106 insertions(+), 98 deletions(-)
public_html/admin/block.php | 12 -----
public_html/admin/database.php | 2
public_html/admin/group.php | 6 --
public_html/admin/mail.php | 5 +-
public_html/admin/moderation.php | 12 -----
public_html/admin/plugins.php | 12 -----
public_html/admin/story.php | 6 --
public_html/admin/syndication.php | 9 +---
public_html/admin/topic.php | 4 -
public_html/admin/trackback.php | 17 ++-----
public_html/admin/user.php | 6 --
public_html/docs/history | 5 ++
public_html/lib-common.php | 83 ++++++++++++++++++++++++++++---------
public_html/users.php | 15 ++++--
public_html/usersettings.php | 10 ----
diffs (truncated from 416 to 300 lines):
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/block.php
--- a/public_html/admin/block.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/block.php Sat Oct 04 17:28:09 2008 +0200
@@ -847,16 +847,8 @@
$display .= listblocks();
$display .= COM_siteFooter();
} else { // 'cancel' or no mode at all
- $display .= COM_siteHeader ('menu', $LANG21[19]);
- $msg = 0;
- if (isset ($_POST['msg'])) {
- $msg = COM_applyFilter ($_POST['msg'], true);
- } else if (isset ($_GET['msg'])) {
- $msg = COM_applyFilter ($_GET['msg'], true);
- }
- if ($msg > 0) {
- $display .= COM_showMessage ($msg);
- }
+ $display .= COM_siteHeader('menu', $LANG21[19]);
+ $display .= COM_showMessageFromParameter();
$display .= listblocks();
$display .= COM_siteFooter();
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/database.php
--- a/public_html/admin/database.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/database.php Sat Oct 04 17:28:09 2008 +0200
@@ -311,6 +311,8 @@
}
}
}
+} else {
+ $display .= COM_showMessageFromParameter();
}
// Show all backups
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/group.php
--- a/public_html/admin/group.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/group.php Sat Oct 04 17:28:09 2008 +0200
@@ -1034,10 +1034,8 @@
$display .= editusers ($grp_id);
$display .= COM_siteFooter ();
} else { // 'cancel' or no mode at all
- $display .= COM_siteHeader ('menu', $LANG28[38]);
- if (isset ($_REQUEST['msg'])) {
- $display .= COM_showMessage (COM_applyFilter ($_REQUEST['msg'], true));
- }
+ $display .= COM_siteHeader('menu', $LANG28[38]);
+ $display .= COM_showMessageFromParameter();
$display .= listgroups();
$display .= COM_siteFooter();
}
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/mail.php
--- a/public_html/admin/mail.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/mail.php Sat Oct 04 17:28:09 2008 +0200
@@ -32,8 +32,8 @@
//
// $Id: mail.php,v 1.37 2008/05/27 20:53:10 dhaun Exp $
-require_once ('../lib-common.php');
-require_once ('auth.inc.php');
+require_once '../lib-common.php';
+require_once 'auth.inc.php';
$display = '';
@@ -230,6 +230,7 @@
if (isset($_POST['mail']) && ($_POST['mail'] == 'mail') && SEC_checkToken()) {
$display .= send_messages ($_POST);
} else {
+ $display .= COM_showMessageFromParameter();
$display .= display_mailform ();
}
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/moderation.php
--- a/public_html/admin/moderation.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/moderation.php Sat Oct 04 17:28:09 2008 +0200
@@ -667,17 +667,7 @@
$display = '';
$display .= COM_siteHeader ('menu', $LANG29[34]);
-$msg = 0;
-if (isset($_GET['msg'])) {
- $msg = COM_applyFilter($_GET['msg'], true);
-}
-if ($msg > 0) {
- $plugin = '';
- if (isset($_GET['plugin'])) {
- $plugin = COM_applyFilter($_GET['plugin']);
- }
- $display .= COM_showMessage($msg, $plugin);
-}
+$display .= COM_showMessageFromParameter();
if (isset ($_POST['mode']) && ($_POST['mode'] == 'moderation') && SEC_checkToken()) {
$action = array();
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/plugins.php Sat Oct 04 17:28:09 2008 +0200
@@ -492,16 +492,7 @@
} else { // 'cancel' or no mode at all
$display .= COM_siteHeader ('menu', $LANG32[5]);
- if (isset ($_REQUEST['msg'])) {
- $msg = COM_applyFilter ($_REQUEST['msg'], true);
- if (!empty ($msg)) {
- $plugin = '';
- if (isset ($_REQUEST['plugin'])) {
- $plugin = COM_applyFilter ($_REQUEST['plugin']);
- }
- $display .= COM_showMessage ($msg, $plugin);
- }
- }
+ $display .= COM_showMessageFromParameter();
$token = SEC_createToken();
$display .= listplugins ($token);
$display .= show_newplugins($token);
@@ -509,4 +500,5 @@
}
echo $display;
+
?>
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/story.php
--- a/public_html/admin/story.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/story.php Sat Oct 04 17:28:09 2008 +0200
@@ -785,11 +785,7 @@
$display = COM_refresh ($_CONF['site_admin_url'] . '/moderation.php');
} else {
$display .= COM_siteHeader('menu', $LANG24[22]);
- $msg = "";
- if (isset($_GET['msg'])) {
- $msg = COM_applyFilter($_GET['msg'], true);
- $display .= COM_showMessage($msg);
- }
+ $display .= COM_showMessageFromParameter();
$display .= liststories();
$display .= COM_siteFooter();
}
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/syndication.php
--- a/public_html/admin/syndication.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/syndication.php Sat Oct 04 17:28:09 2008 +0200
@@ -583,13 +583,12 @@
}
else
{
- $display .= COM_siteHeader ('menu', $LANG33[10]);
- if (isset ($_REQUEST['msg'])) {
- $display .= COM_showMessage (COM_applyFilter($_REQUEST['msg']));
- }
+ $display .= COM_siteHeader('menu', $LANG33[10]);
+ $display .= COM_showMessageFromParameter();
$display .= listfeeds();
- $display .= COM_siteFooter ();
+ $display .= COM_siteFooter();
}
echo $display;
+
?>
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/topic.php
--- a/public_html/admin/topic.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/topic.php Sat Oct 04 17:28:09 2008 +0200
@@ -595,9 +595,7 @@
$display .= COM_siteFooter();
} else { // 'cancel' or no mode at all
$display .= COM_siteHeader('menu', $LANG27[8]);
- if (isset ($_GET['msg'])) {
- $display .= COM_showMessage (COM_applyFilter ($_GET['msg'], true));
- }
+ $display .= COM_showMessageFromParameter();
$display .= listtopics();
$display .= COM_siteFooter();
}
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/trackback.php
--- a/public_html/admin/trackback.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/trackback.php Sat Oct 04 17:28:09 2008 +0200
@@ -1128,13 +1128,7 @@
. COM_siteFooter ();
} else if (($mode == 'fresh') || ($mode == 'preview')) {
$display .= COM_siteHeader ('menu', $LANG_TRB['trackback']);
-
- if (isset ($_REQUEST['msg'])) {
- $msg = COM_applyFilter ($_REQUEST['msg'], true);
- if ($msg > 0) {
- $display .= COM_showMessage ($msg);
- }
- }
+ $display .= COM_showMessageFromParameter();
$target = '';
if (isset ($_REQUEST['target'])) {
@@ -1216,14 +1210,13 @@
$display .= editServiceForm ($pid);
} else if ($mode == 'listservice') {
- $display .= COM_siteHeader ('menu', $LANG_TRB['services_headline']);
- if (isset ($_REQUEST['msg'])) {
- $display .= COM_showMessage (COM_applyFilter ($_REQUEST['msg'], true));
- }
- $display .= listServices ();
+ $display .= COM_siteHeader('menu', $LANG_TRB['services_headline']);
+ $display .= COM_showMessageFromParameter();
+ $display .= listServices();
$display .= COM_siteFooter();
} else if ($mode == 'freepb') {
$display .= COM_siteHeader ('menu', $LANG_TRB['pingback']);
+ $display .= COM_showMessageFromParameter();
$display .= pingbackForm ();
$display .= COM_siteFooter();
} else if ($mode == 'sendpingback') {
diff -r e51de61d0280 -r 86e95e048be4 public_html/admin/user.php
--- a/public_html/admin/user.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/admin/user.php Sat Oct 04 17:28:09 2008 +0200
@@ -1250,10 +1250,8 @@
. batchdelete()
. COM_siteFooter();
} else { // 'cancel' or no mode at all
- $display .= COM_siteHeader ('menu', $LANG28[11]);
- if (isset ($_REQUEST['msg'])) {
- $display .= COM_showMessage (COM_applyFilter ($_REQUEST['msg'], true));
- }
+ $display .= COM_siteHeader('menu', $LANG28[11]);
+ $display .= COM_showMessageFromParameter();
$display .= listusers();
$display .= COM_siteFooter();
}
diff -r e51de61d0280 -r 86e95e048be4 public_html/docs/history
--- a/public_html/docs/history Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/docs/history Sat Oct 04 17:28:09 2008 +0200
@@ -3,6 +3,11 @@
??? ??, 2008 (1.5.2)
------------
+- Introduced new function COM_showMessageText to display a free-form text in a
+ "System Message" box (feature request #0000676) [Dirk]
+- Introduced new function COM_showMessageFromParameter for easy and consistent
+ display of messages passed in the URL, including plugin messages (second
+ attempt to fix bug #0000618) [Dirk]
- Display confirmation message when emailing a story (feature request #0000689)
[Dirk]
- Implemented new function COM_renderWikiText to convert wiki-formatted text
diff -r e51de61d0280 -r 86e95e048be4 public_html/lib-common.php
--- a/public_html/lib-common.php Sat Oct 04 15:00:03 2008 +0200
+++ b/public_html/lib-common.php Sat Oct 04 17:28:09 2008 +0200
@@ -4462,6 +4462,31 @@
return $retval;
}
+/**
+* Displays a message text in a "System Message" block
+*
+* @param string $message Message text; may contain HTML
+* @return string HTML block with message
+*
+*/
+function COM_showMessageText($message)
+{
+ global $_CONF, $MESSAGE, $_IMAGE_TYPE;
+
+ $retval = '';
+
+ if (!empty($message)) {
+ $timestamp = strftime($_CONF['daytime']);
+ $retval .= COM_startBlock($MESSAGE[40] . ' - ' . $timestamp, '',
+ COM_getBlockTemplate('_msg_block', 'header'))
+ . '<p class="sysmessage"><img src="' . $_CONF['layout_url']
+ . '/images/sysmessage.' . $_IMAGE_TYPE . '" alt="" ' . XHTML
+ . '>' . $message . '</p>'
+ . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
+ }
+
+ return $retval;
+}
/**
* Displays a message on the webpage
@@ -4469,19 +4494,17 @@
* Pulls $msg off the URL string and gets the corresponding message and returns
* it for display on the calling page
*
-* @param int $msg ID of message to show
-* @param string $plugin Optional Name of plugin to lookup plugin defined message
-* @return string HTML block with message
-*/
-
+* @param int $msg ID of message to show
+* @param string $plugin Optional Name of plugin to lookup plugin defined message
+* @return string HTML block with message
+*/
function COM_showMessage($msg, $plugin = '')
{
- global $_CONF, $MESSAGE, $_IMAGE_TYPE;
+ global $MESSAGE;
$retval = '';
if ($msg > 0) {
- $timestamp = strftime($_CONF['daytime']);
if (!empty($plugin)) {
$var = 'PLG_' . $plugin . '_MESSAGE' . $msg;
global $$var;
More information about the geeklog-cvs
mailing list