Добавление файла с никами пользователей, оказавшими помощь проекту. Исправления ошибок по запросам тестеров. Перенос js-кода в bbcode.js; исправление ошибки с проверкой на установленность модуля tidy на сервере; изменения на сервисе для проверки ip пользователей. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@586 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08@gmail.com 2014-06-13 19:08:41 +00:00
commit a54e7bcc65
8 changed files with 536 additions and 479 deletions

41
contributors.txt Normal file
View file

@ -0,0 +1,41 @@
Уважаемые пользователи TorrentPier II!
За помощь, оказанную в развитии нашего движка, выражаем особую благодарность нижеперечисленным участникам форума:
********************************
** Сборы марта 2013 года **
********************************
emilio13
UralSOFT
aik
Sarymian
eve
Алексей Письменский
qaqra
rserg99
leszav
Dr_Brown
Bullit
Triceratop (http://goldenshara.com/)
Ramzess
********************************
** Сборы июня 2014 года **
********************************
SamSeGo
alesel (http://sporttracker.kz/)
Bullit
igorsaevets
vasilich619
wint1000 (http://asmlocator.ru/)
********************************
** Прочая информация **
********************************
Большое вам всем спасибо за помощь.
Если в данных списках кто-то не указан, либо если вы хотите указать дополнительно адрес своего трекера, отправьте письмо по адресу admin@torrentpier.me,
с указанием вашего ника на форуме и адреса вашего трекера, дабы мы могли вас добавить в этот список.

View file

@ -590,7 +590,7 @@ INSERT INTO `bb_config` VALUES ('show_network_news', '1');
INSERT INTO `bb_config` VALUES ('max_net_title', '50'); INSERT INTO `bb_config` VALUES ('max_net_title', '50');
INSERT INTO `bb_config` VALUES ('network_news_count', '5'); INSERT INTO `bb_config` VALUES ('network_news_count', '5');
INSERT INTO `bb_config` VALUES ('network_news_forum_id', '2'); 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 ('whois_info', 'http://ip-whois.net/ip_geos.php?ip=');
INSERT INTO `bb_config` VALUES ('show_mod_index', '0'); 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');

View file

@ -29,10 +29,7 @@ function attach_build_auth_levels($is_auth, &$s_auth_can)
} }
// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line // If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
// $rules_link = '(<a href="' . BB_ROOT . 'attach_rules.php?f=' . $forum_id . '" target="_blank">Rules</a>)';
// $s_auth_can .= ( ( $is_auth['auth_attachments'] ) ? $rules_link . ' ' . $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'] ) . '<br />';
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'] ) . '<br />'; $s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'] ) . '<br />';
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'] ) . '<br />'; $s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'] ) . '<br />';
} }
@ -206,8 +203,8 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
DB()->sql_freeresult($result); DB()->sql_freeresult($result);
$template->assign_vars(array( $template->assign_vars(array(
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota), 'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota), 'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
)); ));
} }

View file

@ -55,8 +55,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.6 (RC)'; $bb_cfg['tp_version'] = '2.6 (RC)';
$bb_cfg['tp_release_date'] = '15-05-2014'; $bb_cfg['tp_release_date'] = '13-06-2014';
$bb_cfg['tp_release_state'] = 'R585'; $bb_cfg['tp_release_state'] = 'R586';
// Database // Database
$charset = 'utf8'; $charset = 'utf8';
@ -419,8 +419,6 @@ ini_set('error_log', LOG_DIR .'php_err.log');
if (get_magic_quotes_gpc()) die('Set magic_quotes off'); if (get_magic_quotes_gpc()) die('Set magic_quotes off');
// JSON // JSON
if (!function_exists('json_encode')) die('Json_encode not installed'); if (!function_exists('json_encode')) die('Json_encode not installed');
// Tidy
if (!function_exists('tidy_repair_string')) die('Set $bb_cfg[\'tidy_post\'] = false in config.php');
// Triggers // Triggers
define('BB_ENABLED', TRIGGERS_DIR .'$on'); define('BB_ENABLED', TRIGGERS_DIR .'$on');
@ -500,6 +498,9 @@ $bb_cfg['user_not_active_days_keep'] = 180; // inactive users but only wi
// GroupCP // GroupCP
$bb_cfg['groupcp_members_per_page'] = 300; $bb_cfg['groupcp_members_per_page'] = 300;
// Tidy
if ($bb_cfg['tidy_post'] && !function_exists('tidy_repair_string') or !extension_loaded('tidy')) die('Set $bb_cfg[\'tidy_post\'] = false in config.php');
// Ads // Ads
$bb_cfg['show_ads'] = false; $bb_cfg['show_ads'] = false;
$bb_cfg['show_ads_users'] = array( $bb_cfg['show_ads_users'] = array(

View file

@ -8,8 +8,6 @@ if (defined('PAGE_HEADER_SENT')) return;
global $page_cfg, $userdata, $user, $ads, $bb_cfg, $template, $lang, $images; global $page_cfg, $userdata, $user, $ads, $bb_cfg, $template, $lang, $images;
$logged_in = (int) !empty($userdata['session_logged_in']); $logged_in = (int) !empty($userdata['session_logged_in']);
$is_admin = ($logged_in && IS_ADMIN);
$is_mod = ($logged_in && IS_MOD);
// Generate logged in/logged out status // Generate logged in/logged out status
if ($logged_in) if ($logged_in)
@ -169,7 +167,7 @@ $template->assign_vars(array(
'SIMPLE_HEADER' => !empty($gen_simple_header), 'SIMPLE_HEADER' => !empty($gen_simple_header),
'IN_ADMIN' => defined('IN_ADMIN'), 'IN_ADMIN' => defined('IN_ADMIN'),
'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!($is_admin || $is_mod) && $user->show_ads)), 'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads)),
'USER_HIDE_CAT' => (BB_SCRIPT == 'index'), 'USER_HIDE_CAT' => (BB_SCRIPT == 'index'),
'USER_RUS' => ($userdata['user_lang'] != 'english') ? true : false, 'USER_RUS' => ($userdata['user_lang'] != 'english') ? true : false,

View file

@ -1367,7 +1367,7 @@ $lang['DESIGNER'] = 'Designer';
$lang['LAST_IP'] = 'Last IP:'; $lang['LAST_IP'] = 'Last IP:';
$lang['REG_IP'] = 'Registration IP:'; $lang['REG_IP'] = 'Registration IP:';
$lang['OTHER_IP'] = 'Other IP:'; $lang['OTHER_IP'] = 'Other IP:';
$lang['ALREADY_REG_IP'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to <a href="mailto:%s">Administrator</ a>'; $lang['ALREADY_REG_IP'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to <a href="mailto:%s">Administrator</a>';
$lang['HIDDEN'] = 'Hidden'; $lang['HIDDEN'] = 'Hidden';
// //
// That's all, Folks! // That's all, Folks!

View file

@ -1,45 +1,45 @@
// BBCode control. (based on bbcode.js from http://forum.dklab.ru) // BBCode control
function BBCode(obj) function BBCode(obj)
{ {
textarea = document.getElementById(obj); textarea = document.getElementById(obj);
this.construct(textarea); this.construct(textarea);
} }
BBCode.prototype = { BBCode.prototype = {
VK_TAB: 9, VK_TAB: 9,
VK_ENTER: 13, VK_ENTER: 13,
VK_PAGE_UP: 33, VK_PAGE_UP: 33,
BRK_OP: '[', BRK_OP: '[',
BRK_CL: ']', BRK_CL: ']',
textarea: null, textarea: null,
stext: '', stext: '',
quoter: null, quoter: null,
qouted_pid: null, qouted_pid: null,
collapseAfterInsert: false, collapseAfterInsert: false,
replaceOnInsert: false, replaceOnInsert: false,
// Create new BBCode control. // Create new BBCode control
construct: function(textarea) { construct: function(textarea) {
this.textarea = textarea this.textarea = textarea
this.tags = new Object(); this.tags = new Object();
// Tag for quoting. // Tag for quoting
this.addTag( this.addTag(
'_quoter', '_quoter',
function() { return '[quote="'+th.quoter+'"][qpost='+th.qouted_pid+']' }, function() { return '[quote="'+th.quoter+'"][qpost='+th.qouted_pid+']' },
'[/quote]\n', '[/quote]\n',
null, null,
null, null,
function() { th.collapseAfterInsert=true; return th._prepareMultiline(th.quoterText) } function() { th.collapseAfterInsert=true; return th._prepareMultiline(th.quoterText) }
); );
// Init events. // Init events
var th = this; var th = this;
addEvent(textarea, 'keydown', function(e) { return th.onKeyPress(e, window.HTMLElement? 'down' : 'press') }); addEvent(textarea, 'keydown', function(e) { return th.onKeyPress(e, window.HTMLElement? 'down' : 'press') });
addEvent(textarea, 'keypress', function(e) { return th.onKeyPress(e, 'press') }); addEvent(textarea, 'keypress', function(e) { return th.onKeyPress(e, 'press') });
}, },
// Insert poster name or poster quotes to the text. // Insert poster name or poster quotes to the text
onclickPoster: function(name, post_id) { onclickPoster: function(name, post_id) {
var sel = this.getSelection()[0]; var sel = this.getSelection()[0];
if (sel) { if (sel) {
this.quoter = name; this.quoter = name;
this.qouted_pid = post_id; this.qouted_pid = post_id;
@ -74,244 +74,244 @@ BBCode.prototype = {
return false; return false;
}, },
// For stupid Opera - save selection before mouseover the button. // For stupid Opera - save selection before mouseover the button
refreshSelection: function(get) { refreshSelection: function(get) {
if (get) this.stext = this.getSelection()[0]; if (get) this.stext = this.getSelection()[0];
else this.stext = ''; else this.stext = '';
}, },
// Return current selection and range (if exists). // Return current selection and range (if exists).
// In Opera, this function must be called periodically (on mouse over, // In Opera, this function must be called periodically (on mouse over,
// for example), because on click stupid Opera breaks up the selection. // for example), because on click stupid Opera breaks up the selection.
getSelection: function() { getSelection: function() {
var w = window; var w = window;
var text='', range; var text='', range;
if (w.getSelection) { if (w.getSelection) {
// Opera & Mozilla? // Opera & Mozilla?
text = w.getSelection(); text = w.getSelection();
} else if (w.document.getSelection) { } else if (w.document.getSelection) {
// the Navigator 4.0x code // the Navigator 4.0x code
text = w.document.getSelection(); text = w.document.getSelection();
} else if (w.document.selection && w.document.selection.createRange) { } else if (w.document.selection && w.document.selection.createRange) {
// the Internet Explorer 4.0x code // the Internet Explorer 4.0x code
range = w.document.selection.createRange(); range = w.document.selection.createRange();
text = range.text; text = range.text;
} else { } else {
return [null, null]; return [null, null];
} }
if (text == '') text = this.stext; if (text == '') text = this.stext;
text = ""+text; text = ""+text;
text = text.replace("/^\s+|\s+$/g", ""); text = text.replace("/^\s+|\s+$/g", "");
return [text, range]; return [text, range];
}, },
// Insert string at cursor position of textarea. // Insert string at cursor position of textarea.
insertAtCursor: function(text) { insertAtCursor: function(text) {
// Focus is placed to textarea. // Focus is placed to textarea.
var t = this.textarea; var t = this.textarea;
t.focus(); t.focus();
// Insert the string. // Insert the string.
if (document.selection && document.selection.createRange) { if (document.selection && document.selection.createRange) {
var r = document.selection.createRange(); var r = document.selection.createRange();
if (!this.replaceOnInsert) r.collapse(); if (!this.replaceOnInsert) r.collapse();
r.text = text; r.text = text;
} else if (t.setSelectionRange) { } else if (t.setSelectionRange) {
var start = this.replaceOnInsert? t.selectionStart : t.selectionEnd; var start = this.replaceOnInsert? t.selectionStart : t.selectionEnd;
var end = t.selectionEnd; var end = t.selectionEnd;
var sel1 = t.value.substr(0, start); var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end); var sel2 = t.value.substr(end);
t.value = sel1 + text + sel2; t.value = sel1 + text + sel2;
t.setSelectionRange(start+text.length, start+text.length); t.setSelectionRange(start+text.length, start+text.length);
} else{ } else{
t.value += text; t.value += text;
} }
// For IE. // For IE.
setTimeout(function() { t.focus() }, 100); setTimeout(function() { t.focus() }, 100);
}, },
// Surround piece of textarea text with tags. // Surround piece of textarea text with tags.
surround: function(open, close, fTrans) { surround: function(open, close, fTrans) {
var t = this.textarea; var t = this.textarea;
t.focus(); t.focus();
if (!fTrans) fTrans = function(t) { return t; }; if (!fTrans) fTrans = function(t) { return t; };
var rt = this.getSelection(); var rt = this.getSelection();
var text = rt[0]; var text = rt[0];
var range = rt[1]; var range = rt[1];
if (text == null) return false; if (text == null) return false;
var notEmpty = text != null && text != ''; var notEmpty = text != null && text != '';
// Surround. // Surround.
if (range) { if (range) {
var notEmpty = text != null && text != ''; var notEmpty = text != null && text != '';
var newText = open + fTrans(text) + (close? close : ''); var newText = open + fTrans(text) + (close? close : '');
range.text = newText; range.text = newText;
range.collapse(); range.collapse();
if (text != '') { if (text != '') {
// Correction for stupid IE: \r for moveStart is 0 character. // Correction for stupid IE: \r for moveStart is 0 character.
var delta = 0; var delta = 0;
for (var i=0; i<newText.length; i++) if (newText.charAt(i)=='\r') delta++; for (var i=0; i<newText.length; i++) if (newText.charAt(i)=='\r') delta++;
range.moveStart("character", -close.length-text.length-open.length+delta); range.moveStart("character", -close.length-text.length-open.length+delta);
range.moveEnd("character", -0); range.moveEnd("character", -0);
} else { } else {
range.moveEnd("character", -close.length); range.moveEnd("character", -close.length);
} }
if (!this.collapseAfterInsert) range.select(); if (!this.collapseAfterInsert) range.select();
} else if (t.setSelectionRange) { } else if (t.setSelectionRange) {
var start = t.selectionStart; var start = t.selectionStart;
var end = t.selectionEnd; var end = t.selectionEnd;
var top = t.scrollTop; var top = t.scrollTop;
var sel1 = t.value.substr(0, start); var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end); var sel2 = t.value.substr(end);
var sel = fTrans(t.value.substr(start, end-start)); var sel = fTrans(t.value.substr(start, end-start));
var inner = open + sel + close; var inner = open + sel + close;
t.value = sel1 + inner + sel2; t.value = sel1 + inner + sel2;
if (sel != '') { if (sel != '') {
t.setSelectionRange(start, start+inner.length); t.setSelectionRange(start, start+inner.length);
notEmpty = true; notEmpty = true;
} else { } else {
t.setSelectionRange(start+open.length, start+open.length); t.setSelectionRange(start+open.length, start+open.length);
notEmpty = false; notEmpty = false;
} }
t.scrollTop = top; t.scrollTop = top;
if (this.collapseAfterInsert) t.setSelectionRange(start+inner.length, start+inner.length); if (this.collapseAfterInsert) t.setSelectionRange(start+inner.length, start+inner.length);
} else { } else {
t.value += open + text + close; t.value += open + text + close;
} }
this.collapseAfterInsert = false; this.collapseAfterInsert = false;
return notEmpty; return notEmpty;
}, },
// Internal function for cross-browser event cancellation. // Internal function for cross-browser event cancellation.
_cancelEvent: function(e) { _cancelEvent: function(e) {
if (e.preventDefault) e.preventDefault(); if (e.preventDefault) e.preventDefault();
if (e.stopPropagation) e.stopPropagation(); if (e.stopPropagation) e.stopPropagation();
return e.returnValue = false; return e.returnValue = false;
}, },
// Available key combinations and these interpretaions for BB are // Available key combinations and these interpretaions for BB are
// TAB - Insert TAB char // TAB - Insert TAB char
// CTRL-TAB - Next form field (usual TAB) // CTRL-TAB - Next form field (usual TAB)
// SHIFT-ALT-PAGEUP - Add an Attachment // SHIFT-ALT-PAGEUP - Add an Attachment
// ALT-ENTER - Preview // ALT-ENTER - Preview
// CTRL-ENTER - Submit // CTRL-ENTER - Submit
// The values of virtual codes of keys passed through event.keyCode are // The values of virtual codes of keys passed through event.keyCode are
// Rumata, http://forum.dklab.ru/about/todo/BistrieKlavishiDlyaOtpravkiForm.html // Rumata, http://forum.dklab.ru/about/todo/BistrieKlavishiDlyaOtpravkiForm.html
onKeyPress: function(e, type) { onKeyPress: function(e, type) {
// Try to match all the hot keys. // Try to match all the hot keys.
var key = String.fromCharCode(e.keyCode? e.keyCode : e.charCode); var key = String.fromCharCode(e.keyCode? e.keyCode : e.charCode);
for (var id in this.tags) { for (var id in this.tags) {
var tag = this.tags[id]; var tag = this.tags[id];
// Pressed control key?.. // Pressed control key?..
if (tag.ctrlKey && !e[tag.ctrlKey+"Key"]) continue; if (tag.ctrlKey && !e[tag.ctrlKey+"Key"]) continue;
// Pressed needed key? // Pressed needed key?
if (!tag.key || key.toUpperCase() != tag.key.toUpperCase()) continue; if (!tag.key || key.toUpperCase() != tag.key.toUpperCase()) continue;
// OK. Insert. // OK. Insert.
if (e.type == "keydown") this.insertTag(id); if (e.type == "keydown") this.insertTag(id);
// Reset event. // Reset event.
return this._cancelEvent(e); return this._cancelEvent(e);
} }
// Tab. // Tab
if (type == 'press' && e.keyCode == this.VK_TAB && !e.shiftKey && !e.ctrlKey && !e.altKey) { if (type == 'press' && e.keyCode == this.VK_TAB && !e.shiftKey && !e.ctrlKey && !e.altKey) {
//this.surround("\t", ""); //this.surround("\t", "");
this.insertAtCursor('[tab]'); this.insertAtCursor('[tab]');
return this._cancelEvent(e); return this._cancelEvent(e);
} }
// Ctrl+Tab. // Ctrl+Tab
if (e.keyCode == this.VK_TAB && !e.shiftKey && e.ctrlKey && !e.altKey) { if (e.keyCode == this.VK_TAB && !e.shiftKey && e.ctrlKey && !e.altKey) {
this.textarea.form.post.focus(); this.textarea.form.post.focus();
return this._cancelEvent(e); return this._cancelEvent(e);
} }
// Hot keys // Hot keys
var form = this.textarea.form; var form = this.textarea.form;
var submitter = null; var submitter = null;
if (e.keyCode == this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey) if (e.keyCode == this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.add_attachment_box; submitter = form.add_attachment_box;
if (e.keyCode == this.VK_ENTER &&!e.shiftKey && !e.ctrlKey && e.altKey) if (e.keyCode == this.VK_ENTER &&!e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.preview; submitter = form.preview;
if (e.keyCode == this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey) if (e.keyCode == this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey)
submitter = form.post; submitter = form.post;
if (submitter) { if (submitter) {
submitter.click(); submitter.click();
return this._cancelEvent(e); return this._cancelEvent(e);
} }
return true; return true;
}, },
// Adds a BB tag to the list. // Adds a BB tag to the list
addTag: function(id, open, close, key, ctrlKey, multiline) { addTag: function(id, open, close, key, ctrlKey, multiline) {
if (!ctrlKey) ctrlKey = "ctrl"; if (!ctrlKey) ctrlKey = "ctrl";
var tag = new Object(); var tag = new Object();
tag.id = id; tag.id = id;
tag.open = open; tag.open = open;
tag.close = close; tag.close = close;
tag.key = key; tag.key = key;
tag.ctrlKey = ctrlKey; tag.ctrlKey = ctrlKey;
tag.multiline = multiline; tag.multiline = multiline;
tag.elt = this.textarea.form[id] tag.elt = this.textarea.form[id]
this.tags[id] = tag; this.tags[id] = tag;
// Setup events. // Setup events.
var elt = tag.elt; var elt = tag.elt;
if (elt) { if (elt) {
var th = this; var th = this;
if (elt.type && elt.type.toUpperCase()=="BUTTON") { if (elt.type && elt.type.toUpperCase()=="BUTTON") {
addEvent(elt, 'click', function() { th.insertTag(id); return false; }); addEvent(elt, 'click', function() { th.insertTag(id); return false; });
} }
if (elt.tagName && elt.tagName.toUpperCase()=="SELECT") { if (elt.tagName && elt.tagName.toUpperCase()=="SELECT") {
addEvent(elt, 'change', function() { th.insertTag(id); return false; }); addEvent(elt, 'change', function() { th.insertTag(id); return false; });
} }
} else { } else {
if (id && id.indexOf('_') != 0) return alert("addTag('"+id+"'): no such element in the form"); if (id && id.indexOf('_') != 0) return alert("addTag('"+id+"'): no such element in the form");
} }
}, },
// Inserts the tag with specified ID. // Inserts the tag with specified ID
insertTag: function(id) { insertTag: function(id) {
// Find tag. // Find tag
var tag = this.tags[id]; var tag = this.tags[id];
if (!tag) return alert("Unknown tag ID: "+id); if (!tag) return alert("Unknown tag ID: "+id);
// Open tag is generated by callback? // Open tag is generated by callback?
var op = tag.open; var op = tag.open;
if (typeof(tag.open) == "function") op = tag.open(tag.elt); if (typeof(tag.open) == "function") op = tag.open(tag.elt);
var cl = tag.close!=null? tag.close : "/"+op; var cl = tag.close!=null? tag.close : "/"+op;
// Use "[" if needed. // Use "[" if needed
if (op.charAt(0) != this.BRK_OP) op = this.BRK_OP+op+this.BRK_CL; if (op.charAt(0) != this.BRK_OP) op = this.BRK_OP+op+this.BRK_CL;
if (cl && cl.charAt(0) != this.BRK_OP) cl = this.BRK_OP+cl+this.BRK_CL; if (cl && cl.charAt(0) != this.BRK_OP) cl = this.BRK_OP+cl+this.BRK_CL;
this.surround(op, cl, !tag.multiline? null : tag.multiline===true? this._prepareMultiline : tag.multiline); this.surround(op, cl, !tag.multiline? null : tag.multiline===true? this._prepareMultiline : tag.multiline);
}, },
_prepareMultiline: function(text) { _prepareMultiline: function(text) {
text = text.replace(/\s+$/, ''); text = text.replace(/\s+$/, '');
text = text.replace(/^([ \t]*\r?\n)+/, ''); text = text.replace(/^([ \t]*\r?\n)+/, '');
if (text.indexOf("\n") >= 0) text = "\n" + text + "\n"; if (text.indexOf("\n") >= 0) text = "\n" + text + "\n";
return text; return text;
} }
} }
// Emulation of innerText for Mozilla. // Emulation of innerText for Mozilla.
if (window.HTMLElement && window.HTMLElement.prototype.__defineSetter__) { if (window.HTMLElement && window.HTMLElement.prototype.__defineSetter__) {
HTMLElement.prototype.__defineSetter__("innerText", function (sText) { HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
this.innerHTML = sText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); this.innerHTML = sText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}); });
HTMLElement.prototype.__defineGetter__("innerText", function () { HTMLElement.prototype.__defineGetter__("innerText", function () {
var r = this.ownerDocument.createRange(); var r = this.ownerDocument.createRange();
r.selectNodeContents(this); r.selectNodeContents(this);
return r.toString(); return r.toString();
}); });
} }
function AddSelectedText(BBOpen, BBClose) { function AddSelectedText(BBOpen, BBClose) {
if (document.post.message.caretPos) document.post.message.caretPos.text = BBOpen + document.post.message.caretPos.text + BBClose; if (document.post.message.caretPos) document.post.message.caretPos.text = BBOpen + document.post.message.caretPos.text + BBClose;
else document.post.message.value += BBOpen + BBClose; else document.post.message.value += BBOpen + BBClose;
document.post.message.focus() document.post.message.focus()
} }
function InsertBBCode(BBcode) function InsertBBCode(BBcode)
@ -323,7 +323,164 @@ function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate(); if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
} }
// Translit START function initPostBBCode(context)
{
$('span.post-hr', context).html('<hr align="left" />');
initCodes(context);
initQuotes(context);
initExternalLinks(context);
initPostImages(context);
initSpoilers(context);
initMedia(context);
}
function initCodes(context)
{
$('div.c-body', context).each(function(){
var $c = $(this);
$c.before('<div class="c-head"><b>'+bbl['code']+':</b></div>');
});
}
function initQuotes(context)
{
$('div.q', context).each(function(){
var $q = $(this);
var name = $(this).attr('head');
var q_title = (name ? '<b>'+name+'</b> '+bbl['wrote']+':' : '<b>'+bbl['quote']+'</b>');
if ( quoted_pid = $q.children('u.q-post:first').text() ) {
var on_this_page = $('#post_'+quoted_pid).length;
var href = (on_this_page) ? '#'+ quoted_pid : './viewtopic.php?p='+ quoted_pid +'#'+ quoted_pid;
q_title += ' <a href="'+ href +'" title="'+bbl['quoted_post']+'"><img src="'+bb_url+'templates/default/images/icon_latest_reply.gif" class="icon2" alt="" /></a>';
}
$q.before('<div class="q-head">'+ q_title +'</div>');
});
}
function initPostImages(context)
{
if (hidePostImg) return;
var $in_spoilers = $('div.sp-body var.postImg', context);
$('var.postImg', context).not($in_spoilers).each(function(){
var $v = $(this);
var src = $v.attr('title');
var $img = $('<img src="'+ src +'" class="'+ $v.attr('class') +'" alt="pic" />');
$img = fixPostImage($img);
var maxW = ($v.hasClass('postImgAligned')) ? postImgAligned_MaxWidth : postImg_MaxWidth;
$img.bind('click', function(){ return imgFit(this, maxW); });
if (user.opt_js.i_aft_l) {
$('#preload').append($img);
var loading_icon = '<a href="'+ src +'" target="_blank"><img src="'+bb_url+'images/pic_loading.gif" alt="" /></a>';
$v.html(loading_icon);
if ($.browser.msie) {
$v.after('<wbr>');
}
$img.one('load', function(){
imgFit(this, maxW);
$v.empty().append(this);
});
}
else {
$img.one('load', function(){ imgFit(this, maxW) });
$v.empty().append($img);
if ($.browser.msie) {
$v.after('<wbr>');
}
}
});
$('var.posterImg', context).each(function(){
var $v = $(this);
var src = $v.attr('title');
var $img = $('<img src="'+ src +'" class="'+ $v.attr('class') +'" width="260px;" alt="'+bbl['loading']+'" border="0" />');
$img = fixPostImage($img);
$v.empty().append($img);
if ($.browser.msie) {
$v.after('<wbr>');
}
});
}
function initSpoilers(context)
{
$('div.sp-body', context).each(function(){
var $sp_body = $(this);
var name = $.trim(this.title) || ''+bbl['spoiler_head']+'';
this.title = '';
var $sp_head = $('<div class="sp-head folded clickable">'+ name +'</div>');
$sp_head.insertBefore($sp_body).click(function(e){
if (!$sp_body.hasClass('inited')) {
initPostImages($sp_body);
var $sp_fold_btn = $('<div class="sp-fold clickable">['+bbl['spoiler_close']+']</div>').click(function(){
$.scrollTo($sp_head, { duration:200, axis:'y', offset:-200 });
$sp_head.click().animate({opacity: 0.1}, 500).animate({opacity: 1}, 700);
});
$sp_body.prepend('<div class="clear"></div>').append('<div class="clear"></div>').append($sp_fold_btn).addClass('inited');
}
if (e.shiftKey) {
e.stopPropagation();
e.shiftKey = false;
var fold = $(this).hasClass('unfolded');
$('div.sp-head', $($sp_body.parents('td')[0])).filter( function(){ return $(this).hasClass('unfolded') ? fold : !fold } ).click();
}
else {
$(this).toggleClass('unfolded');
$sp_body.slideToggle('fast');
}
});
});
}
function initExternalLinks(context)
{
var context = context || 'body';
if (ExternalLinks_InNewWindow) {
$("a.postLink:not([href*='"+ window.location.hostname +"/'])", context).attr({ target: '_blank' });
}
}
function fixPostImage ($img)
{
var banned_image_hosts = /imagebanana|hidebehind/i;
var src = $img[0].src;
if (src.match(banned_image_hosts)) {
$img.wrap('<a href="'+ this.src +'" target="_blank"></a>').attr({ src: ""+bb_url+"images/tr_oops.gif", title: ""+bbl['scr_rules']+"" });
}
return $img;
}
function initMedia(context)
{
var apostLink = $('a.postLink', context);
for (var i = 0; i < apostLink.length; i++) {
var link = apostLink[i];
if (typeof link.href != 'string') {
continue;
}
if (/^http(?:s|):\/\/www.youtube.com\/watch\?(.*)?(&?v=([a-z0-9\-_]+))(.*)?|http:\/\/youtu.be\/.+/i.test(link.href)) {
var a = document.createElement('span');
a.className = 'YTLink';
a.innerHTML = '<span title="'+bbl['play_on']+'" class="YTLinkButton">&#9658;</span>';
window.addEvent(a, 'click', function (e) {
var vhref = e.target.nextSibling.href.replace(/^http(?:s|):\/\/www.youtube.com\/watch\?(.*)?(&?v=([a-z0-9\-_]+))(.*)?|http:\/\/youtu.be\//ig, "http://www.youtube.com/embed/$3");
var text = e.target.nextSibling.innerText != "" ? e.target.nextSibling.innerText : e.target.nextSibling.href;
$('#Panel_youtube').remove();
ypanel('youtube', {
title: '<b>' + text + '</b>',
resizing: 0,
width: 862,
height: 550,
content: '<iframe width="853" height="493" frameborder="0" allowfullscreen="" src="' + vhref + '?wmode=opaque"></iframe>'
});
});
link.parentNode.insertBefore(a, link);
a.appendChild(link);
}
}
}
$(document).ready(function(){
$('div.post_wrap, div.signature').each(function(){ initPostBBCode( $(this) ) });
});
// One character letters // One character letters
var t_table1 = "ABVGDEZIJKLMNOPRSTUFXHCYWabvgdezijklmnoprstufxhcyw'#"; var t_table1 = "ABVGDEZIJKLMNOPRSTUFXHCYWabvgdezijklmnoprstufxhcyw'#";
@ -343,91 +500,90 @@ var tagArray = [
function translit2win (str) function translit2win (str)
{ {
var len = str.length; var len = str.length;
var new_str = ""; var new_str = "";
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
/* non-translatable text must be in ^ */ /* non-translatable text must be in ^ */
if(str.substr(i).indexOf("^")==0){ if(str.substr(i).indexOf("^")==0){
end_len=str.substr(i+1).indexOf("^")+2; end_len=str.substr(i+1).indexOf("^")+2;
if (end_len>1){ if (end_len>1){
new_str+=str.substr(i,end_len); new_str+=str.substr(i,end_len);
i += end_len - 1; i += end_len - 1;
continue; continue;
} }
} }
/* Skipping emoticons */ /* Skipping emoticons */
if(str.substr(i).indexOf(":")==0){ if(str.substr(i).indexOf(":")==0){
iEnd = str.substr(i+1).indexOf(":")+2; iEnd = str.substr(i+1).indexOf(":")+2;
if (iEnd > 1 && str.substr(i,iEnd).match("^:[a-zA-Z0-9]+:$")){ if (iEnd > 1 && str.substr(i,iEnd).match("^:[a-zA-Z0-9]+:$")){
new_str += str.substr(i,iEnd); new_str += str.substr(i,iEnd);
i += iEnd - 1; i += iEnd - 1;
continue; continue;
} }
} }
/* Skipping http|news|ftp:/.../ links */ /* Skipping http|news|ftp:/.../ links */
rExp = new RegExp("^((http|https|news|ftp|ed2k):\\/\\/[\\/a-zA-Z0-9%_?.:;&#|\(\)+=@-]+)","i"); rExp = new RegExp("^((http|https|news|ftp|ed2k):\\/\\/[\\/a-zA-Z0-9%_?.:;&#|\(\)+=@-]+)","i");
if (newArr = str.substr(i).match(rExp)){ if (newArr = str.substr(i).match(rExp)){
new_str += newArr[1]; new_str += newArr[1];
i += newArr[1].length - 1; i += newArr[1].length - 1;
continue; continue;
} }
/* Skipping FONT, COLOR, SIZE tags */ /* Skipping FONT, COLOR, SIZE tags */
rExp = new RegExp("^(\\[\\/?(b|i|u|s|font(=[a-z0-9]+)?|size(=[0-9]+)?|color(=#?[a-z0-9]+)?)\\])","i"); rExp = new RegExp("^(\\[\\/?(b|i|u|s|font(=[a-z0-9]+)?|size(=[0-9]+)?|color(=#?[a-z0-9]+)?)\\])","i");
if (newArr = str.substr(i).match(rExp)){ if (newArr = str.substr(i).match(rExp)){
new_str += newArr[1]; new_str += newArr[1];
i += newArr[1].length - 1; i += newArr[1].length - 1;
continue; continue;
} }
/* Skipping [QUOTE]..[/QUOTE], [IMG]..[/IMG], [CODE]..[/CODE], [SQL]..[/SQL], [EMAIL]..[/EMAIL] tags */ /* Skipping [QUOTE]..[/QUOTE], [IMG]..[/IMG], [CODE]..[/CODE], [SQL]..[/SQL], [EMAIL]..[/EMAIL] tags */
bSkip = false; bSkip = false;
for(j = 0; j < tagArray.length; j += 2){ for(j = 0; j < tagArray.length; j += 2){
rExp = new RegExp("^(\\["+tagArray[j]+tagArray[j+1]+"\\])","i"); rExp = new RegExp("^(\\["+tagArray[j]+tagArray[j+1]+"\\])","i");
if (newArr = str.substr(i).match(rExp)){ if (newArr = str.substr(i).match(rExp)){
rExp = new RegExp("\\[\\/" + tagArray[j] + "\\]", "i"); rExp = new RegExp("\\[\\/" + tagArray[j] + "\\]", "i");
if (iEnd = str.substr(i + newArr[1].length + 2).search(rExp)){ if (iEnd = str.substr(i + newArr[1].length + 2).search(rExp)){
end_len = iEnd + newArr[1].length + tagArray[j].length + 4; end_len = iEnd + newArr[1].length + tagArray[j].length + 4;
new_str += str.substr(i,end_len); new_str += str.substr(i,end_len);
i += end_len - 1; i += end_len - 1;
bSkip = true; bSkip = true;
} }
} }
if(bSkip)break; if(bSkip)break;
} }
if(bSkip)continue; if(bSkip)continue;
// Check for 2-character letters // Check for 2-character letters
is2char=false; is2char=false;
if (i < len-1) { if (i < len-1) {
for(j = 0; j < w_table2.length; j++) for(j = 0; j < w_table2.length; j++)
{ {
if(str.substr(i, 2) == t_table2.substr(j*2,2)) { if(str.substr(i, 2) == t_table2.substr(j*2,2)) {
new_str+= w_table2.substr(j, 1); new_str+= w_table2.substr(j, 1);
i++; i++;
is2char=true; is2char=true;
break; break;
} }
} }
} }
if(!is2char) { if(!is2char) {
// Convert one-character letter // Convert one-character letter
var c = str.substr(i, 1); var c = str.substr(i, 1);
var pos = t_table1.indexOf(c); var pos = t_table1.indexOf(c);
if (pos < 0) if (pos < 0)
new_str+= c; new_str+= c;
else else
new_str+= w_table1.substr(pos, 1); new_str+= w_table1.substr(pos, 1);
} }
} }
// document.REPLIER.Post.focus(); return new_str;
return new_str;
} }
function transliterate (msg, e) function transliterate (msg, e)
@ -439,5 +595,4 @@ function transliterate (msg, e)
} }
if (e) e.disabled = false; if (e) e.disabled = false;
}, 1); }, 1);
} }
// Translit END

View file

@ -21,6 +21,9 @@
window.encURL = encodeURIComponent; window.encURL = encodeURIComponent;
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var bb_url = '{SITE_URL}';
var bbl = { "code": "{L_CODE}", "wrote": "{L_WROTE}", "quote": "{L_QUOTE}", "quoted_post": "{L_GOTO_QUOTED_POST}", "loading": "{L_LOADING}", "spoiler_head": "{L_SPOILER_HEAD}", "spoiler_close": "{L_SPOILER_CLOSE}", "links_are": "{L_LINKS_ARE_FORBIDDEN}", "scr_rules": "{L_SCREENSHOTS_RULES}", "play_on": "{L_PLAY_ON_CURPAGE}" }
var postImg_MaxWidth = screen.width - {POST_IMG_WIDTH_DECR_JS}; var postImg_MaxWidth = screen.width - {POST_IMG_WIDTH_DECR_JS};
var postImgAligned_MaxWidth = Math.round(screen.width/3); var postImgAligned_MaxWidth = Math.round(screen.width/3);
var attachImg_MaxWidth = screen.width - {ATTACH_IMG_WIDTH_DECR_JS}; var attachImg_MaxWidth = screen.width - {ATTACH_IMG_WIDTH_DECR_JS};
@ -32,148 +35,9 @@ function copyText_writeLink(node)
if (!is_ie) return; if (!is_ie) return;
document.write('<p style="float: right;"><a class="txtb" onclick="if (ie_copyTextToClipboard('+node+')) alert(\'{L_CODE_COPIED}\'); return false;" href="#">{L_CODE_COPY}</a></p>'); document.write('<p style="float: right;"><a class="txtb" onclick="if (ie_copyTextToClipboard('+node+')) alert(\'{L_CODE_COPIED}\'); return false;" href="#">{L_CODE_COPY}</a></p>');
} }
function initPostBBCode(context)
{
$('span.post-hr', context).html('<hr align="left" />');
initCodes(context);
initQuotes(context);
initExternalLinks(context);
initPostImages(context);
initSpoilers(context);
initMedia(context);
}
function initCodes(context)
{
$('div.c-body', context).each(function(){
var $c = $(this);
$c.before('<div class="c-head"><b>{L_CODE}:</b></div>');
});
}
function initQuotes(context)
{
$('div.q', context).each(function(){
var $q = $(this);
var name = $(this).attr('head');
var q_title = (name ? '<b>'+name+'</b> {L_WROTE}:' : '<b>{L_QUOTE}</b>');
if ( quoted_pid = $q.children('u.q-post:first').text() ) {
var on_this_page = $('#post_'+quoted_pid).length;
var href = (on_this_page) ? '#'+ quoted_pid : './viewtopic.php?p='+ quoted_pid +'#'+ quoted_pid;
q_title += ' <a href="'+ href +'" title="{L_GOTO_QUOTED_POST}"><img src="{SITE_URL}templates/default/images/icon_latest_reply.gif" class="icon2" alt="" /></a>';
}
$q.before('<div class="q-head">'+ q_title +'</div>');
});
}
function initPostImages(context)
{
if (hidePostImg) return;
var $in_spoilers = $('div.sp-body var.postImg', context);
$('var.postImg', context).not($in_spoilers).each(function(){
var $v = $(this);
var src = $v.attr('title');
var $img = $('<img src="'+ src +'" class="'+ $v.attr('class') +'" alt="pic" />');
$img = fixPostImage($img);
var maxW = ($v.hasClass('postImgAligned')) ? postImgAligned_MaxWidth : postImg_MaxWidth;
$img.bind('click', function(){ return imgFit(this, maxW); });
if (user.opt_js.i_aft_l) {
$('#preload').append($img);
var loading_icon = '<a href="'+ src +'" target="_blank"><img src="{SITE_URL}images/pic_loading.gif" alt="" /></a>';
$v.html(loading_icon);
if ($.browser.msie) {
$v.after('<wbr>');
}
$img.one('load', function(){
imgFit(this, maxW);
$v.empty().append(this);
});
}
else {
$img.one('load', function(){ imgFit(this, maxW) });
$v.empty().append($img);
if ($.browser.msie) {
$v.after('<wbr>');
}
}
});
}
function initSpoilers(context)
{
$('div.sp-body', context).each(function(){
var $sp_body = $(this);
var name = $.trim(this.title) || '{L_SPOILER_HEAD}';
this.title = '';
var $sp_head = $('<div class="sp-head folded clickable">'+ name +'</div>');
$sp_head.insertBefore($sp_body).click(function(e){
if (!$sp_body.hasClass('inited')) {
initPostImages($sp_body);
var $sp_fold_btn = $('<div class="sp-fold clickable">[{L_SPOILER_CLOSE}]</div>').click(function(){
$.scrollTo($sp_head, { duration:200, axis:'y', offset:-200 });
$sp_head.click().animate({opacity: 0.1}, 500).animate({opacity: 1}, 700);
});
$sp_body.prepend('<div class="clear"></div>').append('<div class="clear"></div>').append($sp_fold_btn).addClass('inited');
}
if (e.shiftKey) {
e.stopPropagation();
e.shiftKey = false;
var fold = $(this).hasClass('unfolded');
$('div.sp-head', $($sp_body.parents('td')[0])).filter( function(){ return $(this).hasClass('unfolded') ? fold : !fold } ).click();
}
else {
$(this).toggleClass('unfolded');
$sp_body.slideToggle('fast');
}
});
});
}
function initExternalLinks(context)
{
var context = context || 'body';
if (ExternalLinks_InNewWindow) {
$("a.postLink:not([href*='"+ window.location.hostname +"/'])", context).attr({ target: '_blank' });
}
}
function fixPostImage($img)
{
var banned_image_hosts = /imagebanana|hidebehind/i; // imageshack
var src = $img[0].src;
if (src.match(banned_image_hosts)) {
$img.wrap('<a href="'+ this.src +'" target="_blank"></a>').attr({ src: "{SITE_URL}images/tr_oops.gif", title: "{L_SCREENSHOTS_RULES}" });
}
return $img;
}
function initMedia(context)
{
var apostLink = $('a.postLink', context);
for (var i = 0; i < apostLink.length; i++) {
var link = apostLink[i];
if (typeof link.href != 'string') {
continue;
}
if (/^http(?:s|):\/\/www.youtube.com\/watch\?(.*)?(&?v=([a-z0-9\-_]+))(.*)?|http:\/\/youtu.be\/.+/i.test(link.href)) {
var a = document.createElement('span');
a.className = 'YTLink';
a.innerHTML = '<span title="{L_PLAY_ON_CURPAGE}" class="YTLinkButton">&#9658;</span>';
window.addEvent(a, 'click', function (e) {
var vhref = e.target.nextSibling.href.replace(/^http(?:s|):\/\/www.youtube.com\/watch\?(.*)?(&?v=([a-z0-9\-_]+))(.*)?|http:\/\/youtu.be\//ig, "http://www.youtube.com/embed/$3");
var text = e.target.nextSibling.innerText != "" ? e.target.nextSibling.innerText : e.target.nextSibling.href;
$('#Panel_youtube').remove();
ypanel('youtube', {
title: '<b>' + text + '</b>',
resizing: 0,
width: 862,
height: 550,
content: '<iframe width="853" height="510" frameborder="0" allowfullscreen="" src="' + vhref + '?wmode=opaque"></iframe>'
});
});
link.parentNode.insertBefore(a, link);
a.appendChild(link);
}
}
}
$(document).ready(function(){
$('div.post_wrap, div.signature').each(function(){ initPostBBCode( $(this) ) });
});
</script> </script>
<!-- ENDIF / INCLUDE_BBCODE_JS --> <!-- ENDIF / INCLUDE_BBCODE_JS -->
<script type="text/javascript"> <script type="text/javascript">
var BB_ROOT = "{#BB_ROOT}"; var BB_ROOT = "{#BB_ROOT}";
var cookieDomain = "{$bb_cfg['cookie_domain']}"; var cookieDomain = "{$bb_cfg['cookie_domain']}";
@ -194,6 +58,7 @@ var user = {
} }
} }
} }
<!-- IF SHOW_JUMPBOX --> <!-- IF SHOW_JUMPBOX -->
$(document).ready(function(){ $(document).ready(function(){
$("div.jumpbox").html('\ $("div.jumpbox").html('\