[geeklog-cvs] geeklog: Added call to PLG_itemPreSave to support the CAPTCHA pl...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat May 1 07:18:24 EDT 2010


changeset 7904:e8e4b4ed59f1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e8e4b4ed59f1
user: Dirk Haun <dirk at haun-online.de>
date: Sat May 01 12:05:35 2010 +0200
description:
Added call to PLG_itemPreSave to support the CAPTCHA plugin (feature request #0001091)
Also fixed wrong speedlimit warning when a required field was not filled in and fixed handling of "http://", i.e. URL not given

diffstat:

 plugins/links/functions.inc |  29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r 5f786769aeaf -r e8e4b4ed59f1 plugins/links/functions.inc
--- a/plugins/links/functions.inc	Sat May 01 09:58:01 2010 +0200
+++ b/plugins/links/functions.inc	Sat May 01 12:05:35 2010 +0200
@@ -860,16 +860,16 @@
 
     $retval = '';
 
-    if (!empty ($A['title']) && !empty ($A['description']) &&
-                !empty ($A['url'])) {
-        $retval = plugin_save_submit_links ($A);
+    if (!empty($A['title']) && !empty($A['description']) && !empty($A['url'])
+            && ($A['url'] != 'http://')) {
+        $retval = plugin_save_submit_links($A);
     } else {
         $retval .= COM_siteHeader()
             . COM_startBlock ($LANG12[22], '',
                            COM_getBlockTemplate ('_msg_block', 'header'))
             . $LANG12[23]
             . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'))
-            . submissionform('links')
+            . plugin_submit_links()
             . COM_siteFooter ();
     }
 
@@ -928,15 +928,30 @@
     $retval = '';
 
     // pseudo-formatted link description for the spam check
-    $spamcheck = '<p>'. COM_createLink($A['title'], $A['url']) .' ('
-               . $A['categorydd'] . ')<br' . XHTML . '>' . $A['description']
-               . '</p>';
+    if ($A['url'] == 'http://') {
+        $link = $A['title'];
+    } else {
+        $link = COM_createLink($A['title'], $A['url']);
+    }
+    $spamcheck = '<p>'. $link .' (' . $A['categorydd'] . ')<br' . XHTML . '>'
+               . $A['description'] . '</p>';
     $result = PLG_checkforSpam($spamcheck, $_CONF['spamx']);
     if ($result > 0) {
         COM_updateSpeedlimit('submit');
         COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
     }
 
+    $msg = PLG_itemPreSave('links', $A);
+    if (! empty($msg)) {
+        COM_updateSpeedlimit('submit');
+        $retval .= COM_siteHeader('menu')
+                . COM_errorLog($msg, 2)
+                . plugin_submit_links()
+                . COM_siteFooter();
+
+        return $retval;
+    }
+
     $A['cid'] = strip_tags(COM_stripslashes($A['categorydd']));
 
     $validcat = false;



More information about the geeklog-cvs mailing list