mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
Add legal site link and allow site admins to change the text from the admin interface. Still needs some page theming. Issue #7
This commit is contained in:
parent
391f0bc4a7
commit
1be301f06f
6 changed files with 38 additions and 7 deletions
|
@ -378,6 +378,7 @@ class Apps
|
||||||
'Help' => t('Help'),
|
'Help' => t('Help'),
|
||||||
'Invite' => t('Invite'),
|
'Invite' => t('Invite'),
|
||||||
'Language' => t('Language'),
|
'Language' => t('Language'),
|
||||||
|
'Legal' => t('Legal'),
|
||||||
'Login' => t('Login'),
|
'Login' => t('Login'),
|
||||||
'Mail' => t('Mail'),
|
'Mail' => t('Mail'),
|
||||||
'Markup' => t('Markup'),
|
'Markup' => t('Markup'),
|
||||||
|
|
|
@ -199,10 +199,6 @@ class Navbar {
|
||||||
|
|
||||||
Hook::call('nav', $x);
|
Hook::call('nav', $x);
|
||||||
|
|
||||||
// Not sure the best place to put this on the page. So I'm implementing it but leaving it
|
|
||||||
// turned off until somebody discovers this and figures out a good location for it.
|
|
||||||
$powered_by = '';
|
|
||||||
|
|
||||||
if (App::$profile_uid && App::$nav_sel['raw_name']) {
|
if (App::$profile_uid && App::$nav_sel['raw_name']) {
|
||||||
$active_app = q(
|
$active_app = q(
|
||||||
"SELECT app_url FROM app WHERE app_channel = %d AND app_name = '%s' LIMIT 1",
|
"SELECT app_url FROM app WHERE app_channel = %d AND app_name = '%s' LIMIT 1",
|
||||||
|
@ -299,7 +295,6 @@ class Navbar {
|
||||||
'$baseurl' => z_root(),
|
'$baseurl' => z_root(),
|
||||||
'$site_home' => Channel::url($site_channel),
|
'$site_home' => Channel::url($site_channel),
|
||||||
'$project_icon' => $site_icon,
|
'$project_icon' => $site_icon,
|
||||||
'$project_title' => t('Powered by $Projectname'),
|
|
||||||
'$fulldocs' => t('Help'),
|
'$fulldocs' => t('Help'),
|
||||||
'$sitelocation' => $sitelocation,
|
'$sitelocation' => $sitelocation,
|
||||||
'$nav' => $x['nav'],
|
'$nav' => $x['nav'],
|
||||||
|
@ -309,7 +304,6 @@ class Navbar {
|
||||||
'$localuser' => local_channel(),
|
'$localuser' => local_channel(),
|
||||||
'$is_owner' => $is_owner,
|
'$is_owner' => $is_owner,
|
||||||
'$sel' => App::$nav_sel,
|
'$sel' => App::$nav_sel,
|
||||||
'$powered_by' => $powered_by,
|
|
||||||
'$asidetitle' => t('Side Panel'),
|
'$asidetitle' => t('Side Panel'),
|
||||||
'$help' => t('@name, #tag, ?doc, content'),
|
'$help' => t('@name, #tag, ?doc, content'),
|
||||||
'$pleasewait' => t('Please wait...'),
|
'$pleasewait' => t('Please wait...'),
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Code\Module\Admin;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Code\Lib\System;
|
use Code\Lib\System;
|
||||||
|
use Code\Lib\PConfig;
|
||||||
use Code\Access\PermissionRoles;
|
use Code\Access\PermissionRoles;
|
||||||
use Code\Lib\Channel;
|
use Code\Lib\Channel;
|
||||||
use Code\Render\Theme;
|
use Code\Render\Theme;
|
||||||
|
@ -35,6 +36,7 @@ class Site
|
||||||
|
|
||||||
$admininfo = ((x($_POST, 'admininfo')) ? trim($_POST['admininfo']) : false);
|
$admininfo = ((x($_POST, 'admininfo')) ? trim($_POST['admininfo']) : false);
|
||||||
$siteinfo = ((x($_POST, 'siteinfo')) ? trim($_POST['siteinfo']) : '');
|
$siteinfo = ((x($_POST, 'siteinfo')) ? trim($_POST['siteinfo']) : '');
|
||||||
|
$legal = ((x($_POST, 'legal')) ? trim($_POST['legal']) : '');
|
||||||
$language = ((x($_POST, 'language')) ? notags(trim($_POST['language'])) : 'en');
|
$language = ((x($_POST, 'language')) ? notags(trim($_POST['language'])) : 'en');
|
||||||
$theme = ((x($_POST, 'theme')) ? notags(trim($_POST['theme'])) : '');
|
$theme = ((x($_POST, 'theme')) ? notags(trim($_POST['theme'])) : '');
|
||||||
// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
|
// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
|
||||||
|
@ -124,6 +126,7 @@ class Site
|
||||||
set_config('system', 'max_imported_follow', $max_imported_follow);
|
set_config('system', 'max_imported_follow', $max_imported_follow);
|
||||||
set_config('system', 'animated_avatars', $animations);
|
set_config('system', 'animated_avatars', $animations);
|
||||||
set_config('system', 'tos_required', $tos_required);
|
set_config('system', 'tos_required', $tos_required);
|
||||||
|
PConfig::Set(App::$sys_channel['channel_id'], 'system', 'legal', $legal);
|
||||||
|
|
||||||
if ($admininfo == '') {
|
if ($admininfo == '') {
|
||||||
del_config('system', 'admininfo');
|
del_config('system', 'admininfo');
|
||||||
|
@ -268,6 +271,10 @@ class Site
|
||||||
|
|
||||||
$role = ['permissions_role', t('Default permission role for new accounts'), $default_role, t('This role will be used for the first channel created after registration.'), $perm_roles];
|
$role = ['permissions_role', t('Default permission role for new accounts'), $default_role, t('This role will be used for the first channel created after registration.'), $perm_roles];
|
||||||
|
|
||||||
|
$legal = PConfig::Get(App::$sys_channel['channel_id'], 'system', 'legal');
|
||||||
|
if (!$legal) {
|
||||||
|
$legal = file_get_contents('doc/en/TermsOfService.mc');
|
||||||
|
}
|
||||||
|
|
||||||
$homelogin = get_config('system', 'login_on_homepage');
|
$homelogin = get_config('system', 'login_on_homepage');
|
||||||
$enable_context_help = get_config('system', 'enable_context_help');
|
$enable_context_help = get_config('system', 'enable_context_help');
|
||||||
|
@ -285,6 +292,7 @@ class Site
|
||||||
'$sitename' => ['sitename', t("Site name"), htmlspecialchars(get_config('system', 'sitename', App::get_hostname()), ENT_QUOTES, 'UTF-8'), ''],
|
'$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.")],
|
'$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.")],
|
'$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), ''],
|
||||||
'$language' => ['language', t("System language"), get_config('system', 'language', 'en'), "", $lang_choices],
|
'$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' => ['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 ],
|
// '$theme_mobile' => [ 'theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile ],
|
||||||
|
|
22
Code/Module/Legal.php
Normal file
22
Code/Module/Legal.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
namespace Code\Module;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use Code\Lib\PConfig;
|
||||||
|
use Code\Web\Controller;
|
||||||
|
|
||||||
|
class Legal extends Controller
|
||||||
|
{
|
||||||
|
const LEGAL_SOURCE = 'doc/en/TermsOfService.mc';
|
||||||
|
|
||||||
|
public function get() {
|
||||||
|
$sys_channel = App::$sys_channel;
|
||||||
|
$site_document = PConfig::Get($sys_channel['channel_id'],'system', 'legal');
|
||||||
|
if (!$site_document) {
|
||||||
|
$site_document = file_get_contents($this::LEGAL_SOURCE);
|
||||||
|
}
|
||||||
|
$html = bbcode($site_document);
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
5
app/legal.apd
Normal file
5
app/legal.apd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
version: 1
|
||||||
|
url: $baseurl/legal
|
||||||
|
name: Legal
|
||||||
|
photo: icon:gavel
|
||||||
|
categories: System
|
|
@ -57,6 +57,7 @@
|
||||||
{{include file="field_input.tpl" field=$sitename}}
|
{{include file="field_input.tpl" field=$sitename}}
|
||||||
{{include file="field_textarea.tpl" field=$siteinfo}}
|
{{include file="field_textarea.tpl" field=$siteinfo}}
|
||||||
{{include file="field_textarea.tpl" field=$admininfo}}
|
{{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=$reply_address}}
|
||||||
{{include file="field_input.tpl" field=$from_email}}
|
{{include file="field_input.tpl" field=$from_email}}
|
||||||
{{include file="field_input.tpl" field=$from_email_name}}
|
{{include file="field_input.tpl" field=$from_email_name}}
|
||||||
|
|
Loading…
Reference in a new issue