From 701c7de6046f016176725d06e588aa33f8ba068d Mon Sep 17 00:00:00 2001 From: Yuriy Pikhtarev Date: Thu, 25 Aug 2016 23:41:20 +0300 Subject: [PATCH] Bower, NMP (+ Gulp) dependency for frontend and some fixes --- .gitignore | 6 +- app.php | 5 -- bootstrap.php | 4 +- bower.json | 24 +++++ composer.json | 8 +- library/includes/bbcode.php | 6 +- library/includes/functions_selects.php | 88 ++++++++----------- package.json | 25 ++++++ styles/templates/admin/admin_ug_auth.tpl | 3 +- .../templates/default/usercp_viewprofile.tpl | 4 +- 10 files changed, 101 insertions(+), 72 deletions(-) create mode 100644 bower.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 6d129415a..aa95de5ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ ### TorrentPier ### -.idea/ +.idea +bower_components composer.phar composer.lock configs/local.php @@ -12,6 +13,7 @@ internal_data/log internal_data/sitemap internal_data/triggers library/config.local.php +node_modules vendor ### Archives ### @@ -36,4 +38,4 @@ $RECYCLE.BIN/ .Spotlight-V100 .Trashes *.orig -*.rej \ No newline at end of file +*.rej diff --git a/app.php b/app.php index 4434da1f5..7c56997ca 100644 --- a/app.php +++ b/app.php @@ -7,17 +7,12 @@ $view = $di->view; /** @var \TorrentPier\Db\Adapter $db */ $db = $di->db; - $view->addGlobal('title', 'Title Page Simple'); - $categories = $db->select('bb_categories', function (\Zend\Db\Sql\Select $query) { $query->join('bb_forums', 'bb_categories.cat_id = bb_forums.cat_id'); })->all(); - - - echo $view->make('app', [ 'data' => 'Hello world', 'categories' => $categories diff --git a/bootstrap.php b/bootstrap.php index 3c4ca85c8..e9171a804 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,8 +2,8 @@ require_once __DIR__ . '/vendor/autoload.php'; -use TorrentPier\Di, - TorrentPier\ServiceProviders; +use TorrentPier\Di; +use TorrentPier\ServiceProviders; $di = new Di(); diff --git a/bower.json b/bower.json new file mode 100644 index 000000000..eca6c23f5 --- /dev/null +++ b/bower.json @@ -0,0 +1,24 @@ +{ + "name": "torrentpier", + "description": "TorrentPier. Bittorrent-tracker engine", + "main": "build/index.js", + "authors": [ + "Exile " + ], + "license": "GPL-3.0", + "homepage": "https://torrentpier.me/", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "bootstrap": "^3.3.7", + "jquery": "^3.1.0", + "moment": "^2.14.1", + "font-awesome": "fontawesome#^4.6.3", + "jquery.quicksearch": "quicksearch#^2.3.0" + } +} diff --git a/composer.json b/composer.json index 8738048ca..af82508b8 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,12 @@ "support": { "email": "support@torrentpier.me", "issues" : "https://github.com/torrentpier/torrentpier/issues", - "forum": "https://torrentpier.me/", - "get": "http://get.torrentpier.me/", - "docs": "http://faq.torrentpier.me/" + "forum": "https://torrentpier.me/forum/", + "get": "https://get.torrentpier.me/", + "docs": "https://faq.torrentpier.me/" }, "require": { "php": "^5.5 || ^7.0", - "ext-curl": "*", - "ext-mbstring": "*", "google/recaptcha": "^1.0", "monolog/monolog": "^1.18", "pimple/pimple": "^3.0", diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php index ede32bb49..4c23bc89b 100644 --- a/library/includes/bbcode.php +++ b/library/includes/bbcode.php @@ -123,7 +123,6 @@ function generate_smilies($mode) if ($num_smilies) { - $smilies_count = ($mode == 'inline') ? min(19, $num_smilies) : $num_smilies; $smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1; $s_colspan = 0; @@ -658,8 +657,6 @@ class bbcode $found_spam = array(); - $tm_start = utime(); - $msg_decoded = $text; $msg_decoded = html_entity_decode($msg_decoded); $msg_decoded = urldecode($msg_decoded); @@ -689,7 +686,6 @@ class bbcode $text = preg_replace("/($spam_exp)(\S*)/i", $spam_replace, $msg_decoded); $text = htmlCHR($text, false, ENT_NOQUOTES); -# bb_log(date("H:i:s") ." | ". sprintf('%.4f', (utime() - $tm_start)) ." | ". sprintf('%-6s', strlen($text)) ." | ". join(' ** ', $found_spam) ."\n", 'spam_filter'); } return $text; @@ -1015,4 +1011,4 @@ function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600) function update_post_html ($postrow) { DB()->query("DELETE FROM ". BB_POSTS_HTML ." WHERE post_id = ". (int) $postrow['post_id'] ." LIMIT 1"); -} \ No newline at end of file +} diff --git a/library/includes/functions_selects.php b/library/includes/functions_selects.php index 0931987af..fdb209fef 100644 --- a/library/includes/functions_selects.php +++ b/library/includes/functions_selects.php @@ -2,67 +2,57 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); -// // Languages -// -function language_select ($default_lang, $select_name = 'language') +function language_select($default_lang, $select_name = 'language') { - /** @var \TorrentPier\Di $di */ - $di = \TorrentPier\Di::getInstance(); + /** @var \TorrentPier\Di $di */ + $di = \TorrentPier\Di::getInstance(); - $lang_select = ''; - return ($x > 1) ? $lang_select : reset($di->config->get('lang'))['name']; + $lang_select = ''; + return ($x > 1) ? $lang_select : $di->config->get('lang')->ru; } -// // Pick a timezone -// -function tz_select ($default, $select_name = 'timezone') +function tz_select($default, $select_name = 'timezone') { - global $sys_timezone, $lang; + global $sys_timezone, $lang; - if (!isset($default)) - { - $default = $sys_timezone; - } - $tz_select = ''; - while( list($offset, $zone) = each($lang['TZ']) ) - { - $selected = ( $offset == $default ) ? ' selected="selected"' : ''; - $tz_select .= ''; - } - $tz_select .= ''; + while (list($offset, $zone) = each($lang['TZ'])) { + $selected = ($offset == $default) ? ' selected="selected"' : ''; + $tz_select .= ''; + } + $tz_select .= ''; - return $tz_select; + return $tz_select; } -// // Templates -// -function templates_select ($default_style, $select_name = 'tpl_name') +function templates_select($default_style, $select_name = 'tpl_name') { - /** @var \TorrentPier\Di $di */ - $di = \TorrentPier\Di::getInstance(); + /** @var \TorrentPier\Di $di */ + $di = \TorrentPier\Di::getInstance(); - $templates_select = ''; - return ($x > 1) ? $templates_select : reset($di->config->get('templates')); -} \ No newline at end of file + $templates_select = ''; + return ($x > 1) ? $templates_select : $di->config->get('templates')->default; +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..4c4d0061f --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "torrentpier", + "version": "2.1.0", + "description": "TorrentPier. Bittorrent-tracker engine", + "main": "build/index.js", + "directories": { + "test": "tests" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/torrentpier/torrentpier.git" + }, + "author": "", + "license": "GPL-3.0", + "bugs": { + "url": "https://github.com/torrentpier/torrentpier/issues" + }, + "homepage": "https://torrentpier.me/", + "devDependencies": { + "gulp": "^3.9.1" + } +} diff --git a/styles/templates/admin/admin_ug_auth.tpl b/styles/templates/admin/admin_ug_auth.tpl index ae3d87fec..36f4f72df 100644 --- a/styles/templates/admin/admin_ug_auth.tpl +++ b/styles/templates/admin/admin_ug_auth.tpl @@ -17,7 +17,6 @@ table>tbody { } thead tr { position: relative; - top: expression($p("tScrollCont").scrollTop); /* IE5+ only */ } .tPerm { background-color: #B4BBC8; margin-top: -2px; @@ -322,4 +321,4 @@ function mark_changed (f_id, acl_id)



- \ No newline at end of file + diff --git a/styles/templates/default/usercp_viewprofile.tpl b/styles/templates/default/usercp_viewprofile.tpl index b0102a521..7a4d95807 100644 --- a/styles/templates/default/usercp_viewprofile.tpl +++ b/styles/templates/default/usercp_viewprofile.tpl @@ -177,7 +177,7 @@ ajax.callback.gen_passkey = function(data){