aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-01 20:14:42 -0800
committerfriendica <info@friendica.com>2015-03-01 20:14:42 -0800
commit36af4265380e2555d35d7dfbf912b657af45b26c (patch)
tree59c3bceb495bbd497f0f65f889533e584fd9e96c
parente006658b017f4de04b8f98049c2960c3165ceb11 (diff)
downloadvolse-hubzilla-36af4265380e2555d35d7dfbf912b657af45b26c.tar.gz
volse-hubzilla-36af4265380e2555d35d7dfbf912b657af45b26c.tar.bz2
volse-hubzilla-36af4265380e2555d35d7dfbf912b657af45b26c.zip
Nag hub admins with self-signed certs to fix them. Otherwise we'll just have to start
marking them as dead sites.
-rwxr-xr-xboot.php34
-rw-r--r--include/poller.php1
2 files changed, 35 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index a93f074c4..f0f982e03 100755
--- a/boot.php
+++ b/boot.php
@@ -2263,3 +2263,37 @@ function z_get_temp_dir() {
$temp_dir = sys_get_temp_dir();
return $upload_dir;
}
+
+function z_check_cert() {
+ $a = get_app();
+ if(strpos(z_root(),'https://') !== false) {
+ $x = z_fetch_url(z_root() . '/siteinfo/json');
+ if(! $x['success']) {
+ $recurse = 0;
+ $y = z_fetch_url(z_root() . '/siteinfo/json',false,$recurse,array('novalidate' => true));
+ if($y['success'])
+ cert_bad_email();
+ }
+ }
+}
+
+
+
+function cert_bad_email() {
+
+ $a = get_app();
+
+ $email_tpl = get_intltext_template("cert_bad_eml.tpl");
+ $email_msg = replace_macros($email_tpl, array(
+ '$sitename' => $a->config['system']['sitename'],
+ '$siteurl' => $a->get_baseurl(),
+ '$error' => t('Website SSL certificate is not valid. Please correct.')
+ ));
+
+ $subject = email_header_encode(sprintf(t('[red] Website SSL error for %s'), $a->get_hostname()));
+ mail($a->config['system']['admin_email'], $subject, $email_msg,
+ 'From: Administrator' . '@' . $a->get_hostname() . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
+} \ No newline at end of file
diff --git a/include/poller.php b/include/poller.php
index fd78ce087..06311eb39 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -150,6 +150,7 @@ function poller_run($argv, $argc){
call_hooks('cron_weekly',datetime_convert());
+ z_check_cert();
require_once('include/hubloc.php');
prune_hub_reinstalls();