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

Terms (#96)

* change terms to podmin_statement

* use grep more david

* fix labeling
parent daff2ab0
......@@ -9,6 +9,9 @@ if (!($_domain = $_GET['domain'] ?? null)) {
die('no pod domain given');
}
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
die('Could not validate the domain name, be sure to enter it as "domain.com" (no caps, no slashes, no extras)');
......@@ -42,7 +45,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>Terms Link <input type="text" size="20" name="terms"></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>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>
......@@ -71,8 +74,8 @@ if (stristr($outputssl, 'openRegistrations')) {
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($domain, true));
$sql = 'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4)';
$result = pg_query_params($dbh, $sql, [$_domain, $_email, $_terms, $publickey]);
$sql = 'INSERT INTO pods (domain, email, podmin_statement, publickey) VALUES ($1, $2, $3, $4)';
$result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $publickey]);
$result || die('Error in SQL query: ' . pg_last_error());
if ($_email) {
......
......@@ -5,18 +5,17 @@
strlen($_token) > 6 || die('bad token');
// Other parameters.
$_action = $_GET['action'] ?? '';
$_weight = $_GET['weight'] ?? '';
$_email = $_GET['email'] ?? '';
$_stats_apikey = $_GET['stats_apikey'] ?? '';
$_terms = $_GET['terms'] ?? '';
$_action = $_GET['action'] ?? '';
$_weight = $_GET['weight'] ?? '';
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT domain,email,token,tokenexpire,weight,terms FROM pods WHERE domain = $1';
$sql = 'SELECT domain,email,token,tokenexpire,weight,podmin_statement FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -37,8 +36,8 @@ while ($row = pg_fetch_array($result)) {
if ('save' === $_action) {
$_weight <= 10 || die('10 is max weight');
$sql = 'UPDATE pods SET email = $1, weight = $2, terms = $3 WHERE domain = $4';
$result = pg_query_params($dbh, $sql, [$_email, $_weight, $_terms, $_domain]);
$sql = 'UPDATE pods SET email = $1, weight = $2, podmin_statement = $3 WHERE domain = $4';
$result = pg_query_params($dbh, $sql, [$_email, $_weight, $_podmin_statement, $_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
$to = $_email;
......@@ -57,7 +56,7 @@ while ($row = pg_fetch_array($result)) {
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
<label>Email <input type="text" size="20" name="email" value="<?php echo $row['email']; ?>"></label><br>
<label>Terms Link <input type="text" size="20" name="terms" value="<?php echo $row['terms']; ?>"></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.) <textbox cols="100" rows="7" name="podmin_statement"><?php echo $row['podmin_statement']; ?></textbox></label><br>
<label>Weight <input type="text" size="2" name="weight" value="<?php echo $row['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>
......
ALTER TABLE pods ADD terms text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text;
ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text;
ALTER TABLE pods DROP Hgitdate, DROP Hgitref, DROP Hruntime, DROP Hencoding, DROP longversion, DROP ptr, DROP whois, DROP postalcode, DROP connection, DROP pingdomlast;
ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey;
......
......@@ -37,7 +37,7 @@ CREATE TABLE pods (
token text,
publickey text,
tokenexpire timestamp,
terms text,
podmin_statement text,
sslexpire timestamp,
dnssec boolean,
comment_counts int,
......
......@@ -4,5 +4,12 @@ $.facebox.settings.loadingImage = 'bower_components/facebox/src/loading.gif'
$('a[rel*=facebox]').facebox()
$('#myTable').tablesorter()
$('[data-toggle="tooltip"]').tooltip()
$(function () {
$('[data-toggle="popover"]').popover()
})
$('.popover-dismiss').popover({
trigger: 'focus'
})
});
......@@ -2,8 +2,8 @@
Want your pod listed? Or to claim a listed pod?<br>
<br>
<form action="db/add.php" method="get">
<label>Pod Domain Name: <input type="text" name="domain" class="xlarge span4 required" placeholder="domain.com"></label><br>
<label>Pod Terms Link: <input type="text" name="terms" class="xlarge span4" placeholder="/terms"></label><br>
<label>Pod Domain Name: <input type="text" name="domain" class="xlarge span4 required" placeholder="domain.com"></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. HTML is ok.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Your Email: <input type="text" name="email" class="xlarge span4" placeholder="user@domain.com"></label><br>
<input type="submit" value="submit">
</form>
......@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT domain,dnssec,terms,sslexpire,masterversion,shortversion,softwarename,monthsmonitored,score,signup,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,responsetime,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY uptime_alltime DESC';
$sql = 'SELECT domain,dnssec,podmin_statement,sslexpire,masterversion,shortversion,softwarename,monthsmonitored,score,signup,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,responsetime,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY uptime_alltime DESC';
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -39,7 +39,7 @@ $numrows = pg_num_rows($result);
<th><a data-toggle="tooltip" data-placement="bottom" title="Does this domain use DNSSEC.">DNSSEC</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="Pod location, based on IP Geolocation.">Country</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="External Social Networks this pod can post to.">Services</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="Terms page for this pod.">Terms</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="Click for more information about this pod from the pod host (podmin).">Info</a></th>
</tr>
</thead>
<tbody>
......@@ -97,7 +97,8 @@ $numrows = pg_num_rows($result);
$row['service_wordpress'] === 't' && print '<div class="smlogo smlogo-wordpress" title="Publish to WordPress"></div>';
$row['service_xmpp'] === 't' && print '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" title="XMPP chat server" alt="XMPP chat server"></div>';
echo '</td>';
echo '<td>' . ($row['terms'] ? '<a href="https://' . $row['domain'] . $row['terms'] . '">&#128279;</a>' : '&nbsp;') . '</td></tr>';
echo '<td>' . ($row['podmin_statement'] ? '<a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="left" title="Podmin Statement" data-html="true" data-content="' . htmlentities($row['podmin_statement'], ENT_QUOTES) . '">&#8505;</a>' : '&nbsp;') . '</td></tr>';
}
?>
</tbody>
......
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