diff --git a/README.md b/README.md index de8c8e7..b5deda0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This plugin is intended to be used with YOURLS (cf. http://yourls.org) It has been tested on YOURLS v1.5.1 and YourlsBlacklistIPs v1.3 -Current version is 0.01 +Current version is 0.02 Contact : *apelly[ at ]len[ dot ]io* @@ -31,6 +31,10 @@ Thanks to https://github.com/Panthro for YourlsWhiteListDomains which was basica Also thanks to https://github.com/LudoBoggio for the YourlsBlacklistIPs plugin which was the base for YourlsWhiteListDomains: - https://github.com/LudoBoggio/YourlsBlacklistIPs +Changelog +--------- +v0.02 Cosmetic changes +v0.01 Initial code --- Notice diff --git a/plugin.php b/plugin.php index 9b461c9..cb17c25 100644 --- a/plugin.php +++ b/plugin.php @@ -2,11 +2,12 @@ /* Plugin Name: YourlsBlackListDomains Plugin URI: https://github.com/apelly/YourlsBlacklistDomains -Description: Plugin which disallows blacklisted domains, forked from: https://github.com/Panthro/YourlsWhitelistDomains -Version: 0.01 +Description: Plugin which disallows blacklisted domains and bans the submitters IP address. GPL v3 +Version: 0.02 Author: apelly Author URI: http://len.io - +*/ +/* Copyright(c) (2012) Aaron Pelly License: @@ -37,6 +38,8 @@ yourls_add_action( 'plugins_loaded', 'apelly_blacklist_domain_add_page' ); function apelly_blacklist_domain_root ( $bol, $url ) { $parse = parse_url($url); $domain = str_ireplace('www.', '', parse_url($url, PHP_URL_HOST)); + $domain = str_ireplace('http://', '', parse_url($url, PHP_URL_HOST)); + $domain = str_ireplace('https://', '', parse_url($url, PHP_URL_HOST)); $return = false; $domain_list = yourls_get_option ('apelly_blacklist_domain_list'); if ( $domain_list ) { @@ -44,7 +47,7 @@ function apelly_blacklist_domain_root ( $bol, $url ) { if (strpos($domain_list_display,$domain) === true) { // Check if a YourlsBlacklistIPs is installed and active - if (yourls_is_active_plugin( YOURLS_PLUGINDIR .'/BlackListIP/plugin.php' ) { + if (yourls_is_active_plugin( YOURLS_PLUGINDIR .'/BlackListIP/plugin.php' )) { // fetch the blacklisted IP addresses $IP_List = yourls_get_option ('ludo_blacklist_ip_liste'); $IP_List = ( $IP_List ) ? ( unserialize ( $IP_List ) ):((array)NULL); @@ -61,7 +64,9 @@ function apelly_blacklist_domain_root ( $bol, $url ) { } // stop - yourls_die( 'Blacklisted domain', 'Forbidden', 403 ); + //yourls_die( 'Blacklisted domain', 'Forbidden', 403 ); + echo "
Blacklist following domains - -
+Blacklist following domains
+ @@ -113,6 +117,12 @@ function apelly_blacklist_domain_process () { // Update list $sent_list = serialize($_POST['blacklist_form']); yourls_update_option ( 'apelly_blacklist_domain_list',$sent_list ); - echo "Black list updated" ; + echo "Black list updated. New blacklist is " ; + if ( count ( $IPList ) == 0 ) + echo "sent_list."; + else { + echo ":