Commit a854fe83 authored by David Morley's avatar David Morley

Merge branch 'master' into 'develop'

# Conflicts:
#   composer.lock
parents db7b36aa f17c663b
Pipeline #527 passed with stage
in 1 minute and 30 seconds
......@@ -675,6 +675,80 @@
],
"time": "2018-10-05T07:34:25+00:00"
},
{
"name": "rinvex/country",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/rinvex/country.git",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rinvex/country/zipball/e32228ef43f26d3b02296be9454f842c52d492f3",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3",
"shasum": ""
},
"require": {
"php": "^7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Rinvex\\Country\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rinvex LLC",
"email": "help@rinvex.com",
"homepage": "https://rinvex.com"
},
{
"name": "Abdelrahman Omran",
"email": "me@omranic.com",
"homepage": "https://omranic.com",
"role": "Project Lead"
},
{
"name": "The Generous Laravel Community",
"homepage": "https://github.com/rinvex/country/contributors"
}
],
"description": "Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.",
"homepage": "https://rinvex.com",
"keywords": [
"Flexible",
"Simple",
"countries",
"country",
"currencies",
"demonym",
"dialling",
"emoji",
"flags",
"geographic",
"languages",
"rinvex",
"svg"
],
"time": "2017-03-07T18:40:20+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.9.0",
......
......@@ -10,7 +10,22 @@ use RedBeanPHP\R;
require_once __DIR__ . '/../boot.php';
<<<<<<< HEAD
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
if (!($_domain = $_GET['domain'] ?? null)) {
die('no pod domain given');
}
=======
($_domain = $_GET['domain'] ?? null) || die('no pod domain given');
>>>>>>> develop
// Other parameters.
$_email = $_GET['email'] ?? '';
......@@ -59,6 +74,25 @@ foreach ($pods as $pod) {
}
echo <<<EOF
<<<<<<< HEAD
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
}
</script>
<form action="/">
<input type="hidden" name="edit">
<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.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="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>
EOF;
$stop = 1;
=======
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
......@@ -78,10 +112,15 @@ foreach ($pods as $pod) {
EOF;
$stop = true;
>>>>>>> develop
}
}
if (!$stop) {
<<<<<<< HEAD
=======
>>>>>>> develop
$link = 'https://' . $_domain . '/nodeinfo/1.0';
if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
$info = json_decode($infos, true);
......@@ -102,6 +141,27 @@ if (!$stop) {
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($_domain, true));
<<<<<<< HEAD
try {
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
if ($_email) {
$to = $adminemail;
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST'];
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email];
=======
try {
$p = R::dispense('pods');
......@@ -122,6 +182,7 @@ if (!$stop) {
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST'];
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email];
>>>>>>> develop
$message_lines = [
'https://' . $_SERVER['HTTP_HOST'],
'Your pod ' . $_domain . ' will not show up right away, as it needs to pass a few checks first.',
......@@ -136,4 +197,8 @@ if (!$stop) {
} else {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>';
}
<<<<<<< HEAD
}
=======
}
>>>>>>> develop
......@@ -25,6 +25,11 @@ $_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
require_once __DIR__ . '/../boot.php';
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pod = R::findOne('pods', 'domain = ?', [$_domain]);
$pod || die('domain not found');
......
......@@ -16,6 +16,12 @@ $_email = $_GET['email'] ?? '';
require_once __DIR__ . '/../boot.php';
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pod = R::findOne('pods', 'domain = ?', [$_domain]);
$pod || die('domain not found');
......
......@@ -5,7 +5,6 @@
*/
declare(strict_types=1);
use Carbon\Carbon;
require_once __DIR__ . '/boot.php';
......
......@@ -22,6 +22,24 @@ if ($country_code) {
$long = -99;
}
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
// CloudFlare country code pull.
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
if ($country_code) {
$lat = country(strtolower($country_code))->getLatitudeDesc();
$long = country(strtolower($country_code))->getLongitudeDesc();
} else {
$lat = 31;
$long = -99;
}
try {
$pods = R::getAll("
SELECT domain, signup, name, lat, long, softwarename, uptime_alltime, active_users_halfyear, services, service_xmpp
......
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