���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC ‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT h25jguaT5*!‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT h25jguaT5*!log-404.php000066600000003751151733470240006363 0ustar00prefix}redirection_404"; } /** * Create a 404 log entry * * @param string $domain Domain name of request. * @param string $url URL of request. * @param string $ip IP of client. * @param array $details Other log details. * @return integer|false Log ID, or false */ public static function create( $domain, $url, $ip, $details ) { global $wpdb; $insert = static::sanitize_create( $domain, $url, $ip, $details ); $insert = apply_filters( 'redirection_404_data', $insert ); if ( $insert ) { do_action( 'redirection_404', $insert ); $wpdb->insert( $wpdb->prefix . 'redirection_404', $insert ); if ( $wpdb->insert_id ) { return $wpdb->insert_id; } } return false; } /** * Get the CSV filename for this log object * * @return string */ public static function get_csv_filename() { return 'redirection-404'; } /** * Get the CSV headers for this log object * * @return array */ public static function get_csv_header() { return [ 'date', 'source', 'ip', 'referrer', 'useragent' ]; } /** * Get the CSV headers for this log object * * @param object $row Log row. * @return array */ public static function get_csv_row( $row ) { return [ $row->created, $row->url, $row->ip, $row->referrer, $row->agent, ]; } } // phpcs:ignore class RE_404 { public static function create( $url, $agent, $ip, $referrer ) { _deprecated_function( __FUNCTION__, '4.6', 'Red_404_Log::create( $domain, $url, $ip, $details )' ); return Red_404_Log::create( Redirection_Request::get_server(), $url, $ip, [ 'agent' => $agent, 'referrer' => $referrer, 'request_method' => Redirection_Request::get_request_method(), ] ); } } log.php000066600000030071151733470240006051 0ustar00 $value ) { $this->$key = $value; } if ( isset( $values['created'] ) ) { $converted = mysql2date( 'U', $values['created'] ); if ( $converted ) { $this->created = intval( $converted, 10 ); } } } /** * Get's the table name for this log object * * @param Object $wpdb WPDB object. * @return string */ protected static function get_table_name( $wpdb ) { return ''; } /** * Get a log item by ID * * @param integer $id Log ID. * @return Red_Log|false */ public static function get_by_id( $id ) { global $wpdb; $table = static::get_table_name( $wpdb ); // Table name is internally generated. // phpcs:ignore $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table} WHERE id=%d", $id ), ARRAY_A ); if ( $row ) { return new static( $row ); } return false; } /** * Delete a log entry * * @param integer $id Log ID. * @return integer|false */ public static function delete( $id ) { global $wpdb; return $wpdb->delete( static::get_table_name( $wpdb ), [ 'id' => $id ] ); } /** * Delete all matching log entries * * @param array $params Array of filter parameters. * @return integer|false */ public static function delete_all( array $params = [] ) { global $wpdb; $query = self::get_query( $params ); $table = static::get_table_name( $wpdb ); $sql = "DELETE FROM {$table} {$query['where']}"; // phpcs:ignore return $wpdb->query( $sql ); } /** * Convert a log entry to JSON * * @return array */ public function to_json() { return [ 'id' => intval( $this->id, 10 ), 'created' => date_i18n( get_option( 'date_format' ), $this->created ), 'created_time' => gmdate( get_option( 'time_format' ), $this->created ), 'url' => $this->url, 'agent' => $this->agent, 'referrer' => $this->referrer, 'domain' => $this->domain, 'ip' => $this->ip, 'http_code' => intval( $this->http_code, 10 ), 'request_method' => $this->request_method, 'request_data' => $this->request_data ? json_decode( $this->request_data, true ) : '', ]; } /** * Get filtered log entries * * @param array $params Filters. * @return array{items: Array, total: integer} */ public static function get_filtered( array $params ) { global $wpdb; $query = self::get_query( $params ); $table = static::get_table_name( $wpdb ); $sql = "SELECT * FROM {$table} {$query['where']}"; // Already escaped // phpcs:ignore $sql .= $wpdb->prepare( ' ORDER BY ' . $query['orderby'] . ' ' . $query['direction'] . ' LIMIT %d,%d', $query['offset'], $query['limit'] ); // Already escaped // phpcs:ignore $rows = $wpdb->get_results( $sql, ARRAY_A ); // Already escaped // phpcs:ignore $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM $table " . $query['where'] ); $items = array(); foreach ( $rows as $row ) { $item = new static( $row ); $items[] = $item->to_json(); } return [ 'items' => $items, 'total' => intval( $total_items, 10 ), ]; } /** * Get grouped log entries * * @param string $group Group type. * @param array $params Filter params. * @return array{items: mixed, total: integer} */ public static function get_grouped( $group, array $params ) { global $wpdb; $table = static::get_table_name( $wpdb ); $query = self::get_query( $params ); if ( ! in_array( $group, [ 'ip', 'url', 'agent' ], true ) ) { $group = 'url'; } // Already escaped // phpcs:ignore $sql = $wpdb->prepare( "SELECT COUNT(*) as count,$group FROM {$table} {$query['where']} GROUP BY $group ORDER BY count {$query['direction']}, $group LIMIT %d,%d", $query['offset'], $query['limit'] ); // Already escaped // phpcs:ignore $rows = $wpdb->get_results( $sql ); // Already escaped // phpcs:ignore $total_items = $wpdb->get_var( "SELECT COUNT(DISTINCT $group) FROM {$table} {$query['where']}" ); foreach ( $rows as $row ) { $row->count = intval( $row->count, 10 ); if ( isset( $row->url ) ) { $row->id = $row->url; } elseif ( isset( $row->ip ) ) { $row->id = $row->ip; } elseif ( isset( $row->agent ) ) { $row->id = $row->agent; } } return array( 'items' => $rows, 'total' => intval( $total_items, 10 ), ); } /** * Convert a set of filters to a SQL query. * * @param array $params Filters. * @return array{orderby: string, direction: string, limit: integer, offset: integer, where: string} */ public static function get_query( array $params ) { $query = [ 'orderby' => 'id', 'direction' => 'DESC', 'limit' => RED_DEFAULT_PER_PAGE, 'offset' => 0, 'where' => '', ]; if ( isset( $params['orderby'] ) && in_array( $params['orderby'], array( 'ip', 'url' ), true ) ) { $query['orderby'] = $params['orderby']; } if ( isset( $params['direction'] ) && in_array( strtoupper( $params['direction'] ), array( 'ASC', 'DESC' ), true ) ) { $query['direction'] = strtoupper( $params['direction'] ); } if ( isset( $params['per_page'] ) ) { $limit = intval( $params['per_page'], 10 ); if ( $limit >= 5 && $limit <= RED_MAX_PER_PAGE ) { $query['limit'] = $limit; } } if ( isset( $params['page'] ) ) { $offset = intval( $params['page'], 10 ); if ( $offset >= 0 ) { $query['offset'] = $offset * $query['limit']; } } if ( isset( $params['filterBy'] ) && is_array( $params['filterBy'] ) ) { $where = static::get_query_filter( $params['filterBy'] ); if ( count( $where ) > 0 ) { $query['where'] = 'WHERE ' . implode( ' AND ', $where ); } } return $query; } /** * Get query filters as a SQL `WHERE` statement. SQL will be sanitized * * @param array $filter Array of filter params. * @return array */ protected static function get_query_filter( array $filter ) { global $wpdb; $where = []; if ( isset( $filter['ip'] ) ) { // phpcs:ignore $ip = @inet_pton( trim( $filter['ip'] ) ); if ( $ip !== false ) { // Full IP match // phpcs:ignore $ip = @inet_ntop( $ip ); // Convert back to string $where[] = $wpdb->prepare( 'ip = %s', $ip ); } else { // Partial IP match $where[] = $wpdb->prepare( 'ip LIKE %s', '%' . $wpdb->esc_like( trim( $filter['ip'] ) ) . '%' ); } } if ( isset( $filter['domain'] ) ) { $where[] = $wpdb->prepare( 'domain LIKE %s', '%' . $wpdb->esc_like( trim( $filter['domain'] ) ) . '%' ); } if ( isset( $filter['url-exact'] ) ) { $where[] = $wpdb->prepare( 'url = %s', $filter['url-exact'] ); } elseif ( isset( $filter['url'] ) ) { $where[] = $wpdb->prepare( 'url LIKE %s', '%' . $wpdb->esc_like( trim( $filter['url'] ) ) . '%' ); } if ( isset( $filter['referrer'] ) ) { $where[] = $wpdb->prepare( 'referrer LIKE %s', '%' . $wpdb->esc_like( trim( $filter['referrer'] ) ) . '%' ); } if ( isset( $filter['agent'] ) ) { $agent = trim( $filter['agent'] ); if ( empty( $agent ) ) { $where[] = $wpdb->prepare( 'agent = %s', $agent ); } else { $where[] = $wpdb->prepare( 'agent LIKE %s', '%' . $wpdb->esc_like( $agent ) . '%' ); } } if ( isset( $filter['http'] ) ) { $where[] = $wpdb->prepare( 'http_code = %d', $filter['http'] ); } if ( isset( $filter['method'] ) && in_array( strtoupper( $filter['method'] ), static::$supported_methods, true ) ) { $where[] = $wpdb->prepare( 'request_method = %s', strtoupper( $filter['method'] ) ); } return $where; } /** * Sanitize a new log entry * * @param string $domain Requested Domain. * @param string $url Requested URL. * @param string $ip Client IP. This is assumed to be a valid IP and won't be checked. * @param array $details Extra log details. * @return array */ protected static function sanitize_create( $domain, $url, $ip, array $details = [] ) { $url = urldecode( $url ); $insert = [ 'url' => substr( sanitize_text_field( $url ), 0, self::MAX_URL_LENGTH ), 'domain' => substr( sanitize_text_field( $domain ), 0, self::MAX_DOMAIN_LENGTH ), 'ip' => substr( sanitize_text_field( $ip ), 0, self::MAX_IP_LENGTH ), 'created' => current_time( 'mysql' ), ]; // Unfortunatley these names dont match up $allowed = [ 'agent' => 'agent', 'referrer' => 'referrer', 'request_method' => 'request_method', 'http_code' => 'http_code', 'request_data' => 'request_data', ]; foreach ( $allowed as $name => $replace ) { if ( ! empty( $details[ $name ] ) ) { $insert[ $replace ] = $details[ $name ]; } } if ( isset( $insert['agent'] ) ) { $insert['agent'] = substr( sanitize_text_field( $insert['agent'] ), 0, self::MAX_AGENT_LENGTH ); } if ( isset( $insert['referrer'] ) ) { $insert['referrer'] = substr( sanitize_text_field( $insert['referrer'] ), 0, self::MAX_REFERRER_LENGTH ); } if ( isset( $insert['request_data'] ) ) { $insert['request_data'] = wp_json_encode( $insert['request_data'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK ); } if ( isset( $insert['http_code'] ) ) { $insert['http_code'] = intval( $insert['http_code'], 10 ); } if ( isset( $insert['request_method'] ) ) { $insert['request_method'] = strtoupper( sanitize_text_field( $insert['request_method'] ) ); if ( ! in_array( $insert['request_method'], static::$supported_methods, true ) ) { $insert['request_method'] = ''; } } return $insert; } /** * Get the CSV filename for this log object * * @return string */ public static function get_csv_filename() { return ''; } /** * Get the CSV headers for this log object * * @return array */ public static function get_csv_header() { return []; } /** * Get the CSV headers for this log object * * @param object $row Log row. * @return array */ public static function get_csv_row( $row ) { return []; } /** * Export the log entry to CSV * * @return void */ public static function export_to_csv() { $filename = static::get_csv_filename() . '-' . date_i18n( get_option( 'date_format' ) ) . '.csv'; header( 'Content-Type: text/csv' ); header( 'Cache-Control: no-cache, must-revalidate' ); header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); // phpcs:ignore $stdout = fopen( 'php://output', 'w' ); if ( ! $stdout ) { return; } fputcsv( $stdout, static::get_csv_header() ); global $wpdb; $table = static::get_table_name( $wpdb ); // phpcs:ignore $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM $table" ); $exported = 0; $limit = 100; while ( $exported < $total_items ) { // phpcs:ignore $rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table LIMIT %d,%d", $exported, $limit ) ); $exported += count( $rows ); foreach ( $rows as $row ) { $csv = static::get_csv_row( $row ); fputcsv( $stdout, $csv ); } if ( count( $rows ) < $limit ) { break; } } } } log-redirect.php000066600000007722151733470240007657 0ustar00prefix}redirection_logs"; } /** * Create a redirect log entry * * @param string $domain Domain name of request. * @param string $url URL of request. * @param string $ip IP of client. * @param array $details Other log details. * @return integer|false Log ID, or false */ public static function create( $domain, $url, $ip, $details ) { global $wpdb; $insert = self::sanitize_create( $domain, $url, $ip, $details ); $insert['redirection_id'] = 0; if ( isset( $details['redirect_id'] ) ) { $insert['redirection_id'] = intval( $details['redirect_id'], 10 ); } if ( isset( $details['target'] ) ) { $insert['sent_to'] = $details['target']; } if ( isset( $details['redirect_by'] ) ) { $insert['redirect_by'] = strtolower( substr( $details['redirect_by'], 0, 50 ) ); } $insert = apply_filters( 'redirection_log_data', $insert ); if ( $insert ) { do_action( 'redirection_log', $insert ); $wpdb->insert( $wpdb->prefix . 'redirection_logs', $insert ); if ( $wpdb->insert_id ) { return $wpdb->insert_id; } } return false; } /** * Get query filters as a SQL `WHERE` statement. SQL will be sanitized * * @param array $filter Array of filter params. * @return array */ protected static function get_query_filter( array $filter ) { global $wpdb; $where = parent::get_query_filter( $filter ); if ( isset( $filter['target'] ) ) { $where[] = $wpdb->prepare( 'sent_to LIKE %s', '%' . $wpdb->esc_like( trim( $filter['target'] ) ) . '%' ); } if ( isset( $filter['redirect_by'] ) ) { $where[] = $wpdb->prepare( 'redirect_by = %s', $filter['redirect_by'] ); } return $where; } /** * Get the CSV filename for this log object * * @return string */ public static function get_csv_filename() { return 'redirection-log'; } /** * Get the CSV headers for this log object * * @return array */ public static function get_csv_header() { return [ 'date', 'source', 'target', 'ip', 'referrer', 'agent' ]; } /** * Get the CSV headers for this log object * * @param object $row Log row. * @return array */ public static function get_csv_row( $row ) { return [ $row->created, $row->url, $row->sent_to, $row->ip, $row->referrer, $row->agent, ]; } /** * Get a displayable name for the originator of the redirect. * * @param string $agent Redirect agent. * @return string */ private function get_redirect_name( $agent ) { // phpcs:ignore if ( $agent === 'wordpress' ) { return 'WordPress'; } return ucwords( $agent ); } /** * Convert a log entry to JSON * * @return array */ public function to_json() { return array_merge( parent::to_json(), [ 'sent_to' => $this->sent_to, 'redirection_id' => intval( $this->redirection_id, 10 ), 'redirect_by_slug' => $this->redirect_by, 'redirect_by' => $this->get_redirect_name( $this->redirect_by ), ] ); } } // phpcs:ignore class RE_Log { public static function create( $url, $target, $agent, $ip, $referrer, $extra = array() ) { _deprecated_function( __FUNCTION__, '4.6', 'Red_Redirect_Log::create( $domain, $url, $ip, $details )' ); return Red_Redirect_Log::create( Redirection_Request::get_server(), $url, $ip, array_merge( [ 'agent' => $agent, 'referrer' => $referrer, 'target' => $target, 'request_method' => Redirection_Request::get_request_method(), ], $extra ) ); } }