From 3971209b0996a1b0506d6ddaf7326432933eae1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 15 Sep 2011 12:23:00 +0000 Subject: [PATCH] Extension ext-cprping introduced (dummy), 'install' directory excluded from GNU GPL: - New extension ext-cprping introduced (I had that idea of reactivating the code at http://cpr-stats.mxchange.org - Some functions moved above note for auto-recreated functions - Directory 'install' excluded from GNU GPL - TODOs.txt updated --- .gitattributes | 2 + DOCS/README | 4 +- DOCS/TODOs.txt | 16 ++-- inc/extensions/ext-cprping.php | 100 ++++++++++++++++++++ inc/functions.php | 4 +- inc/http-functions.php | 130 +++++++++++++------------- inc/wrapper-functions.php | 15 ++- templates/de/html/ext/ext_cprping.tpl | 32 +++++++ 8 files changed, 222 insertions(+), 81 deletions(-) create mode 100644 inc/extensions/ext-cprping.php create mode 100644 templates/de/html/ext/ext_cprping.tpl diff --git a/.gitattributes b/.gitattributes index f3fc871ce3..48c1617b67 100644 --- a/.gitattributes +++ b/.gitattributes @@ -142,6 +142,7 @@ inc/extensions/ext-cache.php svneol=native#text/plain inc/extensions/ext-clickbanner.php svneol=native#text/plain inc/extensions/ext-country.php svneol=native#text/plain inc/extensions/ext-coupon.php svneol=native#text/plain +inc/extensions/ext-cprping.php svneol=native#text/plain inc/extensions/ext-debug.php svneol=native#text/plain inc/extensions/ext-demo.php svneol=native#text/plain inc/extensions/ext-doubler.php svneol=native#text/plain @@ -1566,6 +1567,7 @@ templates/de/html/ext/ext_cache.tpl svneol=native#text/plain templates/de/html/ext/ext_clickbanner.tpl svneol=native#text/plain templates/de/html/ext/ext_country.tpl svneol=native#text/plain templates/de/html/ext/ext_coupon.tpl svneol=native#text/plain +templates/de/html/ext/ext_cprping.tpl svneol=native#text/plain templates/de/html/ext/ext_debug.tpl svneol=native#text/plain templates/de/html/ext/ext_demo.tpl svneol=native#text/plain templates/de/html/ext/ext_doubler.tpl svneol=native#text/plain diff --git a/DOCS/README b/DOCS/README index d6ad3c5504..abf3234c8c 100644 --- a/DOCS/README +++ b/DOCS/README @@ -20,5 +20,5 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -This applies to all files from root directory except DOCS, img and templates -directories. +This applies to all files from root directory except DOCS, img, install and +templates directories. diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 86955b69d6..7afe6b0b09 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -177,16 +177,16 @@ ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1080: // @TODO Deprecate this thing -./inc/template-functions.php:1091: // @TODO Deprecate this thing -./inc/template-functions.php:1181: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1214: // @TODO Add a little more infos here -./inc/template-functions.php:1543:// @TODO Lame description for this function -./inc/template-functions.php:1565: // @TODO Move this in a filter +./inc/template-functions.php:1083: // @TODO Deprecate this thing +./inc/template-functions.php:1094: // @TODO Deprecate this thing +./inc/template-functions.php:1184: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1217: // @TODO Add a little more infos here +./inc/template-functions.php:1546:// @TODO Lame description for this function +./inc/template-functions.php:1568: // @TODO Move this in a filter ./inc/template-functions.php:193: * @TODO On some pages this is buggy ./inc/template-functions.php:281: // @TODO Remove these sanity checks if all is fine -./inc/template-functions.php:608:// @TODO $simple/$constants are deprecated -./inc/wrapper-functions.php:512:// @TODO Do some more sanity check here +./inc/template-functions.php:611:// @TODO $simple/$constants are deprecated +./inc/wrapper-functions.php:485:// @TODO Do some more sanity check here ./inc/xml-functions.php:189: // @TODO Handle characters ./mailid.php:139: // @TODO Rewrite this to a filter ./mailid.php:96: // @TODO Rewrite this to a filter diff --git a/inc/extensions/ext-cprping.php b/inc/extensions/ext-cprping.php new file mode 100644 index 0000000000..965a1ed5e2 --- /dev/null +++ b/inc/extensions/ext-cprping.php @@ -0,0 +1,100 @@ + diff --git a/inc/functions.php b/inc/functions.php index b142253bab..eb353b4481 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -202,11 +202,11 @@ function sendRawEmail ($toEmail, $subject, $message, $headers) { $mail->Subject = $subject; if ((isExtensionActive('html_mail')) && (secureString($message) != $message)) { $mail->Body = $message; - $mail->AltBody = 'Your mail program required HTML support to read this mail!'; + $mail->AltBody = decodeEntities($message); $mail->WordWrap = 70; $mail->IsHTML(true); } else { - $mail->Body = decodeEntities($message); + $mail->Body = decodeEntities(strip_tags($message)); } $mail->AddAddress($toEmail, ''); diff --git a/inc/http-functions.php b/inc/http-functions.php index 6877963cc3..9398678b10 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -584,6 +584,71 @@ function isBrokenHttpServerImplentation () { return $isBroken; } +// Extract host from script name +function extractHostnameFromUrl (&$script) { + // Use default SERVER_URL by default... ;) So? + $url = getServerUrl(); + + // Is this URL valid? + if (substr($script, 0, 7) == 'http://') { + // Use the hostname from script URL as new hostname + $url = substr($script, 7); + $extract = explode('/', $url); + $url = $extract[0]; + // Done extracting the URL :) + } // END - if + + // Extract host name + $host = str_replace('http://', '', $url); + if (isInString('/', $host)) { + $host = substr($host, 0, strpos($host, '/')); + } // END - if + + // Generate relative URL + //* DEBUG: */ debugOutput('SCRIPT=' . $script); + if (substr(strtolower($script), 0, 7) == 'http://') { + // But only if http:// is in front! + $script = substr($script, (strlen($url) + 7)); + } elseif (substr(strtolower($script), 0, 8) == 'https://') { + // Does this work?! + $script = substr($script, (strlen($url) + 8)); + } + + //* DEBUG: */ debugOutput('SCRIPT=' . $script); + if (substr($script, 0, 1) == '/') { + $script = substr($script, 1); + } // END - if + + // Return host name + return $host; +} + +// Adds a HTTP header to array +function addHttpHeader ($header) { + // Send the header + //* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header); + $GLOBALS['http_header'][] = trim($header); +} + +// Flushes all HTTP headers +function flushHttpHeaders () { + // Is the header already sent? + if (headers_sent()) { + // Then abort here + debug_report_bug(__FUNCTION__, __LINE__, 'Headers already sent!'); + } // END - if + + // Flush all headers if found + if ((isset($GLOBALS['http_header'])) && (is_array($GLOBALS['http_header']))) { + foreach ($GLOBALS['http_header'] as $header) { + header($header); + } // END - foreach + } // END - if + + // Mark them as flushed + $GLOBALS['http_header'] = array(); +} + //----------------------------------------------------------------------------- // Automatically re-created functions, all taken from user comments on www.php.net //----------------------------------------------------------------------------- @@ -734,70 +799,5 @@ next[100]=
'.replaceReturnNewLine(htmlentities(call_user_func_array($mbPrefi
 	}
 } // END - if
 
-// Extract host from script name
-function extractHostnameFromUrl (&$script) {
-	// Use default SERVER_URL by default... ;) So?
-	$url = getServerUrl();
-
-	// Is this URL valid?
-	if (substr($script, 0, 7) == 'http://') {
-		// Use the hostname from script URL as new hostname
-		$url = substr($script, 7);
-		$extract = explode('/', $url);
-		$url = $extract[0];
-		// Done extracting the URL :)
-	} // END - if
-
-	// Extract host name
-	$host = str_replace('http://', '', $url);
-	if (isInString('/', $host)) {
-		$host = substr($host, 0, strpos($host, '/'));
-	} // END - if
-
-	// Generate relative URL
-	//* DEBUG: */ debugOutput('SCRIPT=' . $script);
-	if (substr(strtolower($script), 0, 7) == 'http://') {
-		// But only if http:// is in front!
-		$script = substr($script, (strlen($url) + 7));
-	} elseif (substr(strtolower($script), 0, 8) == 'https://') {
-		// Does this work?!
-		$script = substr($script, (strlen($url) + 8));
-	}
-
-	//* DEBUG: */ debugOutput('SCRIPT=' . $script);
-	if (substr($script, 0, 1) == '/') {
-		$script = substr($script, 1);
-	} // END - if
-
-	// Return host name
-	return $host;
-}
-
-// Adds a HTTP header to array
-function addHttpHeader ($header) {
-	// Send the header
-	//* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header);
-	$GLOBALS['http_header'][] = trim($header);
-}
-
-// Flushes all HTTP headers
-function flushHttpHeaders () {
-	// Is the header already sent?
-	if (headers_sent()) {
-		// Then abort here
-		debug_report_bug(__FUNCTION__, __LINE__, 'Headers already sent!');
-	} // END - if
-
-	// Flush all headers if found
-	if ((isset($GLOBALS['http_header'])) && (is_array($GLOBALS['http_header']))) {
-		foreach ($GLOBALS['http_header'] as $header) {
-			header($header);
-		} // END - foreach
-	} // END - if
-
-	// Mark them as flushed
-	$GLOBALS['http_header'] = array();
-}
-
 // [EOF]
 ?>
diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php
index ce74b918bd..308f7439a6 100644
--- a/inc/wrapper-functions.php
+++ b/inc/wrapper-functions.php
@@ -2642,10 +2642,17 @@ function convertCommaToDotInPostDataArray ($postEntries) {
  * @link	http://de.php.net/manual/en/function.floatval.php#92563
  */
 function parseFloat ($floatString){
-    $LocaleInfo = localeconv();
-    $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '', $floatString);
-    $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString);
-    return floatval($floatString);
+	// Load locale info
+	$LocaleInfo = localeconv();
+
+	// Remove thousand separators
+	$floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '' , $floatString);
+
+	// Convert decimal point
+	$floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString);
+
+	// Return float value of converted string
+	return floatval($floatString);
 }
 
 // Generates a YES/NO option list from given default
diff --git a/templates/de/html/ext/ext_cprping.tpl b/templates/de/html/ext/ext_cprping.tpl
new file mode 100644
index 0000000000..c81453e14c
--- /dev/null
+++ b/templates/de/html/ext/ext_cprping.tpl
@@ -0,0 +1,32 @@
+
+ Diese Erweiterung schickt per "Ping" (HTTP-POST) an ein Script + von meinem ehemaligen Blog die anfragende + IP-Nummer, die Browserbezeichnung und ein verdecktes Feld in der Anmeldung, + das per Filter hinzugefügt wurde, wenn das verdeckte Feld + ausgefüllt sein sollte. +
+ +
+ Das verdeckte Feld hat im Gegensatz zum CPR-Plugin (C/omments + Post Rewriter) einen Zufallsanteil, um dem Spambot das + Erkennen des Feldes durch Mustererkennung zu erschweren. Da für das + sich anmeldende Mitglied das verdeckte Feld nicht sichtbar ist (dies ist + durch per Zufall ausgewählte Möglichkeit realisiert und somit dem + Spambot dies weiter erschwert), kann mit hoher Wahrscheinlichkeit erkannt + werden, dass die IP-Nummer einem Spammer gehört. +
+ +
+ Sollten die spam-erkannten Zugriffe durch die IP-Nummer einen einstellbaren + Schwellwert überschritten haben, wird diese IP-Nummer ganz blockiert. +
+ +
+ Das "Ping-Script" selbst liefert nur eine neutrale Antwort und + Zusatzkopfzeilen HTTP-konform zurück bzw. diverse Fehlercodes. Mehr + dazu und alle vom Ping-Script zurückgegebenen Fehlercodes entnehmen Sie + bitte der beigefügten README.txt Datei unter + DOCS/de/cprping/README.txt (diese ist noch nicht vorhanden, + ich weis). +
-- 2.39.5