| | 65 | // User account was registered less than 2 weeks ago (but longer than 3 days) (user is still fairly new) |
| | 66 | $twoweeksago = time() - (2 * 7 * 24 * 60 * 60); |
| | 67 | $threedaysago = time() - (3 * 1 * 24 * 60 * 60); |
| | 68 | if ( strtotime($author->user_registered) > $twoweeksago && strtotime($author->user_registered) < $threedaysago ) array_push( $flagged['low'], __( 'account registered less than 2 weeks ago', 'wporg-plugins' ) ); |
| | 69 | if ( strtotime($author->user_registered) > $threedaysago ) array_push( $flagged['low'], __( 'account registered less than 3 days ago', 'wporg-plugins' ) ); |
| | 70 | |
| | 71 | // Username ends in numbers |
| | 72 | if ( is_numeric(substr($author->user_login, -1, 1) ) ) array_push( $flagged['low'], __( 'username ends in numbers', 'wporg-plugins' ) ); |
| | 73 | |
| | 74 | // User has no URL |
| | 75 | if ( empty( $author->user_url ) ) array_push( $flagged['low'], __( 'account has no URL', 'wporg-plugins' ) ); |
| | 76 | |
| | 77 | // URL matches the weird list |
| | 78 | $weird_urls = array ( |
| | 79 | 'blogger', 'blogspot', 'example.com', 'weebly', 'squarespace', 'medium.com', 'yahoo.com', |
| | 80 | 'mail.com', 'example.org', |
| | 81 | ); |
| | 82 | foreach ( $weird_urls as $url ) { |
| | 83 | if ( stripos( $author->user_url , $url ) !== false ) |
| | 84 | array_push( $flagged['med'], __( 'account URL contains ', 'wporg-plugins' ) . $url ); |
| | 85 | if ( stripos( $author->user_email , $url ) !== false ) |
| | 86 | array_push( $flagged['med'], __( 'account email contains ', 'wporg-plugins' ) . $url ); |
| | 87 | } |
| | 88 | |
| | 89 | // Reserved slugs are also often abused domain names (trademark law sucks) |
| | 90 | foreach ( $reserved_slugs as $url ) { |
| | 91 | if ( stripos( $author->user_url , $url ) !== false ) |
| | 92 | array_push( $flagged['high'], __( 'account URL contains ', 'wporg-plugins' ) . $url ); |
| | 93 | if ( stripos( $author->user_email , $url ) !== false ) |
| | 94 | array_push( $flagged['med'], __( 'account email contains ', 'wporg-plugins' ) . $url ); |
| | 95 | } |
| | 96 | |
| | 97 | // User Behavior |
| | 98 | // If FORUM ROLE is blocked |
| | 99 | if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) { |
| | 100 | $user = new \WP_User( $post->post_author, '', WPORG_SUPPORT_FORUMS_BLOGID ); |
| | 101 | if ( ! empty( $user->allcaps['bbp_blocked'] ) ) |
| | 102 | array_push( $flagged['high'], __( 'user is blocked', 'wporg-plugins' ) ); |
| | 103 | } |
| | 104 | |
| | 105 | // No plugins |
| | 106 | if ( empty( $author_commit ) && empty( $author_plugins ) ) |
| | 107 | array_push( $flagged['low'], __( 'user has no plugins', 'wporg-plugins' ) ); |
| | 108 | |
| | 109 | // Echo flag results (everyone pretty much has at least one) |
| | 110 | echo "<ul class=\"plugin-flagged\">"; |
| | 111 | $noflag = 0; |
| | 112 | foreach ( $flagged as $flag => $reasons ) { |
| | 113 | if (count($reasons) > '0') { |
| | 114 | $allreasons = array(); |
| | 115 | echo "<li class=\"plugin-flagged-".$flag."\"><strong>".strtoupper($flag)." (".count($reasons)."):</strong> "; |
| | 116 | foreach( $reasons as $reason) { |
| | 117 | $allreasons[] = $reason; |
| | 118 | } |
| | 119 | echo implode( '; ', $allreasons ) . "</li>"; |
| | 120 | } else { |
| | 121 | $noflag++; |
| | 122 | } |
| | 123 | } |
| | 124 | |
| | 125 | if ($noflag == '3' ) { |
| | 126 | ?><li><?php _e( 'Nothing flagged! You found Matt!', 'wporg-plugins' ); ?></li><?php |
| | 127 | } |
| | 128 | |
| | 129 | echo "</ul>"; |
| | 130 | |
| | 131 | } else { |
| | 132 | echo "<ul> |
| | 133 | <li><a href='https://plugins.trac.wordpress.org/log/{$post->post_name}/'>" . __( 'Development Log', 'wporg-plugins' ) . "</a></li> |
| | 134 | <li><a href='https://plugins.svn.wordpress.org/{$post->post_name}/'>" . __( 'Subversion Repository', 'wporg-plugins' ) . "</a></li> |
| | 135 | <li><a href='https://plugins.trac.wordpress.org/browser/{$post->post_name}/'>" . __( 'Browse in Trac', 'wporg-plugins' ) . '</a></li> |
| | 136 | </ul>'; |
| | 137 | } |
| | 138 | |