diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a6719f51d..f82540284 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ build: environment: php: - version: 5.6 + version: 7.0.8 filter: excluded_paths: @@ -29,4 +29,4 @@ coding_style: use_tabs: true spaces: around_operators: - concatenation: true \ No newline at end of file + concatenation: true diff --git a/.styleci.yml b/.styleci.yml index 9a1c54393..64c6be3ca 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -7,4 +7,4 @@ finder: - "*Stub.php" path: - "src" - - "tests" \ No newline at end of file + - "tests" diff --git a/.travis.yml b/.travis.yml index 20d5dff49..cfa75fae4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,16 @@ language: php php: - - 5.5 - - 5.6 - 7.0 + - 7.1 - hhvm +matrix: + allow_failures: + - php: hhvm + before_script: - travis_retry composer self-update - travis_retry composer install --no-interaction -script: phpunit --configuration phpunit.xml --coverage-text \ No newline at end of file +script: phpunit --configuration phpunit.xml --coverage-text diff --git a/README.md b/README.md index c3dc09ef2..874fa566a 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ TorrentPier - движок торрент-трекера, написанный ## Необходимая версия php -Минимально поддерживаемой версией в настоящий момент является 5.5. Существует поддержка вплоть до версии 7.0. +Минимально поддерживаемой версией в настоящий момент является 7.0.8. Существует поддержка вплоть до версии 7.1. ## Необходимые настройки php diff --git a/admin/admin_smilies.php b/admin/admin_smilies.php index b1a92f7ea..26d497f99 100644 --- a/admin/admin_smilies.php +++ b/admin/admin_smilies.php @@ -41,6 +41,7 @@ if (isset($_POST['mode']) || isset($_GET['mode'])) { } $delimeter = '=+:'; +$s_hidden_fields = ''; // Read a listing of uploaded smilies for use in the add or edit smliey code $dir = opendir(BB_ROOT . $di->config->get('smilies_path')); diff --git a/admin/index.php b/admin/index.php index 5ca7781b3..7bc212be4 100644 --- a/admin/index.php +++ b/admin/index.php @@ -125,36 +125,6 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') { $users_per_day = $total_users; } - // DB size ... MySQL only - $sql = "SELECT VERSION() AS mysql_version"; - if ($result = DB()->sql_query($sql)) { - $row = DB()->sql_fetchrow($result); - $version = $row['mysql_version']; - - if (preg_match('/^(3\.23|4\.|5\.|10\.)/', $version)) { - $dblist = array(); - foreach ($di->config->get('db') as $name => $row) { - $sql = "SHOW TABLE STATUS FROM {$row[1]}"; - if ($result = DB()->sql_query($sql)) { - $tabledata_ary = DB()->sql_fetchrowset($result); - - $dbsize = 0; - for ($i = 0; $i < count($tabledata_ary); $i++) { - if ($tabledata_ary[$i]['Type'] != 'MRG_MYISAM') { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; - } - } - $dblist[] = '' . humn_size($dbsize) . ''; - } - } - $dbsize = implode(' | ', $dblist); - } else { - $dbsize = $lang['NOT_AVAILABLE']; - } - } else { - $dbsize = $lang['NOT_AVAILABLE']; - } - $template->assign_vars(array( 'NUMBER_OF_POSTS' => $total_posts, 'NUMBER_OF_TOPICS' => $total_topics, @@ -164,14 +134,11 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') { 'TOPICS_PER_DAY' => $topics_per_day, 'USERS_PER_DAY' => $users_per_day, 'AVATAR_DIR_SIZE' => $avatar_dir_size, - 'DB_SIZE' => $dbsize, - 'GZIP_COMPRESSION' => ($di->config->get('gzip_compress')) ? $lang['ON'] : $lang['OFF'], 'TP_VERSION' => $di->config->get('tp_version') . (!empty($di->config->get('tp_release_state')) ? ' :: ' . $di->config->get('tp_release_state') : ''), 'TP_RELEASE_DATE' => $di->config->get('tp_release_date'), - 'ZF_VERSION' => Zend\Version\Version::VERSION, )); - if ($_GET['users_online']) { + if (isset($_GET['users_online'])) { $template->assign_vars(array( 'SHOW_USERS_ONLINE' => true, )); diff --git a/composer.json b/composer.json index af82508b8..0b5addabc 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "docs": "https://faq.torrentpier.me/" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0", "google/recaptcha": "^1.0", "monolog/monolog": "^1.18", "pimple/pimple": "^3.0", @@ -44,8 +44,8 @@ "doctrine/cache": "^1.6" }, "require-dev": { - "phpunit/phpunit": "4.8.*", - "squizlabs/php_codesniffer": "2.5.*", + "phpunit/phpunit": "^5.0", + "squizlabs/php_codesniffer": "2.6.*", "sebastian/phpcpd": "2.0.*" }, "autoload": { diff --git a/library/includes/functions.php b/library/includes/functions.php index f0d90d3f1..76c501aa0 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -125,7 +125,7 @@ function get_tracks($type) trigger_error(__FUNCTION__ . ": invalid type '$type'", E_USER_ERROR); } $tracks = !empty($_COOKIE[$c_name]) ? unserialize($_COOKIE[$c_name]) : false; - return ($tracks) ? $tracks : array(); + return ($tracks) ? $tracks : []; } /** @@ -358,13 +358,13 @@ function setbit(&$int, $bit_num, $on) * @param int $group_perm * @return array|mixed */ -function auth($type, $forum_id, $ug_data, $f_access = array(), $group_perm = UG_PERM_BOTH) +function auth($type, $forum_id, $ug_data, $f_access = [], $group_perm = UG_PERM_BOTH) { global $lang, $bf, $datastore; $is_guest = true; $is_admin = false; - $auth = $auth_fields = $u_access = array(); + $auth = $auth_fields = $u_access = []; $add_auth_type_desc = ($forum_id != AUTH_LIST_ALL); // @@ -544,10 +544,9 @@ class Date_Delta 31363200 => 'mday', // 12 months 311040000 => 'mon', // 10 years ); - public $intervals = array(); + public $intervals = []; public $format = ''; - // Creates new object. /** * Date_Delta constructor. */ @@ -559,8 +558,9 @@ class Date_Delta $this->format = $lang['DELTA_TIME']['FORMAT']; } - // Makes the spellable phrase. /** + * Makes the spellable phrase. + * * @param $first * @param $last * @param string $from @@ -587,12 +587,12 @@ class Date_Delta // Solve data delta. $delta = $this->getDelta($first, $last); - if (!$delta) { + if (empty($delta)) { return false; } // Make spellable phrase. - $parts = array(); + $parts = []; $intervals = $GLOBALS['lang']['DELTA_TIME']['INTERVALS']; foreach (array_reverse($delta) as $k => $n) { @@ -613,16 +613,17 @@ class Date_Delta return join(' ', $parts); } - // returns the associative array with date deltas. /** + * Returns the associative array with date deltas. + * * @param $first * @param $last - * @return bool + * @return array */ public function getDelta($first, $last) { if ($last < $first) { - return false; + return []; } // Solve H:M:S part. @@ -662,8 +663,9 @@ class Date_Delta return $delta; } - // Returns the length (in days) of the specified month. /** + * Returns the length (in days) of the specified month. + * * @param $year * @param $mon * @return int @@ -698,7 +700,8 @@ function delta_time($timestamp_1, $timestamp_2 = TIMENOW, $granularity = 'auto') */ function get_select($select, $selected = null, $return_as = 'html', $first_opt = '»» Выбрать ') { - $select_ary = array(); + $select_name = ''; + $select_ary = []; switch ($select) { case 'groups': @@ -725,10 +728,10 @@ function get_select($select, $selected = null, $return_as = 'html', $first_opt = class html_common { public $options = ''; - public $attr = array(); + public $attr = []; public $cur_attr = null; public $max_length = HTML_SELECT_MAX_LENGTH; - public $selected = array(); + public $selected = []; /** * @param $name @@ -749,7 +752,7 @@ class html_common $this->selected = array_flip((array)$selected); $this->max_length = $max_length; - $this->attr = array(); + $this->attr = []; $this->cur_attr =& $this->attr; if (isset($params['__attributes'])) { @@ -1019,8 +1022,8 @@ function commify($number) */ function humn_size($size, $rounder = null, $min = null, $space = ' ') { - static $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); - static $rounders = array(0, 0, 0, 2, 3, 3, 3, 3, 3); + static $sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + static $rounders = [0, 0, 0, 2, 3, 3, 3, 3, 3]; $size = (float)$size; $ext = $sizes[0]; @@ -1152,7 +1155,7 @@ function set_var(&$result, $var, $type, $multibyte = false, $strip = true) $result = $var; if ($type == 'string') { - $result = trim(htmlspecialchars(str_replace(array("\r\n", "\r"), array("\n", "\n"), $result))); + $result = trim(htmlspecialchars(str_replace(["\r\n", "\r"], ["\n", "\n"], $result))); if (!empty($result)) { // Make sure multibyte characters are wellformed @@ -1181,15 +1184,17 @@ function set_var(&$result, $var, $type, $multibyte = false, $strip = true) */ function request_var($var_name, $default, $multibyte = false, $cookie = false) { + $key_type = $sub_key_type = $sub_type = ''; + if (!$cookie && isset($_COOKIE[$var_name])) { if (!isset($_GET[$var_name]) && !isset($_POST[$var_name])) { - return (is_array($default)) ? array() : $default; + return (is_array($default)) ? [] : $default; } $_REQUEST[$var_name] = isset($_POST[$var_name]) ? $_POST[$var_name] : $_GET[$var_name]; } if (!isset($_REQUEST[$var_name]) || (is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($default) && !is_array($_REQUEST[$var_name]))) { - return (is_array($default)) ? array() : $default; + return (is_array($default)) ? [] : $default; } $var = $_REQUEST[$var_name]; @@ -1211,7 +1216,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) if (is_array($var)) { $_var = $var; - $var = array(); + $var = []; foreach ($_var as $k => $v) { set_var($k, $k, $key_type); @@ -1244,10 +1249,10 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) function get_username($user_id) { if (empty($user_id)) { - return is_array($user_id) ? array() : false; + return is_array($user_id) ? [] : false; } if (is_array($user_id)) { - $usernames = array(); + $usernames = []; foreach (DB()->fetch_rowset("SELECT user_id, username FROM " . BB_USERS . " WHERE user_id IN(" . get_id_csv($user_id) . ")") as $row) { $usernames[$row['user_id']] = $row['username']; } @@ -1421,7 +1426,7 @@ function bb_get_config($table, $from_db = false, $update_cache = true) */ function bb_update_config($params, $table = BB_CONFIG) { - $updates = array(); + $updates = []; foreach ($params as $name => $val) { $updates[] = array( 'config_name' => $name, @@ -1618,7 +1623,7 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n if (is_null($max_length)) { $max_length = HTML_SELECT_MAX_LENGTH; } - $select = is_null($all_forums_option) ? array() : array($lang['ALL_AVAILABLE'] => $all_forums_option); + $select = is_null($all_forums_option) ? [] : array($lang['ALL_AVAILABLE'] => $all_forums_option); if (!$forums = $datastore->get('cat_forums')) { $datastore->update('cat_forums'); $forums = $datastore->get('cat_forums'); @@ -2571,7 +2576,7 @@ function get_title_match_topics($search) /** @var \TorrentPier\Di $di */ $di = \TorrentPier\Di::getInstance(); - $where_ids = array(); + $where_ids = []; $forum_ids = (isset($search['ids']) && is_array($search['ids'])) ? array_diff($search['ids'], array(0 => 0)) : ''; $title_match_sql = encode_text_match($search['query']); diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 3d356b49e..a3f51fc07 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -33,8 +33,8 @@ if (!defined('BB_CFG_LOADED')) { trigger_error('File config.php not loaded', E_USER_ERROR); } -if (PHP_VERSION < '5.5') { - die('TorrentPier requires PHP version 5.5 and above (ZF requirement). Your PHP version is ' . PHP_VERSION); +if (PHP_VERSION < '7.0.8') { + die('TorrentPier requires PHP version 7.0.8 and above (used code and packages requirement). Your PHP version is ' . PHP_VERSION); } /** @var \TorrentPier\Di $di */ diff --git a/library/language/en/main.php b/library/language/en/main.php index 41fc88a7b..1a84b944c 100644 --- a/library/language/en/main.php +++ b/library/language/en/main.php @@ -1589,7 +1589,6 @@ $lang['CREATE_PROFILE'] = 'Create profile'; $lang['TP_VERSION'] = 'TorrentPier version'; $lang['TP_RELEASE_DATE'] = 'Release date'; -$lang['ZF_VERSION'] = 'Zend Framework version'; $lang['PHP_INFO'] = 'Information about PHP'; $lang['CLICK_RETURN_ADMIN_INDEX'] = 'Click %sHere%s to return to the Admin Index'; @@ -1602,8 +1601,6 @@ $lang['NUMBER_USERS'] = 'Number of users'; $lang['USERS_PER_DAY'] = 'Users per day'; $lang['BOARD_STARTED'] = 'Board started'; $lang['AVATAR_DIR_SIZE'] = 'Avatar directory size'; -$lang['DATABASE_SIZE'] = 'Database size'; -$lang['GZIP_COMPRESSION'] = 'Gzip compression'; $lang['NOT_AVAILABLE'] = 'Not available'; // Clear Cache diff --git a/library/language/ru/main.php b/library/language/ru/main.php index 6a835b59d..37c2b4348 100644 --- a/library/language/ru/main.php +++ b/library/language/ru/main.php @@ -1589,7 +1589,6 @@ $lang['CREATE_PROFILE'] = 'Создать аккаунт'; $lang['TP_VERSION'] = 'Версия TorrentPier'; $lang['TP_RELEASE_DATE'] = 'Дата выпуска'; -$lang['ZF_VERSION'] = 'Версия Zend Framework'; $lang['PHP_INFO'] = 'Информация о PHP'; $lang['CLICK_RETURN_ADMIN_INDEX'] = '%sВернуться на главную страницу администраторского раздела%s'; @@ -1602,8 +1601,6 @@ $lang['NUMBER_USERS'] = 'Кол-во пользователей'; $lang['USERS_PER_DAY'] = 'Пользователей в день'; $lang['BOARD_STARTED'] = 'Дата запуска'; $lang['AVATAR_DIR_SIZE'] = 'Размер директории с аватарами'; -$lang['DATABASE_SIZE'] = 'Объем БД'; -$lang['GZIP_COMPRESSION'] = 'сжатие Gzip'; $lang['NOT_AVAILABLE'] = 'Недоступно'; // Clear Cache diff --git a/library/language/uk/main.php b/library/language/uk/main.php index 1b20226f4..05f801292 100644 --- a/library/language/uk/main.php +++ b/library/language/uk/main.php @@ -1589,7 +1589,6 @@ $lang['CREATE_PROFILE'] = 'Створити акаунт'; $lang['TP_VERSION'] = 'Версія TorrentPier'; $lang['TP_RELEASE_DATE'] = 'Дата випуску'; -$lang['ZF_VERSION'] = 'Версія Zend Framework'; $lang['PHP_INFO'] = 'Інформація про PHP'; $lang['CLICK_RETURN_ADMIN_INDEX'] = '%sВернуться на головну сторінку адміністраторського розділу%s'; @@ -1602,8 +1601,6 @@ $lang['NUMBER_USERS'] = 'Кількість користувачів'; $lang['USERS_PER_DAY'] = 'Користувачів'; $lang['BOARD_STARTED'] = 'Дата запуску'; $lang['AVATAR_DIR_SIZE'] = 'Розмір директорії з аватарами'; -$lang['DATABASE_SIZE'] = "Об'єм БД"; -$lang['GZIP_COMPRESSION'] = 'стискання Gzip'; $lang['NOT_AVAILABLE'] = 'Недоступне'; // Clear Cache diff --git a/package.json b/package.json index 4c4d0061f..c606f113b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "torrentpier", - "version": "2.1.0", + "version": "2.2.0", "description": "TorrentPier. Bittorrent-tracker engine", "main": "build/index.js", "directories": { diff --git a/styles/js/bbcode.js b/styles/js/bbcode.js index 7828ec7e1..5fa43ed43 100644 --- a/styles/js/bbcode.js +++ b/styles/js/bbcode.js @@ -91,7 +91,7 @@ BBCode.prototype = { } else { return [null, null]; } - if (text == '') text = this.stext; + if (text === '') text = this.stext; text = "" + text; text = text.replace("/^\s+|\s+$/g", ""); return [text, range]; @@ -134,20 +134,20 @@ BBCode.prototype = { var rt = this.getSelection(); var text = rt[0]; 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 if (range) { - var notEmpty = text != null && text != ''; + var notEmpty = text !== null && text !== ''; var newText = open + fTrans(text) + (close ? close : ''); range.text = newText; range.collapse(); - if (text != '') { + 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++; + 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 { @@ -163,7 +163,7 @@ BBCode.prototype = { var sel = fTrans(t.value.substr(start, end - start)); var inner = open + sel + close; t.value = sel1 + inner + sel2; - if (sel != '') { + if (sel !== '') { t.setSelectionRange(start, start + inner.length); notEmpty = true; } else { @@ -199,21 +199,21 @@ BBCode.prototype = { // Pressed control key? if (tag.ctrlKey && !e[tag.ctrlKey + "Key"]) continue; // Pressed needed key? - if (!tag.key || key.toUpperCase() != tag.key.toUpperCase()) continue; + if (!tag.key || key.toUpperCase() !== tag.key.toUpperCase()) continue; // Insert - if (e.type == "keydown") this.insertTag(id); + 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) { + if (type === 'press' && e.keyCode === this.VK_TAB && !e.shiftKey && !e.ctrlKey && !e.altKey) { this.insertAtCursor('[tab]'); return this._cancelEvent(e); } // 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(); return this._cancelEvent(e); } @@ -221,9 +221,9 @@ BBCode.prototype = { // Hot keys var form = this.textarea.form; var submitter = null; - 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; - 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; if (submitter) { submitter.click(); @@ -249,13 +249,13 @@ BBCode.prototype = { var elt = tag.elt; if (elt) { 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; }); } - if (elt.tagName && elt.tagName.toUpperCase() == "SELECT") { + if (elt.tagName && elt.tagName.toUpperCase() === "SELECT") { addEvent(elt, 'change', function () { th.insertTag(id); return false; @@ -263,7 +263,7 @@ BBCode.prototype = { } } 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"); } }, @@ -275,12 +275,12 @@ BBCode.prototype = { // 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; + 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; + 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); }, @@ -440,7 +440,7 @@ 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') { + if (typeof link.href !== 'string') { continue; } if (/^http(?:s|):\/\/www.youtube.com\/watch\?(.*)?(&?v=([a-z0-9\-_]+))(.*)?|http:\/\/youtu.be\/.+/i.test(link.href)) { @@ -449,7 +449,7 @@ function initMedia(context) { a.innerHTML = ''; 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; + var text = e.target.nextSibling.innerText !== "" ? e.target.nextSibling.innerText : e.target.nextSibling.href; $('#Panel_youtube').remove(); ypanel('youtube', { title: '' + text + '', diff --git a/styles/js/main.js b/styles/js/main.js index 5ed9224a9..0e0913535 100644 --- a/styles/js/main.js +++ b/styles/js/main.js @@ -2,9 +2,9 @@ function $p() { var elements = []; for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; - if (typeof element == 'string') + if (typeof element === 'string') element = document.getElementById(element); - if (arguments.length == 1) + if (arguments.length === 1) return element; elements.push(element); } @@ -43,7 +43,7 @@ var EventCache = function () { if (item[0].removeEventListener) { item[0].removeEventListener(item[1], item[2], item[3]); } - if (item[1].substring(0, 2) != "on") { + if (item[1].substring(0, 2) !== "on") { item[1] = "on" + item[1]; } if (item[0].detachEvent) { @@ -60,7 +60,7 @@ if (document.all) { function imgFit(img, maxW) { img.title = 'Размеры изображения: ' + img.width + ' x ' + img.height; - if (typeof(img.naturalHeight) == 'undefined') { + if (typeof(img.naturalHeight) === 'undefined') { img.naturalHeight = img.height; img.naturalWidth = img.width; } @@ -71,7 +71,7 @@ function imgFit(img, maxW) { img.style.cursor = 'move'; return false; } - else if (img.width == maxW && img.width < img.naturalWidth) { + else if (img.width === maxW && img.width < img.naturalWidth) { img.height = img.naturalHeight; img.width = img.naturalWidth; img.title = 'Размеры изображения: ' + img.naturalWidth + ' x ' + img.naturalHeight; @@ -84,7 +84,7 @@ function imgFit(img, maxW) { function toggle_block(id) { var el = document.getElementById(id); - el.style.display = (el.style.display == 'none') ? '' : 'none'; + el.style.display = (el.style.display === 'none') ? '' : 'none'; } function toggle_disabled(id, val) { @@ -107,7 +107,7 @@ function rand(min, max) { * secure transmission */ function setCookie(name, value, days, path, domain, secure) { - if (days != 'SESSION') { + if (days !== 'SESSION') { var date = new Date(); days = days || 365; date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); @@ -183,14 +183,14 @@ var Menu = { var curTop = parseInt(CSS.top); var tCorner = $(document).scrollTop() + $(window).height() - 20; var maxVisibleTop = Math.min(curTop, Math.max(0, tCorner - this.$menu.height())); - if (curTop != maxVisibleTop) { + if (curTop !== maxVisibleTop) { CSS.top = maxVisibleTop; } CSS.left += this.offsetCorrection_X; var curLeft = parseInt(CSS.left); var rCorner = $(document).scrollLeft() + $(window).width() - 6; var maxVisibleLeft = Math.min(curLeft, Math.max(0, rCorner - this.$menu.width())); - if (curLeft != maxVisibleLeft) { + if (curLeft !== maxVisibleLeft) { CSS.left = maxVisibleLeft; } this.$menu.css(CSS); @@ -201,13 +201,13 @@ var Menu = { var curLeft = parseInt($menu.css('left')); var rCorner = $(document).scrollLeft() + $(window).width() - 6; var maxVisibleLeft = Math.min(curLeft, Math.max(0, rCorner - $menu.width())); - if (curLeft != maxVisibleLeft) { + if (curLeft !== maxVisibleLeft) { $menu.css('left', maxVisibleLeft); } var curTop = parseInt($menu.css('top')); var tCorner = $(document).scrollTop() + $(window).height() - 20; var maxVisibleTop = Math.min(curTop, Math.max(0, tCorner - $menu.height())); - if (curTop != maxVisibleTop) { + if (curTop !== maxVisibleTop) { $menu.css('top', maxVisibleTop); } }, @@ -387,7 +387,7 @@ Ajax.prototype = { event.stopPropagation(); var params = ajax.params[$(this).attr('id')]; var action = params.action; - if (ajax.state[action] == 'readyToSubmit' || ajax.state[action] == 'error') { + if (ajax.state[action] === 'readyToSubmit' || ajax.state[action] === 'error') { return false; } else { ajax.state[action] = 'readyToSubmit'; @@ -408,13 +408,13 @@ Ajax.prototype = { var inputsHtml = $('#editable-tpl-' + editableType).html(); $editable.hide().after(inputsHtml); var $inputs = $('.editable-inputs', $root); - if (editableType == 'input' || editableType == 'textarea') { + if (editableType === 'input' || editableType === 'textarea') { $('.editable-value', $inputs).val($.trim($editable.text())); } $('input.editable-submit', $inputs).click(function () { var params = ajax.params[rootElementId]; var $val = $('.editable-value', '#' + rootElementId); - params.value = ($val.size() == 1) ? $val.val() : $val.filter(':checked').val(); + params.value = ($val.size() === 1) ? $val.val() : $val.filter(':checked').val(); params.submit = true; ajax.init[params.action](params); }); @@ -454,7 +454,7 @@ $(document).ready(function () { $("#ajax-error").ajaxError(function (req, xml) { var status = xml.status; var text = xml.statusText; - if (status == 200) { + if (status === 200) { status = ''; text = 'неверный формат данных'; } @@ -470,7 +470,7 @@ $(document).ready(function () { params.event = params.event || 'dblclick'; ajax.params[params.id] = params; $("#" + params.id).bind(params.event, ajax.callInitFn); - if (params.event == 'click' || params.event == 'dblclick') { + if (params.event === 'click' || params.event === 'dblclick') { $("#" + params.id).addClass('editable-container'); } }); diff --git a/styles/templates/admin/admin_board.tpl b/styles/templates/admin/admin_board.tpl index 23a7f6dc2..64a0eac9c 100644 --- a/styles/templates/admin/admin_board.tpl +++ b/styles/templates/admin/admin_board.tpl @@ -366,4 +366,4 @@ -
\ No newline at end of file +
diff --git a/styles/templates/admin/admin_bt_forum_cfg.tpl b/styles/templates/admin/admin_bt_forum_cfg.tpl index 8311585cf..7dde860c2 100644 --- a/styles/templates/admin/admin_bt_forum_cfg.tpl +++ b/styles/templates/admin/admin_bt_forum_cfg.tpl @@ -162,4 +162,4 @@ -
\ No newline at end of file +
diff --git a/styles/templates/admin/admin_bt_tracker_cfg.tpl b/styles/templates/admin/admin_bt_tracker_cfg.tpl index 1115f769d..f0b3c713a 100644 --- a/styles/templates/admin/admin_bt_tracker_cfg.tpl +++ b/styles/templates/admin/admin_bt_tracker_cfg.tpl @@ -131,4 +131,4 @@ -
\ No newline at end of file +
diff --git a/styles/templates/admin/admin_cron.tpl b/styles/templates/admin/admin_cron.tpl index 4a69aef50..5e8de8042 100644 --- a/styles/templates/admin/admin_cron.tpl +++ b/styles/templates/admin/admin_cron.tpl @@ -225,4 +225,4 @@ tr.hl-tr:hover td { background-color: #CFC !important; } - \ No newline at end of file + diff --git a/styles/templates/admin/admin_disallow.tpl b/styles/templates/admin/admin_disallow.tpl index 902a00767..557394ead 100644 --- a/styles/templates/admin/admin_disallow.tpl +++ b/styles/templates/admin/admin_disallow.tpl @@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_forum_prune.tpl b/styles/templates/admin/admin_forum_prune.tpl index 888695299..60afe25a9 100644 --- a/styles/templates/admin/admin_forum_prune.tpl +++ b/styles/templates/admin/admin_forum_prune.tpl @@ -45,4 +45,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_forumauth.tpl b/styles/templates/admin/admin_forumauth.tpl index 6bd290707..588d1058b 100644 --- a/styles/templates/admin/admin_forumauth.tpl +++ b/styles/templates/admin/admin_forumauth.tpl @@ -62,4 +62,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_forumauth_list.tpl b/styles/templates/admin/admin_forumauth_list.tpl index ff49557fe..dc8f9190f 100644 --- a/styles/templates/admin/admin_forumauth_list.tpl +++ b/styles/templates/admin/admin_forumauth_list.tpl @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_forums.tpl b/styles/templates/admin/admin_forums.tpl index 2ac997fe6..be15b61e0 100644 --- a/styles/templates/admin/admin_forums.tpl +++ b/styles/templates/admin/admin_forums.tpl @@ -4,7 +4,7 @@ @@ -241,4 +241,4 @@ function hl (id, on)
- \ No newline at end of file + diff --git a/styles/templates/admin/admin_groups.tpl b/styles/templates/admin/admin_groups.tpl index 31a510cc1..7f2d62692 100644 --- a/styles/templates/admin/admin_groups.tpl +++ b/styles/templates/admin/admin_groups.tpl @@ -97,4 +97,4 @@



- \ No newline at end of file + diff --git a/styles/templates/admin/admin_log.tpl b/styles/templates/admin/admin_log.tpl index 887bcb95a..f15b90e53 100644 --- a/styles/templates/admin/admin_log.tpl +++ b/styles/templates/admin/admin_log.tpl @@ -207,4 +207,4 @@ table.log_filters td { - \ No newline at end of file + diff --git a/styles/templates/admin/admin_mass_email.tpl b/styles/templates/admin/admin_mass_email.tpl index 22132dd7c..7507c6be6 100644 --- a/styles/templates/admin/admin_mass_email.tpl +++ b/styles/templates/admin/admin_mass_email.tpl @@ -46,4 +46,4 @@ function checkForm(formObj) return false; } } - \ No newline at end of file + diff --git a/styles/templates/admin/admin_ranks.tpl b/styles/templates/admin/admin_ranks.tpl index a70d28825..e278137c5 100644 --- a/styles/templates/admin/admin_ranks.tpl +++ b/styles/templates/admin/admin_ranks.tpl @@ -86,4 +86,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_rebuild_search.tpl b/styles/templates/admin/admin_rebuild_search.tpl index 28369869a..bb0e8bf15 100644 --- a/styles/templates/admin/admin_rebuild_search.tpl +++ b/styles/templates/admin/admin_rebuild_search.tpl @@ -18,7 +18,7 @@ function update_clear_search(myselect) // enable/disable radio buttons for (i = 0; i < 3; i++) { - document.rebuild.clear_search[i].disabled = ( myselect.options[myselect.selectedIndex].value != 0 ); + document.rebuild.clear_search[i].disabled = ( myselect.options[myselect.selectedIndex].value !== 0 ); } swap_values(); @@ -126,7 +126,7 @@ function updateButton() { if ( ticker >= 0) { - if ( ticker == 0 ) + if ( ticker === 0 ) { document.form_rebuild_progress.submit_button.value = label; document.form_rebuild_progress.submit_button.disabled = true; @@ -253,4 +253,4 @@ function updateButton() - \ No newline at end of file + diff --git a/styles/templates/admin/admin_sitemap.tpl b/styles/templates/admin/admin_sitemap.tpl index 79886e927..05efe3d83 100644 --- a/styles/templates/admin/admin_sitemap.tpl +++ b/styles/templates/admin/admin_sitemap.tpl @@ -66,7 +66,7 @@ ajax.sitemap = function(mode) { }); }; ajax.callback.sitemap = function(data) { - if(data.mode == 'create') $('#mess_time').html(data.html); + if(data.mode === 'create') $('#mess_time').html(data.html); else $('#sitemap').html(data.html); } @@ -119,4 +119,4 @@ ajax.callback.sitemap = function(data) { - \ No newline at end of file + diff --git a/styles/templates/admin/admin_smilies.tpl b/styles/templates/admin/admin_smilies.tpl index 71e177e9c..edc1dc3d2 100644 --- a/styles/templates/admin/admin_smilies.tpl +++ b/styles/templates/admin/admin_smilies.tpl @@ -113,4 +113,4 @@ function update_smiley(newimage) - \ No newline at end of file + diff --git a/styles/templates/admin/admin_terms.tpl b/styles/templates/admin/admin_terms.tpl index 85b6e7a6d..fe9b85d77 100644 --- a/styles/templates/admin/admin_terms.tpl +++ b/styles/templates/admin/admin_terms.tpl @@ -21,4 +21,4 @@ -
\ No newline at end of file +
diff --git a/styles/templates/admin/admin_ug_auth.tpl b/styles/templates/admin/admin_ug_auth.tpl index 36f4f72df..e4f065768 100644 --- a/styles/templates/admin/admin_ug_auth.tpl +++ b/styles/templates/admin/admin_ug_auth.tpl @@ -202,7 +202,7 @@ function flip_perm (f_id, acl_id) var cb = $p('cb_' + id); var td = $p('td_' + id); - if (cb.value == 1) { + if (cb.value === 1) { cb.value = 0; td.className = 'no'; td.innerHTML = '{NO_SIGN}'; @@ -221,7 +221,7 @@ function flip_mod (f_id, acl_id) var cb = $p('cb_' + id); var td = $p('td_' + id); - if (cb.value == 1) { + if (cb.value === 1) { cb.value = 0; td.className = 'noMOD'; td.innerHTML = '{L_NO}'; @@ -239,7 +239,7 @@ function hl (f_id, acl_id, on) var ac = $p('type_' + acl_id); var fn = $p('fname_' + f_id); - if (on == 1) { + if (on === 1) { ac.style.color = fn.style.color = '#FF4500'; } else { ac.style.color = fn.style.color = '#000000'; diff --git a/styles/templates/admin/admin_user_ban.tpl b/styles/templates/admin/admin_user_ban.tpl index 7baefd033..9a86bd10c 100644 --- a/styles/templates/admin/admin_user_ban.tpl +++ b/styles/templates/admin/admin_user_ban.tpl @@ -55,4 +55,4 @@ -

{L_BAN_EXPLAIN_WARN}

\ No newline at end of file +

{L_BAN_EXPLAIN_WARN}

diff --git a/styles/templates/admin/admin_user_search.tpl b/styles/templates/admin/admin_user_search.tpl index 0ef04d088..40db38840 100644 --- a/styles/templates/admin/admin_user_search.tpl +++ b/styles/templates/admin/admin_user_search.tpl @@ -160,4 +160,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/admin_words.tpl b/styles/templates/admin/admin_words.tpl index 4ecf7259d..302608c0b 100644 --- a/styles/templates/admin/admin_words.tpl +++ b/styles/templates/admin/admin_words.tpl @@ -58,4 +58,4 @@ - \ No newline at end of file + diff --git a/styles/templates/admin/index.tpl b/styles/templates/admin/index.tpl index 16aa706d3..d65750f95 100644 --- a/styles/templates/admin/index.tpl +++ b/styles/templates/admin/index.tpl @@ -142,10 +142,6 @@ ajax.callback.manage_admin = function(data) { {L_TP_RELEASE_DATE}: {TP_RELEASE_DATE} - - {L_ZF_VERSION}: - {ZF_VERSION} -
@@ -182,12 +178,6 @@ ajax.callback.manage_admin = function(data) { {L_AVATAR_DIR_SIZE}: {AVATAR_DIR_SIZE} - - {L_DATABASE_SIZE}: - {DB_SIZE} - {L_GZIP_COMPRESSION}: - {GZIP_COMPRESSION} -
@@ -224,4 +214,4 @@ ajax.callback.manage_admin = function(data) { - \ No newline at end of file + diff --git a/styles/templates/default/group_edit.tpl b/styles/templates/default/group_edit.tpl index 115dd8c49..2cb3c4b9a 100644 --- a/styles/templates/default/group_edit.tpl +++ b/styles/templates/default/group_edit.tpl @@ -7,7 +7,7 @@ function manage_group(mode, value) { value : value }); ajax.callback.manage_group = function(data) { - if (data.act == 0) $('div#avatar').hide(100); + if (data.act === 0) $('div#avatar').hide(100); console.log(data); } } diff --git a/styles/templates/default/index_map.tpl b/styles/templates/default/index_map.tpl index cf9c5af1c..10a38c6c8 100644 --- a/styles/templates/default/index_map.tpl +++ b/styles/templates/default/index_map.tpl @@ -20,7 +20,7 @@ function qs_highlight_found () this.style.display = ''; var a = $('a:first', this); var q = $('#q-search').val().toLowerCase(); - if (q != '' && a.text().toLowerCase().indexOf(q) != -1) { + if (q !== '' && a.text().toLowerCase().indexOf(q) !== -1) { a.html(a.text().replace(q, '' + q + '')); } else { diff --git a/styles/templates/default/page_header.tpl b/styles/templates/default/page_header.tpl index 624714f77..e5a792b02 100644 --- a/styles/templates/default/page_header.tpl +++ b/styles/templates/default/page_header.tpl @@ -6,16 +6,16 @@ {META} - + - - + + - + @@ -288,7 +288,7 @@ ajax.callback.index_data = function(data) {}; $(document).ready(function() { x = new Date(); tz = -x.getTimezoneOffset()/60; - if (tz != {BOARD_TIMEZONE}) + if (tz !== {BOARD_TIMEZONE}) { ajax.index_data(tz); } @@ -304,7 +304,7 @@ $(document).ready(function() {
-