38 lines
899 B
PHP
38 lines
899 B
PHP
<?php
|
|
|
|
define('N',"\n");
|
|
|
|
$conffp='../.env.production';
|
|
|
|
$conf=array(
|
|
'DB_HOST'=>null,
|
|
'DB_PORT'=>null,
|
|
'DB_NAME'=>null,
|
|
'DB_USER'=>null,
|
|
'DB_PASS'=>null
|
|
);
|
|
|
|
$confa=file($conffp,FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
|
|
|
|
foreach ($confa as $line) {
|
|
if (preg_match('/^([A-Z_]+)=(.*)$/',$line,$buf)===1 && array_key_exists($buf[1],$conf))
|
|
$conf[$buf[1]]=$buf[2];
|
|
}
|
|
|
|
$dbconn=pg_connect('host='.$conf['DB_HOST'].' port='.$conf['DB_PORT'].' dbname='.$conf['DB_NAME'].' user='.$conf['DB_USER'].' password='.$conf['DB_PASS'])
|
|
or die('Connessione fallita: '.pg_last_error());
|
|
|
|
$res=pg_query('SELECT domain, created_at, updated_at, severity, reject_media, reject_reports, public_comment FROM domain_blocks')
|
|
or die('Query fallita: '.pg_last_error());
|
|
|
|
while ($row=pg_fetch_assoc($res))
|
|
$domblocks[]=$row;
|
|
|
|
pg_free_result($res);
|
|
pg_close($dbconn);
|
|
|
|
echo(json_encode($domblocks));
|
|
|
|
exit(0);
|
|
|
|
?>
|