Commit ca94de08 authored by David Morley's avatar David Morley Committed by GitHub

Merge pull request #99 from diasporg/fixes5

Fixes5
parents 563c63fb 34c28b20
......@@ -11,7 +11,7 @@ if (!($_domain = $_GET['domain'] ?? null)) {
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
......@@ -46,7 +46,7 @@ while ($row = pg_fetch_array($result)) {
<input type="hidden" name="domain" value="{$_domain}">
<input type="hidden" name="token" value="{$uuid}">
<label>Email <input type="text" size="20" name="email"></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Weight <input type="text" size="2" name="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<input type="submit" name="action" value="save">
</form>
......@@ -75,7 +75,7 @@ if (stristr($outputssl, 'openRegistrations')) {
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($domain, true));
$sql = 'INSERT INTO pods (domain, email, podmin_statement, $podmin_notify, publickey) VALUES ($1, $2, $3, $4, $5)';
$sql = 'INSERT INTO pods (domain, email, podmin_statement, podmin_notify, publickey) VALUES ($1, $2, $3, $4, $5)';
$result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $_podmin_notify, $publickey]);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -6,9 +6,10 @@ strlen($_token) > 6 || die('bad token');
// Other parameters.
$_action = $_GET['action'] ?? '';
$_weight = $_GET['weight'] ?? '';
$_weight = $_GET['weight'] ?? 10;
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
require_once __DIR__ . '/../config.php';
......
......@@ -18,7 +18,11 @@ ALTER TABLE pods ALTER COLUMN hidden TYPE boolean USING hidden::boolean;
ALTER TABLE pods ALTER COLUMN secure TYPE boolean USING secure::boolean;
ALTER TABLE pods ALTER COLUMN signup TYPE boolean USING signup::boolean;
ALTER TABLE pods ALTER weight SET DEFAULT 10;
ALTER TABLE pods ALTER score SET DEFAULT 50;
ALTER TABLE pods ALTER adminrating SET DEFAULT 0;
ALTER TABLE pods ALTER userrating SET DEFAULT 0;
ALTER TABLE pods ALTER weightedscore SET DEFAULT 0;
DROP TABLE users;
......
......@@ -5,10 +5,10 @@ CREATE TABLE pods (
softwarename text,
masterversion text,
shortversion text,
score int DEFAULT 10,
weightedscore numeric(5,2) DEFAULT 10,
adminrating decimal DEFAULT 10,
userrating decimal DEFAULT 10,
score int DEFAULT 50,
weightedscore numeric(5,2) DEFAULT 0,
adminrating decimal DEFAULT 0,
userrating decimal DEFAULT 0,
hidden boolean DEFAULT true,
ip text,
country text,
......@@ -42,7 +42,7 @@ CREATE TABLE pods (
sslexpire timestamp,
dnssec boolean,
comment_counts int,
weight int DEFAULT 50,
weight int DEFAULT 10,
date_updated timestamp DEFAULT current_timestamp,
date_laststats timestamp DEFAULT current_timestamp,
date_created timestamp DEFAULT current_timestamp
......
......@@ -46,7 +46,11 @@ $numrows = pg_num_rows($result);
echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="text-success url" target="_self" href="/go.php?domain=' . $row['domain'] . '">' . $row['domain'] . '</a></div></td>';
echo '<td>' . $row['uptime_alltime'] . '%</td>';
if ($row['active_users_halfyear'] > 0) {
echo '<td data-toggle="tooltip" data-placement="bottom" title="Active users six months: ' . $row['active_users_halfyear'] . ', Active users one month: ' . $row['active_users_monthly'] . '">' . $row['active_users_halfyear'] . '</td>';
} else {
echo '<td data-toggle="tooltip" data-placement="bottom" title="Pod does not share user data."></td>';
}
if ($country_code === $row['country']) {
echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="City: ' . ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '"><b>' . $row['country'] . '</b></td>';
} else {
......
......@@ -28,7 +28,7 @@ foreach ($csv as $cords) {
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT domain,signup,name,lat,long,softwarename,uptime_alltime,active_users_halfyear,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden";
$sql = "SELECT domain,signup,name,lat,long,softwarename,uptime_alltime,active_users_halfyear,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND lat != '' AND long != ''";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment