[geeklog-cvs] geeklog: Display confirmation message when emailing a story (fea...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Oct 4 08:41:14 EDT 2008


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/a8c5335a82d4
changeset: 6419:a8c5335a82d4
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Oct 04 14:40:59 2008 +0200
description:
Display confirmation message when emailing a story (feature request #0000689)

diffstat:

4 files changed, 31 insertions(+), 10 deletions(-)
public_html/article.php    |   11 +++++++++--
public_html/docs/history   |    2 ++
public_html/lib-common.php |    4 +++-
public_html/profiles.php   |   24 +++++++++++++++++-------

diffs (105 lines):

diff -r 10585aeefd17 -r a8c5335a82d4 public_html/article.php
--- a/public_html/article.php	Fri Oct 03 22:38:53 2008 +0200
+++ b/public_html/article.php	Sat Oct 04 14:40:59 2008 +0200
@@ -246,8 +246,15 @@
         }
         $display .= COM_siteHeader ('menu', $pagetitle, $rdf);
 
-        if (isset ($_GET['msg'])) {
-            $display .= COM_showMessage (COM_applyFilter ($_GET['msg'], true));
+        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);
+            }
         }
 
         DB_query ("UPDATE {$_TABLES['stories']} SET hits = hits + 1 WHERE (sid = '".$story->getSid()."') AND (date <= NOW()) AND (draft_flag = 0)");
diff -r 10585aeefd17 -r a8c5335a82d4 public_html/docs/history
--- a/public_html/docs/history	Fri Oct 03 22:38:53 2008 +0200
+++ b/public_html/docs/history	Sat Oct 04 14:40:59 2008 +0200
@@ -3,6 +3,8 @@
 ??? ??, 2008 (1.5.2)
 ------------
 
+- Display confirmation message when emailing a story (feature request #0000689)
+  [Dirk]
 - Implemented new function COM_renderWikiText to convert wiki-formatted text
   to (X)HTML (feature request #0000643) [Dirk]
 - Added support for CUSTOM_formatEmailAddress and CUSTOM_emailEscape functions
diff -r 10585aeefd17 -r a8c5335a82d4 public_html/lib-common.php
--- a/public_html/lib-common.php	Fri Oct 03 22:38:53 2008 +0200
+++ b/public_html/lib-common.php	Sat Oct 04 14:40:59 2008 +0200
@@ -4495,12 +4495,14 @@
             $message = $MESSAGE[$msg];
         }
 
-        $retval .= COM_startBlock($MESSAGE[40] . ' - ' . $timestamp, '',
+        if (!empty($message)) {
+            $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;
diff -r 10585aeefd17 -r a8c5335a82d4 public_html/profiles.php
--- a/public_html/profiles.php	Fri Oct 03 22:38:53 2008 +0200
+++ b/public_html/profiles.php	Sat Oct 04 14:40:59 2008 +0200
@@ -271,16 +271,20 @@
 *                this code
 *
 */
-function mailstory ($sid, $to, $toemail, $from, $fromemail, $shortmsg)
+function mailstory($sid, $to, $toemail, $from, $fromemail, $shortmsg)
 {
     global $_CONF, $_TABLES, $_USER, $LANG01, $LANG08;
 
-    $retval = COM_refresh (COM_buildUrl ($_CONF['site_url']
-                                         . '/article.php?story=' . $sid));
+    $storyurl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
+    if ($_CONF['url_rewrite']) {
+        $retval = COM_refresh($storyurl . '?msg=85');
+    } else {
+        $retval = COM_refresh($storyurl . '&msg=85');
+    }
 
     // check for correct $_CONF permission
-    if (empty ($_USER['username']) &&
-        (($_CONF['loginrequired'] == 1) || ($_CONF['emailstoryloginrequired'] == 1))) {
+    if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
+                             ($_CONF['emailstoryloginrequired'] == 1))) {
         return $retval;
     }
 
@@ -290,8 +294,8 @@
     }
 
     // check mail speedlimit
-    COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
-    if (COM_checkSpeedlimit ('mail') > 0) {
+    COM_clearSpeedlimit($_CONF['speedlimit'], 'mail');
+    if (COM_checkSpeedlimit('mail') > 0) {
         return $retval;
     }
 
@@ -343,6 +347,12 @@
 
     // Increment numemails counter for story
     DB_query ("UPDATE {$_TABLES['stories']} SET numemails = numemails + 1 WHERE sid = '$sid'");
+
+    if ($_CONF['url_rewrite']) {
+        $retval = COM_refresh($storyurl . '?msg=27');
+    } else {
+        $retval = COM_refresh($storyurl . '&msg=27');
+    }
 
     return $retval;
 }



More information about the geeklog-cvs mailing list