function wpmc_screen()
{
    ?>
	<div class='wrap'>
		<?php 
    jordy_meow_donation();
    ?>
		<div id="icon-upload" class="icon32"><br></div>
		<h2>WP Media Cleaner <?php 
    by_jordy_meow();
    ?>
</h2>

		<?php 
    global $wpdb;
    $posts_per_page = 15;
    $view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : "issues";
    $paged = isset($_GET['paged']) ? sanitize_text_field($_GET['paged']) : 1;
    $reset = isset($_GET['reset']) ? $_GET['reset'] : 0;
    if ($reset) {
        wpmc_reset();
    }
    $s = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
    $table_name = $wpdb->prefix . "wpmcleaner";
    $issues_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name} WHERE ignored = 0 AND deleted = 0");
    $total_size = $wpdb->get_var("SELECT SUM(size) FROM {$table_name} WHERE ignored = 0 AND deleted = 0");
    $trash_total_size = $wpdb->get_var("SELECT SUM(size) FROM {$table_name} WHERE ignored = 0 AND deleted = 1");
    $ignored_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name} WHERE ignored = 1");
    $deleted_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name} WHERE deleted = 1");
    if ($view == 'deleted') {
        $items_count = $deleted_count;
        $items = $wpdb->get_results($wpdb->prepare("SELECT id, type, postId, path, size, ignored, deleted, issue \n\t\t\t\t\tFROM {$table_name} WHERE ignored = 0 AND deleted = 1 AND path LIKE %s \n\t\t\t\t\tORDER BY time \n\t\t\t\t\tDESC LIMIT %d, %d", '%' . $s . '%', ($paged - 1) * $posts_per_page, $posts_per_page), OBJECT);
    } else {
        if ($view == 'ignored') {
            $items_count = $ignored_count;
            $items = $wpdb->get_results($wpdb->prepare("SELECT id, type, postId, path, size, ignored, deleted, issue \n\t\t\t\t\tFROM {$table_name} \n\t\t\t\t\tWHERE ignored = 1 AND deleted = 0 AND path LIKE %s \n\t\t\t\t\tORDER BY time \n\t\t\t\t\tDESC LIMIT %d, %d", '%' . $s . '%', ($paged - 1) * $posts_per_page, $posts_per_page), OBJECT);
        } else {
            $items_count = $issues_count;
            $items = $wpdb->get_results($wpdb->prepare("SELECT id, type, postId, path, size, ignored, deleted, issue \n\t\t\t\t\tFROM {$table_name} \n\t\t\t\t\tWHERE ignored = 0 AND deleted = 0  AND path LIKE %s\n\t\t\t\t\tORDER BY time \n\t\t\t\t\tDESC LIMIT %d, %d", '%' . $s . '%', ($paged - 1) * $posts_per_page, $posts_per_page), OBJECT);
        }
    }
    ?>

		<style>
			#wpmc-pages {
				float: right;
				position: relative;
				top: 12px;
			}

			#wpmc-pages a {
				text-decoration: none;
				border: 1px solid black;
				padding: 2px 5px;
				border-radius: 4px;
				background: #E9E9E9;
				color: lightslategrey;
				border-color: #BEBEBE;
			}

			#wpmc-pages .current {
				font-weight: bold;
			}
		</style>
		
		<div style='margin-top: 0px; background: #FFF; padding: 5px; border-radius: 4px; height: 28px; box-shadow: 0px 0px 6px #C2C2C2;'>
			
			<!-- SCAN -->
			<?php 
    if ($view != 'deleted') {
        ?>
				<a id='wpmc_scan' onclick='wpmc_scan()' class='button-primary' style='float: left;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
search.png' /><?php 
        _e("Scan", 'wp-media-cleaner');
        ?>
</a>
			<?php 
    }
    ?>

			<!-- DELETE SELECTED -->		
			<a id='wpmc_delete' onclick='wpmc_delete()' class='button' style='float: left; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
    ?>
delete.png' /><?php 
    _e("Delete", 'wp-media-cleaner');
    ?>
</a>
			<?php 
    if ($view == 'deleted') {
        ?>
				<a id='wpmc_recover' onclick='wpmc_recover()' class='button-secondary' style='float: left; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
pills.png' /><?php 
        _e("Recover", 'wp-media-cleaner');
        ?>
</a>
			<?php 
    }
    ?>

			<!-- IGNORE SELECTED -->		
			<a id='wpmc_ignore' onclick='wpmc_ignore()' class='button' style='float: left; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
    ?>
tick.png' /><?php 
    _e("Ignore", 'wp-media-cleaner');
    ?>
</a>

			<!-- RESET -->
			<?php 
    if ($view != 'deleted') {
        ?>
				<a id='wpmc_reset' href='?page=wp-media-cleaner&reset=1' class='button-primary' style='float: right; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
burn.png' /><?php 
        _e("Reset", 'wp-media-cleaner');
        ?>
</a>
			<?php 
    }
    ?>

			<!-- DELETE ALL -->
			<?php 
    if ($view == 'deleted') {
        ?>
				<a id='wpmc_recover_all' onclick='wpmc_recover_all()' class='button-primary' style='float: right; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
pills.png' /><?php 
        _e("Recover all", 'wp-media-cleaner');
        ?>
</a>
				<a id='wpmc_delete_all' onclick='wpmc_delete_all(true)' class='button button-red' style='float: right; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
trash.png' /><?php 
        _e("Empty trash", 'wp-media-cleaner');
        ?>
</a>				
			<?php 
    } else {
        ?>
				<a id='wpmc_delete_all' onclick='wpmc_delete_all()' class='button button-red' style='float: right; margin-left: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
        echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-media-cleaner/img');
        ?>
delete.png' /><?php 
        _e("Delete all", 'wp-media-cleaner');
        ?>
</a>
			<?php 
    }
    ?>

			<form id="posts-filter" action="upload.php" method="get" style='float: right;'>
				<p class="search-box" style='margin-left: 5px; float: left;'>
					<input type="search" name="s" style="width: 120px;" value="<?php 
    echo $s ? $s : "";
    ?>
">
					<input type="hidden" name="page" value="wp-media-cleaner">
					<input type="hidden" name="view" value="<?php 
    echo $view;
    ?>
">
					<input type="hidden" name="paged" value="<?php 
    echo $paged;
    ?>
">
					<input type="submit" class="button" value="Search"><span style='border-right: #A2A2A2 solid 1px; margin-left: 5px; margin-right: 3px;'>&nbsp;</span>
				</p>
			</form>

			<!-- PROGRESS -->
			<span style='margin-left: 12px; font-size: 15px; top: 5px; position: relative; color: #747474;' id='wpmc_progression'></span>	

		</div>

		<p>
			<?php 
    $scan_files = wpmc_getoption('scan_files', 'wpmc_basics', true);
    $scan_media = wpmc_getoption('scan_media', 'wpmc_basics', true);
    echo "<p>";
    echo "Deleted files will be moved to the 'uploads/wpmc-trash' directory. Please backup your database and files.";
    if (!$scan_files && !$scan_media) {
        echo "<span style='color: red;'>";
        _e(" Scan is not enabled for either the files or the medias. Please check Settings > WP Media Cleaner.", 'wp-media-cleaner');
        echo "</span>";
    }
    if ($scan_media) {
        _e(" If you delete an item of the type MEDIA, the database entry for it (Media Library) will be deleted permanently.", 'wp-media-cleaner');
    }
    ?>
			There are <b><?php 
    echo $issues_count;
    ?>
 issue(s)</b> with your files, accounting for <b><?php 
    echo number_format($total_size / 1000000, 2);
    ?>
 MB</b>. Your trash contains <b><?php 
    echo number_format($trash_total_size / 1000000, 2);
    ?>
 MB.</b>
		</p>

		<div id='wpmc-pages'>
		<?php 
    echo paginate_links(array('base' => '?page=wp-media-cleaner&s=' . urlencode($s) . '&view=' . $view . '%_%', 'current' => $paged, 'format' => '&paged=%#%', 'total' => ceil($items_count / $posts_per_page), 'prev_next' => false));
    ?>
		</div>

		<ul class="subsubsub">
			<li class="all"><a <?php 
    if ($view == 'issues') {
        echo "class='current'";
    }
    ?>
 href='?page=wp-media-cleaner&s=<?php 
    echo $s;
    ?>
&view=issues'><?php 
    _e("Issues", 'wp-media-cleaner');
    ?>
</a><span class="count">(<?php 
    echo $issues_count;
    ?>
)</span></li> |
			<li class="all"><a <?php 
    if ($view == 'ignored') {
        echo "class='current'";
    }
    ?>
 href='?page=wp-media-cleaner&s=<?php 
    echo $s;
    ?>
&view=ignored'><?php 
    _e("Ignored", 'wp-media-cleaner');
    ?>
</a><span class="count">(<?php 
    echo $ignored_count;
    ?>
)</span></li> |
			<li class="all"><a <?php 
    if ($view == 'deleted') {
        echo "class='current'";
    }
    ?>
 href='?page=wp-media-cleaner&s=<?php 
    echo $s;
    ?>
&view=deleted'><?php 
    _e("Trash", 'wp-media-cleaner');
    ?>
</a><span class="count">(<?php 
    echo $deleted_count;
    ?>
)</span></li>
		</ul>

		<table id='wpmc-table' class='wp-list-table widefat fixed media'>

			<thead>
				<tr>
					<th scope="col" id="cb" class="manage-column column-cb check-column"><input id="wpmc-cb-select-all" type="checkbox"></th>
					<th style='width: 64px;'>Thumb</th>
					<th style='width: 50px;'>Type</th>
					<th style='width: 80px;'>Origin</th>
					<th>Path</th>
					<th style='width: 220px;'>Issue</th>
					<th style='width: 80px; text-align: right;'>Size</th>
				</tr>
			</thead>

			<tbody>
				<?php 
    foreach ($items as $issue) {
        ?>
				<tr>
					<td><input type="checkbox" name="id" value="<?php 
        echo $issue->id;
        ?>
"></td>
					<td>
						<?php 
        if ($issue->deleted == 0) {
            if ($issue->type == 0) {
                // FILE
                $upload_dir = wp_upload_dir();
                echo "<img style='max-width: 48px; max-height: 48px;' src='" . htmlspecialchars($upload_dir['baseurl'] . '/' . $issue->path, ENT_QUOTES) . "' />";
            } else {
                // MEDIA
                $attachmentsrc = wp_get_attachment_image_src($issue->postId, 'thumbnail');
                echo "<img style='max-width: 48px; max-height: 48px;' src='" . htmlspecialchars($attachmentsrc[0], ENT_QUOTES) . "' />";
            }
        }
        ?>
					</td>
					<td><?php 
        echo $issue->type == 0 ? 'FILE' : 'MEDIA';
        ?>
</td>
					<td><?php 
        echo $issue->type == 0 ? 'Filesystem' : "<a href='media.php?attachment_id=" . $issue->postId . "&action=edit'>ID " . $issue->postId . "</a>";
        ?>
</td>
					<td><?php 
        echo stripslashes($issue->path);
        ?>
</td>
					<td><?php 
        echo_issue($issue->issue);
        ?>
</td>
					<td style='text-align: right;'><?php 
        echo number_format($issue->size / 1000, 2);
        ?>
 KB</td>
				</tr>
				<?php 
    }
    ?>
			</tbody>

			<tfoot>
				<tr><th></th><th></th><th>Type</th><th>Origin</th><th>Path</th><th>Issue</th><th style='width: 80px; text-align: right;'>Size</th></tr>
			</tfoot>

		</table>
	</wrap>

	<?php 
    jordy_meow_footer();
}
/**
 *
 * PRO
 * Come on, it's not so expensive :'(
 *
 */
function wpmc_is_pro()
{
    $validated = get_transient('wpmc_validated');
    if ($validated) {
        $serial = get_option('wpmc_pro_serial');
        return !empty($serial);
    }
    $subscr_id = get_option('wpmc_pro_serial', "");
    if (!empty($subscr_id)) {
        return wpmc_validate_pro(wpmc_getoption("subscr_id", "wpmc_pro", array()));
    }
    return false;
}