コード例 #1
0
ファイル: ServerInterface.php プロジェクト: nicolasjoly/MumPI
 function getServerBansIpString($srvid)
 {
     $bans = $this->getServerBans($srvid);
     foreach ($bans as &$ban) {
         $ban->address = HelperFunctions::int2ipAddress($ban->address);
     }
     return $bans;
 }
コード例 #2
0
ファイル: admin.ajax.php プロジェクト: nicolasjoly/MumPI
    public static function server_bans_show()
    {
        $serverId = intval($_POST['sid']);
        if (!PermissionManager::getInstance()->isAdminOfServer($serverId)) {
            echo tr('permission_denied');
            MessageManager::echoAllMessages();
            exit;
        }
        $bans = array();
        try {
            $bans = ServerInterface::getInstance()->getServerBans($serverId);
            echo '<h2>Bans</h2>';
            if (count($bans) == 0) {
                echo 'no bans on this virtual server';
            } else {
                ?>
				<table>
					<thead>
						<tr>
							<th>username</th>
							<th>address</th>
							<th>bits</th>
							<th>hash</th>
							<th>reason</th>
							<th>banned at (until)</th>
							<th>actions</th>
						</tr>
					</thead>
					<tbody>
						<?php 
                foreach ($bans as $ban) {
                    ?>
						<?php 
                    $ipAsString = HelperFunctions::int2ipAddress($ban->address);
                    ?>
							<tr>
								<td><?php 
                    echo $ban->name;
                    ?>
</td>
								<td><?php 
                    echo $ipAsString;
                    ?>
</td>
								<td><?php 
                    echo $ban->bits;
                    ?>
</td>
								<td><?php 
                    echo $ban->hash;
                    ?>
</td>
								<td><?php 
                    echo $ban->reason;
                    ?>
</td>
								<td><?php 
                    echo date('r', $ban->start) . ' (' . ($ban->duration != 0 ? date('r', $ban->duration) : 'unlimited') . ')';
                    ?>
</td>
								<td>
									<?php 
                    if (PermissionManager::getInstance()->serverCanBan($serverId)) {
                        $banObj = MurmurBan::fromIceObject($ban);
                        echo "<a class=\"jqlink\" onclick=\"if(confirm('Are you sure you want to remove this ban?')){jq_server_unban({$serverId}, '{$ipAsString}', {$banObj->bits}, '{$banObj->name}', '{$banObj->hash}', '{$banObj->reason}', {$banObj->start}, {$banObj->duration});}\">remove</a>";
                    }
                    ?>
							</td>
							</tr>
						<?php 
                }
                ?>
					</tbody>
				</table>
				<br/>
				<p>
					<?php 
                echo tr('info_ip_bits');
                ?>
				</p>
<?php 
            }
        } catch (Murmur_ServerBootedException $exc) {
            //TODO i18n
            echo 'Server is not running.';
        }
    }