finish issue #7 - remove admininfo as well as siteinfo endpoint.

This commit is contained in:
Mike Macgirvin 2022-08-29 21:19:51 -07:00
parent 1be301f06f
commit fbe31cef60
6 changed files with 160 additions and 237 deletions

View file

@ -2710,13 +2710,6 @@ class Libzot
$access_policy = ACCESS_PRIVATE;
}
if ($access_policy != ACCESS_PRIVATE) {
$x = Url::get($arr['url'] . '/siteinfo.json');
if (!$x['success']) {
$access_policy = ACCESS_PRIVATE;
}
}
$site_about = EMPTY_STR;
$site_logo = EMPTY_STR;
$sitename = EMPTY_STR;

View file

@ -34,13 +34,10 @@ class Site
$sitename = ((x($_POST, 'sitename')) ? notags(trim($_POST['sitename'])) : App::get_hostname());
$admininfo = ((x($_POST, 'admininfo')) ? trim($_POST['admininfo']) : false);
$siteinfo = ((x($_POST, 'siteinfo')) ? trim($_POST['siteinfo']) : '');
$legal = ((x($_POST, 'legal')) ? trim($_POST['legal']) : '');
$language = ((x($_POST, 'language')) ? notags(trim($_POST['language'])) : 'en');
$theme = ((x($_POST, 'theme')) ? notags(trim($_POST['theme'])) : '');
// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
// $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
$maximagesize = ((x($_POST, 'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$register_policy = ((x($_POST, 'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
@ -128,12 +125,6 @@ class Site
set_config('system', 'tos_required', $tos_required);
PConfig::Set(App::$sys_channel['channel_id'], 'system', 'legal', $legal);
if ($admininfo == '') {
del_config('system', 'admininfo');
} else {
linkify_tags($admininfo, local_channel());
set_config('system', 'admininfo', $admininfo);
}
set_config('system', 'siteinfo', $siteinfo);
// sync sitename and siteinfo updates to the system channel
@ -249,8 +240,6 @@ class Site
/* Admin Info */
$admininfo = get_config('system', 'admininfo');
/* Register policy */
$register_choices = [
REGISTER_CLOSED => t("No"),
@ -290,9 +279,8 @@ class Site
'$advanced' => t('Advanced'),
'$baseurl' => z_root(),
'$sitename' => ['sitename', t("Site name"), htmlspecialchars(get_config('system', 'sitename', App::get_hostname()), ENT_QUOTES, 'UTF-8'), ''],
'$admininfo' => ['admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. Multicode may be used here.")],
'$siteinfo' => ['siteinfo', t('Site Information'), get_config('system', 'siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. Multicode may be used here.")],
'$legal' => ['legal',t('Legal Information'), htmlspecialchars($legal), ''],
'$siteinfo' => ['siteinfo', t('Site Information'), get_config('system', 'siteinfo'), t("Description of this site. Multicode may be used here.")],
'$legal' => ['legal',t('Legal Information'), htmlspecialchars($legal), t('Multicode may be used here.')],
'$language' => ['language', t("System language"), get_config('system', 'language', 'en'), "", $lang_choices],
'$theme' => ['theme', t("System theme"), get_config('system', 'theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices],
// '$theme_mobile' => [ 'theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile ],

View file

@ -29,7 +29,10 @@ class Fastping extends Controller
public function init()
{
// Provide a general purpose ping endpoint to check server health.
if (argc() > 1 && argv(1) === 'pong') {
json_return_and_die(['success' => true ]);
}
$result['notice'] = [];
$result['info'] = [];

View file

@ -1,59 +0,0 @@
<?php
namespace Code\Module;
use Code\Lib\System;
use Code\Lib\Config;
use Code\Web\Controller;
use Code\Extend\Hook;
use Code\Render\Theme;
class Siteinfo extends Controller
{
public function get()
{
$federated = 'Nomad';
if (Config::get('system', 'activitypub', true)) {
$federated .= ', ActivityPub';
}
Hook::call('federated_transports', $federated);
$siteinfo = replace_macros(
Theme::get_template('siteinfo.tpl'),
[
'$title' => t('About this site'),
'$url' => z_root(),
'$sitenametxt' => t('Site Name'),
'$sitename' => System::get_site_name(),
'$headline' => t('Site Information'),
'$site_about' => bbcode(get_config('system', 'siteinfo')),
'$admin_headline' => t('Administrator'),
'$admin_about' => bbcode(get_config('system', 'admininfo')),
'$terms' => t('Terms of Service'),
'$prj_header' => t('Software and Project information'),
'$prj_name' => t('This site is powered by $Projectname'),
'$prj_transport' => t('Federated and decentralised networking and identity services provided by Nomad'),
'$transport_link' => '<a href="https://zotlabs.com">https://zotlabs.com</a>',
'$ebs' => System::ebs(),
'$additional_text' => t('Protocols:'),
'$additional_fed' => $federated,
'$prj_version' => ((get_config('system', 'hidden_version_siteinfo')) ? '' : sprintf(t('Version %s'), System::get_project_version())),
'$prj_linktxt' => t('Project homepage'),
'$prj_srctxt' => t('Developer homepage'),
'$prj_link' => System::get_project_link(),
'$prj_src' => System::get_project_srclink(),
'$prj_icon' => System::get_site_icon(),
]
);
Hook::call('about_hook', $siteinfo);
return $siteinfo;
}
}

View file

@ -2460,10 +2460,9 @@ function z_get_temp_dir() {
*/
function z_check_cert() {
if(strpos(z_root(), 'https://') !== false) {
$x = Url::get(z_root() . '/siteinfo');
$x = Url::get(z_root() . '/fastping/pong');
if(! $x['success']) {
$recurse = 0;
$y = Url::get(z_root() . '/siteinfo', ['novalidate' => true]);
$y = Url::get(z_root() . '/fastping/pong', ['novalidate' => true]);
if($y['success'])
cert_bad_email();
}

View file

@ -1,5 +1,5 @@
<script>
$(function(){
$(function() {
$("#cnftheme").colorbox({
width: 800,
onLoad: function(){
@ -56,7 +56,6 @@
<div class="section-content-tools-wrapper">
{{include file="field_input.tpl" field=$sitename}}
{{include file="field_textarea.tpl" field=$siteinfo}}
{{include file="field_textarea.tpl" field=$admininfo}}
{{include file="field_textarea.tpl" field=$legal}}
{{include file="field_input.tpl" field=$reply_address}}
{{include file="field_input.tpl" field=$from_email}}