Example #1
0
                     mytop($from['id']);
                     break;
                 case '/reloadquiz':
                     if ($from['id'] == administrator_id) {
                         global $questionlist;
                         $questions = file_get_contents('quiz');
                         $questions .= "\n" . file_get_contents('quiz2');
                         $questionlist = explode("\n", trim($questions));
                     }
                     break;
                 default:
                     if (mb_stripos($text, '/ban', 0, 'UTF-8') !== FALSE && $from['id'] == administrator_id) {
                         ban(mb_substr($text, 5, mb_strlen($text, 'UTF-8'), 'UTF-8'));
                     } else {
                         if (mb_stripos($text, '/unban', 0, 'UTF-8') !== FALSE && $from['id'] == administrator_id) {
                             unban(mb_substr($text, 7, mb_strlen($text, 'UTF-8'), 'UTF-8'));
                         } else {
                             if (mb_stripos($text, '/feedback', 0, 'UTF-8') !== FALSE) {
                                 feedback($from['id'], mb_substr($text, 10, mb_strlen($text, 'UTF-8'), 'UTF-8'));
                             } else {
                                 message($from['id'], $text);
                             }
                         }
                     }
                     break;
             }
         }
     }
 }
 process();
 flushlog();
Example #2
0
function mod_page_ip($ip)
{
    global $config, $mod;
    if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
        error("Invalid IP address.");
    }
    if (isset($_POST['ban_id'], $_POST['unban'])) {
        if (!hasPermission($config['mod']['unban'])) {
            error($config['error']['noaccess']);
        }
        require_once 'inc/mod/ban.php';
        unban($_POST['ban_id']);
        header('Location: ?/IP/' . $ip . '#bans', true, $config['redirect_http']);
        return;
    }
    if (isset($_POST['note'])) {
        if (!hasPermission($config['mod']['create_notes'])) {
            error($config['error']['noaccess']);
        }
        markup($_POST['note']);
        $query = prepare('INSERT INTO `ip_notes` VALUES (NULL, :ip, :mod, :time, :body)');
        $query->bindValue(':ip', $ip);
        $query->bindValue(':mod', $mod['id']);
        $query->bindValue(':time', time());
        $query->bindValue(':body', $_POST['note']);
        $query->execute() or error(db_error($query));
        modLog("Added a note for <a href=\"?/IP/{$ip}\">{$ip}</a>");
        header('Location: ?/IP/' . $ip . '#notes', true, $config['redirect_http']);
        return;
    }
    $args = array();
    $args['ip'] = $ip;
    $args['posts'] = array();
    if ($config['mod']['dns_lookup']) {
        $args['hostname'] = rDNS($ip);
    }
    $boards = listBoards();
    foreach ($boards as $board) {
        openBoard($board['uri']);
        $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $board['uri']));
        $query->bindValue(':ip', $ip);
        $query->bindValue(':limit', $config['mod']['ip_recentposts'], PDO::PARAM_INT);
        $query->execute() or error(db_error($query));
        while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
            if (!$post['thread']) {
                // TODO: There is no reason why this should be such a f*****g mess.
                $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false);
            } else {
                $po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod);
            }
            if (!isset($args['posts'][$board['uri']])) {
                $args['posts'][$board['uri']] = array('board' => $board, 'posts' => array());
            }
            $args['posts'][$board['uri']]['posts'][] = $po->build(true);
        }
    }
    $args['boards'] = $boards;
    $args['token'] = make_secure_link_token('ban');
    if (hasPermission($config['mod']['view_ban'])) {
        $query = prepare("SELECT `bans`.*, `username` FROM `bans` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip");
        $query->bindValue(':ip', $ip);
        $query->execute() or error(db_error($query));
        $args['bans'] = $query->fetchAll(PDO::FETCH_ASSOC);
    }
    if (hasPermission($config['mod']['view_notes'])) {
        $query = prepare("SELECT `ip_notes`.*, `username` FROM `ip_notes` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip");
        $query->bindValue(':ip', $ip);
        $query->execute() or error(db_error($query));
        $args['notes'] = $query->fetchAll(PDO::FETCH_ASSOC);
    }
    mod_page(sprintf('%s: %s', _('IP'), $ip), 'mod/view_ip.html', $args, $args['hostname']);
}
Example #3
0
         guestbook_entries_action($_REQUEST['id'], isset($_REQUEST['banip']) && $_REQUEST['banip'] == "true", 'delete');
     }
     show_entries_admin();
     break;
 case "approve":
     if ($READ_ONLY_MODE === FALSE && $DEMO_MODE === FALSE && $MODERATION_ENABLED === TRUE && isset($_REQUEST['id'])) {
         guestbook_entries_action($_REQUEST['id'], false, 'approve');
     }
     show_entries_admin();
     break;
 case "showbans":
     show_bans_admin();
     break;
 case "unban":
     if ($READ_ONLY_MODE === FALSE && $DEMO_MODE === FALSE && isset($_POST['id'])) {
         unban($_POST['id']);
     }
     show_bans_admin();
     break;
 case "showbadwords":
     show_bad_words_admin();
     break;
 case "removebadword":
     if ($READ_ONLY_MODE === FALSE && $DEMO_MODE === FALSE && isset($_POST['id'])) {
         remove_bad_word($_POST['id']);
     }
     show_bad_words_admin();
     break;
 case "addbadword":
     if ($READ_ONLY_MODE === FALSE && $DEMO_MODE === FALSE && isset($_POST['word'])) {
         bad_word_add($_POST['word']);
Example #4
0
function checkBanned() {
	global $reqType;
	$ip = getIP();
		
	if (isBanned($ip)) {
		if (isAdmin()) {
			sysShout('Looks like someone tried to ban you! You\'re an admin though, so I\'ll take the liberty of unbanning you. You see, if all the admins are banned then the site owner\'s in a bit of a pesky situation, as he has to go and clear the ban file manually. So it\'s for your own good, I assure you.');
			unban($ip);
		}
		
		if ($reqType == 'init') {
			sysShout('You\'re banned.');
		}
		exit;
	}
}