Unverified Commit 3f63e29d authored by David Morley's avatar David Morley
Browse files

Merge branch 'noplanman-code_structure'

parents d9b0a90d b2dd66f7
<?php
//Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file.
if ($_GET['key'] != '4r45tg') {die;}
if ($_GET['key'] != '4r45tg') {
die;
}
require_once __DIR__ . '/config.php';
......@@ -8,6 +10,7 @@ $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
die('Error in connection: ' . pg_last_error());
}
if ($_GET['format'] == 'georss') {
echo <<<EOF
<?xml version="1.0" encoding="utf-8"?>
......@@ -35,7 +38,11 @@ EOF;
$row['dateupdated'],
$row['score']
);
if ($row['secure'] == 'true') {$method = 'https://';} else {$method = 'http://';}
if ($row['secure'] == 'true') {
$method = 'https://';
} else {
$method = 'http://';
}
echo <<<EOF
<entry>
<title>{$method}{$row['domain']}</title>
......@@ -51,8 +58,7 @@ EOF;
EOF;
}
echo '</feed>';
}
elseif ($_GET['format'] == 'json') {
} elseif ($_GET['format'] == 'json') {
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,pingdomurl,monthsmonitored,uptimelast7,responsetimelast7,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden FROM pods';
$result = pg_query($dbh, $sql);
if (!$result) {
......@@ -61,7 +67,7 @@ elseif ($_GET['format'] == 'json') {
$numrows = pg_num_rows($result);
//json output, thx Vipul A M for fixing this
header('Content-type: application/json');
$rows=array_values(pg_fetch_all($result));
$rows = array_values(pg_fetch_all($result));
$obj->podcount = $numrows;
$obj->pods = $rows;
if ($_GET['method'] == 'jsonp') {
......@@ -69,9 +75,8 @@ elseif ($_GET['format'] == 'json') {
} else {
print json_encode($obj);
}
}
else {
$i=0;
} else {
$i = 0;
$sql = "SELECT * FROM pods WHERE hidden <> 'yes' ORDER BY uptimelast7 DESC";
$result = pg_query($dbh, $sql);
if (!$result) {
......@@ -79,15 +84,24 @@ elseif ($_GET['format'] == 'json') {
}
$numrows = pg_num_rows($result);
while ($row = pg_fetch_array($result)) {
if ($row['status'] == 'up'){$status = 'Online';} else {$status = 'Offline';}
if ($row['secure'] == 'true') {$method = 'https://';$class = 'green';} else {$method = 'http://';$class = 'red';}
if ($row['status'] == 'up') {
$status = 'Online';
} else {
$status = 'Offline';
}
if ($row['secure'] == 'true') {
$method = 'https://';
$class = 'green';
} else {
$method = 'http://';
$class = 'red';
}
echo $row['domain'] . ' Up ' . $row['uptimelast7'] . '% This Month - Located in: ' . $row['country'];
if ($i < ($numrows -1)) {
if ($i < ($numrows - 1)) {
echo ',';
}
$i++;
}
$i ++;
}
pg_free_result($result);
pg_close($dbh);
......
<?php
$tt=0;
$tt = 0;
require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
die('Error in connection: ' . pg_last_error());
}
$sql = "SELECT * FROM pods WHERE hidden <> 'no' AND score < 50 ORDER BY weightedscore";
$result = pg_query($dbh, $sql);
if (!$result) {
}
$sql = "SELECT * FROM pods WHERE hidden <> 'no' AND score < 50 ORDER BY weightedscore";
$result = pg_query($dbh, $sql);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
}
$numrows = pg_num_rows($result);
?>
<meta property="og:title" content="<?php echo $numrows; ?> #Diaspora Pods listed, Come see the privacy aware social network." /><?php echo $numrows; ?> pods that are open for signup now.
<meta property="og:title" content="<?php echo $numrows; ?> #Diaspora Pods listed, Come see the privacy aware social network."/><?php echo $numrows; ?> pods that are open for signup now.
<meta charset="utf-8">
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
<table id="myTable" class="table table-striped table-sm tablesorter table-hover tfont">
<thead>
<tr>
<th>Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date('F') ?>.">?</a></th>
<th>ms</th>
<th>Signups</th>
<th>Total<a class="tipsy" title="Number of total users on this pod.">?</a></th>
<th>Active 6<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
<th>Active 1<a class="tipsy" title="Number of users active last 1 month on this pod.">?</a></th>
<th>Posts<a class="tipsy" title="Number of total posts on this pod.">?</a></th>
<th>Comm<a class="tipsy" title="Number of total comments on this pod.">?</a></th>
<th>Month<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a></th>
<th>Sc<a class="tipsy" title="System Score on a 100 scale">?</a></th>
<th>conn<a class="tipsy" title="">?</a></th>
<th>Delete?<a class="tipsy" title="Delete this pod from DB?">?</a></th>
</tr>
</thead>
<tbody>
<?php
<thead>
<tr>
<th>Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date('F') ?>.">?</a></th>
<th>ms</th>
<th>Signups</th>
<th>Total<a class="tipsy" title="Number of total users on this pod.">?</a></th>
<th>Active 6<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
<th>Active 1<a class="tipsy" title="Number of users active last 1 month on this pod.">?</a></th>
<th>Posts<a class="tipsy" title="Number of total posts on this pod.">?</a></th>
<th>Comm<a class="tipsy" title="Number of total comments on this pod.">?</a></th>
<th>Month<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a>
</th>
<th>Sc<a class="tipsy" title="System Score on a 100 scale">?</a></th>
<th>conn<a class="tipsy" title="">?</a></th>
<th>Delete?<a class="tipsy" title="Delete this pod from DB?">?</a></th>
</tr>
</thead>
<tbody>
<?php
while ($row = pg_fetch_array($result)) {
$tt=$tt+1;
if ($row['secure'] == 'true') {
$method = 'https://';
$class= 'green';
$tip= 'This pod uses SSL encryption for traffic.';}
else {
$method = 'http://';
$class= 'red';
$tip= 'This pod does not offer SSL';
}
$verdiff = str_replace('.', '', $row['masterversion']) - str_replace('.', '', $row['shortversion']);
$tt = $tt + 1;
if ($row['secure'] == 'true') {
$method = 'https://';
$class = 'green';
$tip = 'This pod uses SSL encryption for traffic.';
} else {
$method = 'http://';
$class = 'red';
$tip = 'This pod does not offer SSL';
}
$verdiff = str_replace('.', '', $row['masterversion']) - str_replace('.', '', $row['shortversion']);
$pod_name = htmlentities($row['name'], ENT_QUOTES);
$tip .= sprintf(
$pod_name = htmlentities($row['name'], ENT_QUOTES);
$tip .= sprintf(
"\n" . 'This pod %1$s has been watched for %2$s months and its average ping time is %3$s with uptime of %4$s%% this month and was last checked on %5$s. On a score of -20 to +20 this pod is a %6$s right now',
$pod_name,
$row['monthsmonitored'],
......@@ -62,49 +62,66 @@ $tip .= sprintf(
$row['uptimelast7'],
$row['dateupdated'],
$row['score']
);
);
echo '<tr><td><a class="' . $class . '" target="_self" href="' . $method . $row['domain'] . '">' . $row['domain'] . '<div title="' . $tip . '" class="tipsy" style="display: inline-block">?</div></a></td>';
if (stristr($row['shortversion'],'head'))
{$version = '.dev';$pre = 'This pod runs pre release
development code';} elseif (!$row['shortversion'])
{$version = '0';$pre = 'This pod runs
unknown code';}
else
{$version =$row['shortversion'];$pre = 'This pod runs production code';}
if ($row['shortversion'] == $row['masterversion'] && $row['shortversion'] != '') {$classver = 'green';} elseif ($verdiff > 6) {$classver = 'red';} else {$classver = 'black';}
if (stristr($row['shortversion'], 'head')) {
$version = '.dev';
$pre = 'This pod runs pre release development code';
} elseif (!$row['shortversion']) {
$version = '0';
$pre = 'This pod runs unknown code';
} else {
$version = $row['shortversion'];
$pre = 'This pod runs production code';
}
if ($row['shortversion'] == $row['masterversion'] && $row['shortversion'] != '') {
$classver = 'green';
} elseif ($verdiff > 6) {
$classver = 'red';
} else {
$classver = 'black';
}
echo '<td class="' . $classver . '"><div title="' . $pre . ' codename: ' . $row['longversion'] . ' master version is: ' . $row['masterversion'] . '" class="tipsy">' . $version . '</div></td>';
echo '<td>' . $row['uptimelast7'] . '</td>';
echo '<td>' . $row['responsetimelast7'] . '</td>';
if ($row['signup'] == 1) {$signup = 'Open';} else {$signup = 'Closed';}
if ($row['signup'] == 1) {
$signup = 'Open';
} else {
$signup = 'Closed';
}
echo '<td>' . $signup . '</td>';
echo '<td>' . $row['total_users'] . '</td>';
echo '<td>' . $row['active_users_halfyear'] . '</td>';
echo '<td>' . $row['active_users_monthly'] . '</td>';
echo '<td>' . $row['local_posts'] . '</td>';
echo '<td>' . $row['comment_counts'] . '</td>';
if (strpos($row['pingdomurl'],
'pingdom.com')) {$moreurl = $row['pingdomurl'];} else {$moreurl = 'http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=' . $row['pingdomurl'];}
if (strpos($row['pingdomurl'],
'pingdom.com')) {
$moreurl = $row['pingdomurl'];
} else {
$moreurl = 'http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=' . $row['pingdomurl'];
}
echo '<td><div title="Last Check ' . $row['dateupdated'] . '" class="tipsy"><a target="_self" href="' . $moreurl . '">' . $row['monthsmonitored'] . '</a></div></td>';
echo '<td>' . $row['score'] . '</td>';
echo '<td><div class="tipsy" title="' . $row['sslvalid'] . '">con info </td>';
?>
<td>
<form method="post" action="db/kill.php" target="_blank">
<input name="comments" value="<?php echo $row['sslvalid']; ?>" size=10>
<input name="domain" value="<?php echo $row['domain']; ?>" type="hidden">
<input name="adminkey" value="<?php echo $_COOKIE['adminkey']; ?>" type="hidden">
<input name="action" type="radio" value="warn">warn
<input name="action" type="radio" value="delete">delete
<input type="submit" value="Process">
</form>
</td>
<?php
?>
<td>
<form method="post" action="db/kill.php" target="_blank">
<input name="comments" value="<?php echo $row['sslvalid']; ?>" size=10>
<input name="domain" value="<?php echo $row['domain']; ?>" type="hidden">
<input name="adminkey" value="<?php echo $_COOKIE['adminkey']; ?>" type="hidden">
<input name="action" type="radio" value="warn">warn
<input name="action" type="radio" value="delete">delete
<input type="submit" value="Process">
</form>
</td>
<?php
echo '</td></tr>';
}
pg_free_result($result);
pg_close($dbh);
?>
</tbody>
?>
</tbody>
</table>
......@@ -17,4 +17,4 @@ $adminemail = '';
//admin key for deleting pods, set this as a cookie on your own
$adminkey = '';
//apikey for public api calls
$apikey= '';
$apikey = '';
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
<?php
$valid=0;
$valid = 0;
require_once __DIR__ . '/../logging.php';
$log = new Logging();
$log->lfile($log_dir . '/add.php.log');
if (!$_POST['url']){
$log->lwrite('no url given '.$_POST['domain']);
if (!$_POST['url']) {
$log->lwrite('no url given ' . $_POST['domain']);
die('no url given');
}
if (!$_POST['email']){
$log->lwrite('no email given '.$_POST['domain']);
if (!$_POST['email']) {
$log->lwrite('no email given ' . $_POST['domain']);
die('no email given');
}
if (!$_POST['domain']){
$log->lwrite('no domain given '.$_POST['domain']);
if (!$_POST['domain']) {
$log->lwrite('no domain given ' . $_POST['domain']);
die('no pod domain given');
}
if (!$_POST['url']){
$log->lwrite('no api given '.$_POST['domain']);
if (!$_POST['url']) {
$log->lwrite('no api given ' . $_POST['domain']);
die('no API key for your stats');
}
if (strlen($_POST['url']) < 14){
$log->lwrite('api key too short '.$_POST['domain']);
if (strlen($_POST['url']) < 14) {
$log->lwrite('api key too short ' . $_POST['domain']);
die('API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee');
}
......@@ -39,11 +39,11 @@ if (!$result) {
}
while ($row = pg_fetch_array($result)) {
if ($row['domain'] == $_POST['domain']) {
$log->lwrite('domain already exists '.$_POST['domain']);
$log->lwrite('domain already exists ' . $_POST['domain']);
die('domain already exists');
}
if ($row['pingdomurl'] == $_POST['url']) {
$log->lwrite('API key already exists '.$_POST['domain']);
$log->lwrite('API key already exists ' . $_POST['domain']);
die('API key already exists');
}
}
......@@ -70,33 +70,33 @@ $output = curl_exec($ch);
curl_close($ch);
if (stristr($outputssl, 'nodeName')) {
$log->lwrite('Your pod has ssl and is valid '.$_POST['domain']);
$log->lwrite('Your pod has ssl and is valid ' . $_POST['domain']);
echo 'Your pod has ssl and is valid<br>';
$valid=1;
$valid = 1;
}
if (stristr($output, 'nodeName')) {
$log->lwrite('Your pod does not have ssl but is a valid pod '.$_POST['domain']);
$log->lwrite('Your pod does not have ssl but is a valid pod ' . $_POST['domain']);
echo 'Your pod does not have ssl but is a valid pod<br>';
$valid=1;
$valid = 1;
}
if ($valid == '1') {
$sql = "INSERT INTO pods (domain, pingdomurl, email) VALUES($1, $2, $3)";
$result = pg_query_params($dbh, $sql, array($_POST['domain'], $_POST['url'], $_POST['email']));
$result = pg_query_params($dbh, $sql, [$_POST['domain'], $_POST['url'], $_POST['email']]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
$to = $adminemail;
$cc = $_POST['email'];
$subject = 'New pod added to podupti.me ';
$message.= sprintf(
$message .= sprintf(
"%1$s\n\n Stats Url: %2$s\n\n Pod: %3$s\n\n",
'https://podupti.me',
'https://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=' . $_POST['url'],
'https://podupti.me/db/pull.php?debug=1&domain=' . $_POST['domain']
);
$message.= 'Your pod will not show right away, needs to pass a few checks, Give it a few hours!';
$message .= 'Your pod will not show right away, needs to pass a few checks, Give it a few hours!';
$headers = 'From: ' . $_POST['email'] . "\r\nReply-To: " . $_POST['email'] . "\r\nCc: " . $_POST['email'] . "\r\n";
@mail( $to, $subject, $message, $headers );
@mail($to, $subject, $message, $headers);
echo 'Data successfully inserted! Your pod will be reviewed and live on the list in a few hours!';
......
......@@ -8,7 +8,7 @@ if (!$dbh) {
die('Error in connection: ' . pg_last_error());
}
$sql = "SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,pingdomurl,monthsmonitored,uptimelast7,responsetimelast7,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden FROM pods WHERE domain = $1";
$result = pg_query_params($dbh, $sql, array($_GET['url']));
$result = pg_query_params($dbh, $sql, [$_GET['url']]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
......
......@@ -7,11 +7,11 @@ $file_name = $backup_dir . '/dump_' . $dump_date . '.sql';
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --username=$pguser $pgdb >> $file_name");
echo "pg backup of $pgdb made";
$dirh = dir($backup_dir);
while($entry = $dirh->read()) {
while ($entry = $dirh->read()) {
$old_file_time = (date('U') - $keep);
$file_created = filectime("$backup_dir/$entry");
if ($file_created < $old_file_time && !is_dir($entry)) {
if(unlink("$backup_dir/$entry")) {
if (unlink("$backup_dir/$entry")) {
echo 'Cleaned up old backups';
}
}
......
<?php
if (!$_GET['domain']){
if (!$_GET['domain']) {
die('no pod domain given');
}
if (!$_GET['token']){
if (!$_GET['token']) {
die('no token given');
}
if (strlen($_GET['token']) < 6){
if (strlen($_GET['token']) < 6) {
die('bad token');
}
$domain = $_GET['domain'];
......@@ -29,9 +29,9 @@ while ($row = pg_fetch_array($result)) {
die('token expired');
}
//delete pod
if ($_GET['delete'] == $row['token']){
if ($_GET['delete'] == $row['token']) {
$sql = "DELETE FROM pods WHERE domain = $1";
$result = pg_query_params($dbh, $sql, array($_GET['domain']));
$result = pg_query_params($dbh, $sql, [$_GET['domain']]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
} else {
......@@ -39,20 +39,20 @@ while ($row = pg_fetch_array($result)) {
}
}
//save and exit
if ($_GET['save'] == $row['token']){
if ($_GET['save'] == $row['token']) {
if ($_GET['weight'] > 10) {
die('10 is max weight');
}
$sql = "UPDATE pods SET email=$1, pingdomurl=$2, weight=$3 WHERE domain = $4";
$result = pg_query_params($dbh, $sql, array($_GET['email'],$_GET['pingdomurl'],$_GET['weight'],$_GET['domain']));
$result = pg_query_params($dbh, $sql, [$_GET['email'], $_GET['pingdomurl'], $_GET['weight'], $_GET['domain']]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
$to = $_GET['email'];
$subject = 'Edit notice from poduptime ';
$message = 'Data for ' . $_GET['domain'] . " Updated. If it was not you reply and let me know! \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $_GET['oldemail'] ."\r\n";
@mail( $to, $subject, $message, $headers );
$headers = "From: support@diasp.org\r\nCc:support@diasp.org," . $_GET['oldemail'] . "\r\n";
@mail($to, $subject, $message, $headers);
pg_free_result($result);
pg_close($dbh);
die('Data saved. Will go into effect on next hourly change');
......
<?php
$systemTimeZone = system('date +%Z');
if (!$_POST['domain']){
if (!$_POST['domain']) {
die('no pod domain given');
}
$domain = $_POST['domain'];
......@@ -21,14 +21,14 @@ if ($rows <= 0) {
die('domain not found');
}
while ($row = pg_fetch_array($result)) {
if ($_POST['email']){
if ($_POST['email']) {
if ($row['email'] <> $_POST['email']) {
die('email not a match');
}
$uuid = md5(uniqid($domain, true));
$expire = date('Y-m-d H:i:s', time() + 2700);
$sql = "UPDATE pods SET token=$1, tokenexpire=$2 WHERE domain = '$domain'";
$result = pg_query_params($dbh, $sql, array($uuid,$expire));
$result = pg_query_params($dbh, $sql, [$uuid, $expire]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
......@@ -36,13 +36,13 @@ while ($row = pg_fetch_array($result)) {
$subject = 'Temporary edit key for podupti.me';
$message = 'Link: https://podupti.me/db/edit.php?domain=' . $_POST['domain'] . '&token=' . $uuid . ' Expires: ' . $expire . ' ' . $systemTimeZone . "\n\n";
$headers = "From: support@diasp.org\r\nBcc: support@diasp.org\r\n";
@mail( $to, $subject, $message, $headers );
@mail($to, $subject, $message, $headers);
echo 'Link sent to your email';
} elseif (!$_POST['email']){
} elseif (!$_POST['email']) {
$uuid = md5(uniqid($domain, true));
$expire = date('Y-m-d H:i:s', time() + 9700);
$sql = "UPDATE pods SET token=$1, tokenexpire=$2 WHERE domain = '$domain'";
$result = pg_query_params($dbh, $sql, array($uuid,$expire));
$result = pg_query_params($dbh, $sql, [$uuid, $expire]);
if (!$result) {
die('Error in SQL query: ' . pg_last_error());
}
......@@ -50,7 +50,7 @@ while ($row = pg_fetch_array($result)) {
$subject = 'FORWARD REQUEST: Temporary edit key for podupti.me';
$message = 'User trying to edit pod without email address. Email found: ' . $row['email'] . ' Link: https://podupti.me/db/edit.php?domain=' . $_POST['domain'] . '&token=' . $uuid . ' Expires: ' . $expire . ' ' . $systemTimeZone . "\n\n";
$headers = "From: support@diasp.org\r\nBcc: support@diasp.org\r\n";
@mail( $to, $subject, $message, $headers );
@mail($to, $subject, $message, $headers);
echo 'Link sent to administrator to review and verify, if approved they will forward the edit key to you.';
}
pg_free_result($result);
......
<?php
if (!$_POST['domain']){
if (!$_POST['domain']) {
die('no pod domain given');
}
if (!$_POST['adminkey']){
if (!$_POST['adminkey']) {
die('no token given');
}
if (!$_POST['action']){
if (!$_POST['action']) {
die('no action selected');
}
$domain = $_POST['domain'];
......@@ -28,7 +28,7 @@ while ($row = pg_fetch_array($result)) {
//save and exit
if ($_POST['action'] == 'delete') {
$sql = "DELETE from pods WHERE domain = $1";
$result = pg_query_params($dbh, $sql, array($domain));
$result = pg_query_params($dbh, $sql, [$domain]);
if (!$result) {
die('two Error in SQL query: ' . pg_last_error());
}
......@@ -36,8 +36,8 @@ while ($row = pg_fetch_array($result)) {
$to = $row['email'];
$subject = 'Pod deleted from poduptime ';
$message = 'Pod ' . $_POST['domain'] . ' was deleted from podupti.me as it was dead on the list. ' . $_POST['comments'] . " Feel free to add back at any time. \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $row['email'] . "\r\n";
@mail( $to, $subject, $message, $headers );
$headers = "From: support@diasp.org\r\nCc:support@diasp.org," . $row['email'] . "\r\n";
@mail($to, $subject, $message, $headers);
}
pg_free_result($result);
pg_close($dbh);
......@@ -46,8 +46,8 @@ while ($row = pg_fetch_array($result)) {
$to = $row['email'];
$subject = 'Pod removal warning from poduptime ';
$message = 'Pod ' . $_POST['domain'] . ' is on the list to be deleted now because: ' . $_POST['comments'] . ". \n\n Please let me know if you need help fixing before it is removed. \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $row['email'] . "\r\n";
@mail( $to, $subject, $message, $headers );
$headers = "From: support@diasp.org\r\nCc:support@diasp.org," . $row['email'] . "\r\n";
@mail($to, $subject, $message, $headers);
}
}
echo $result;
......
<?php
$debug = isset($_GET['debug'])?1:0;
$debug=1;
$debug = isset($_GET['debug']) ? 1 : 0;
$debug = 1;
//$debug = isset($argv[1])?1:0;
//* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
require_once __DIR__ . '/../config.php';
......@@ -15,9 +15,11 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv);
curl_close($mv);
preg_match('/number: "(.*?)"/',$outputmv,$version);
preg_match('/number: "(.*?)"/', $outputmv, $version);
$dmasterversion = trim($version[1], '"');
if ($debug) {echo 'Diaspora Masterversion: ' . $dmasterversion . '<br>';}
if ($debug) {
echo 'Diaspora Masterversion: ' . $dmasterversion . '<br>';
}
//get master code version for freindica pods
$mv = curl_init();
......@@ -29,9 +31,11 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv);
curl_close($mv);
preg_match('/FRIENDICA_VERSION\', \'(.*?)\'/',$outputmv,$version);
preg_match('/FRIENDICA_VERSION\', \'(.*?)\'/', $outputmv, $version);
$fmasterversion = trim($version[1], '"');
if ($debug) {echo 'Frendica Masterversion: ' . $fmasterversion . '<br>';}
if ($debug) {
echo 'Frendica Masterversion: ' . $fmasterversion . '<br>';
}
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh2 = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
......@@ -39,52 +43,78 @@ if (!$dbh) {
}
//foreach pod check it and update db
$domain = isset($_GET['domain'])?$_GET['domain']:null;
$domain = isset($_GET['domain']) ? $_GET['domain'] : null;
if ($domain) {
$sql = "SELECT domain,pingdomurl,score,datecreated,weight FROM pods WHERE domain = $1";