if ($_POST['ip'] != '') { $banexists = banByIP($_POST['ip']); if ($banexists) { fancyDie('Sorry, there is already a ban on record for that IP address.'); } $ban = array(); $ban['ip'] = $_POST['ip']; $ban['expire'] = $_POST['expire'] > 0 ? time() + $_POST['expire'] : 0; $ban['reason'] = $_POST['reason']; insertBan($ban); $text .= manageInfo('Ban record added for ' . $ban['ip']); } } elseif (isset($_GET['lift'])) { $ban = banByID($_GET['lift']); if ($ban) { deleteBanByID($_GET['lift']); $text .= manageInfo('Ban record lifted for ' . $ban['ip']); } } $onload = manageOnLoad('bans'); $text .= manageBanForm(); $text .= manageBansTable(); } else { if (isset($_GET['update'])) { if (is_dir('.git')) { $git_output = shell_exec('git pull 2>&1'); $text .= '<blockquote class="reply" style="padding: 7px;font-size: 1.25em;"> <pre style="margin: 0;padding: 0;">Attempting update...' . "\n\n" . $git_output . '</pre> </blockquote> <p><b>Note:</b> If TinyIB updates and you have made custom modifications, <a href="https://github.com/tslocum/TinyIB/commits/master">review the changes</a> which have been merged into your installation. Ensure that your modifications do not interfere with any new/modified files.
function clearExpiredBans() { $compClause = new AndWhereClause(); $compClause->add(new SimpleWhereClause(BAN_EXPIRE, '>', 0, INTEGER_COMPARISON)); $compClause->add(new SimpleWhereClause(BAN_EXPIRE, '<=', time(), INTEGER_COMPARISON)); $bans = $GLOBALS['db']->selectWhere(BANS_FILE, $compClause, -1); foreach ($bans as $ban) { deleteBanByID($ban[BAN_ID]); } }