Добавление файла с никами пользователей, оказавшими помощь проекту. Исправления ошибок по запросам тестеров. Перенос 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 ('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 ('whois_info', 'http://ip-whois.net/ip_geos.php?ip=');
INSERT INTO `bb_config` VALUES ('show_mod_index', '0');
INSERT INTO `bb_config` VALUES ('premod', '0');
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
// $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_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);
$template->assign_vars(array(
'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_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_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
$bb_cfg['tp_version'] = '2.6 (RC)';
$bb_cfg['tp_release_date'] = '15-05-2014';
$bb_cfg['tp_release_state'] = 'R585';
$bb_cfg['tp_release_date'] = '13-06-2014';
$bb_cfg['tp_release_state'] = 'R586';
// Database
$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');
// JSON
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
define('BB_ENABLED', TRIGGERS_DIR .'$on');
@ -500,6 +498,9 @@ $bb_cfg['user_not_active_days_keep'] = 180; // inactive users but only wi
// GroupCP
$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
$bb_cfg['show_ads'] = false;
$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;
$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
if ($logged_in)
@ -169,7 +167,7 @@ $template->assign_vars(array(
'SIMPLE_HEADER' => !empty($gen_simple_header),
'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_RUS' => ($userdata['user_lang'] != 'english') ? true : false,

View file

@ -1367,7 +1367,7 @@ $lang['DESIGNER'] = 'Designer';
$lang['LAST_IP'] = 'Last IP:';
$lang['REG_IP'] = 'Registration 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';
//
// 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)
{
textarea = document.getElementById(obj);
this.construct(textarea);
}
BBCode.prototype = {
VK_TAB: 9,
VK_ENTER: 13,
VK_PAGE_UP: 33,
BRK_OP: '[',
BRK_CL: ']',
textarea: null,
stext: '',
quoter: null,
qouted_pid: null,
collapseAfterInsert: false,
replaceOnInsert: false,
VK_TAB: 9,
VK_ENTER: 13,
VK_PAGE_UP: 33,
BRK_OP: '[',
BRK_CL: ']',
textarea: null,
stext: '',
quoter: null,
qouted_pid: null,
collapseAfterInsert: false,
replaceOnInsert: false,
// Create new BBCode control.
construct: function(textarea) {
this.textarea = textarea
this.tags = new Object();
// Tag for quoting.
this.addTag(
'_quoter',
function() { return '[quote="'+th.quoter+'"][qpost='+th.qouted_pid+']' },
'[/quote]\n',
null,
null,
function() { th.collapseAfterInsert=true; return th._prepareMultiline(th.quoterText) }
);
// Create new BBCode control
construct: function(textarea) {
this.textarea = textarea
this.tags = new Object();
// Tag for quoting
this.addTag(
'_quoter',
function() { return '[quote="'+th.quoter+'"][qpost='+th.qouted_pid+']' },
'[/quote]\n',
null,
null,
function() { th.collapseAfterInsert=true; return th._prepareMultiline(th.quoterText) }
);
// Init events.
var th = this;
addEvent(textarea, 'keydown', function(e) { return th.onKeyPress(e, window.HTMLElement? 'down' : 'press') });
addEvent(textarea, 'keypress', function(e) { return th.onKeyPress(e, 'press') });
},
// Init events
var th = this;
addEvent(textarea, 'keydown', function(e) { return th.onKeyPress(e, window.HTMLElement? 'down' : 'press') });
addEvent(textarea, 'keypress', function(e) { return th.onKeyPress(e, 'press') });
},
// Insert poster name or poster quotes to the text.
onclickPoster: function(name, post_id) {
var sel = this.getSelection()[0];
// Insert poster name or poster quotes to the text
onclickPoster: function(name, post_id) {
var sel = this.getSelection()[0];
if (sel) {
this.quoter = name;
this.qouted_pid = post_id;
@ -74,244 +74,244 @@ BBCode.prototype = {
return false;
},
// For stupid Opera - save selection before mouseover the button.
// For stupid Opera - save selection before mouseover the button
refreshSelection: function(get) {
if (get) this.stext = this.getSelection()[0];
else this.stext = '';
},
if (get) this.stext = this.getSelection()[0];
else this.stext = '';
},
// Return current selection and range (if exists).
// In Opera, this function must be called periodically (on mouse over,
// for example), because on click stupid Opera breaks up the selection.
getSelection: function() {
var w = window;
var text='', range;
if (w.getSelection) {
// Opera & Mozilla?
text = w.getSelection();
} else if (w.document.getSelection) {
// the Navigator 4.0x code
text = w.document.getSelection();
} else if (w.document.selection && w.document.selection.createRange) {
// the Internet Explorer 4.0x code
range = w.document.selection.createRange();
text = range.text;
} else {
return [null, null];
}
if (text == '') text = this.stext;
text = ""+text;
text = text.replace("/^\s+|\s+$/g", "");
return [text, range];
},
// Return current selection and range (if exists).
// In Opera, this function must be called periodically (on mouse over,
// for example), because on click stupid Opera breaks up the selection.
getSelection: function() {
var w = window;
var text='', range;
if (w.getSelection) {
// Opera & Mozilla?
text = w.getSelection();
} else if (w.document.getSelection) {
// the Navigator 4.0x code
text = w.document.getSelection();
} else if (w.document.selection && w.document.selection.createRange) {
// the Internet Explorer 4.0x code
range = w.document.selection.createRange();
text = range.text;
} else {
return [null, null];
}
if (text == '') text = this.stext;
text = ""+text;
text = text.replace("/^\s+|\s+$/g", "");
return [text, range];
},
// Insert string at cursor position of textarea.
insertAtCursor: function(text) {
// Focus is placed to textarea.
var t = this.textarea;
t.focus();
// Insert the string.
if (document.selection && document.selection.createRange) {
var r = document.selection.createRange();
if (!this.replaceOnInsert) r.collapse();
r.text = text;
} else if (t.setSelectionRange) {
var start = this.replaceOnInsert? t.selectionStart : t.selectionEnd;
var end = t.selectionEnd;
var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end);
t.value = sel1 + text + sel2;
t.setSelectionRange(start+text.length, start+text.length);
} else{
t.value += text;
}
// For IE.
setTimeout(function() { t.focus() }, 100);
},
// Insert string at cursor position of textarea.
insertAtCursor: function(text) {
// Focus is placed to textarea.
var t = this.textarea;
t.focus();
// Insert the string.
if (document.selection && document.selection.createRange) {
var r = document.selection.createRange();
if (!this.replaceOnInsert) r.collapse();
r.text = text;
} else if (t.setSelectionRange) {
var start = this.replaceOnInsert? t.selectionStart : t.selectionEnd;
var end = t.selectionEnd;
var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end);
t.value = sel1 + text + sel2;
t.setSelectionRange(start+text.length, start+text.length);
} else{
t.value += text;
}
// For IE.
setTimeout(function() { t.focus() }, 100);
},
// Surround piece of textarea text with tags.
surround: function(open, close, fTrans) {
var t = this.textarea;
t.focus();
if (!fTrans) fTrans = function(t) { return t; };
// Surround piece of textarea text with tags.
surround: function(open, close, fTrans) {
var t = this.textarea;
t.focus();
if (!fTrans) fTrans = function(t) { return t; };
var rt = this.getSelection();
var text = rt[0];
var range = rt[1];
if (text == null) return false;
var rt = this.getSelection();
var text = rt[0];
var range = rt[1];
if (text == null) return false;
var notEmpty = text != null && text != '';
var notEmpty = text != null && text != '';
// Surround.
if (range) {
var notEmpty = text != null && text != '';
var newText = open + fTrans(text) + (close? close : '');
range.text = newText;
range.collapse();
if (text != '') {
// Correction for stupid IE: \r for moveStart is 0 character.
var delta = 0;
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.moveEnd("character", -0);
} else {
range.moveEnd("character", -close.length);
}
if (!this.collapseAfterInsert) range.select();
} else if (t.setSelectionRange) {
var start = t.selectionStart;
var end = t.selectionEnd;
var top = t.scrollTop;
var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end);
var sel = fTrans(t.value.substr(start, end-start));
var inner = open + sel + close;
t.value = sel1 + inner + sel2;
if (sel != '') {
t.setSelectionRange(start, start+inner.length);
notEmpty = true;
} else {
t.setSelectionRange(start+open.length, start+open.length);
notEmpty = false;
}
t.scrollTop = top;
if (this.collapseAfterInsert) t.setSelectionRange(start+inner.length, start+inner.length);
} else {
t.value += open + text + close;
}
this.collapseAfterInsert = false;
return notEmpty;
},
// Surround.
if (range) {
var notEmpty = text != null && text != '';
var newText = open + fTrans(text) + (close? close : '');
range.text = newText;
range.collapse();
if (text != '') {
// Correction for stupid IE: \r for moveStart is 0 character.
var delta = 0;
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.moveEnd("character", -0);
} else {
range.moveEnd("character", -close.length);
}
if (!this.collapseAfterInsert) range.select();
} else if (t.setSelectionRange) {
var start = t.selectionStart;
var end = t.selectionEnd;
var top = t.scrollTop;
var sel1 = t.value.substr(0, start);
var sel2 = t.value.substr(end);
var sel = fTrans(t.value.substr(start, end-start));
var inner = open + sel + close;
t.value = sel1 + inner + sel2;
if (sel != '') {
t.setSelectionRange(start, start+inner.length);
notEmpty = true;
} else {
t.setSelectionRange(start+open.length, start+open.length);
notEmpty = false;
}
t.scrollTop = top;
if (this.collapseAfterInsert) t.setSelectionRange(start+inner.length, start+inner.length);
} else {
t.value += open + text + close;
}
this.collapseAfterInsert = false;
return notEmpty;
},
// Internal function for cross-browser event cancellation.
_cancelEvent: function(e) {
if (e.preventDefault) e.preventDefault();
if (e.stopPropagation) e.stopPropagation();
return e.returnValue = false;
},
// Internal function for cross-browser event cancellation.
_cancelEvent: function(e) {
if (e.preventDefault) e.preventDefault();
if (e.stopPropagation) e.stopPropagation();
return e.returnValue = false;
},
// Available key combinations and these interpretaions for BB are
// TAB - Insert TAB char
// CTRL-TAB - Next form field (usual TAB)
// SHIFT-ALT-PAGEUP - Add an Attachment
// ALT-ENTER - Preview
// CTRL-ENTER - Submit
// The values of virtual codes of keys passed through event.keyCode are
// Rumata, http://forum.dklab.ru/about/todo/BistrieKlavishiDlyaOtpravkiForm.html
onKeyPress: function(e, type) {
// Try to match all the hot keys.
var key = String.fromCharCode(e.keyCode? e.keyCode : e.charCode);
for (var id in this.tags) {
var tag = this.tags[id];
// Pressed control key?..
if (tag.ctrlKey && !e[tag.ctrlKey+"Key"]) continue;
// Pressed needed key?
if (!tag.key || key.toUpperCase() != tag.key.toUpperCase()) continue;
// OK. Insert.
if (e.type == "keydown") this.insertTag(id);
// Reset event.
return this._cancelEvent(e);
}
// Available key combinations and these interpretaions for BB are
// TAB - Insert TAB char
// CTRL-TAB - Next form field (usual TAB)
// SHIFT-ALT-PAGEUP - Add an Attachment
// ALT-ENTER - Preview
// CTRL-ENTER - Submit
// The values of virtual codes of keys passed through event.keyCode are
// Rumata, http://forum.dklab.ru/about/todo/BistrieKlavishiDlyaOtpravkiForm.html
onKeyPress: function(e, type) {
// Try to match all the hot keys.
var key = String.fromCharCode(e.keyCode? e.keyCode : e.charCode);
for (var id in this.tags) {
var tag = this.tags[id];
// Pressed control key?..
if (tag.ctrlKey && !e[tag.ctrlKey+"Key"]) continue;
// Pressed needed key?
if (!tag.key || key.toUpperCase() != tag.key.toUpperCase()) continue;
// OK. Insert.
if (e.type == "keydown") this.insertTag(id);
// Reset event.
return this._cancelEvent(e);
}
// Tab.
if (type == 'press' && e.keyCode == this.VK_TAB && !e.shiftKey && !e.ctrlKey && !e.altKey) {
//this.surround("\t", "");
this.insertAtCursor('[tab]');
return this._cancelEvent(e);
}
// Tab
if (type == 'press' && e.keyCode == this.VK_TAB && !e.shiftKey && !e.ctrlKey && !e.altKey) {
//this.surround("\t", "");
this.insertAtCursor('[tab]');
return this._cancelEvent(e);
}
// Ctrl+Tab.
if (e.keyCode == this.VK_TAB && !e.shiftKey && e.ctrlKey && !e.altKey) {
this.textarea.form.post.focus();
return this._cancelEvent(e);
}
// Ctrl+Tab
if (e.keyCode == this.VK_TAB && !e.shiftKey && e.ctrlKey && !e.altKey) {
this.textarea.form.post.focus();
return this._cancelEvent(e);
}
// Hot keys
var form = this.textarea.form;
var submitter = null;
if (e.keyCode == this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.add_attachment_box;
if (e.keyCode == this.VK_ENTER &&!e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.preview;
if (e.keyCode == this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey)
submitter = form.post;
if (submitter) {
submitter.click();
return this._cancelEvent(e);
}
// Hot keys
var form = this.textarea.form;
var submitter = null;
if (e.keyCode == this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.add_attachment_box;
if (e.keyCode == this.VK_ENTER &&!e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.preview;
if (e.keyCode == this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey)
submitter = form.post;
if (submitter) {
submitter.click();
return this._cancelEvent(e);
}
return true;
},
return true;
},
// Adds a BB tag to the list.
addTag: function(id, open, close, key, ctrlKey, multiline) {
if (!ctrlKey) ctrlKey = "ctrl";
var tag = new Object();
tag.id = id;
tag.open = open;
tag.close = close;
tag.key = key;
tag.ctrlKey = ctrlKey;
tag.multiline = multiline;
tag.elt = this.textarea.form[id]
this.tags[id] = tag;
// Setup events.
var elt = tag.elt;
if (elt) {
var th = this;
if (elt.type && elt.type.toUpperCase()=="BUTTON") {
addEvent(elt, 'click', function() { th.insertTag(id); return false; });
}
if (elt.tagName && elt.tagName.toUpperCase()=="SELECT") {
addEvent(elt, 'change', function() { th.insertTag(id); return false; });
}
} else {
if (id && id.indexOf('_') != 0) return alert("addTag('"+id+"'): no such element in the form");
}
},
// Adds a BB tag to the list
addTag: function(id, open, close, key, ctrlKey, multiline) {
if (!ctrlKey) ctrlKey = "ctrl";
var tag = new Object();
tag.id = id;
tag.open = open;
tag.close = close;
tag.key = key;
tag.ctrlKey = ctrlKey;
tag.multiline = multiline;
tag.elt = this.textarea.form[id]
this.tags[id] = tag;
// Setup events.
var elt = tag.elt;
if (elt) {
var th = this;
if (elt.type && elt.type.toUpperCase()=="BUTTON") {
addEvent(elt, 'click', function() { th.insertTag(id); return false; });
}
if (elt.tagName && elt.tagName.toUpperCase()=="SELECT") {
addEvent(elt, 'change', function() { th.insertTag(id); return false; });
}
} else {
if (id && id.indexOf('_') != 0) return alert("addTag('"+id+"'): no such element in the form");
}
},
// Inserts the tag with specified ID.
insertTag: function(id) {
// Find tag.
var tag = this.tags[id];
if (!tag) return alert("Unknown tag ID: "+id);
// Inserts the tag with specified ID
insertTag: function(id) {
// Find tag
var tag = this.tags[id];
if (!tag) return alert("Unknown tag ID: "+id);
// Open tag is generated by callback?
var op = tag.open;
if (typeof(tag.open) == "function") op = tag.open(tag.elt);
var cl = tag.close!=null? tag.close : "/"+op;
// Open tag is generated by callback?
var op = tag.open;
if (typeof(tag.open) == "function") op = tag.open(tag.elt);
var cl = tag.close!=null? tag.close : "/"+op;
// Use "[" if needed.
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;
// Use "[" if needed
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;
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) {
text = text.replace(/\s+$/, '');
text = text.replace(/^([ \t]*\r?\n)+/, '');
if (text.indexOf("\n") >= 0) text = "\n" + text + "\n";
return text;
}
_prepareMultiline: function(text) {
text = text.replace(/\s+$/, '');
text = text.replace(/^([ \t]*\r?\n)+/, '');
if (text.indexOf("\n") >= 0) text = "\n" + text + "\n";
return text;
}
}
// Emulation of innerText for Mozilla.
if (window.HTMLElement && window.HTMLElement.prototype.__defineSetter__) {
HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
this.innerHTML = sText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
});
HTMLElement.prototype.__defineGetter__("innerText", function () {
var r = this.ownerDocument.createRange();
r.selectNodeContents(this);
return r.toString();
});
HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
this.innerHTML = sText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
});
HTMLElement.prototype.__defineGetter__("innerText", function () {
var r = this.ownerDocument.createRange();
r.selectNodeContents(this);
return r.toString();
});
}
function AddSelectedText(BBOpen, 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;
document.post.message.focus()
if (document.post.message.caretPos) document.post.message.caretPos.text = BBOpen + document.post.message.caretPos.text + BBClose;
else document.post.message.value += BBOpen + BBClose;
document.post.message.focus()
}
function InsertBBCode(BBcode)
@ -323,7 +323,164 @@ function storeCaret(textEl) {
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
var t_table1 = "ABVGDEZIJKLMNOPRSTUFXHCYWabvgdezijklmnoprstufxhcyw'#";
@ -343,91 +500,90 @@ var tagArray = [
function translit2win (str)
{
var len = str.length;
var new_str = "";
var len = str.length;
var new_str = "";
for (i = 0; i < len; i++)
{
/* non-translatable text must be in ^ */
if(str.substr(i).indexOf("^")==0){
end_len=str.substr(i+1).indexOf("^")+2;
if (end_len>1){
new_str+=str.substr(i,end_len);
i += end_len - 1;
continue;
}
}
for (i = 0; i < len; i++)
{
/* non-translatable text must be in ^ */
if(str.substr(i).indexOf("^")==0){
end_len=str.substr(i+1).indexOf("^")+2;
if (end_len>1){
new_str+=str.substr(i,end_len);
i += end_len - 1;
continue;
}
}
/* Skipping emoticons */
if(str.substr(i).indexOf(":")==0){
iEnd = str.substr(i+1).indexOf(":")+2;
if (iEnd > 1 && str.substr(i,iEnd).match("^:[a-zA-Z0-9]+:$")){
new_str += str.substr(i,iEnd);
i += iEnd - 1;
continue;
}
}
/* Skipping emoticons */
if(str.substr(i).indexOf(":")==0){
iEnd = str.substr(i+1).indexOf(":")+2;
if (iEnd > 1 && str.substr(i,iEnd).match("^:[a-zA-Z0-9]+:$")){
new_str += str.substr(i,iEnd);
i += iEnd - 1;
continue;
}
}
/* Skipping http|news|ftp:/.../ links */
rExp = new RegExp("^((http|https|news|ftp|ed2k):\\/\\/[\\/a-zA-Z0-9%_?.:;&#|\(\)+=@-]+)","i");
if (newArr = str.substr(i).match(rExp)){
new_str += newArr[1];
i += newArr[1].length - 1;
continue;
}
/* Skipping http|news|ftp:/.../ links */
rExp = new RegExp("^((http|https|news|ftp|ed2k):\\/\\/[\\/a-zA-Z0-9%_?.:;&#|\(\)+=@-]+)","i");
if (newArr = str.substr(i).match(rExp)){
new_str += newArr[1];
i += newArr[1].length - 1;
continue;
}
/* Skipping FONT, COLOR, SIZE tags */
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)){
new_str += newArr[1];
i += newArr[1].length - 1;
continue;
}
/* Skipping FONT, COLOR, SIZE tags */
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)){
new_str += newArr[1];
i += newArr[1].length - 1;
continue;
}
/* Skipping [QUOTE]..[/QUOTE], [IMG]..[/IMG], [CODE]..[/CODE], [SQL]..[/SQL], [EMAIL]..[/EMAIL] tags */
bSkip = false;
for(j = 0; j < tagArray.length; j += 2){
rExp = new RegExp("^(\\["+tagArray[j]+tagArray[j+1]+"\\])","i");
if (newArr = str.substr(i).match(rExp)){
rExp = new RegExp("\\[\\/" + tagArray[j] + "\\]", "i");
if (iEnd = str.substr(i + newArr[1].length + 2).search(rExp)){
end_len = iEnd + newArr[1].length + tagArray[j].length + 4;
new_str += str.substr(i,end_len);
i += end_len - 1;
bSkip = true;
}
}
if(bSkip)break;
}
if(bSkip)continue;
/* Skipping [QUOTE]..[/QUOTE], [IMG]..[/IMG], [CODE]..[/CODE], [SQL]..[/SQL], [EMAIL]..[/EMAIL] tags */
bSkip = false;
for(j = 0; j < tagArray.length; j += 2){
rExp = new RegExp("^(\\["+tagArray[j]+tagArray[j+1]+"\\])","i");
if (newArr = str.substr(i).match(rExp)){
rExp = new RegExp("\\[\\/" + tagArray[j] + "\\]", "i");
if (iEnd = str.substr(i + newArr[1].length + 2).search(rExp)){
end_len = iEnd + newArr[1].length + tagArray[j].length + 4;
new_str += str.substr(i,end_len);
i += end_len - 1;
bSkip = true;
}
}
if(bSkip)break;
}
if(bSkip)continue;
// Check for 2-character letters
is2char=false;
if (i < len-1) {
for(j = 0; j < w_table2.length; j++)
{
if(str.substr(i, 2) == t_table2.substr(j*2,2)) {
new_str+= w_table2.substr(j, 1);
i++;
is2char=true;
break;
}
}
}
// Check for 2-character letters
is2char=false;
if (i < len-1) {
for(j = 0; j < w_table2.length; j++)
{
if(str.substr(i, 2) == t_table2.substr(j*2,2)) {
new_str+= w_table2.substr(j, 1);
i++;
is2char=true;
break;
}
}
}
if(!is2char) {
// Convert one-character letter
var c = str.substr(i, 1);
var pos = t_table1.indexOf(c);
if (pos < 0)
new_str+= c;
else
new_str+= w_table1.substr(pos, 1);
}
}
if(!is2char) {
// Convert one-character letter
var c = str.substr(i, 1);
var pos = t_table1.indexOf(c);
if (pos < 0)
new_str+= c;
else
new_str+= w_table1.substr(pos, 1);
}
}
// document.REPLIER.Post.focus();
return new_str;
return new_str;
}
function transliterate (msg, e)
@ -439,5 +595,4 @@ function transliterate (msg, e)
}
if (e) e.disabled = false;
}, 1);
}
// Translit END
}

View file

@ -21,6 +21,9 @@
window.encURL = encodeURIComponent;
</script>
<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 postImgAligned_MaxWidth = Math.round(screen.width/3);
var attachImg_MaxWidth = screen.width - {ATTACH_IMG_WIDTH_DECR_JS};
@ -32,148 +35,9 @@ function copyText_writeLink(node)
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>');
}
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>
<!-- ENDIF / INCLUDE_BBCODE_JS -->
<script type="text/javascript">
var BB_ROOT = "{#BB_ROOT}";
var cookieDomain = "{$bb_cfg['cookie_domain']}";
@ -194,6 +58,7 @@ var user = {
}
}
}
<!-- IF SHOW_JUMPBOX -->
$(document).ready(function(){
$("div.jumpbox").html('\