> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ include_once('db.php'); include_once('nonce.php'); include_once('rpc.php'); if(!isset($_SESSION['id'])){die(_('Insufficient privileges'));} if(!($privileges&PRIV_FEDERATION)){die(_('Insufficient privileges'));} $error=''; if(checknonce()) // Save changes { if(isset($_POST['options'])) { setoption('autofollow', isset($_POST['autofollow'])); } if(isset($_POST['addpeer']) || isset($_POST['blacklistpeer'])) { $peer=mysqli_real_escape_string($db, $_POST['newpeer']); $blacklist=(isset($_POST['blacklistpeer'])?'1':'0'); mysqli_query($db, 'delete from peers where domain="'.$peer.'"'); mysqli_query($db, 'insert into peers(domain, blacklist) values("'.$peer.'", '.$blacklist.')'); } if(isset($_POST['deletepeer'])) { $peer=mysqli_real_escape_string($db, $_POST['deletepeer']); mysqli_query($db, 'delete from peers where domain="'.$peer.'"'); } if(isset($_POST['action']) && $_POST['action']=='addindirectpeers') { $peers=Array(); $blacklist=Array(); $res=mysqli_query($db, 'select domain, blacklist from peers order by domain asc'); while($row=mysqli_fetch_assoc($res)) { if($row['blacklist']){$blacklist[]=$row['domain'];}else{$peers[]=$row['domain'];} } $oldpeers=count($peers); // For inserting new peers later for($i=0; $i'; if($i>=$oldpeers){array_splice($peers, $i, 1); --$i;} // Don't add if there are issues (but ignore old peers because we're not autoremoving) continue; } foreach($newpeers['peers'] as $peer) { // Skip already known peers if($peer==DOMAIN || in_array($peer, $peers) || in_array($peer, $blacklist)){continue;} $peers[]=$peer; } } for($i=$oldpeers; $i';} // Load current $peers=''; $res=mysqli_query($db, 'select domain, blacklist from peers order by domain asc'); while($row=mysqli_fetch_assoc($res)) { $domain=htmlentities($row['domain']); if($row['blacklist']){$domain=''.$domain.'';} $peers.=$domain.'
'; } $autofollowcheck=(getoption('autofollow')?' checked':''); ?>