function smarty_modifier_get_pretty_time($string)
{
    $time = CODOF\Time::get_pretty_time($string);
    if (!$time) {
        return _t("just now");
    }
    return $time;
}
 private function base_query()
 {
     if ($this->count_rows && $this->isMySQL) {
         $count = 'SQL_CALC_FOUND_ROWS';
     } else {
         $count = '';
     }
     $qry = 'SELECT ' . $count . ' #SELECTORS# ' . 'FROM codo_posts AS p ' . 'LEFT JOIN codo_topics AS t ON t.topic_id=p.topic_id ' . 'LEFT JOIN codo_users AS u ON u.id=p.uid ' . 'LEFT JOIN codo_categories AS c ON c.cat_id=t.cat_id ' . 'LEFT JOIN codo_user_roles AS r ON r.uid=u.id AND r.is_primary=1 ' . 'WHERE t.topic_status<>0 ' . '      AND p.post_status=1' . '      #CONDITIONS# ';
     if ($this->cats != null) {
         $qry .= ' AND p.cat_id IN (?) ';
     }
     if ($this->tid != null) {
         if (strpos($this->tid, '=') === FALSE) {
             $this->tid = ' = ' . $this->tid;
         }
         $qry .= ' AND p.topic_id ' . $this->tid;
     }
     if ($this->pid != null) {
         $qry .= ' AND p.post_id ' . $this->pid;
     }
     if ($this->time_within != 'anytime') {
         $time = new \CODOF\Time();
         $error = false;
         if ($this->time_within == 'hour') {
             $this->time_within = $time->unix_get_time_hour();
         } else {
             if ($this->time_within == 'day') {
                 $this->time_within = $time->unix_get_time_day();
             } else {
                 if ($this->time_within == 'week') {
                     $this->time_within = $time->unix_get_time_day(7);
                 } else {
                     if ($this->time_within == 'month') {
                         $this->time_within = $time->unix_get_time_day(31);
                     } else {
                         if ($this->time_within == 'year') {
                             $this->time_within = $time->unix_get_time_day(365);
                         } else {
                             $error = true;
                         }
                     }
                 }
             }
         }
         if (!$error) {
             $qry .= ' AND p.post_created > ' . $this->time_within;
         }
     }
     $topic = new \CODOF\Forum\Topic(false);
     $qry .= ' AND ' . $topic->getViewTopicPermissionConditions();
     $qry .= ' ORDER BY #SORT# #ORDER# LIMIT  ' . $this->num_results . ' OFFSET ' . $this->from;
     return $qry;
 }
<?php

/*
 * @CODOLICENSE
 */
$smarty = \CODOF\Smarty\Single::get_instance();
$db = \DB::getPDO();
CODOF\Util::get_config($db);
$reg_req_admin = \CODOF\Util::get_opt('reg_req_admin');
if (isset($_POST['action']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) {
    $action = $_POST['action'];
    if ($action == 'approve') {
        \DB::table(PREFIX . 'codo_users')->whereIn('id', $_POST['ids'])->update(array('user_status' => 1));
        \DB::table(PREFIX . 'codo_user_roles')->whereIn('uid', $_POST['ids'])->update(array('rid' => ROLE_USER));
    } else {
        foreach ($_POST['ids'] as $id) {
            $user = CODOF\User\User::get((int) $id);
            $user->deleteAccount();
        }
    }
}
$qry = "SELECT id,username,mail,created,user_status FROM " . PREFIX . "codo_users WHERE user_status=2 OR user_status=0 AND username<>'anonymous'";
$obj = $db->query($qry);
$res = $obj->fetchAll();
$users = array();
foreach ($res as $user) {
    $users[] = array('id' => $user['id'], 'username' => $user['username'], 'mail' => $user['mail'], 'created' => CODOF\Time::get_pretty_time($user['created']), 'confirmed' => (int) $user['user_status'] == 2 ? 'yes' : 'no');
}
$smarty->assign('reg_req_admin', $reg_req_admin);
$smarty->assign('users', $users);
$content = $smarty->fetch('moderation/approve_users.tpl');