>
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');
if(!isset($_SESSION['id'])){die(_('Insufficient privileges'));}
if(!($privileges&PRIV_FEDERATION)){die(_('Insufficient privileges'));}
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.'"');
}
}
// 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':'');
?>