Changeset 5488
- Timestamp:
- 09/10/2014 02:15:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r5487 r5488 792 792 } 793 793 794 // Bail if keymaster is author795 if ( ! empty( $author_id ) && bbp_is_user_keymaster( $author_id ) ) {794 // Bail if author is keymaster 795 if ( ! empty( $author_id ) && bbp_is_user_keymaster( $author_id ) ) { 796 796 return true; 797 797 } … … 801 801 $match_out = ''; 802 802 803 /** Blacklist *************************************************************/804 805 // Get the moderation keys806 $blacklist = trim( get_option( 'moderation_keys' ) );807 808 // Bail if blacklist is empty809 if ( empty( $blacklist ) ) {810 return true;811 }812 813 803 /** User Data *************************************************************/ 814 804 815 805 // Map anonymous user data 816 if ( ! empty( $anonymous_data ) ) {806 if ( ! empty( $anonymous_data ) ) { 817 807 $_post['author'] = $anonymous_data['bbp_anonymous_name']; 818 808 $_post['email'] = $anonymous_data['bbp_anonymous_email']; … … 820 810 821 811 // Map current user data 822 } elseif ( ! empty( $author_id ) ) {812 } elseif ( ! empty( $author_id ) ) { 823 813 824 814 // Get author data … … 844 834 845 835 $max_links = get_option( 'comment_max_links' ); 846 if ( ! empty( $max_links ) ) {836 if ( ! empty( $max_links ) ) { 847 837 848 838 // How many links? 849 $num_links = preg_match_all( '/ <a [^>]*href/i', $content, $match_out );839 $num_links = preg_match_all( '/(http|ftp|https):\/\//i', $content, $match_out ); 850 840 851 841 // Allow for bumping the max to include the user's URL … … 858 848 } 859 849 860 /** Words *****************************************************************/ 861 862 // Get words separated by new lines 863 $words = explode( "\n", $blacklist ); 864 865 // Loop through words 866 foreach ( (array) $words as $word ) { 867 868 // Trim the whitespace from the word 869 $word = trim( $word ); 870 871 // Skip empty lines 872 if ( empty( $word ) ) { continue; } 873 874 // Do some escaping magic so that '#' chars in the 875 // spam words don't break things: 876 $word = preg_quote( $word, '#' ); 877 $pattern = "#$word#i"; 878 879 // Loop through post data 880 foreach ( $_post as $post_data ) { 881 882 // Check each user data for current word 883 if ( preg_match( $pattern, $post_data ) ) { 884 885 // Post does not pass 886 return false; 850 /** Blacklist *************************************************************/ 851 852 // Get the moderation keys 853 $blacklist = trim( get_option( 'moderation_keys' ) ); 854 855 // Bail if blacklist is empty 856 if ( ! empty( $blacklist ) ) { 857 858 // Get words separated by new lines 859 $words = explode( "\n", $blacklist ); 860 861 // Loop through words 862 foreach ( (array) $words as $word ) { 863 864 // Trim the whitespace from the word 865 $word = trim( $word ); 866 867 // Skip empty lines 868 if ( empty( $word ) ) { 869 continue; 870 } 871 872 // Do some escaping magic so that '#' chars in the 873 // spam words don't break things: 874 $word = preg_quote( $word, '#' ); 875 $pattern = "#$word#i"; 876 877 // Loop through post data 878 foreach ( $_post as $post_data ) { 879 880 // Check each user data for current word 881 if ( preg_match( $pattern, $post_data ) ) { 882 883 // Post does not pass 884 return false; 885 } 887 886 } 888 887 }
Note: See TracChangeset
for help on using the changeset viewer.