<?php
error_reporting(E_ALL);
define("IN_MYBB", 1);
require_once "./global.php";
logadmin();
$lang->load("maintenance");
switch($mybb->input['action'])
{
    case "prune_no_posts":
        addacpnav("Deleted successfully all members with no posts");
        break;
    case "prune_not_activated":
        addacpnav("Deleted successfully all members not activated");
        break;
    default:
        addacpnav("Prune Members");
}
if($mybb->input['action'] == "prune_not_activated")
{
    $time = time();
    $timecut = $time-(intval($mybb->input['days'])*60*60*24);
    $thequery = "lastvisit<'$timecut' AND usergroup='5'";
    $db->delete_query(TABLE_PREFIX."users", $thequery);
        $cache->updatestats(); 
}
if($mybb->input['action'] == "prune_no_posts") 
{
    $time = time();
    $timecut = $time-(intval($mybb->input['days'])*60*60*24);
    $thequery = "lastvisit<'$timecut' AND postnum='0'";
    $db->delete_query(TABLE_PREFIX."users", $thequery);
        $cache->updatestats(); 
}
    global $menu, $mybb, $lang;
    cpheader();
    startform("prune.php", "" , "prune_no_posts");
    starttable();
    tableheader("Prune Members With No Posts", "", "2");
    tablesubheader("These option will delete members permanently so be cautious.");
    makelabelcode("The number of days members have not logged in that will be pruned.", '', 2);
    makeinputcode("", "days", "0", 25, "", 50, 0);
    endtable();
    endform($lang->proceed);
    cpheader();
    startform("prune.php", "" , "prune_not_activated");
    starttable();
    tableheader("Prune Members Not Yet Activated");
    tablesubheader("These option will delete members permanently so be cautious.");
    makelabelcode("The number of days members have not logged in that will be pruned.", '', 2);
    makeinputcode("", "days", "0", 25, "", 50, 0);
    endtable();
    endform($lang->proceed);
    cpfooter();
?>