[geeklog-cvs] geeklog: Some quick usability improvements (that don't need temp...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 10 15:28:15 EST 2010
changeset 7597:e22c4001d5b2
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e22c4001d5b2
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jan 10 16:42:45 2010 +0100
description:
Some quick usability improvements (that don't need template changes)
diffstat:
public_html/admin/mail.php | 44 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 36 insertions(+), 8 deletions(-)
diffs (95 lines):
diff -r a411f5d356bb -r e22c4001d5b2 public_html/admin/mail.php
--- a/public_html/admin/mail.php Sun Jan 10 11:17:57 2010 +0100
+++ b/public_html/admin/mail.php Sun Jan 10 16:42:45 2010 +0100
@@ -48,7 +48,7 @@
$display = '';
// Make sure user has access to this page
-if (!SEC_inGroup('Mail Admin') && !SEC_hasrights('user.mail')) {
+if (! SEC_hasRights('user.mail')) {
$display .= COM_siteHeader('menu', $MESSAGE[30])
. COM_showMessageText($MESSAGE[29], $MESSAGE[30])
. COM_siteFooter();
@@ -61,10 +61,11 @@
* Shows the form the admin uses to send Geeklog members a message. Right now
* you can only email an entire group.
*
-* @return string HTML for the email form
+* @param array $vars optional array of form content
+* @return string HTML for the email form
*
*/
-function display_mailform ()
+function display_mailform($vars = array())
{
global $_CONF, $LANG31, $LANG_ADMIN, $_IMAGE_TYPE;
@@ -98,21 +99,47 @@
$mail_templates->set_var('lang_to', $LANG31[18]);
$mail_templates->set_var('lang_selectgroup', $LANG31[25]);
+ $to_group = 0;
+ if (isset($vars['to_group'])) {
+ $to_group = COM_applyFilter($vars['to_group'], true);
+ }
+
$thisUsersGroups = SEC_getUserGroups();
uksort($thisUsersGroups, 'strcasecmp');
$group_options = '';
foreach ($thisUsersGroups as $groupName => $groupID) {
if ($groupName != 'All Users') {
- $group_options .= '<option value="' . $groupID . '">'
- . ucwords($groupName) . '</option>';
+ $group_options .= '<option value="' . $groupID . '"';
+ if (($to_group > 0) && ($to_group == $groupID)) {
+ $group_options .= ' selected="selected"';
+ }
+ $group_options .= '>' . ucwords($groupName) . '</option>';
}
}
$mail_templates->set_var('group_options', $group_options);
$mail_templates->set_var('lang_from', $LANG31[2]);
- $mail_templates->set_var('site_name', $_CONF['site_name']);
+ if (! empty($vars['fra'])) {
+ $from = $vars['fra'];
+ } else {
+ $from = $_CONF['site_name'];
+ }
+ $from = strip_tags($from);
+ $from = substr($from, 0, strcspn($from, "\r\n"));
+ $from = htmlspecialchars(trim($from), ENT_QUOTES);
+ $mail_templates->set_var('site_name', $from);
+
$mail_templates->set_var('lang_replyto', $LANG31[3]);
- $mail_templates->set_var('site_mail', $_CONF['site_mail']);
+ if (! empty($vars['fraepost'])) {
+ $fromemail = $vars['fraepost'];
+ } else {
+ $fromemail = $_CONF['site_mail'];
+ }
+ $fromemail = strip_tags($fromemail);
+ $fromemail = substr($fromemail, 0, strcspn($fromemail, "\r\n"));
+ $fromemail = htmlspecialchars(trim($fromemail), ENT_QUOTES);
+ $mail_templates->set_var('site_mail', $fromemail);
+
$mail_templates->set_var('lang_subject', $LANG31[4]);
$mail_templates->set_var('lang_body', $LANG31[5]);
$mail_templates->set_var('lang_sendto', $LANG31[6]);
@@ -155,6 +182,7 @@
empty($vars['subject']) OR empty($vars['message']) OR
empty($vars['to_group']) OR (strpos($vars['fra'], '@') !== false)) {
$retval .= COM_showMessageText($LANG31[26]);
+ $retval .= display_mailform($vars);
return $retval;
}
@@ -261,7 +289,7 @@
$display .= send_messages ($_POST);
} else {
$display .= COM_showMessageFromParameter();
- $display .= display_mailform ();
+ $display .= display_mailform();
}
$display .= COM_siteFooter ();
More information about the geeklog-cvs
mailing list