Commit 3a3049d2 authored by David Morley's avatar David Morley

Merge branch 'develop'

parents 365a3644 8f8aeb32
# Changelog
The format is based on [Keep a Changelog] and this project adheres to [Semantic Versioning].
## [2.4.0] - 2018-09-03
:exclamation: DB migrations required! (see [SQL migration script][2.4.0-sql-migration])
:exclimation: config.php rewritten - requires migration
### Added
- Added bootstrapping to simplify initialisation of config and database
- Config syntax has changed to array style (#155)
- Added `pghost` config to set database port
- Added `CONTRIBUTING.md`
- Podmin can choose at what fail score to send the notice out
- Podmin email shares details on why pod is failing
- Only retrieve location data for remote servers / IPs
- Fontawesome for icons
### Changed
- Introduce proper changelog format (#189)
- Moved DB migration scripts into `db` folder
- Use Curl for all http calls
- Use filter dropdowns for pre-defined columns
- Use pretty URLs (see nginx.example)
- Open pod URLs in a new tab
- Use detectlanguage.com API for language guess
- Only use JSON data, ignore HTML when returned
- Allow curl redirect on home page check
- Score now goes to -5000 before a pod is removed so dead pods get checked a while then removed for good
- Move functions to dedicated file to allow reuse
- Backup script rewrite
- Store services as json array
- Paging can be changed to some or all on advanced view
### Deprecated
### Removed
### Fixed
- Notify podmins just once at 50 when pod failing (#186)
- Add missing meta and PHP module requirements to `composer.json`
### Security
## [2.3.1] - 2018-08-05
### Added
- Podmins can link directly to their pod via `https://podupti.me/domain.name` for stats and to allow users to rate easier
- Wizard to help you filter the columns to what you need (#145)
- Cookie used to remember last pod you clicked
### Changed
- Now one table with a basic default view you can customize (#171)
- Switch to a library for country to lat long lookup
- Switch GeoIP from built in PHP to library and use newer Maxmind database file
## [2.3.0] - 2018-07-19
:exclamation: DB migrations required! (see [SQL migration script][2.2.0-sql-migration])
### Added
- Language is detected based on your homepage, edit your homepage to non-en if that is what you use
- Add development and release dates to `masterversions` table (#143)
- Store full country name, store days monitored each pod (#150)
- Store detectedlanguage (#144)
- Show version and update in full view cleaner (#143)
- Filter and search on the columns of data (#147)
- Paginate the results so they fit per page (#147)
### Changed
- Podmins can no longer access `db/pull.php` to test their pod, they can however get to a debug screen from the edit pod area
- Edit will send to email on file and be less delay, runner of site does not really have any way to verify email address
- Default new pods to `UP` to be checked
- Use the git API for release versions, check development releases on pods (#143)
- Move from [bower to yarn](https://bower.io/blog/2017/how-to-migrate-away-from-bower/) for packages
- Move to PHP 7.2 with strict typing
- Move to [Eslint compliance](https://eslint.org/docs/rules/)
- Move to [PSR-2 compliance](https://www.php-fig.org/psr/psr-2/)
- NOTE `config.php.example` change to full paths for 2 items!
- Show time as human readable everywhere (#150)
### Removed
- Unused `hidden` and `secure` columns (#140, #141)
### Fixed
- Rename table `rating_comments` to `ratingcomments` for redbean support (#146)
### Security
- Forbid access to files that should be CLI only (#152)
## [2.2.0] - 2018-05-12
:exclamation: DB migrations required! (see [SQL migration script][2.2.0-sql-migration])
### Added
- Podmins can now pause/unpause or delete from podmin area
- Graph on user growth on the network
- Add monthly stats table
### Changed
- `go.php` auto select picks a more stable pod than before
- Make map prettier
- Use lines on tables to make them more readable
- Don't delete dead pods, keep them and data for history hide them for users
- Put daily tasks in the `pull.sh` and run each day
- Update status to 1-5 rather than text
### Fixed
- Fix ipv6
[2.4.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.3.0-2.4.0.sql
[2.3.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.2.0-2.3.0.sql
[2.2.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.1.4-2.2.0.sql
[Unreleased]: https://git.feneas.org/diasporg/Poduptime/compare/master...develop
[2.3.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.3.0...2.3.1
[2.3.0]: https://git.feneas.org/diasporg/Poduptime/compare/v2.2.0...2.3.0
[2.2.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.1.3...v2.2.0
[Keep a Changelog]: https://keepachangelog.com/
[Semantic Versioning]: https://semver.org/
# How To Contribute
## Workflow
* Fork Git Repo https://git.feneas.org/diasporg/Poduptime
* Pull Git
* Create a topic branch to work from
* Commit and push your branch up
* Create a Merge Request to the develop branch
## Guidelines
* Note your changes in [`CHANGELOG.md`] following https://keepachangelog.com
* Create any necessary DB migration script in [`db/migrations`] and note them in the changelog.
* Update [`README.md`] with needed changes
* Update the [Wiki] with API changes
* Write your tests and validate them before you do your MR
## Coding Style
* PHP follows [PSR-2]
* CSS follows [CSSLint]
* JS follows [ESLint]
[`README.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/README.md
[`CHANGELOG.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/CHANGELOG.md
[`db/migrations`]: https://git.feneas.org/diasporg/Poduptime/tree/master/db/migrations
[Wiki]: https://git.feneas.org/diasporg/Poduptime/wikis/home
[PSR-2]: https://www.php-fig.org/psr/psr-2/
[CSSLint]: https://github.com/CSSLint/csslint
[ESLint]: https://eslint.org/docs/rules/
......@@ -8,9 +8,8 @@ Environmental items you need (debian based system assumed):
OS Dependencies:
```
php7.2 php7.2-curl php7.2-pgsql php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
```
GeoIP needs setup normally with a dat file
Yarn is a separate install: https://yarnpkg.com
......@@ -54,13 +53,14 @@ run `db/pull.sh debug` to debug output
run `db/pull.sh sqldebug` to debug sql
run `db/pull.sh develop` to run without email alerts to end users
run `db/pull.sh Check_System_Deleted` to re-check system deleted pods as needed
These commands can be combined
# To Upgrade:
```
git pull
yarn install
composer install
psql -U podupuser podupdb < db/migrationXXX.sql (see db/version.md for proper migration versions)
psql -U podupuser podupdb < db/migrations/xxx.sql (see db/migrations/README.md for proper migration versions)
```
# Status
......
......@@ -15,15 +15,7 @@ $_format = $_GET['format'] ?? '';
$_method = $_GET['method'] ?? '';
$_callback = $_GET['callback'] ?? '';
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/config.php';
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);
require_once __DIR__ . '/boot.php';
if ($_format === 'georss') {
echo <<<EOF
......
<?php
/**
* Boot the application, loading config and database connection.
*/
declare(strict_types=1);
use DetectLanguage\DetectLanguage;
use RedBeanPHP\R;
define('PODUPTIME', microtime(true));
require_once __DIR__ . '/vendor/autoload.php';
// Initialise language detection.
DetectLanguage::setApiKey(c('dlkey'));
DetectLanguage::setSecure(true);
// Set up global DB connection.
R::setup(
sprintf(
'pgsql:host=%s;port=%d;dbname=%s',
c('pghost'),
c('pgport', 5432),
c('pgdb')
),
c('pguser'),
c('pgpass'),
true
);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
{
"name": "diasporg/poduptime",
"description": "Poduptime is software to get live stats and data on listed Diaspora Pods.",
"license": "AGPL-3.0-or-later",
"config": {
"platform": {
"php": "7.2"
......@@ -6,22 +9,29 @@
},
"require": {
"php": "^7.2",
"gabordemooij/redbean": "^5.0",
"nesbot/carbon": "^1.31",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-bcmath": "*",
"gabordemooij/redbean": "^5.1",
"nesbot/carbon": "^1.33",
"commerceguys/enum": "^1.0",
"noplanman/xec": "0.1.0",
"jaybizzle/crawler-detect": "1.*",
"patrickschur/language-detection": "^3.3",
"jaybizzle/crawler-detect": "^1.2",
"geoip2/geoip2": "^2.9",
"maxmind-db/reader": "~1.0",
"maxmind-db/reader": "^1.3",
"matriphe/iso-639": "^1.2",
"rinvex/country": "^3.1"
"rinvex/country": "^3.1",
"detectlanguage/detectlanguage": "^2.2",
"longman/ip-tools": "^1.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3"
},
"autoload": {
"classmap": ["lib"]
"classmap": ["lib"],
"files": ["lib/functions.php"]
},
"scripts": {
"check-code": [
......
This diff is collapsed.
......@@ -4,38 +4,46 @@
* Config for Poduptime.
*/
//backup directory - full dir path
$backup_dir = __DIR__ . '/backup';
return [
//backup directory - full dir path
'backup_dir' => __DIR__ . '/backup',
//log directory - full dir path
$log_dir = __DIR__ . '/log';
//log directory - full dir path
'log_dir' => __DIR__ . '/log',
//location of pg dump - full dir path
$pg_dump_dir = '/usr/bin';
//location of pg dump - full dir path
'pg_dump_dir' => '/usr/bin',
//db host
$pghost = 'localhost';
//db host
'pghost' => 'localhost',
//db username
$pguser = '';
//db port
'pgport' => 5432,
//db password
$pgpass = '';
//db username
'pguser' => '',
//db name
$pgdb = '';
//db password
'pgpass' => '',
//admin email for forms
$adminemail = '';
//db name
'pgdb' => '',
//DNS server for dnssec testing. 1.1.1.1 tests the best
$dnsserver = '';
//admin email for forms
'adminemail' => '',
//CA for curl to use - full file path (pull.sh will update this monthly)
$cafullpath = '';
//DNS server for dnssec testing. 1.1.1.1 tests the best
'dnsserver' => '',
//Mapbox.com API key. https://www.mapbox.com/help/how-access-tokens-work/
$mapboxkey = '';
//CA for curl to use - full file path (pull.sh will update this monthly)
'cafullpath' => '',
//Geolite2-city database file in mmdb format - full file path (pull.sh will update this monthly)
$geoip2db = '';
//Mapbox.com API key. https://www.mapbox.com/help/how-access-tokens-work/
'mapboxkey' => '',
//Geolite2-city database file in mmdb format - full file path (pull.sh will update this monthly)
'geoip2db' => '',
//detectlanguage.com api key
'dlkey' => '',
];
@import url("/node_modules/typeface-roboto/index.css");
body {
font-family: 'Roboto', sans-serif;
font-weight: 400;
--blue: #303030;
--grey: #4e89a4;
--green: #6B8E23;
}
.bg-blue {
background-color: var(--blue) !important;
}
.blue {
color: var(--blue);
}
.bg-green {
background-color: var(--green);
}
.green {
color: var(--green);
}
.bg-grey {
background-color: var(--grey);
}
.grey {
color: var(--grey);
}
a {
color: var(--blue);
}
.tablesorter-header {
background-color: var(--grey) !important;
}
.main {
padding: 5px;
}
......@@ -25,35 +67,8 @@
}
.smlogo {
width: 16px;
height: 16px;
background: url('/images/smlogo.png') 0 0;
display: inline-block;
margin: 0;
}
.smlogo-twitter {
background-position: 0 -776px;
}
.smlogo-facebook {
background-position: 0 -824px;
}
.smlogo-tumblr {
background-position: 0 -792px;
}
.smlogo-wordpress {
background-position: 0 -656px;
}
.smlogo-xmpp {
background: none;
}
.smlogo-xmpp img {
vertical-align: unset;
display: inline-block;
}
#map {
......
......@@ -8,9 +8,9 @@ declare(strict_types=1);
use RedBeanPHP\R;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../boot.php';
<<<<<<< HEAD
define('PODUPTIME', microtime(true));
......@@ -23,11 +23,15 @@ 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'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
$_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
......@@ -43,6 +47,7 @@ try {
die('Error in SQL query: ' . $e->getMessage());
}
$stop = false;
foreach ($pods as $pod) {
if ($pod['domain'] === $_domain) {
if ($pod['email']) {
......@@ -69,6 +74,7 @@ foreach ($pods as $pod) {
}
echo <<<EOF
<<<<<<< HEAD
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
......@@ -86,11 +92,35 @@ foreach ($pods as $pod) {
EOF;
$stop = 1;
=======
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
$("#podmin_notify_level").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>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" data-from="50" name="podmin_notify_level" id="podmin_notify_level"></label><br>
<input type="submit" name="action" value="save">
</form>
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);
......@@ -111,6 +141,7 @@ if (!$stop) {
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($_domain, true));
<<<<<<< HEAD
try {
$p = R::dispense('pods');
......@@ -130,6 +161,28 @@ if (!$stop) {
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST'];
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email];
=======
try {
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify;
$p['podmin_notify_level'] = $_podmin_notify_level;
$p['publickey'] = $publickey;
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
if ($_email) {
$to = c('adminemail');
$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.',
......@@ -144,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>';
}
}
\ No newline at end of file
<<<<<<< HEAD
}
=======
}
>>>>>>> develop
......@@ -15,15 +15,7 @@ use RedBeanPHP\R;
// Other parameters.
$_format = $_GET['format'] ?? '';
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
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);
require_once __DIR__ . '/../boot.php';
try {
$pod = R::getRow('
......
......@@ -6,25 +6,45 @@
declare(strict_types=1);
if (PHP_SAPI !== 'cli') {
require_once __DIR__ . '/../boot.php';
if (!is_cli()) {
header('HTTP/1.0 403 Forbidden');
exit;
}
require_once __DIR__ . '/../config.php';
$keep_for = 60 * 60 * 6; // 6 hours
$backup_file = c('backup_dir') . '/dump_' . date('Ymd_His') . '.sql';
printf("Making backup of '%s' to '%s'...", c('pgdb'), $backup_file);
system(sprintf(
'export PGPASSWORD=%3$s &&' .
'"%1$s" --clean --format=tar --username=%2$s %4$s >> "%5$s"',
c('pg_dump_dir') . '/pg_dump',
c('pguser'),
c('pgpass'),
c('pgdb'),
$backup_file
), $exit_code);
printf(" %s\n", $exit_code === 0 ? 'Success!' : 'Failed.');
$keep = (60 * 60 * 6) * 1;
$dump_date = date('Ymd_Hs');
$file_name = $backup_dir . '/dump_' . $dump_date . '.sql';
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --clean --format=tar --username=$pguser $pgdb >> $file_name");
echo "pg backup of $pgdb made";
$dirh = dir($backup_dir);
$dirh = dir(c('backup_dir'));
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")) {
echo 'Cleaned up old backups';
}
$file = c('backup_dir') . "/{$entry}";
// Skip dotfiles and non-files (folders, symlinks, etc.).
if ($entry[0] === '.' || !is_file($file)) {
continue;
}
if (filectime($file) + $keep_for > time()) {
//echo "Don't delete {$entry}\n";
continue;
}
printf(
"Removing old file '%s'... %s\n",
$entry,
unlink($file) ? 'Success!' : 'Failed.'
);
}
......@@ -16,14 +16,14 @@ use RedBeanPHP\R;
strlen($_token) > 6 || die('bad token');
// Other parameters.
$_action = $_GET['action'] ?? '';
$_weight = $_GET['weight'] ?? 10;
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_action = $_GET['action'] ?? '';
$_weight = $_GET['weight'] ?? 10;
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../boot.php';
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
......@@ -78,10 +78,12 @@ if ('save' === $_action) {
$_weight <= 10 || die('10 is max weight');
try {
$pod['email'] = $_email;
$pod['weight'] = $_weight;
$pod['podmin_statement'] = $_podmin_statement;
$pod['podmin_notify'] = $_podmin_notify;
$pod['email'] = $_email;
$pod['weight'] = $_weight;
$pod['podmin_statement'] = $_podmin_statement;
$pod['podmin_notify'] = $_podmin_notify;
$pod['podmin_notify_level'] = $_podmin_notify_level;
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
......@@ -89,7 +91,7 @@ if ('save' === $_action) {
}
$to = $_email;
$headers = ['From: ' . $adminemail, 'Cc: ' . $pod['email'], 'Bcc: ' . $adminemail];
$headers = ['From: ' . c('adminemail'), 'Cc: ' . $pod['email'], 'Bcc: ' . c('adminemail')];
$subject = 'Edit notice from poduptime';
$message = 'Data for ' . $_domain . ' updated. If it was not you reply and let me know!';
@mail($to, $subject, $message, implode("\r\n", $headers));
......@@ -103,6 +105,7 @@ if ('save' === $_action) {
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
$("#podmin_notify_level").ionRangeSlider();
}
</script>
Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($pod['tokenexpire']))->diffForHumans(null, true); ?><br>
......@@ -114,6 +117,8 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po
<label>Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight" data-from="<?php echo $pod['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>
<label>Notify if pod falls off the list? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" name="podmin_notify_level" id="podmin_notify_level" data-from="<?php echo $pod['podmin_notify_level']; ?>"></label><br>
<input type="submit" name="action" value="save">
</form>
<br>
......@@ -149,4 +154,4 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po
<input value="debug" type="button" aria-describedby="debug" data-featherlight="/db/pull.php?debug=1&nowrite=1&domain=<?php echo $_domain; ?>"/>
<small id="debug" class="form-text text-muted">
Do a debug pull of your pod. Won't update the database just show what it would look like on a pass.
</small>
\ No newline at end of file
</small>
......@@ -14,8 +14,7 @@ use RedBeanPHP\R;
// Other parameters.
$_email = $_GET['email'] ?? '';
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../boot.php';
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
......@@ -33,7 +32,7 @@ try {
// Set up common variables.
$uuid = md5(uniqid($_domain, true));
$link = sprintf('https://%1$s/?edit&domain=%2$s&token=%3$s', $_SERVER['HTTP_HOST'], $_domain, $uuid);
$headers = ['From: ' . $adminemail];
$headers = ['From: ' . c('adminemail')];
$message_lines = [];
if ($_email) {
......@@ -41,7 +40,7 @@ if ($_email) {
$to = $_email;
$subject = 'Temporary edit key for ' . $_SERVER['HTTP_HOST'];
$headers[] = 'Bcc: ' . $adminemail;
$headers[] = 'Bcc: ' . c('adminemail');
$expire = time() + 8700;
$output = 'Link sent to your email.';
} elseif (!$pod['email']) {
......@@ -49,7 +48,7 @@ if ($_email) {
} else {
$to = $pod['email'];
$subject = 'Temporary edit key for ' . $_SERVER['HTTP_HOST'];
$headers[] = 'Bcc: ' . $adminemail;
$headers[] = 'Bcc: ' . c('adminemail');
$message_lines[] = 'Looks like you did not enter your email address, be sure to update it if you forgot the one we have for you.';
$message_lines[] = 'Email found: ' . $pod['email'];
$expire