mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Rework: terms.php; new default locale (english).
This commit is contained in:
parent
7e4d6bf300
commit
ba690c6a52
5 changed files with 47 additions and 31 deletions
|
@ -34,7 +34,7 @@ $di = new \TorrentPier\Di();
|
|||
|
||||
// TODO: Need to get locale from settings
|
||||
$di['settings.locale'] = function($di) {
|
||||
return 'ru';
|
||||
return 'en';
|
||||
};
|
||||
|
||||
$di->register(new \TorrentPier\ServiceProviders\ConfigServiceProvider, [
|
||||
|
|
|
@ -7,6 +7,9 @@ return [
|
|||
'Send' => 'Send',
|
||||
'Submit' => 'Submit',
|
||||
|
||||
// Control panel
|
||||
'Control panel' => 'Control panel',
|
||||
|
||||
// Errors
|
||||
'File not found: %location%' => 'File not found: %location%',
|
||||
'Invalid request: not specified %data%' => 'Invalid request: not specified %data%',
|
||||
|
@ -14,4 +17,9 @@ return [
|
|||
// Style guide (styleguide.php)
|
||||
'Hello, %name%' => 'Hello, %name%',
|
||||
'Style guide' => 'Style guide',
|
||||
|
||||
// Terms (terms.php)
|
||||
'Only administrators see this line' => 'Only administrators see this line',
|
||||
'Terms' => 'Terms',
|
||||
'The text on this page can be edited in the' => 'The text on this page can be edited in the',
|
||||
];
|
|
@ -1,21 +0,0 @@
|
|||
<table class="forumline">
|
||||
<tr>
|
||||
<th>{L_TERMS}</th>
|
||||
</tr>
|
||||
<!-- IF TERMS_HTML -->
|
||||
<tr>
|
||||
<td class="row1">
|
||||
<div class="post_wrap">
|
||||
{TERMS_HTML}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF IS_ADMIN -->
|
||||
<tr>
|
||||
<td class="row2">
|
||||
{TERMS_EDIT}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</table>
|
21
templates/default/terms.twig
Normal file
21
templates/default/terms.twig
Normal file
|
@ -0,0 +1,21 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>{% trans %}Terms{% endtrans %}</th>
|
||||
</tr>
|
||||
{% if termsHtml %}
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
{{ termsHtml|raw }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if isAdmin %}
|
||||
<tr>
|
||||
<td>
|
||||
{% trans %}The text on this page can be edited in the{% endtrans %} <a href="{{ transUrl }}">{{ transUrlName }}</a>. {% trans %}Only administrators see this line{% endtrans %}.
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
26
terms.php
26
terms.php
|
@ -2,17 +2,25 @@
|
|||
|
||||
define('BB_SCRIPT', 'terms');
|
||||
define('BB_ROOT', './');
|
||||
require(BB_ROOT .'common.php');
|
||||
require(INC_DIR .'bbcode.php');
|
||||
require_once __DIR__ . '/common.php';
|
||||
require_once(INC_DIR . 'bbcode.php');
|
||||
|
||||
$di = \TorrentPier\Di::getInstance();
|
||||
|
||||
// Start session management
|
||||
$user->session_start();
|
||||
|
||||
if (!$bb_cfg['terms'] && !IS_ADMIN) redirect('index.php');
|
||||
if (!$di->config->get('terms') && !IS_ADMIN) redirect('index.php');
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TERMS_EDIT' => bbcode2html(sprintf($lang['TERMS_EMPTY_TEXT'], $domain_name)),
|
||||
'TERMS_HTML' => bbcode2html($bb_cfg['terms']),
|
||||
));
|
||||
$content = $di->view->make('terms', [
|
||||
'isAdmin' => IS_ADMIN,
|
||||
'termsHtml' => bbcode2html($di->config->get('terms')),
|
||||
'transUrl' => make_url('admin/admin_terms.php'),
|
||||
'transUrlName' => $di->translator->trans('Control panel'),
|
||||
]);
|
||||
|
||||
print_page('terms.tpl');
|
||||
/** @var \Symfony\Component\HttpFoundation\Response $response */
|
||||
$response = \Symfony\Component\HttpFoundation\Response::create();
|
||||
$response->setContent($content);
|
||||
|
||||
$response->prepare($di->request);
|
||||
$response->send();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue