INSERT INTO `bb_config` VALUES ('premod', '0'); Возможность отключения премодерации Фикс больших картинок в спойлере (выносило за пределы спойлера) Объеденение гостевый ajax функций. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@377 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
pherum83 2012-02-24 20:42:44 +00:00
parent 5174beaf5c
commit 1760c80ec1
20 changed files with 188 additions and 158 deletions

View file

@ -660,6 +660,7 @@ INSERT INTO `bb_config` VALUES ('network_news_count', '5');
INSERT INTO `bb_config` VALUES ('network_news_forum_id', '2');
INSERT INTO `bb_config` VALUES ('whois_info', 'http://ip-whois.net/ip_geo.php?ip=');
INSERT INTO `bb_config` VALUES ('show_mod_index', '1');
INSERT INTO `bb_config` VALUES ('premod', '0');
-- --------------------------------------------------------

View file

@ -98,6 +98,7 @@ switch($mode)
'BIRTHDAY_MAX_AGE' => $new['birthday_max_age'],
'BIRTHDAY_MIN_AGE' => $new['birthday_min_age'],
'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'],
'PREMOD' => $new['premod'],
));
break;

View file

@ -80,14 +80,12 @@ class ajax_common
'gen_passkey' => array('user'),
'change_torrent' => array('user'),
'change_tz' => array('user'),
'view_post' => array('guest'),
'view_torrent' => array('guest'),
'user_register' => array('guest'),
'posts' => array('guest'),
'birthday_list' => array('guest'),
'get_forum_mods' => array('guest'),
'index_data' => array('guest'),
);
@ -378,93 +376,10 @@ class ajax_common
else $this->ajax_die($lang['NOT_AUTHORISED']);
}
function birthday_list()
{
global $bb_cfg, $lang, $datastore;
if (!$stats = $datastore->get('stats'))
{
$datastore->update('stats');
$stats = $datastore->get('stats');
}
$mode = (string) $this->request['mode'];
switch($mode)
{
case 'week':
if ($stats['birthday_week_list'])
{
foreach($stats['birthday_week_list'] as $week)
{
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $html));
}
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
break;
case 'today':
if ($stats['birthday_today_list'])
{
foreach($stats['birthday_today_list'] as $today)
{
$html[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
}
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
}
else $html = $lang['NOBIRTHDAY_TODAY'];
break;
default:
$html = '';
break;
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;
}
function get_forum_mods()
{
global $lang, $datastore;
$forum_id = (int) $this->request['forum_id'];
$datastore->enqueue(array(
'moderators',
));
$moderators = array();
$mod = $datastore->get('moderators');
if (isset($mod['mod_users'][$forum_id]))
{
foreach ($mod['mod_users'][$forum_id] as $user_id)
{
$moderators[] = '<a href="'. PROFILE_URL . $user_id .'">'. $mod['name_users'][$user_id] .'</a>';
}
}
if (isset($mod['mod_groups'][$forum_id]))
{
foreach ($mod['mod_groups'][$forum_id] as $group_id)
{
$moderators[] = '<a href="'. "groupcp.php?". POST_GROUPS_URL ."=". $group_id .'">'. $mod['name_groups'][$group_id] .'</a>';
}
}
$html = ':&nbsp;';
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
$this->response['html'] = '<strong>'.$html.'</strong>';
unset($moderators, $mod);
$datastore->rm('moderators');
}
// User groups membership
function group_membership ()
{
global $user;
global $lang, $user;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
@ -521,7 +436,7 @@ class ajax_common
}
else
{
$this->response['group_list_html'] = 'не член, либо у вас нет прав на просмотр скрытых групп';
$this->response['group_list_html'] = $lang['GROUP_HIDDEN'];
}
break;
@ -575,18 +490,8 @@ class ajax_common
require(AJAX_DIR .'topic_tpl.php');
}
function change_tz()
function index_data()
{
global $bb_cfg, $userdata;
$tz = (int) $this->request['tz'];
if ($tz < -12) $tz = -12;
if ($tz > 13) $tz = 13;
if ($tz != $bb_cfg['board_timezone'])
{
// Set current user timezone
DB()->query("UPDATE ". BB_USERS ." SET user_timezone = $tz WHERE user_id = ". $userdata['user_id'] ." LIMIT 1");
$bb_cfg['board_timezone'] = $tz;
cache_rm_user_sessions ($userdata['user_id']);
}
require(AJAX_DIR .'index_data.php');
}
}

View file

@ -0,0 +1,98 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata, $datastore;
$mode = (string) $this->request['mode'];
$html = '';
switch($mode)
{
case 'birthday_week':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_week_list'])
{
foreach($stats['birthday_week_list'] as $week)
{
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html));
}
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
break;
case 'birthday_today':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_today_list'])
{
foreach($stats['birthday_today_list'] as $today)
{
$html[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
}
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
}
else $html = $lang['NOBIRTHDAY_TODAY'];
break;
case 'get_forum_mods':
$forum_id = (int) $this->request['forum_id'];
$datastore->enqueue(array(
'moderators',
));
$moderators = array();
$mod = $datastore->get('moderators');
if (isset($mod['mod_users'][$forum_id]))
{
foreach ($mod['mod_users'][$forum_id] as $user_id)
{
$moderators[] = '<a href="'. PROFILE_URL . $user_id .'">'. $mod['name_users'][$user_id] .'</a>';
}
}
if (isset($mod['mod_groups'][$forum_id]))
{
foreach ($mod['mod_groups'][$forum_id] as $group_id)
{
$moderators[] = '<a href="'. "groupcp.php?". POST_GROUPS_URL ."=". $group_id .'">'. $mod['name_groups'][$group_id] .'</a>';
}
}
$html = ':&nbsp;';
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
unset($moderators, $mod);
$datastore->rm('moderators');
break;
case 'change_tz':
$tz = (int) $this->request['tz'];
if ($tz < -12) $tz = -12;
if ($tz > 13) $tz = 13;
if ($tz != $bb_cfg['board_timezone'])
{
// Set current user timezone
DB()->query("UPDATE ". BB_USERS ." SET user_timezone = $tz WHERE user_id = ". $userdata['user_id'] ." LIMIT 1");
$bb_cfg['board_timezone'] = $tz;
cache_rm_user_sessions ($userdata['user_id']);
}
break;
default:
$html = '';
break;
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;

View file

@ -25,7 +25,7 @@ switch($mode)
case 'delete_topics':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Удалить все сообщения и все начатые юзером топики целиком?');
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_ALL_POSTS_CONFIRM']);
if (IS_ADMIN)
{
@ -40,7 +40,7 @@ switch($mode)
case 'delete_message':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Удалить все сообщения, кроме заглавных?');
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
if (IS_ADMIN)
{

View file

@ -113,11 +113,6 @@ switch ($mode)
}
$this->response['ip_list_html'] = '
<style type="text/css">
table.mod_ip { background: #F9F9F9; border: 1px solid #A5AFB4; border-collapse: separate;}
table.mod_ip td { padding: 2px 5px; white-space: normal; font-size: 11px; }
table.mod_ip div { max-height: 150px; overflow: auto;}
</style>
<br /><table class="mod_ip bCenter borderless" cellspacing="1">
<tr class="row5" >
<td>'. $lang['REG_IP'] .'</td>

View file

@ -52,8 +52,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array();
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.4 (beta)';
$bb_cfg['tp_release_state'] = 'R376';
$bb_cfg['tp_release_date'] = '22-02-2012';
$bb_cfg['tp_release_state'] = 'R377';
$bb_cfg['tp_release_date'] = '25-02-2012';
// Database
$charset = 'utf8';

View file

@ -567,7 +567,7 @@ function send_torrent_with_passkey ($filename)
}
else
{
$announce = strval($ann_url . "?$passkey_key=$passkey_val&");
$announce = strval($ann_url . "?$passkey_key=$passkey_val");
}
// Replace original announce url with tracker default

View file

@ -529,6 +529,11 @@ function htmlCHR ($txt, $double_encode = false, $quote_style = ENT_QUOTES, $char
return (string) htmlspecialchars($txt, $quote_style, $charset, $double_encode);
}
function html_ent_decode ($txt, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
{
return (string) html_entity_decode($txt, $quote_style, $charset);
}
function make_url ($path)
{
return FULL_URL . preg_replace('#^\/?(.*?)\/?$#', '\1', $path);

View file

@ -382,7 +382,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
$week_list[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
}
$week_all = ($week_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'birthday_list\', mode: \'week\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
$week_all = ($week_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $week_list)) . $week_all;
}
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
@ -400,7 +400,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
$today_list[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
}
$today_all = ($today_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'birthday_list\', mode: \'today\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
$today_all = ($today_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_today\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
$today_list = $lang['BIRTHDAY_TODAY'] . join(', ', $today_list) . $today_all;
}
else $today_list = $lang['NOBIRTHDAY_TODAY'];

View file

@ -669,3 +669,5 @@ $lang['PIC_GALLERY'] = 'Directory for the images';
$lang['PIC_SIZE'] = 'The maximum size of images';
$lang['AUTO_DELETE_POSTED_PICS'] = 'Delete Images hosted in remote positions';
$lang['SHOW_MOD_HOME_PAGE'] = 'Show on moderators the index.php';
$lang['PREMOD_HELP'] = '<h4><span class="tor-icon tor-dup">&#8719;</span> Pre-moderation</h4> <h6>If you do not have hands to the status of v, #, or T in this section, including subsections, the distribution will automatically receive this status</h6>';

View file

@ -1612,9 +1612,10 @@ $lang['USER_DELETE_CSV'] = 'Sorry, this account is not allowed to delete!';
$lang['USER_DELETE_CONFIRM'] = 'Are you sure you want to delete this user?';
$lang['USER_DELETED'] = 'User was successfully deleted';
$lang['DELETE_USER_ALL_POSTS'] = 'Delete all user posts';
$lang['DELETE_USER_ALL_POSTS_CONFIRM'] = 'Are you sure you want to delete all messages and all topics started by the whole thing?';
$lang['DELETE_USER_POSTS'] = 'Delete all messages, except for capital';
$lang['DELETE_USER_POSTS_ME'] = 'Are you sure you want to delete all my posts?';
$lang['DELETE_USER_POSTS_CONFIRM'] = 'Are you sure you want to delete all of your users?';
$lang['DELETE_USER_POSTS_CONFIRM'] = 'Are you sure you want to delete all messages, except for capital?';
$lang['USER_DELETED_POSTS'] = 'Posts were successfully removed';
$lang['USER'] = 'User';
@ -1623,6 +1624,7 @@ $lang['MEMBERSHIP_IN'] = 'Membership in';
$lang['PARTY'] = 'Party:';
$lang['CANDIDATE'] = 'Candidate:';
$lang['INDIVIDUAL'] = 'Has the individual rights';
$lang['GROUP_HIDDEN'] = 'You are not authorized to view hidden groups';
$lang['USER_ACTIVATE'] = 'Activate';
$lang['USER_DEACTIVATE'] = 'Deactivate';

View file

@ -667,3 +667,4 @@ $lang['PIC_GALLERY'] = 'Директория для изображений';
$lang['PIC_SIZE'] = 'Максимальный размер изображений';
$lang['AUTO_DELETE_POSTED_PICS'] = 'Удалять изображения размещенные в удаленных постах';
$lang['SHOW_MOD_HOME_PAGE'] = 'Показывать модераторов на главной';
$lang['PREMOD_HELP'] = '<h4><span class="tor-icon tor-dup">&#8719;</span> Премодерация</h4> <h6>Если у пользователя нет раздач со статусом <span class="tor-icon tor-approved">&radic;</span>, <span class="tor-icon tor-approved">#</span> или <span class="tor-icon tor-dup">T</span> в текущем разделе, включая подразделы, то раздача автоматически получает данный статус</h6>';

View file

@ -1617,9 +1617,10 @@ $lang['USER_DELETE_CSV'] = 'Извините, этот аккаунт запре
$lang['USER_DELETE_CONFIRM'] = 'Вы действительно хотите удалить этого пользователя?';
$lang['USER_DELETED'] = 'Пользователь был успешно удалён';
$lang['DELETE_USER_ALL_POSTS'] = 'Удалить все сообщения пользователя';
$lang['DELETE_USER_ALL_POSTS_CONFIRM'] = 'Вы действительно хотите удалить все сообщения и все начатые пользователем топики целиком?';
$lang['DELETE_USER_POSTS'] = 'Удалить все сообщения, кроме заглавных';
$lang['DELETE_USER_POSTS_ME'] = 'Вы действительно хотите удалить все свои сообщения?';
$lang['DELETE_USER_POSTS_CONFIRM'] = 'Вы действительно хотите удалить все свои пользователя?';
$lang['DELETE_USER_POSTS_CONFIRM'] = 'Вы действительно хотите удалить все сообщения пользователя, кроме заглавных?';
$lang['USER_DELETED_POSTS'] = 'Сообщения успешно удалены';
$lang['USER'] = 'Пользователь';
@ -1628,6 +1629,7 @@ $lang['MEMBERSHIP_IN'] = 'Членство в группах';
$lang['PARTY'] = 'Участник:';
$lang['CANDIDATE'] = 'Кандидат:';
$lang['INDIVIDUAL'] = 'Имеет индивидуальные права';
$lang['GROUP_HIDDEN'] = 'У Вас нет прав на просмотр скрытых групп';
$lang['USER_ACTIVATE'] = 'Активировать';

View file

@ -540,6 +540,8 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
{
include(INC_DIR .'functions_torrent.php');
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
{
if($bb_cfg['premod'])
{
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
@ -566,9 +568,12 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM) tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
}
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
}
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)

View file

@ -322,6 +322,13 @@
<label><input type="radio" name="show_mod_index" value="0" <!-- IF not SHOW_MOD_INDEX -->checked="checked"<!-- ENDIF --> />{L_DISABLED}</label>
</td>
</tr>
<tr>
<td>{L_PREMOD_HELP}</td>
<td>
<label><input type="radio" name="premod" value="1" <!-- IF PREMOD -->checked="checked"<!-- ENDIF --> />{L_ENABLED}</label>&nbsp;&nbsp;
<label><input type="radio" name="premod" value="0" <!-- IF not PREMOD -->checked="checked"<!-- ENDIF --> />{L_DISABLED}</label>
</td>
</tr>
<tr class="row3 med">
<td class="bold tCenter" colspan="2">{L_LATEST_NEWS}</td>

View file

@ -254,8 +254,8 @@ a.small, a.gensmall { color: #006699; text-decoration: none; }
/* ---------------------------------- *
Spoiler
* ---------------------------------- */
.sp-wrap { padding: 0; background: #E9E9E6; }
.sp-head { border-width: 0; font-size: 11px; padding: 1px 14px 3px; margin-left: 6px; line-height: 15px; font-weight: bold; color: #2A2A2A; cursor: pointer; }
.sp-wrap { padding: 0; background: #E9E9E6; width:auto;}
.sp-head { border-width: 0; font-size: 11px; padding: 1px 14px 3px; margin-left: 6px; line-height: 15px; font-weight: bold; color: #2A2A2A; cursor: pointer; width:auto;}
.sp-body { border-width: 1px 0 0 0; display: none; font-weight: normal; background: #F5F5F5; border-bottom: 1px solid #C3CBD1;}
.sp-fold { width: 98%; margin: 0 auto; text-align: right; font-size: 10px; color: #444444; }
/* ---------------------------------- *
@ -593,7 +593,11 @@ table.smilies td { padding: 3px; text-align: center; }
a.selfMod, a.selfMod:visited { color: #0000FF; }
.view-message { border: 1px #A5AFB4 solid; padding: 4px; margin: 6px; overflow: auto; }
.birthday { margin: 3px 0; padding: 2px 4px; max-height: 200px; overflow: auto;}
table.mod_ip { background: #F9F9F9; border: 1px solid #A5AFB4; border-collapse: separate;}
table.mod_ip td { padding: 2px 5px; white-space: normal; font-size: 11px; }
table.mod_ip div { max-height: 150px; overflow: auto;}
/* ---------------------------------- *
Forums on home page
* ---------------------------------- */

View file

@ -180,13 +180,13 @@
<!-- IF $bb_cfg['birthday_enabled'] -->
<script type="text/javascript">
ajax.callback.birthday_list = function(data) {
$('#birthday_'+ data.mode).html(data.html);
ajax.callback.index_data = function(data) {
$('#'+ data.mode).html(data.html);
};
</script>
<div class="hr1" style="margin: 5px 0 4px;"></div>
<p id="birthday_today">{WHOSBIRTHDAY_TODAY}</p>
<p id="birthday_week">{WHOSBIRTHDAY_WEEK}</p>
<p id="birthday_today" class="birthday">{WHOSBIRTHDAY_TODAY}</p>
<p id="birthday_week" class="birthday">{WHOSBIRTHDAY_WEEK}</p>
<!-- ENDIF -->
<div class="hr1" style="margin: 5px 0 4px;"></div>

View file

@ -353,20 +353,21 @@ function go_to_page ()
<!-- IF LOGGED_IN -->
<script type="text/javascript">
ajax.change_tz = function(tz) {
ajax.index_data = function(tz) {
ajax.exec({
action : 'change_tz',
action : 'index_data',
mode : 'change_tz',
tz : tz,
});
};
ajax.callback.change_tz = function(data) {
ajax.callback.index_data = function(data) {
};
$(document).ready(function() {
x = new Date();
tz = -x.getTimezoneOffset()/60;
if (tz != <?php echo $bb_cfg['board_timezone']?>)
{
ajax.change_tz(tz);
ajax.index_data(tz);
}
});
</script>

View file

@ -274,17 +274,18 @@ td.topic_id { cursor: pointer; }
$(document).ready(function(){
$("#moderators a").one('click', function(){
$('#moderators').html($('#moderators').text());
ajax.get_forum_mods();
ajax.index_data();
return false;
});
});
ajax.get_forum_mods = function() {
ajax.index_data = function() {
ajax.exec({
action : 'get_forum_mods',
action : 'index_data',
mode : 'get_forum_mods',
forum_id : {FORUM_ID}
});
};
ajax.callback.get_forum_mods = function(data) {
ajax.callback.index_data = function(data) {
$('#moderators').append(data.html);
};
</script>