[geeklog-cvs] geeklog: Send people back to a user's profile when using "Send E...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Oct 4 09:00:16 EDT 2008
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e51de61d0280
changeset: 6420:e51de61d0280
user: Dirk Haun <dirk at haun-online.de>
date: Sat Oct 04 15:00:03 2008 +0200
description:
Send people back to a user's profile when using "Send Email" option; Code cleanup: Use COM_isAnonUser
diffstat:
1 file changed, 23 insertions(+), 20 deletions(-)
public_html/profiles.php | 43 +++++++++++++++++++++++--------------------
diffs (141 lines):
diff -r a8c5335a82d4 -r e51de61d0280 public_html/profiles.php
--- a/public_html/profiles.php Sat Oct 04 14:40:59 2008 +0200
+++ b/public_html/profiles.php Sat Oct 04 15:00:03 2008 +0200
@@ -2,14 +2,14 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.4 |
+// | Geeklog 1.5 |
// +---------------------------------------------------------------------------+
// | profiles.php |
// | |
// | This pages lets GL users communicate with each other without risk of |
// | their email address being intercepted by spammers. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2006 by the following authors: |
+// | Copyright (C) 2000-2008 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -35,7 +35,7 @@
//
// $Id: profiles.php,v 1.56 2008/02/20 20:32:37 mjervis Exp $
-require_once ('lib-common.php');
+require_once 'lib-common.php';
/**
* Mails the contents of the contact form to that user
@@ -54,10 +54,10 @@
$retval = '';
// check for correct $_CONF permission
- if (empty ($_USER['username']) &&
- (($_CONF['loginrequired'] == 1) || ($_CONF['emailuserloginrequired'] == 1))
- && ($uid != 2)) {
- return COM_refresh ($_CONF['site_url'] . '/index.php');
+ if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
+ ($_CONF['emailuserloginrequired'] == 1))
+ && ($uid != 2)) {
+ return COM_refresh($_CONF['site_url'] . '/index.php?msg=85');
}
// check for correct 'to' user preferences
@@ -70,13 +70,13 @@
}
if ((($P['emailfromadmin'] != 1) && $isAdmin) ||
(($P['emailfromuser'] != 1) && !$isAdmin)) {
- return COM_refresh ($_CONF['site_url'] . '/index.php');
+ return COM_refresh ($_CONF['site_url'] . '/index.php?msg=85');
}
// check mail speedlimit
COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
if (COM_checkSpeedlimit ('mail') > 0) {
- return COM_refresh ($_CONF['site_url'] . '/index.php');
+ return COM_refresh ($_CONF['site_url'] . '/index.php?msg=85');
}
if (!empty($author) && !empty($subject) && !empty($message)) {
@@ -86,8 +86,9 @@
// Append the user's signature to the message
$sig = '';
- if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
- $sig = DB_getItem ($_TABLES['users'], 'sig', "uid={$_USER['uid']}");
+ if (!COM_isAnonUser()) {
+ $sig = DB_getItem($_TABLES['users'], 'sig',
+ "uid={$_USER['uid']}");
if (!empty ($sig)) {
$sig = strip_tags (COM_stripslashes ($sig));
$sig = "\n\n-- \n" . $sig;
@@ -128,7 +129,9 @@
COM_mail ($to, $subject, $message, $from);
COM_updateSpeedlimit ('mail');
- $retval .= COM_refresh($_CONF['site_url'] . '/index.php?msg=27');
+ $retval .= COM_refresh($_CONF['site_url']
+ . '/users.php?mode=profile&uid=' . $uid
+ . '&msg=27');
} else {
$subject = strip_tags ($subject);
$subject = substr ($subject, 0, strcspn ($subject, "\r\n"));
@@ -166,8 +169,8 @@
$retval = '';
- if (empty ($_USER['username']) &&
- (($_CONF['loginrequired'] == 1) || ($_CONF['emailuserloginrequired'] == 1))) {
+ if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
+ ($_CONF['emailuserloginrequired'] == 1))) {
$retval = COM_startBlock ($LANG_LOGIN[1], '',
COM_getBlockTemplate ('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
@@ -202,7 +205,7 @@
$mail_template->set_var ('site_url', $_CONF['site_url']);
$mail_template->set_var ('lang_description', $LANG08[26]);
$mail_template->set_var ('lang_username', $LANG08[11]);
- if (empty ($_USER['username'])) {
+ if (COM_isAnonUser()) {
$sender = '';
if (isset ($_POST['author'])) {
$sender = strip_tags ($_POST['author']);
@@ -216,7 +219,7 @@
$_USER['fullname']));
}
$mail_template->set_var ('lang_useremail', $LANG08[12]);
- if (empty ($_USER['email'])) {
+ if (COM_isAnonUser()) {
$email = '';
if (isset ($_POST['authoremail'])) {
$email = strip_tags ($_POST['authoremail']);
@@ -273,7 +276,7 @@
*/
function mailstory($sid, $to, $toemail, $from, $fromemail, $shortmsg)
{
- global $_CONF, $_TABLES, $_USER, $LANG01, $LANG08;
+ global $_CONF, $_TABLES, $LANG01, $LANG08;
$storyurl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
if ($_CONF['url_rewrite']) {
@@ -371,8 +374,8 @@
$retval = '';
- if (empty ($_USER['username']) &&
- (($_CONF['loginrequired'] == 1) || ($_CONF['emailstoryloginrequired'] == 1))) {
+ if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
+ ($_CONF['emailstoryloginrequired'] == 1))) {
$retval = COM_startBlock ($LANG_LOGIN[1], '',
COM_getBlockTemplate ('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
@@ -396,7 +399,7 @@
}
if (empty ($from) && empty ($fromemail)) {
- if (!empty ($_USER['username'])) {
+ if (!COM_isAnonUser()) {
$from = COM_getDisplayName ($_USER['uid'], $_USER['username'],
$_USER['fullname']);
$fromemail = DB_getItem ($_TABLES['users'], 'email',
More information about the geeklog-cvs
mailing list