mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Merge pull request #31 from torrentpier/develop
R599b Дополнение к предыдущей ревизии. Добавлена страница с правилами ресурса, которую администратор может настроить в администраторской панели. Текст правил вводится как обычное сообщение и поддерживает бб-коды. Также был вынесен кеш конфига в отдельную сущность, дабы при его обновлениях не скидывался кеш всего форума в целом. Мелкие правки по шаблону. Для обновления на ревизию требуется выполнить запрос к базе: INSERT INTO `bb_config` VALUES ('terms', '');
This commit is contained in:
commit
2d865de5a1
15 changed files with 224 additions and 125 deletions
|
@ -581,6 +581,7 @@ INSERT INTO `bb_config` VALUES ('show_mod_index', '0');
|
||||||
INSERT INTO `bb_config` VALUES ('premod', '0');
|
INSERT INTO `bb_config` VALUES ('premod', '0');
|
||||||
INSERT INTO `bb_config` VALUES ('new_tpls', '1');
|
INSERT INTO `bb_config` VALUES ('new_tpls', '1');
|
||||||
INSERT INTO `bb_config` VALUES ('tor_comment', '1');
|
INSERT INTO `bb_config` VALUES ('tor_comment', '1');
|
||||||
|
INSERT INTO `bb_config` VALUES ('terms', '');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ ALTER TABLE `bb_posts` ADD `poster_rg_id` mediumint(8) NOT NULL DEFAULT '0' AFTE
|
||||||
// добавлено 598 ↑
|
// добавлено 598 ↑
|
||||||
ALTER TABLE `bb_posts` ADD `attach_rg_sig` tinyint(4) NOT NULL DEFAULT '0' AFTER `poster_rg_id`;
|
ALTER TABLE `bb_posts` ADD `attach_rg_sig` tinyint(4) NOT NULL DEFAULT '0' AFTER `poster_rg_id`;
|
||||||
// добавлено 598 ↑
|
// добавлено 598 ↑
|
||||||
|
INSERT INTO `bb_config` VALUES ('terms', ''); // добавлено 599b
|
||||||
|
|
||||||
Удаленные файлы/папки:
|
Удаленные файлы/папки:
|
||||||
|
|
||||||
|
|
25
upload/admin/admin_terms.php
Normal file
25
upload/admin/admin_terms.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!empty($setmodules))
|
||||||
|
{
|
||||||
|
$module['GENERAL']['TERMS'] = basename(__FILE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
require(INC_DIR .'bbcode.php');
|
||||||
|
|
||||||
|
if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message'])
|
||||||
|
{
|
||||||
|
bb_update_config(array('terms' => $_POST['message']));
|
||||||
|
bb_die($lang['CONFIG_UPDATED']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_ACTION' => 'admin_terms.php',
|
||||||
|
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
|
||||||
|
'MESSAGE' => ($bb_cfg['terms']) ? $bb_cfg['terms'] : '',
|
||||||
|
'PREVIEW_HTML' => (isset($_REQUEST['preview'])) ? bbcode2html($_POST['message']) : '',
|
||||||
|
));
|
||||||
|
|
||||||
|
print_page('admin_terms.tpl', 'admin');
|
|
@ -72,8 +72,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
||||||
|
|
||||||
// Version info
|
// Version info
|
||||||
$bb_cfg['tp_version'] = '2.1 (RC)';
|
$bb_cfg['tp_version'] = '2.1 (RC)';
|
||||||
$bb_cfg['tp_release_date'] = '30-08-2014';
|
$bb_cfg['tp_release_date'] = '31-08-2014';
|
||||||
$bb_cfg['tp_release_state'] = 'R599';
|
$bb_cfg['tp_release_state'] = 'R599b';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
@ -122,6 +122,7 @@ $bb_cfg['cache']['redis'] = array(
|
||||||
# name => array( (string) type, (array) cfg )
|
# name => array( (string) type, (array) cfg )
|
||||||
$bb_cfg['cache']['engines'] = array(
|
$bb_cfg['cache']['engines'] = array(
|
||||||
'bb_cache' => array('filecache', array()),
|
'bb_cache' => array('filecache', array()),
|
||||||
|
'bb_config' => array('filecache', array()),
|
||||||
'tr_cache' => array('filecache', array()),
|
'tr_cache' => array('filecache', array()),
|
||||||
'session_cache' => array('filecache', array()),
|
'session_cache' => array('filecache', array()),
|
||||||
'bb_cap_sid' => array('filecache', array()),
|
'bb_cap_sid' => array('filecache', array()),
|
||||||
|
@ -600,7 +601,7 @@ $banned_user_agents = array(
|
||||||
$bb_cfg['trash_forum_id'] = 0; // (int) 7
|
$bb_cfg['trash_forum_id'] = 0; // (int) 7
|
||||||
|
|
||||||
$bb_cfg['first_logon_redirect_url'] = 'index.php';
|
$bb_cfg['first_logon_redirect_url'] = 'index.php';
|
||||||
$bb_cfg['terms_and_conditions_url'] = 'index.php';
|
$bb_cfg['terms_and_conditions_url'] = 'terms.php';
|
||||||
|
|
||||||
$bb_cfg['user_agreement_url'] = 'misc.php?do=info&show=user_agreement';
|
$bb_cfg['user_agreement_url'] = 'misc.php?do=info&show=user_agreement';
|
||||||
$bb_cfg['copyright_holders_url'] = 'misc.php?do=info&show=copyright_holders';
|
$bb_cfg['copyright_holders_url'] = 'misc.php?do=info&show=copyright_holders';
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ function get_attachments_dir ($cfg = null)
|
||||||
|
|
||||||
function bb_get_config ($table, $from_db = false, $update_cache = true)
|
function bb_get_config ($table, $from_db = false, $update_cache = true)
|
||||||
{
|
{
|
||||||
if ($from_db OR !$cfg = CACHE('bb_cache')->get("config_{$table}"))
|
if ($from_db OR !$cfg = CACHE('bb_config')->get("config_{$table}"))
|
||||||
{
|
{
|
||||||
$cfg = array();
|
$cfg = array();
|
||||||
foreach (DB()->fetch_rowset("SELECT * FROM $table") as $row)
|
foreach (DB()->fetch_rowset("SELECT * FROM $table") as $row)
|
||||||
|
@ -1297,7 +1297,7 @@ function bb_get_config ($table, $from_db = false, $update_cache = true)
|
||||||
}
|
}
|
||||||
if ($update_cache)
|
if ($update_cache)
|
||||||
{
|
{
|
||||||
CACHE('bb_cache')->set("config_{$table}", $cfg);
|
CACHE('bb_config')->set("config_{$table}", $cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $cfg;
|
return $cfg;
|
||||||
|
@ -1316,6 +1316,7 @@ function bb_update_config ($params, $table = BB_CONFIG)
|
||||||
$updates = DB()->build_array('MULTI_INSERT', $updates);
|
$updates = DB()->build_array('MULTI_INSERT', $updates);
|
||||||
|
|
||||||
DB()->query("REPLACE INTO $table $updates");
|
DB()->query("REPLACE INTO $table $updates");
|
||||||
|
|
||||||
// Update cache
|
// Update cache
|
||||||
bb_get_config($table, true, true);
|
bb_get_config($table, true, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,10 +468,8 @@ $html = new html_common();
|
||||||
$log_action = new log_action();
|
$log_action = new log_action();
|
||||||
$ads = new ads_common();
|
$ads = new ads_common();
|
||||||
|
|
||||||
// !!! Temporarily (??) 'cat_forums' always enqueued
|
// TODO temporarily 'cat_forums' always enqueued
|
||||||
$datastore->enqueue(array(
|
$datastore->enqueue(array('cat_forums'));
|
||||||
'cat_forums',
|
|
||||||
));
|
|
||||||
|
|
||||||
// Дата старта вашего проекта
|
// Дата старта вашего проекта
|
||||||
if (!$bb_cfg['board_startdate'])
|
if (!$bb_cfg['board_startdate'])
|
||||||
|
|
|
@ -2878,3 +2878,6 @@ $lang['ATOM_NO_USER'] = 'This user does not have a feed (no ongoing topics)';
|
||||||
|
|
||||||
$lang['HASH_INVALID'] = 'Hash %s is invalid';
|
$lang['HASH_INVALID'] = 'Hash %s is invalid';
|
||||||
$lang['HASH_NOT_FOUND'] = 'Release with hash %s not found';
|
$lang['HASH_NOT_FOUND'] = 'Release with hash %s not found';
|
||||||
|
|
||||||
|
$lang['TERMS_EMPTY_TEXT'] = '[align=center]The text of this page is edited at: [url=http://%s/admin/admin_terms.php]admin/admin_terms.php[/url]. This line can see only administrators.[/align]';
|
||||||
|
$lang['TERMS_EXPLAIN'] = 'On this page, you can specify the text of the basic rules of the resource is displayed to users.';
|
|
@ -2878,3 +2878,6 @@ $lang['ATOM_NO_USER'] = 'Для этого пользователя нет ле
|
||||||
|
|
||||||
$lang['HASH_INVALID'] = 'Хэш %s некорректен';
|
$lang['HASH_INVALID'] = 'Хэш %s некорректен';
|
||||||
$lang['HASH_NOT_FOUND'] = 'Раздача с хэшем %s не найдена';
|
$lang['HASH_NOT_FOUND'] = 'Раздача с хэшем %s не найдена';
|
||||||
|
|
||||||
|
$lang['TERMS_EMPTY_TEXT'] = '[align=center]Текст этой страницы редактируется по адресу: [url=http://%s/admin/admin_terms.php]admin/admin_terms.php[/url]. Эту строку видят только администраторы.[/align]';
|
||||||
|
$lang['TERMS_EXPLAIN'] = 'На данной странице вы можете указать текст основных правил ресурса, выводящихся пользователям.';
|
|
@ -2878,3 +2878,6 @@ $lang['ATOM_NO_USER'] = 'Для цього користувача немає с
|
||||||
|
|
||||||
$lang['HASH_INVALID'] = 'Хеш %s некоректний';
|
$lang['HASH_INVALID'] = 'Хеш %s некоректний';
|
||||||
$lang['HASH_NOT_FOUND'] = 'Роздача з хешем %s не знайдено';
|
$lang['HASH_NOT_FOUND'] = 'Роздача з хешем %s не знайдено';
|
||||||
|
|
||||||
|
$lang['TERMS_EMPTY_TEXT'] = '[align=center]Текст цієї сторінки редагується за адресою: [url=http://%s/admin/admin_terms.php]admin/admin_terms.php[/url]. Цю рядок бачать тільки адміністраторам.[/align]';
|
||||||
|
$lang['TERMS_EXPLAIN'] = 'На цій сторінці ви можете вказати текст основних правил ресурсу, які виводяться користувачам.';
|
|
@ -24,10 +24,9 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
|
||||||
<input class="text" type="hidden" name="mode" value="{S_MODE}" />
|
<input class="text" type="hidden" name="mode" value="{S_MODE}" />
|
||||||
|
|
||||||
<table cellpadding="2" cellspacing="0" width="100%">
|
<table cellpadding="2" cellspacing="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="80%">
|
<td width="80%">
|
||||||
<h1>{L_CRON}</h1>
|
<h1>{L_CRON}</h1>
|
||||||
|
|
||||||
<a href="admin_cron.php?mode=add">{L_CRON_EDIT_HEAD_ADD}</a>
|
<a href="admin_cron.php?mode=add">{L_CRON_EDIT_HEAD_ADD}</a>
|
||||||
</td>
|
</td>
|
||||||
<td width="20%" class="vBottom tRight nowrap med">
|
<td width="20%" class="vBottom tRight nowrap med">
|
||||||
|
@ -58,7 +57,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
|
||||||
</table>
|
</table>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table class="forumline">
|
<table class="forumline">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="catBottom">
|
<td colspan="2" class="catBottom">
|
||||||
{L_WITH_SELECTED}
|
{L_WITH_SELECTED}
|
||||||
<select name="cron_action" id="cron_select" >
|
<select name="cron_action" id="cron_select" >
|
||||||
|
@ -114,7 +113,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
|
||||||
<label><input onclick="toggle_disabled('send', this.checked)" type="checkbox" name="confirm" value="1" /></label>
|
<label><input onclick="toggle_disabled('send', this.checked)" type="checkbox" name="confirm" value="1" /></label>
|
||||||
<input type="submit" name="submit" id="send" value="{L_SUBMIT}" class="mainoption" disabled="disabled" />
|
<input type="submit" name="submit" id="send" value="{L_SUBMIT}" class="mainoption" disabled="disabled" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
25
upload/templates/admin/admin_terms.tpl
Normal file
25
upload/templates/admin/admin_terms.tpl
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
<h1>{L_TERMS}</h1>
|
||||||
|
|
||||||
|
<p>{L_TERMS_EXPLAIN}</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<form action="{S_ACTION}" method="post">
|
||||||
|
<table class="forumline">
|
||||||
|
<tr>
|
||||||
|
<th>{L_TERMS}</th>
|
||||||
|
</tr>
|
||||||
|
<tr id="view_message"<!-- IF not PREVIEW_HTML --> class="hidden"<!-- ENDIF -->>
|
||||||
|
<td class="row1">
|
||||||
|
<div class="view-message">{PREVIEW_HTML}</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row2">
|
||||||
|
<td>
|
||||||
|
<!-- INCLUDE posting_editor.tpl -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br clear="all"/>
|
21
upload/templates/default/terms.tpl
Normal file
21
upload/templates/default/terms.tpl
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<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>
|
18
upload/terms.php
Normal file
18
upload/terms.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('BB_SCRIPT', 'terms');
|
||||||
|
define('BB_ROOT', './');
|
||||||
|
require(BB_ROOT .'common.php');
|
||||||
|
require(INC_DIR .'bbcode.php');
|
||||||
|
|
||||||
|
// Start session management
|
||||||
|
$user->session_start();
|
||||||
|
|
||||||
|
if (!$bb_cfg['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']),
|
||||||
|
));
|
||||||
|
|
||||||
|
print_page('terms.tpl');
|
Loading…
Add table
Add a link
Reference in a new issue