diff --git a/.gitignore b/.gitignore index d430f2cc7..49e80b6e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,11 @@ ### TorrentPier ### .idea/ -data/avatars/**/ +data/avatars/ data/old_files/ data/torrent_files/ internal_data/ajax_html/*.html internal_data/atom/ internal_data/cache/ -internal_data/captcha/**/ internal_data/log/ internal_data/sitemap/*.xml internal_data/triggers/ @@ -32,4 +31,6 @@ $RECYCLE.BIN/ .LSOverride ._* .Spotlight-V100 -.Trashes \ No newline at end of file +.Trashes +*.orig +*.rej \ No newline at end of file diff --git a/README.md b/README.md index af7f6a07f..7034b6f02 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ TorrentPier II - движок торрент-трекера, написанны - internal_data/ajax_html - internal_data/atom - internal_data/cache -- internal_data/captcha - internal_data/log - internal_data/sitemap - internal_data/triggers diff --git a/admin/admin_ranks.php b/admin/admin_ranks.php index dd9f6df05..641ea54e3 100644 --- a/admin/admin_ranks.php +++ b/admin/admin_ranks.php @@ -77,7 +77,7 @@ if ($mode != '') 'SPECIAL_RANK' => $rank_is_special, 'NOT_SPECIAL_RANK' => $rank_is_not_special, 'MINIMUM' => ($rank_is_special) ? '' : @$rank_info['rank_min'], - 'IMAGE' => !empty($rank_info['rank_image']) ? $rank_info['rank_image'] : 'images/ranks/rank_image.png', + 'IMAGE' => !empty($rank_info['rank_image']) ? $rank_info['rank_image'] : 'styles/images/ranks/rank_image.png', 'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '', 'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '' : '', diff --git a/admin/index.php b/admin/index.php index 1334f3d8b..33c3cd5f7 100644 --- a/admin/index.php +++ b/admin/index.php @@ -23,8 +23,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') $template->assign_vars(array( 'TPL_ADMIN_NAVIGATE' => true, - 'U_FORUM_INDEX' => '../index.php', - 'U_ADMIN_INDEX' => 'index.php?pane=right', + 'U_FORUM_INDEX' => '../index.php', + 'U_ADMIN_INDEX' => 'index.php?pane=right', )); ksort($module); @@ -269,6 +269,7 @@ else { // Generate frameset $template->assign_vars(array( + 'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'], 'TPL_ADMIN_FRAMESET' => true, )); send_no_cache_headers(); diff --git a/ajax.php b/ajax.php index 0f40f474d..b0d3e8b0b 100644 --- a/ajax.php +++ b/ajax.php @@ -249,7 +249,7 @@ class ajax_common } } - $response_js = bb_json_encode($this->response); + $response_js = Zend\Json\Json::encode($this->response); if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) { diff --git a/common.php b/common.php index 0bf328a70..68d47bf0f 100644 --- a/common.php +++ b/common.php @@ -25,6 +25,9 @@ require(BB_ROOT . 'library/Zend/Loader/StandardAutoloader.php'); $loader = new StandardAutoloader(array('autoregister_zf' => true)); $loader->register(); +// ZF use +use Zend\Json; + $server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://'; $server_port = (in_array($bb_cfg['server_port'], array(80, 443))) ? '' : ':' . $bb_cfg['server_port']; define('FORUM_PATH', $bb_cfg['script_path']); diff --git a/dl.php b/dl.php index 845e7353f..c46645bb7 100644 --- a/dl.php +++ b/dl.php @@ -17,7 +17,7 @@ $thumbnail = request_var('thumb', 0); // Send file to browser function send_file_to_browser($attachment, $upload_dir) { - global $lang, $attach_config; + global $bb_cfg, $lang, $userdata; $filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename']; @@ -50,7 +50,7 @@ function send_file_to_browser($attachment, $upload_dir) header('Pragma: public'); $real_filename = clean_filename(basename($attachment['real_filename'])); $mimetype = $attachment['mimetype'].';'; - $charset = (isset($lang['CONTENT_ENCODING'])) ? "charset={$lang['CONTENT_ENCODING']};" : ''; + $charset = "charset={$bb_cfg['lang'][$userdata['user_lang']]['encoding']};"; // Send out the Headers header("Content-Type: $mimetype $charset name=\"$real_filename\""); @@ -203,14 +203,14 @@ if ($download_mode == PHYSICAL_LINK) } else { - if (IS_GUEST && !CAPTCHA()->verify_code()) + if (IS_GUEST && !bb_captcha('check')) { global $template; $redirect_url = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/'); $message = '
'; - $message .= $lang['CONFIRM_CODE']; - $message .= '
'. CAPTCHA()->get_html() .'
'; + $message .= $lang['CAPTCHA'].':'; + $message .= '
'. bb_captcha('get') .'
'; $message .= ''; $message .= '  '; $message .= ''; diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index 186a10624..9763848dc 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -414,21 +414,6 @@ CREATE TABLE IF NOT EXISTS `bb_bt_user_settings` ( -- Records of bb_bt_user_settings -- ---------------------------- --- ---------------------------- --- Table structure for `bb_captcha` --- ---------------------------- -DROP TABLE IF EXISTS `bb_captcha`; -CREATE TABLE IF NOT EXISTS `bb_captcha` ( - `cap_id` int(10) NOT NULL DEFAULT '0', - `cap_code` char(6) NOT NULL DEFAULT '', - `cap_expire` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`cap_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of bb_captcha --- ---------------------------- - -- ---------------------------- -- Table structure for `bb_categories` -- ---------------------------- @@ -589,9 +574,9 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'DS update stats', 'ds_update_stats.php', INSERT INTO `bb_cron` VALUES ('', '1', 'Flash topic view', 'flash_topic_view.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Clean search results', 'clean_search_results.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', '', '', '20', '', '', '00:15:00', '0', '', '0', '0', '0'); +INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:15:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', '', '', '10', '', '', '00:10:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', '', '', '255', '', '', '01:00:00', '0', '', '0', '0', '0'); -INSERT INTO `bb_cron` VALUES ('', '1', 'Captcha', 'captcha_gen_gc.php', 'daily', '', '05:00:00', '120', '', '', '', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', '', '', '255', '', '', '06:00:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Cache garbage collector', 'cache_gc.php', 'interval', '', '', '255', '', '', '00:05:00', '0', '', '0', '0', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Sitemap update', 'sitemap.php', 'daily', '', '06:00:00', '30', '', '', '', '0', '', '0', '0', '0'); diff --git a/install/upgrade/changes.txt b/install/upgrade/changes.txt index a18e98d6b..acbed64ed 100644 --- a/install/upgrade/changes.txt +++ b/install/upgrade/changes.txt @@ -2,6 +2,7 @@ Изменения в базе: +// 2.1.1 DROP TABLE IF EXISTS `bb_reports`; DROP TABLE IF EXISTS `bb_reports_changes`; DROP TABLE IF EXISTS `bb_reports_modules`; @@ -18,4 +19,37 @@ ALTER TABLE `bb_privmsgs` DROP COLUMN `privmsgs_reported`; ALTER TABLE `bb_topics` DROP COLUMN `topic_reported`; DELETE FROM `bb_cron` WHERE `cron_script` = 'site_backup.php'; DELETE FROM `bb_cron` WHERE `cron_script` = 'db_backup.php'; -UPDATE `bb_cron` SET `cron_script` = 'board_maintenance.php' WHERE `cron_script` = 'bb_maintenance.php'; \ No newline at end of file +UPDATE `bb_cron` SET `cron_script` = 'board_maintenance.php' WHERE `cron_script` = 'bb_maintenance.php'; +UPDATE `bb_attachments_config` SET `config_value` = 'data/old_files' WHERE `config_name` = 'upload_dir'; +UPDATE `bb_attachments_config` SET `config_value` = 'styles/images/icon_clip.gif' WHERE `config_name` = 'upload_img'; +UPDATE `bb_attachments_config` SET `config_value` = 'styles/images/icon_clip.gif' WHERE `config_name` = 'topic_icon'; +UPDATE `bb_config` SET `config_value` = 'styles/images/smiles' WHERE `config_name` = 'smilies_path'; + +// 2.1.4 +ALTER TABLE `bb_bt_tracker` DROP COLUMN `ul_gdc`; +ALTER TABLE `bb_bt_tracker` DROP COLUMN `ul_gdc_c`; +ALTER TABLE `bb_bt_tracker` DROP COLUMN `ul_16k_c`; +ALTER TABLE `bb_bt_tracker` DROP COLUMN `ul_eq_dl`; +ALTER TABLE `bb_bt_torrents` CHANGE `info_hash` `info_hash` VARBINARY(20) NOT NULL DEFAULT ''; +ALTER TABLE `bb_bt_torrents` CHANGE `speed_up` `speed_up` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_bt_torrents` CHANGE `speed_down` `speed_down` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_bt_tracker` CHANGE `peer_id` `peer_id` VARCHAR(20) NOT NULL DEFAULT '0'; +UPDATE `bb_config` SET `config_value` = '180' WHERE `config_name` = 'cron_check_interval'; +ALTER TABLE `bb_cron` CHANGE `run_order` `run_order` TINYINT(4) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `bb_cron` CHANGE `run_interval` `run_interval` TIME DEFAULT NULL DEFAULT '0'; +ALTER TABLE `bb_groups` CHANGE `group_description` `group_description` TEXT NOT NULL; +ALTER TABLE `bb_groups` CHANGE `group_signature` `group_signature` TEXT NOT NULL; +ALTER TABLE `bb_posts` CHANGE `mc_comment` `mc_comment` TEXT NOT NULL; +ALTER TABLE `bb_posts` CHANGE `mc_user_id` `mc_user_id` MEDIUMINT(8) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_posts_html` CHANGE `post_html` `post_html` MEDIUMTEXT NOT NULL DEFAULT ''; +ALTER TABLE `bb_users` CHANGE `user_regdate` `user_regdate` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_users` CHANGE `user_lang` `user_lang` VARCHAR(255) NOT NULL DEFAULT 'ru'; +ALTER TABLE `bb_users` CHANGE `avatar_ext_id` `avatar_ext_id` TINYINT(4) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_user_group` CHANGE `user_time` `user_time` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `bb_bt_tracker` ADD `client` VARCHAR(51) NOT NULL DEFAULT 'Unknown' AFTER `port`; +ALTER TABLE `bb_bt_tracker` ADD `complete` INT(11) NOT NULL DEFAULT '0' AFTER `complete_percent`; + +// 2.1.5 +DROP TABLE IF EXISTS `bb_captcha`; +DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php'; +INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:15:00', '0', '', '0', '0', '0'); \ No newline at end of file diff --git a/library/ajax/change_user_opt.php b/library/ajax/change_user_opt.php index 5cf33d2ef..db9fc94e8 100644 --- a/library/ajax/change_user_opt.php +++ b/library/ajax/change_user_opt.php @@ -5,7 +5,7 @@ if (!defined('IN_AJAX')) die(basename(__FILE__)); global $bf, $lang; $user_id = (int) $this->request['user_id']; -$new_opt = bb_json_decode($this->request['user_opt']); +$new_opt = Zend\Json\Json::decode($this->request['user_opt'], Zend\Json\Json::TYPE_ARRAY); if (!$user_id OR !$u_data = get_userdata($user_id)) { diff --git a/library/ajax/user_register.php b/library/ajax/user_register.php index aa0a3d009..818b95c28 100644 --- a/library/ajax/user_register.php +++ b/library/ajax/user_register.php @@ -66,10 +66,6 @@ switch($mode) } } break; - - case 'refresh_captcha'; - $html = CAPTCHA()->get_html(); - break; } $this->response['html'] = $html; diff --git a/library/config.php b/library/config.php index 2e7d35932..7592a7ad4 100644 --- a/library/config.php +++ b/library/config.php @@ -33,7 +33,7 @@ * Email * Debug * Special users (dbg_users, unlimited_users, super_admins) - * LOG + * Log options * Error reporting * Triggers * Date format @@ -72,8 +72,8 @@ $domain_name = 'torrentpier.me'; // enter here your primary domain name of your $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name; // Version info -$bb_cfg['tp_version'] = '2.1.4'; -$bb_cfg['tp_release_date'] = '26-11-2014'; +$bb_cfg['tp_version'] = '2.1.5'; +$bb_cfg['tp_release_date'] = '06-12-2014'; $bb_cfg['tp_release_state'] = 'ALPHA'; $bb_cfg['tp_zf_version'] = '2.3.3'; @@ -101,7 +101,6 @@ $bb_cfg['db_alias'] = array( 'ip' => 'db1', // BB_POSTS_IP 'ut' => 'db1', // BB_TOPICS_USER_POSTED # db3 - 'cap' => 'db1', // BB_CAPTCHA 'pm' => 'db1', // BB_PRIVMSGS, BB_PRIVMSGS_TEXT 'pt' => 'db1', // BB_POSTS_TEXT ); @@ -305,11 +304,25 @@ else } } -$bb_cfg['languages'] = array( -// 'folder' => 'Name', - 'ru' => 'Русский', - 'uk' => 'Український', - 'en' => 'English', +$bb_cfg['lang'] = array( + 'ru' => array( + 'name' => 'Русский', + 'locale' => 'ru_RU.UTF-8', + 'encoding' => 'UTF-8', + 'captcha' => 'ru', + ), + 'uk' => array( + 'name' => 'Український', + 'locale' => 'uk_UA.UTF-8', + 'encoding' => 'UTF-8', + 'captcha' => 'uk', + ), + 'en' => array( + 'name' => 'English', + 'locale' => 'en_US.UTF-8', + 'encoding' => 'UTF-8', + 'captcha' => 'en', + ), ); // Templates @@ -354,7 +367,7 @@ $bb_cfg['invalid_logins'] = 5; // Количество не $bb_cfg['new_user_reg_disabled'] = false; // Запретить регистрацию новых учетных записей $bb_cfg['unique_ip'] = false; // Запретить регистрацию нескольких учетных записей с одного ip $bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени с 01:00 до 17:00 -$bb_cfg['reg_email_activation'] = false; // Требовать активацию учетной записи по email +$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email // Email $bb_cfg['emailer_disabled'] = false; @@ -413,22 +426,6 @@ define('LOG_SEPR', ' | '); define('LOG_LF', "\n"); define('LOG_MAX_SIZE', 1048576); // bytes -// Log request -$log_ip_req = array( -# '127.0.0.1' => 'user1', // CLIENT_IP => 'name' -# '7f000001' => 'user2', // USER_IP => 'name' -); - -$log_passkey = array( -# 'passkey' => 'log_filename', -); - -// Log response -$log_ip_resp = array( -# '127.0.0.1' => 'user1', // CLIENT_IP => 'name' -# '7f000001' => 'user2', // USER_IP => 'name' -); - // Error reporting ini_set('error_reporting', E_ALL); ini_set('display_errors', 0); @@ -621,11 +618,12 @@ $bb_cfg['group_avatars'] = array( ); // Captcha +// Get a Google reCAPTCHA API Key: https://www.google.com/recaptcha/admin $bb_cfg['captcha'] = array( 'disabled' => false, - 'secret_key' => 'secret_key', - 'img_path' => INT_DATA_DIR .'captcha/', // with ending slash - 'img_url' => './internal_data/captcha/', // with ending slash + 'public_key' => '', // your public key + 'secret_key' => '', // your secret key + 'theme' => 'light', // light or dark ); // Atom feed diff --git a/library/includes/captcha/.htaccess b/library/includes/captcha/.htaccess deleted file mode 100644 index baa56e5a3..000000000 --- a/library/includes/captcha/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -order allow,deny -deny from all \ No newline at end of file diff --git a/library/includes/captcha/captcha.php b/library/includes/captcha/captcha.php deleted file mode 100644 index 4b8366ca2..000000000 --- a/library/includes/captcha/captcha.php +++ /dev/null @@ -1,398 +0,0 @@ -cfg = $cfg; - $this->can_bypass = !empty($_POST[$this->cfg['secret_key']]); - $this->curr_code_key = $this->get_key_name(TIMENOW); - $this->prev_code_key = $this->get_key_name(TIMENOW - $this->key_ttl); - } - - function verify_code () - { - // обход - if ($this->can_bypass || $this->cfg['disabled']) - { - if (!empty($_POST[$this->cfg['secret_key']])) log_get('cap/off', @$_POST['login_username']); - return true; - } - // cap_sid - if (isset($_POST[$this->cap_sid_key]) && verify_id($_POST[$this->cap_sid_key], $this->cap_sid_len)) - { - $this->cap_sid_val = $_POST[$this->cap_sid_key]; - } - else - { - return false; - } - // code - $entered_code = ''; - if (isset($_POST[$this->curr_code_key])) - { - $entered_code = (string) $_POST[$this->curr_code_key]; - } - else if (isset($_POST[$this->prev_code_key])) - { - $entered_code = (string) $_POST[$this->prev_code_key]; - } - - $entered_code = strtolower(trim($entered_code)); - - $valid_code = $this->get_code(); - - if ($entered_code === $valid_code) - { - $this->del_sid(); - return true; - } - else - { - $this->del_sid(); - return false; - } - } - - function get_html () - { - if ($this->cfg['disabled']) return ''; - - $this->gen_cap_sid(); - $this->new_img_url = $this->get_img_url($this->new_cap_id); - $this->new_code_key = $this->get_key_name(TIMENOW); - - return ' -
pic
- - - '; - } - - function get_code () - { - if ($this->cap_sid_val AND $code = CACHE('bb_cap_sid')->get('c_sid_'. $this->cap_sid_val)) - { - return strtolower(trim($code)); - } - else - { - return null; - } - } - - function del_sid () - { - if ($this->cap_sid_val) - { - CACHE('bb_cap_sid')->rm('c_sid_'. $this->cap_sid_val); - } - } - - function gen_cap_sid () - { - $row = DB('cap')->fetch_row("SELECT MIN(cap_id) AS min_id, MAX(cap_id) AS max_id FROM ". BB_CAPTCHA ." WHERE cap_id > 0"); - - $min_id = intval($row['min_id']) + $this->new_per_minute; - $max_id = intval($row['max_id']); - - $this->new_cap_id = ($min_id < $max_id) ? mt_rand($min_id, $max_id) : $max_id; - - $this->new_cap_code = (string) DB('cap')->fetch_row("SELECT cap_code FROM ". BB_CAPTCHA ." WHERE cap_id = {$this->new_cap_id}", 'cap_code'); - - $this->new_cap_sid = make_rand_str($this->cap_sid_len); - - CACHE('bb_cap_sid')->set('c_sid_'. $this->new_cap_sid, $this->new_cap_code, $this->key_ttl*2); - } - - function get_img_url ($id) - { - return $this->get_path($id, $this->cfg['img_url']); - } - - function get_img_path ($id) - { - return $this->get_path($id, $this->cfg['img_path']); - } - - function get_path ($id, $base) - { - $path = $base . ($id % 50) .'/'. $id .'.'. $this->img_ext; - return preg_replace("#/($id)(\.{$this->img_ext})\$#", '/'. md5($this->cfg['secret_key'] . md5($id)) .'$2', $path); - } - - /** - * Генерит валидное имя ключа для получения введенного кода капчи из $_POST - */ - function get_key_name ($tm) - { - return 'cap_code_'. md5($this->cfg['secret_key'] . md5($tm - ($tm % $this->key_ttl))); - } -} - -class captcha_kcaptcha extends captcha_common -{ - // generates keystring and image - function gen_img ($cap_id) - { - global $bb_cfg; - - // do not change without changing font files! - $alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; - - # symbols used to draw CAPTCHA - alphabet without similar symbols (o=0, 1=l, i=j, t=f) - $allowed_symbols = "23456789abcdeghkmnpqsuvxyz"; - - # folder with fonts - $fontsdir = INC_DIR .'captcha/kcaptcha/fonts/'; - - $fonts = array( - 'antiqua.png', - 'baskerville.png', - 'batang.png', - 'bookman.png', - 'calisto.png', - 'cambria.png', - 'centaur.png', - 'century.png', - 'chaparral.png', - 'constantia.png', - 'footlight.png', - 'garamond.png', - 'georgia.png', - 'goudy_old.png', - 'kozuka.png', - 'lucida.png', - 'minion.png', - 'palatino.png', - 'perpetua.png', - 'rockwell.png', - 'times.png', - 'warnock.png', - ); - - # CAPTCHA string length - $length = mt_rand($this->cap_min_chars, $this->cap_max_chars); - - # CAPTCHA image size (you do not need to change it, whis parameters is optimal) - $width = 120; - $height = 60; - - # symbol's vertical fluctuation amplitude divided by 2 - $fluctuation_amplitude = 5; - - # increase safety by prevention of spaces between symbols - $no_spaces = true; - - # show credits - $show_credits = true; # set to false to remove credits line. Credits adds 12 pixels to image height - $credits = $bb_cfg['server_name']; # if empty, HTTP_HOST will be shown - - # CAPTCHA image colors (RGB, 0-255) - $foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100)); - $background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255)); - - # JPEG quality of CAPTCHA image (bigger is better quality, but larger file size) - $jpeg_quality = 90; - - $alphabet_length=strlen($alphabet); - - do{ - // generating random keystring - while(true){ - $this->keystring=''; - for($i=0;$i<$length;$i++){ - $this->keystring.=$allowed_symbols[mt_rand(0,strlen($allowed_symbols)-1)]; - } - if(!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $this->keystring)) break; - } - - $font_file = $fontsdir . $fonts[mt_rand(0, count($fonts)-1)]; - $font=imagecreatefrompng($font_file); - imagealphablending($font, true); - $fontfile_width=imagesx($font); - $fontfile_height=imagesy($font)-1; - $font_metrics=array(); - $symbol=0; - $reading_symbol=false; - - // loading font - for($i=0;$i<$fontfile_width && $symbol<$alphabet_length;$i++){ - $transparent = (imagecolorat($font, $i, 0) >> 24) == 127; - - if(!$reading_symbol && !$transparent){ - $font_metrics[$alphabet[$symbol]]=array('start'=>$i); - $reading_symbol=true; - continue; - } - - if($reading_symbol && $transparent){ - $font_metrics[$alphabet[$symbol]]['end']=$i; - $reading_symbol=false; - $symbol++; - continue; - } - } - - $img=imagecreatetruecolor($width, $height); - imagealphablending($img, true); - $white=imagecolorallocate($img, 255, 255, 255); - $black=imagecolorallocate($img, 0, 0, 0); - - imagefilledrectangle($img, 0, 0, $width-1, $height-1, $white); - - // draw text - $x=1; - for($i=0;$i<$length;$i++){ - $m=$font_metrics[$this->keystring[$i]]; - - $y=mt_rand(-$fluctuation_amplitude, $fluctuation_amplitude)+($height-$fontfile_height)/2+2; - - if($no_spaces){ - $shift=0; - if($i>0){ - $shift=10000; - for($sy=7;$sy<$fontfile_height-20;$sy+=1){ - for($sx=$m['start']-1;$sx<$m['end'];$sx+=1){ - $rgb=imagecolorat($font, $sx, $sy); - $opacity=$rgb>>24; - if($opacity<127){ - $left=$sx-$m['start']+$x; - $py=$sy+$y; - if($py>$height) break; - for($px=min($left,$width-1);$px>$left-12 && $px>=0;$px-=1){ - $color=imagecolorat($img, $px, $py) & 0xff; - if($color+$opacity<190){ - if($shift>$left-$px){ - $shift=$left-$px; - } - break; - } - } - break; - } - } - } - if($shift==10000){ - $shift=mt_rand(4,6); - } - - } - }else{ - $shift=1; - } - imagecopy($img, $font, $x-$shift, $y, $m['start'], 1, $m['end']-$m['start'], $fontfile_height); - $x+=$m['end']-$m['start']-$shift; - } - }while($x>=$width-10); // while not fit in canvas - - $center=$x/2; - - // credits - $img2=imagecreatetruecolor($width, $height+($show_credits?12:0)); - $foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]); - $background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]); - imagefilledrectangle($img2, 0, 0, $width-1, $height-1, $background); - imagefilledrectangle($img2, 0, $height, $width-1, $height+12, $foreground); - $credits=empty($credits)?$bb_cfg['server_name']:$credits; - imagestring($img2, 2, $width/2-imagefontwidth(2)*strlen($credits)/2, $height-2, $credits, $background); - - // periods - $rand1=mt_rand(750000,1200000)/10000000; - $rand2=mt_rand(750000,1200000)/10000000; - $rand3=mt_rand(750000,1200000)/10000000; - $rand4=mt_rand(750000,1200000)/10000000; - // phases - $rand5=mt_rand(0,31415926)/10000000; - $rand6=mt_rand(0,31415926)/10000000; - $rand7=mt_rand(0,31415926)/10000000; - $rand8=mt_rand(0,31415926)/10000000; - // amplitudes - $rand9=mt_rand(330,420)/110; - $rand10=mt_rand(330,450)/110; - - //wave distortion - - for($x=0;$x<$width;$x++){ - for($y=0;$y<$height;$y++){ - $sx=$x+(sin($x*$rand1+$rand5)+sin($y*$rand3+$rand6))*$rand9-$width/2+$center+1; - $sy=$y+(sin($x*$rand2+$rand7)+sin($y*$rand4+$rand8))*$rand10; - - if($sx<0 || $sy<0 || $sx>=$width-1 || $sy>=$height-1){ - continue; - }else{ - $color=imagecolorat($img, $sx, $sy) & 0xFF; - $color_x=imagecolorat($img, $sx+1, $sy) & 0xFF; - $color_y=imagecolorat($img, $sx, $sy+1) & 0xFF; - $color_xy=imagecolorat($img, $sx+1, $sy+1) & 0xFF; - } - - if($color==255 && $color_x==255 && $color_y==255 && $color_xy==255){ - continue; - }else if($color==0 && $color_x==0 && $color_y==0 && $color_xy==0){ - $newred=$foreground_color[0]; - $newgreen=$foreground_color[1]; - $newblue=$foreground_color[2]; - }else{ - $frsx=$sx-floor($sx); - $frsy=$sy-floor($sy); - $frsx1=1-$frsx; - $frsy1=1-$frsy; - - $newcolor=( - $color*$frsx1*$frsy1+ - $color_x*$frsx*$frsy1+ - $color_y*$frsx1*$frsy+ - $color_xy*$frsx*$frsy); - - if($newcolor>255) $newcolor=255; - $newcolor=$newcolor/255; - $newcolor0=1-$newcolor; - - $newred=$newcolor0*$foreground_color[0]+$newcolor*$background_color[0]; - $newgreen=$newcolor0*$foreground_color[1]+$newcolor*$background_color[1]; - $newblue=$newcolor0*$foreground_color[2]+$newcolor*$background_color[2]; - } - - imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newred, $newgreen, $newblue)); - } - } - - $img_path = $this->get_img_path($cap_id); - file_write('', $img_path, null, true, true); - - imagejpeg($img2, $img_path, $jpeg_quality); - - imagedestroy($img2); - - return $this->keystring; - } -} \ No newline at end of file diff --git a/library/includes/captcha/kcaptcha/fonts/antiqua.png b/library/includes/captcha/kcaptcha/fonts/antiqua.png deleted file mode 100644 index 78d93d597..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/antiqua.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/baskerville.png b/library/includes/captcha/kcaptcha/fonts/baskerville.png deleted file mode 100644 index 5a635287d..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/baskerville.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/batang.png b/library/includes/captcha/kcaptcha/fonts/batang.png deleted file mode 100644 index ba0075634..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/batang.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/bookman.png b/library/includes/captcha/kcaptcha/fonts/bookman.png deleted file mode 100644 index 1132a122a..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/bookman.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/calisto.png b/library/includes/captcha/kcaptcha/fonts/calisto.png deleted file mode 100644 index b3b0dd560..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/calisto.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/cambria.png b/library/includes/captcha/kcaptcha/fonts/cambria.png deleted file mode 100644 index 76ad92107..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/cambria.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/centaur.png b/library/includes/captcha/kcaptcha/fonts/centaur.png deleted file mode 100644 index 30a46cadd..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/centaur.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/century.png b/library/includes/captcha/kcaptcha/fonts/century.png deleted file mode 100644 index abf89d7e2..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/century.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/chaparral.png b/library/includes/captcha/kcaptcha/fonts/chaparral.png deleted file mode 100644 index 7395bacdb..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/chaparral.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/constantia.png b/library/includes/captcha/kcaptcha/fonts/constantia.png deleted file mode 100644 index d3abc6464..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/constantia.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/footlight.png b/library/includes/captcha/kcaptcha/fonts/footlight.png deleted file mode 100644 index cb2a634ec..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/footlight.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/garamond.png b/library/includes/captcha/kcaptcha/fonts/garamond.png deleted file mode 100644 index eb7222123..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/garamond.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/georgia.png b/library/includes/captcha/kcaptcha/fonts/georgia.png deleted file mode 100644 index d00bb75e4..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/georgia.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/goudy_old.png b/library/includes/captcha/kcaptcha/fonts/goudy_old.png deleted file mode 100644 index b4d236d9a..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/goudy_old.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/kozuka.png b/library/includes/captcha/kcaptcha/fonts/kozuka.png deleted file mode 100644 index ececa1104..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/kozuka.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/lucida.png b/library/includes/captcha/kcaptcha/fonts/lucida.png deleted file mode 100644 index 050732aa7..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/lucida.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/minion.png b/library/includes/captcha/kcaptcha/fonts/minion.png deleted file mode 100644 index 34384e51a..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/minion.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/palatino.png b/library/includes/captcha/kcaptcha/fonts/palatino.png deleted file mode 100644 index 3a9d37b24..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/palatino.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/perpetua.png b/library/includes/captcha/kcaptcha/fonts/perpetua.png deleted file mode 100644 index 8b4c0871a..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/perpetua.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/rockwell.png b/library/includes/captcha/kcaptcha/fonts/rockwell.png deleted file mode 100644 index da19566d1..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/rockwell.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/times.png b/library/includes/captcha/kcaptcha/fonts/times.png deleted file mode 100644 index 656e99d97..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/times.png and /dev/null differ diff --git a/library/includes/captcha/kcaptcha/fonts/warnock.png b/library/includes/captcha/kcaptcha/fonts/warnock.png deleted file mode 100644 index c114dbcb9..000000000 Binary files a/library/includes/captcha/kcaptcha/fonts/warnock.png and /dev/null differ diff --git a/library/includes/classes/correct.php b/library/includes/classes/correct.php index 5d296fdf8..87a40be86 100644 --- a/library/includes/classes/correct.php +++ b/library/includes/classes/correct.php @@ -48,6 +48,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); * @author Nasibullin Rinat * @version 1.4.3 */ + class Text_LangCorrect { /** diff --git a/library/includes/classes/emailer.php b/library/includes/classes/emailer.php index 3c94a0e89..2ad378edf 100644 --- a/library/includes/classes/emailer.php +++ b/library/includes/classes/emailer.php @@ -98,11 +98,11 @@ class emailer if (empty($this->tpl_msg[$template_lang . $template_file])) { - $tpl_file = LANG_ROOT_DIR ."$template_lang/email/$template_file.tpl"; + $tpl_file = LANG_ROOT_DIR ."$template_lang/email/$template_file.html"; if (!@file_exists(@bb_realpath($tpl_file))) { - $tpl_file = LANG_ROOT_DIR ."{$bb_cfg['default_lang']}/email/$template_file.tpl"; + $tpl_file = LANG_ROOT_DIR ."{$bb_cfg['default_lang']}/email/$template_file.html"; if (!@file_exists(@bb_realpath($tpl_file))) { @@ -133,7 +133,7 @@ class emailer // Send the mail out to the recipients set previously in var $this->address function send ($email_format = 'text') { - global $bb_cfg, $lang; + global $bb_cfg, $userdata; if ($bb_cfg['emailer_disabled']) { @@ -176,12 +176,12 @@ class emailer if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match)) { - $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($lang['CONTENT_ENCODING']); + $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']); $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); } else { - $this->encoding = trim($lang['CONTENT_ENCODING']); + $this->encoding = trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']); } $this->subject = $this->encode($this->subject); diff --git a/library/includes/classes/recaptcha.php b/library/includes/classes/recaptcha.php new file mode 100644 index 000000000..bdc7580ff --- /dev/null +++ b/library/includes/classes/recaptcha.php @@ -0,0 +1,139 @@ +" . self::$_signupUrl . ""); + } + $this->_secret = $secret; + } + + /** + * Encodes the given data into a query string format. + * + * @param array $data array of string elements to be encoded. + * + * @return string - encoded request. + */ + private function _encodeQS($data) + { + $req = ""; + foreach ($data as $key => $value) { + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; + } + + // Cut the last '&' + $req = substr($req, 0, strlen($req) - 1); + return $req; + } + + /** + * Submits an HTTP GET to a reCAPTCHA server. + * + * @param string $path url path to recaptcha server. + * @param array $data array of parameters to be sent. + * + * @return array response + */ + private function _submitHTTPGet($path, $data) + { + $req = $this->_encodeQS($data); + $response = file_get_contents($path . $req); + return $response; + } + + /** + * Calls the reCAPTCHA siteverify API to verify whether the user passes + * CAPTCHA test. + * + * @param string $remoteIp IP address of end user. + * @param string $response response string from recaptcha verification. + * + * @return ReCaptchaResponse + */ + public function verifyResponse($remoteIp, $response) + { + // Discard empty solution submissions + if ($response == null || strlen($response) == 0) { + $recaptchaResponse = new ReCaptchaResponse(); + $recaptchaResponse->success = false; + $recaptchaResponse->errorCodes = 'missing-input'; + return $recaptchaResponse; + } + + $getResponse = $this->_submitHttpGet( + self::$_siteVerifyUrl, + array( + 'secret' => $this->_secret, + 'remoteip' => $remoteIp, + 'v' => self::$_version, + 'response' => $response + ) + ); + $answers = json_decode($getResponse, true); + $recaptchaResponse = new ReCaptchaResponse(); + + if (trim($answers['success']) == true) { + $recaptchaResponse->success = true; + } else { + $recaptchaResponse->success = false; + $recaptchaResponse->errorCodes = $answers['error-codes']; + } + + return $recaptchaResponse; + } +} \ No newline at end of file diff --git a/library/includes/classes/reflection.php b/library/includes/classes/reflection.php index d7023ad97..ba0f59059 100644 --- a/library/includes/classes/reflection.php +++ b/library/includes/classes/reflection.php @@ -27,6 +27,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); * @author Nasibullin Rinat * @version 1.1.0 */ + class ReflectionTypeHint { protected static $hints = array( diff --git a/library/includes/classes/utf8.php b/library/includes/classes/utf8.php index af5bfb2ae..4a03eac17 100644 --- a/library/includes/classes/utf8.php +++ b/library/includes/classes/utf8.php @@ -62,6 +62,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); * @author Nasibullin Rinat * @version 2.2.2 */ + class UTF8 { #REPLACEMENT CHARACTER (for broken char) diff --git a/library/includes/cron/jobs/captcha_gen_gc.php b/library/includes/cron/jobs/captcha_gen_gc.php deleted file mode 100644 index 61a454a34..000000000 --- a/library/includes/cron/jobs/captcha_gen_gc.php +++ /dev/null @@ -1,61 +0,0 @@ -cap_img_total; // сколько должно быть всего активных (cap_id > 0) -$new_per_minute = CAPTCHA()->new_per_minute; // сколько добавлять новых -$cap_expire_time = TIMENOW + CAPTCHA()->key_ttl*2; - -$gen_new_img_count = $new_per_minute; // сколько реально нужно сгенерить новых -$expire_img_count = $new_per_minute; // сколько пометить для удаления - -$row = DB('cap')->fetch_row("SELECT COUNT(*) AS cnt, MAX(cap_id) AS max_id FROM ". BB_CAPTCHA ." WHERE cap_id > 0"); - -$cur_total_count = (int) $row['cnt']; -$cur_max_id = (int) $row['max_id']; - -if ($cur_total_count < $cap_img_total) -{ - $gen_new_img_count += ($cap_img_total - $cur_total_count); -} - -$start_id = $cur_max_id + 1; -$cur_id = $start_id; -$finish_id = $start_id + $gen_new_img_count - 1; - -while ($cur_id <= $finish_id) -{ - $code = CAPTCHA()->gen_img($cur_id); - DB('cap')->query("INSERT INTO ". BB_CAPTCHA ." (cap_id, cap_code) VALUES ($cur_id, '$code')"); - $cur_id++; -} - -// -// Метка о неактивности и об истечении срока -// -DB('cap')->query(" - UPDATE ". BB_CAPTCHA ." SET - cap_id = -cap_id, - cap_expire = $cap_expire_time - WHERE cap_id > 0 - ORDER BY cap_id - LIMIT $expire_img_count -"); - -// -// Удаление старых -// -$del_ids = DB('cap')->fetch_rowset("SELECT cap_id FROM ". BB_CAPTCHA ." WHERE cap_id < 0 AND cap_expire < ". TIMENOW, 'cap_id'); - -foreach ($del_ids as $del_id) -{ - $cap_img_path = CAPTCHA()->get_img_path(abs($del_id)); - if (@fopen($cap_img_path, 'r')) - { - unlink($cap_img_path); - } - DB('cap')->query("DELETE FROM ". BB_CAPTCHA ." WHERE cap_id = $del_id LIMIT 1"); -} \ No newline at end of file diff --git a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php index 3fee3a01f..3b4283054 100644 --- a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php +++ b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php @@ -150,56 +150,4 @@ DB()->query(" ". BB_BT_LAST_USERSTAT ." TO ". OLD_BB_BT_LAST_USERSTAT .", ". NEW_BB_BT_LAST_USERSTAT ." TO ". BB_BT_LAST_USERSTAT ." "); -DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_LAST_USERSTAT .", ". OLD_BB_BT_LAST_USERSTAT); - -DB()->expect_slow_query(10); - -if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release']) -{ - DB()->query(" - CREATE TEMPORARY TABLE tmp_bonus ( - user_id INT UNSIGNED NOT NULL DEFAULT '0', - release_count INT UNSIGNED NOT NULL DEFAULT '0' - ) ENGINE = MEMORY - "); - - $tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824); - - DB()->query("INSERT INTO tmp_bonus - SELECT bt.user_id, count(bt.seeder) AS release_count - FROM ". BB_BT_TRACKER ." bt, ". BB_BT_TORRENTS ." tor - WHERE tor.topic_id = bt.topic_id - AND tor.size > $tor_size - AND bt.seeder > 0 - GROUP BY user_id - "); - - $seed_bonus = (float) unserialize($bb_cfg['seed_bonus_points']); - $seed_release = (int) unserialize($bb_cfg['seed_bonus_release']); - - foreach($seed_bonus as $i => $points) - { - if (!$points || !$seed_release[$i]) continue; - - $user_points = ($points / 4); - $release = $seed_release[$i]; - $user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400); - - DB()->query(" - UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b - SET - u.user_points = u.user_points + $user_points, - bu.points_today = bu.points_today + $user_points, - b.user_id = 0 - WHERE - b.user_id = u.user_id - AND bu.user_id = u.user_id - AND b.release_count <= $release - AND u.user_regdate < $user_regdate - AND u.user_active = 1 - AND u.user_id not IN(". EXCLUDED_USERS_CSV .") - "); - } - - DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus"); -} \ No newline at end of file +DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_LAST_USERSTAT .", ". OLD_BB_BT_LAST_USERSTAT); \ No newline at end of file diff --git a/library/includes/cron/jobs/tr_seed_bonus.php b/library/includes/cron/jobs/tr_seed_bonus.php new file mode 100644 index 000000000..3cc379c26 --- /dev/null +++ b/library/includes/cron/jobs/tr_seed_bonus.php @@ -0,0 +1,55 @@ +expect_slow_query(600); + +if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release']) +{ + DB()->query(" + CREATE TEMPORARY TABLE tmp_bonus ( + user_id INT UNSIGNED NOT NULL DEFAULT '0', + release_count INT UNSIGNED NOT NULL DEFAULT '0' + ) ENGINE = MEMORY + "); + + $tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824); + + DB()->query("INSERT INTO tmp_bonus + SELECT bt.user_id, count(bt.seeder) AS release_count + FROM ". BB_BT_TRACKER ." bt, ". BB_BT_TORRENTS ." tor + WHERE tor.topic_id = bt.topic_id + AND tor.size > $tor_size + AND bt.seeder > 0 + GROUP BY user_id + "); + + $seed_bonus = unserialize($bb_cfg['seed_bonus_points']); + $seed_release = unserialize($bb_cfg['seed_bonus_release']); + + foreach($seed_bonus as $i => $points) + { + if (!$points || !$seed_release[$i]) continue; + + $user_points = ((float) $points / 4); + $release = (int) $seed_release[$i]; + $user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400); + + DB()->query(" + UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b + SET + u.user_points = u.user_points + '$user_points', + bu.points_today = bu.points_today + '$user_points', + b.user_id = 0 + WHERE + b.user_id = u.user_id + AND bu.user_id = u.user_id + AND b.release_count <= $release + AND u.user_regdate < $user_regdate + AND u.user_active = 1 + AND u.user_id not IN(". EXCLUDED_USERS_CSV .") + "); + } + + DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus"); +} \ No newline at end of file diff --git a/library/includes/functions.php b/library/includes/functions.php index 96dc8bb83..d4db85468 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2287,7 +2287,7 @@ function get_poll_data_items_js ($topic_id) } foreach ($items as $k => $v) { - $items[$k] = php2js($v); + $items[$k] = Zend\Json\Json::encode($v); } return is_array($topic_id) ? $items : $items[$topic_id]; @@ -2296,7 +2296,7 @@ function get_poll_data_items_js ($topic_id) function poll_is_active ($t_data) { global $bb_cfg; - return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days']*86400); + return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days'] * 86400); } function print_confirmation ($tpl_vars) @@ -2373,86 +2373,6 @@ function caching_output ($enabled, $mode, $cache_var_name, $ttl = 300) } } -// -// Ajax -// -/** - * Encode PHP var to JSON (PHP -> JS) - */ -function bb_json_encode ($data) -{ - return json_encode($data); -} - -/** - * Decode JSON to PHP (JS -> PHP) - */ -function bb_json_decode ($data) -{ - if (!is_string($data)) trigger_error('invalid argument for '. __FUNCTION__, E_USER_ERROR); - return json_decode($data, true); -} - -/** - * -- from JsHttpRequest -- - * Convert a PHP scalar, array or hash to JS scalar/array/hash. This function is - * an analog of json_encode(), but it can work with a non-UTF8 input and does not - * analyze the passed data. Output format must be fully JSON compatible. - * - * @param mixed $a Any structure to convert to JS. - * @return string JavaScript equivalent structure. - */ -function php2js ($a = false) -{ - if (is_null($a)) return 'null'; - if ($a === false) return 'false'; - if ($a === true) return 'true'; - if (is_scalar($a)) - { - if (is_float($a)) - { - // Always use "." for floats. - $a = str_replace(",", ".", strval($a)); - } - // All scalars are converted to strings to avoid indeterminism. - // PHP's "1" and 1 are equal for all PHP operators, but - // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend, - // we should get the same result in the JS frontend (string). - // Character replacements for JSON. - static $jsonReplaces = array( - array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), - array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'), - ); - return '"'. str_replace($jsonReplaces[0], $jsonReplaces[1], $a) .'"'; - } - $isList = true; - for ($i = 0, reset($a); $i < count($a); $i++, next($a)) - { - if (key($a) !== $i) - { - $isList = false; - break; - } - } - $result = array(); - if ($isList) - { - foreach ($a as $v) - { - $result[] = php2js($v); - } - return '[ '. join(', ', $result) .' ]'; - } - else - { - foreach ($a as $k => $v) - { - $result[] = php2js($k) .': '. php2js($v); - } - return '{ '. join(', ', $result) .' }'; - } -} - function clean_title ($str, $replace_underscore = false) { $str = ($replace_underscore) ? str_replace('_', ' ', $str) : $str; @@ -2668,20 +2588,6 @@ function set_pr_die_append_msg ($pr_uid) '); } -function CAPTCHA () -{ - static $captcha_obj = null; - - if ($captcha_obj === null) - { - global $bb_cfg; - require(INC_DIR .'captcha/captcha.php'); - $captcha_obj = new captcha_kcaptcha($bb_cfg['captcha']); - } - - return $captcha_obj; -} - function send_pm ($user_id, $subject, $message, $poster_id = BOT_UID) { global $userdata; @@ -2868,4 +2774,54 @@ function hash_search ($hash) { bb_die(sprintf($lang['HASH_NOT_FOUND'], $hash)); } +} + +function bb_captcha ($mode, $callback = '') +{ + global $bb_cfg, $userdata; + + require_once(CLASS_DIR .'recaptcha.php'); + + $secret = $bb_cfg['captcha']['secret_key']; + $public = $bb_cfg['captcha']['public_key']; + $theme = $bb_cfg['captcha']['theme']; + $lang = $bb_cfg['lang'][$userdata['user_lang']]['captcha']; + + $reCaptcha = new ReCaptcha($secret); + + switch ($mode) + { + case 'get': + return " + +
+ "; + break; + + case 'check': + $resp = null; + $error = null; + $g_resp = request_var('g-recaptcha-response', ''); + if ($g_resp) { + $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $g_resp); + } + if ($resp != null && $resp->success) { + return true; + } else { + return false; + } + break; + + default: + bb_simple_die(__FUNCTION__ .": invalid mode '$mode'"); + } + return false; } \ No newline at end of file diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php index 85cdeedda..07e3a40b7 100644 --- a/library/includes/functions_post.php +++ b/library/includes/functions_post.php @@ -60,9 +60,9 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, & } } - if (IS_GUEST && !CAPTCHA()->verify_code()) + if (IS_GUEST && !bb_captcha('check')) { - $error_msg .= (!empty($error_msg)) ? '
' . $lang['CONFIRM_CODE_WRONG'] : $lang['CONFIRM_CODE_WRONG']; + $error_msg .= (!empty($error_msg)) ? '
' . $lang['CAPTCHA_WRONG'] : $lang['CAPTCHA_WRONG']; } } diff --git a/library/includes/functions_selects.php b/library/includes/functions_selects.php index b541d0a61..8cf43a765 100644 --- a/library/includes/functions_selects.php +++ b/library/includes/functions_selects.php @@ -11,15 +11,15 @@ function language_select ($default_lang, $select_name = 'language') $lang_select = ''; - return ($x > 1) ? $lang_select : reset($bb_cfg['languages']); + return ($x > 1) ? $lang_select : reset($bb_cfg['lang'])['name']; } // diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index bc72a297f..8ba6bf91e 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -266,7 +266,6 @@ define('BB_BT_LAST_USERSTAT', 'bb_bt_last_userstat'); define('BB_BT_TORHELP', 'bb_bt_torhelp'); define('BB_BT_TORSTAT', 'bb_bt_torstat'); define('BB_CATEGORIES', 'bb_categories'); -define('BB_CAPTCHA', 'bb_captcha'); define('BB_CONFIG', 'bb_config'); define('BB_CRON', 'bb_cron'); define('BB_DISALLOW', 'bb_disallow'); diff --git a/library/includes/page_footer.php b/library/includes/page_footer.php index 238a61c61..cb286084c 100644 --- a/library/includes/page_footer.php +++ b/library/includes/page_footer.php @@ -78,17 +78,6 @@ if (DBG_USER && SQL_DEBUG && !(isset($_GET['pane']) && $_GET['pane'] == 'left')) require(INC_DIR . 'page_footer_dev.php'); } -##### LOG ##### -global $log_ip_resp; - -if (isset($log_ip_resp[USER_IP]) || isset($log_ip_resp[CLIENT_IP])) -{ - $str = date('H:i:s') . LOG_SEPR . preg_replace("#\s+#", ' ', $contents) . LOG_LF; - $file = 'sessions/'. date('m-d') .'_{'. USER_IP .'}_'. CLIENT_IP .'_resp'; - bb_log($str, $file); -} -### LOG END ### - echo ' diff --git a/library/includes/page_header.php b/library/includes/page_header.php index 17eaf93a3..6c04c6b04 100644 --- a/library/includes/page_header.php +++ b/library/includes/page_header.php @@ -110,6 +110,7 @@ $template->assign_vars(array( // The following assigns all _common_ variables that may be used at any point in a template $template->assign_vars(array( 'SIMPLE_HEADER' => !empty($gen_simple_header), + 'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'], 'IN_ADMIN' => defined('IN_ADMIN'), 'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads)), @@ -118,7 +119,7 @@ $template->assign_vars(array( 'USER_LANG' => $userdata['user_lang'], 'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']), - 'USER_OPTIONS_JS' => (IS_GUEST) ? '{}' : bb_json_encode($user->opt_js), + 'USER_OPTIONS_JS' => (IS_GUEST) ? '{}' : Zend\Json\Json::encode($user->opt_js), 'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']), diff --git a/library/includes/sessions.php b/library/includes/sessions.php index 8442d27e5..d0e1c75d9 100644 --- a/library/includes/sessions.php +++ b/library/includes/sessions.php @@ -131,25 +131,6 @@ class user_common } } - ##### LOG ##### - global $log_ip_req; - - if (isset($log_ip_req[USER_IP]) || isset($log_ip_req[CLIENT_IP])) - { - $file = 'sessions/'. date('m-d') .'_{'. USER_IP .'}_'. CLIENT_IP; - $str = array(); - $str[] = date('H:i:s'); - $str[] = (@$this->sessiondata['uid']) ? sprintf('%06d', strval($this->sessiondata['uid'])) : 'guest '; - $str[] = (@$this->data['session_start']) ? gmdate('H:i:s', $this->data['session_start']) : 'guest '; - $str[] = (@$this->sessiondata['sid']) ? sprintf('%-12s', strval($this->sessiondata['sid'])) : 'none '; - $str[] = $_SERVER['REQUEST_URI']; - # $str[] = 'REFERER: '. $_SERVER['HTTP_REFERER']; - $str[] = @$_SERVER['HTTP_USER_AGENT']; - $str = join(LOG_SEPR, $str) . LOG_LF; - bb_log($str, $file); - } - ### LOG END ### - // Did the session exist in the DB? if ($this->data) { @@ -614,6 +595,7 @@ class user_common if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR); require(LANG_DIR .'main.php'); + setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale']); $theme = setup_style(); $DeltaTime = new Date_Delta(); @@ -671,7 +653,7 @@ class user_common } else if (!empty($_COOKIE['opt_js'])) { - $opt_js = bb_json_decode($_COOKIE['opt_js']); + $opt_js = Zend\Json\Json::decode($_COOKIE['opt_js'], Zend\Json\Json::TYPE_ARRAY); if (is_array($opt_js)) { diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index 84401a0a1..35983886c 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -148,14 +148,14 @@ switch ($mode) trigger_error("invalid mode: $mode", E_USER_ERROR); } -// CAPTCHA -$need_captcha = ($mode == 'register' && !IS_ADMIN); +// Captcha +$need_captcha = ($mode == 'register' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']); if ($submit) { - if ($need_captcha && !CAPTCHA()->verify_code()) + if ($need_captcha && !bb_captcha('check')) { - $errors[] = $lang['CONFIRM_CODE_WRONG']; + $errors[] = $lang['CAPTCHA_WRONG']; } } @@ -653,7 +653,7 @@ if ($submit && !$errors) $emailer = new emailer($bb_cfg['smtp_delivery']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>"); - $emailer->email_address("$username <$email>"); + $emailer->email_address($username ." <{$email}>"); $emailer->use_template($email_template, $user_lang); @@ -691,9 +691,10 @@ if ($submit && !$errors) require(CLASS_DIR .'emailer.php'); $emailer = new emailer($bb_cfg['smtp_delivery']); - $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>"); + $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>"); + $emailer->email_address($username ." <{$email}>"); + $emailer->use_template('user_activate', $pr_data['user_lang']); - $emailer->email_address("$username <$email>"); $emailer->assign_vars(array( 'SITENAME' => $bb_cfg['sitename'], @@ -726,11 +727,11 @@ if ($submit && !$errors) cache_rm_user_sessions ($pr_data['user_id']); - if($adm_edit) + if ($adm_edit) { bb_die($lang['PROFILE_USER'] . ' '. profile_url($pr_data) .' '. $lang['GOOD_UPDATE']); } - elseif(!$pr_data['user_active']) + elseif (!$pr_data['user_active']) { bb_die($lang['PROFILE_UPDATED_INACTIVE']); } @@ -757,7 +758,7 @@ $template->assign_vars(array( 'EDIT_PROFILE' => ($mode == 'editprofile'), 'ADM_EDIT' => $adm_edit, 'SHOW_PASS' => ($adm_edit || ($mode == 'register' && IS_ADMIN)), - 'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '', + 'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '', 'LANGUAGE_SELECT' => language_select($pr_data['user_lang'], 'user_lang'), 'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'), diff --git a/library/includes/ucp/sendpasswd.php b/library/includes/ucp/sendpasswd.php index 79dd6bd20..051ee55b9 100644 --- a/library/includes/ucp/sendpasswd.php +++ b/library/includes/ucp/sendpasswd.php @@ -6,16 +6,14 @@ set_die_append_msg(); if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']); -$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN); +$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']); -if ( isset($_POST['submit']) ) +if (isset($_POST['submit'])) { - if ($need_captcha && !CAPTCHA()->verify_code()) bb_die($lang['CONFIRM_CODE_WRONG']); - $email = ( !empty($_POST['email']) ) ? trim(strip_tags(htmlspecialchars($_POST['email']))) : ''; - $sql = "SELECT * - FROM " . BB_USERS . " - WHERE user_email = '" . DB()->escape($email)."'"; - if ( $result = DB()->sql_query($sql) ) + if ($need_captcha && !bb_captcha('check')) bb_die($lang['CAPTCHA_WRONG']); + $email = (!empty($_POST['email'])) ? trim(strip_tags(htmlspecialchars($_POST['email']))) : ''; + $sql = "SELECT * FROM " . BB_USERS . " WHERE user_email = '" . DB()->escape($email)."'"; + if ($result = DB()->sql_query($sql)) { if ( $row = DB()->sql_fetchrow($result) ) { @@ -77,10 +75,10 @@ else } $template->assign_vars(array( - 'USERNAME' => $username, - 'EMAIL' => $email, - 'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '', - 'S_HIDDEN_FIELDS' => '', + 'USERNAME' => $username, + 'EMAIL' => $email, + 'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '', + 'S_HIDDEN_FIELDS' => '', 'S_PROFILE_ACTION' => "profile.php?mode=sendpassword", )); diff --git a/library/includes/ucp/viewprofile.php b/library/includes/ucp/viewprofile.php index 99ac117fc..84ab4e7fc 100644 --- a/library/includes/ucp/viewprofile.php +++ b/library/includes/ucp/viewprofile.php @@ -190,7 +190,7 @@ else if (IS_ADMIN) { - $ajax_user_opt = bb_json_encode(array( + $ajax_user_opt = Zend\Json\Json::encode(array( 'dis_avatar' => bf($profiledata['user_opt'], 'user_opt', 'dis_avatar'), 'dis_sig' => bf($profiledata['user_opt'], 'user_opt', 'dis_sig'), 'dis_passkey' => bf($profiledata['user_opt'], 'user_opt', 'dis_passkey'), diff --git a/library/language/en/email/admin_send_email.tpl b/library/language/en/email/admin_send_email.html similarity index 100% rename from library/language/en/email/admin_send_email.tpl rename to library/language/en/email/admin_send_email.html diff --git a/library/language/en/email/blank.tpl b/library/language/en/email/blank.html similarity index 100% rename from library/language/en/email/blank.tpl rename to library/language/en/email/blank.html diff --git a/library/language/en/email/group_added.tpl b/library/language/en/email/group_added.html similarity index 100% rename from library/language/en/email/group_added.tpl rename to library/language/en/email/group_added.html diff --git a/library/language/en/email/group_approved.tpl b/library/language/en/email/group_approved.html similarity index 100% rename from library/language/en/email/group_approved.tpl rename to library/language/en/email/group_approved.html diff --git a/library/language/en/email/group_request.tpl b/library/language/en/email/group_request.html similarity index 100% rename from library/language/en/email/group_request.tpl rename to library/language/en/email/group_request.html diff --git a/library/language/en/email/privmsg_notify.tpl b/library/language/en/email/privmsg_notify.html similarity index 100% rename from library/language/en/email/privmsg_notify.tpl rename to library/language/en/email/privmsg_notify.html diff --git a/library/language/en/email/profile_send_email.tpl b/library/language/en/email/profile_send_email.html similarity index 100% rename from library/language/en/email/profile_send_email.tpl rename to library/language/en/email/profile_send_email.html diff --git a/library/language/en/email/topic_notify.tpl b/library/language/en/email/topic_notify.html similarity index 100% rename from library/language/en/email/topic_notify.tpl rename to library/language/en/email/topic_notify.html diff --git a/library/language/en/email/user_activate.tpl b/library/language/en/email/user_activate.html similarity index 100% rename from library/language/en/email/user_activate.tpl rename to library/language/en/email/user_activate.html diff --git a/library/language/en/email/user_activate_passwd.tpl b/library/language/en/email/user_activate_passwd.html similarity index 100% rename from library/language/en/email/user_activate_passwd.tpl rename to library/language/en/email/user_activate_passwd.html diff --git a/library/language/en/email/user_welcome.tpl b/library/language/en/email/user_welcome.html similarity index 100% rename from library/language/en/email/user_welcome.tpl rename to library/language/en/email/user_welcome.html diff --git a/library/language/en/email/user_welcome_inactive.tpl b/library/language/en/email/user_welcome_inactive.html similarity index 100% rename from library/language/en/email/user_welcome_inactive.tpl rename to library/language/en/email/user_welcome_inactive.html diff --git a/library/language/en/main.php b/library/language/en/main.php index cb9583d3f..c5701326a 100644 --- a/library/language/en/main.php +++ b/library/language/en/main.php @@ -1,8 +1,5 @@ 'temporary directory not found', UPLOAD_ERR_CANT_WRITE => 'write error', UPLOAD_ERR_EXTENSION => 'upload stopped by extension', -); \ No newline at end of file +); + +// Captcha +$lang['CAPTCHA'] = 'Check that you are not a robot'; +$lang['CAPTCHA_WRONG'] = 'You could not confirm that you are not a robot'; \ No newline at end of file diff --git a/library/language/ru/email/admin_send_email.tpl b/library/language/ru/email/admin_send_email.html similarity index 100% rename from library/language/ru/email/admin_send_email.tpl rename to library/language/ru/email/admin_send_email.html diff --git a/library/language/ru/email/blank.tpl b/library/language/ru/email/blank.html similarity index 100% rename from library/language/ru/email/blank.tpl rename to library/language/ru/email/blank.html diff --git a/library/language/ru/email/group_added.tpl b/library/language/ru/email/group_added.html similarity index 100% rename from library/language/ru/email/group_added.tpl rename to library/language/ru/email/group_added.html diff --git a/library/language/ru/email/group_approved.tpl b/library/language/ru/email/group_approved.html similarity index 100% rename from library/language/ru/email/group_approved.tpl rename to library/language/ru/email/group_approved.html diff --git a/library/language/ru/email/group_request.tpl b/library/language/ru/email/group_request.html similarity index 100% rename from library/language/ru/email/group_request.tpl rename to library/language/ru/email/group_request.html diff --git a/library/language/ru/email/privmsg_notify.tpl b/library/language/ru/email/privmsg_notify.html similarity index 100% rename from library/language/ru/email/privmsg_notify.tpl rename to library/language/ru/email/privmsg_notify.html diff --git a/library/language/ru/email/profile_send_email.tpl b/library/language/ru/email/profile_send_email.html similarity index 100% rename from library/language/ru/email/profile_send_email.tpl rename to library/language/ru/email/profile_send_email.html diff --git a/library/language/ru/email/topic_notify.tpl b/library/language/ru/email/topic_notify.html similarity index 100% rename from library/language/ru/email/topic_notify.tpl rename to library/language/ru/email/topic_notify.html diff --git a/library/language/ru/email/user_activate.tpl b/library/language/ru/email/user_activate.html similarity index 100% rename from library/language/ru/email/user_activate.tpl rename to library/language/ru/email/user_activate.html diff --git a/library/language/ru/email/user_activate_passwd.tpl b/library/language/ru/email/user_activate_passwd.html similarity index 100% rename from library/language/ru/email/user_activate_passwd.tpl rename to library/language/ru/email/user_activate_passwd.html diff --git a/library/language/ru/email/user_welcome.tpl b/library/language/ru/email/user_welcome.html similarity index 100% rename from library/language/ru/email/user_welcome.tpl rename to library/language/ru/email/user_welcome.html diff --git a/library/language/ru/email/user_welcome_inactive.tpl b/library/language/ru/email/user_welcome_inactive.html similarity index 100% rename from library/language/ru/email/user_welcome_inactive.tpl rename to library/language/ru/email/user_welcome_inactive.html diff --git a/library/language/ru/main.php b/library/language/ru/main.php index 6977eeba7..dd679a295 100644 --- a/library/language/ru/main.php +++ b/library/language/ru/main.php @@ -1,8 +1,5 @@ 'временная директория не найдена', UPLOAD_ERR_CANT_WRITE => 'ошибка записи', UPLOAD_ERR_EXTENSION => 'загрузка остановлена из-за расширения', -); \ No newline at end of file +); + +// Captcha +$lang['CAPTCHA'] = 'Проверка, что вы не робот'; +$lang['CAPTCHA_WRONG'] = 'Вы не смогли подтвердить, что вы не робот'; \ No newline at end of file diff --git a/library/language/uk/email/admin_send_email.tpl b/library/language/uk/email/admin_send_email.html similarity index 100% rename from library/language/uk/email/admin_send_email.tpl rename to library/language/uk/email/admin_send_email.html diff --git a/library/language/uk/email/blank.tpl b/library/language/uk/email/blank.html similarity index 100% rename from library/language/uk/email/blank.tpl rename to library/language/uk/email/blank.html diff --git a/library/language/uk/email/group_added.tpl b/library/language/uk/email/group_added.html similarity index 100% rename from library/language/uk/email/group_added.tpl rename to library/language/uk/email/group_added.html diff --git a/library/language/uk/email/group_approved.tpl b/library/language/uk/email/group_approved.html similarity index 100% rename from library/language/uk/email/group_approved.tpl rename to library/language/uk/email/group_approved.html diff --git a/library/language/uk/email/group_request.tpl b/library/language/uk/email/group_request.html similarity index 100% rename from library/language/uk/email/group_request.tpl rename to library/language/uk/email/group_request.html diff --git a/library/language/uk/email/privmsg_notify.tpl b/library/language/uk/email/privmsg_notify.html similarity index 100% rename from library/language/uk/email/privmsg_notify.tpl rename to library/language/uk/email/privmsg_notify.html diff --git a/library/language/uk/email/profile_send_email.tpl b/library/language/uk/email/profile_send_email.html similarity index 100% rename from library/language/uk/email/profile_send_email.tpl rename to library/language/uk/email/profile_send_email.html diff --git a/library/language/uk/email/topic_notify.tpl b/library/language/uk/email/topic_notify.html similarity index 100% rename from library/language/uk/email/topic_notify.tpl rename to library/language/uk/email/topic_notify.html diff --git a/library/language/uk/email/user_activate.tpl b/library/language/uk/email/user_activate.html similarity index 100% rename from library/language/uk/email/user_activate.tpl rename to library/language/uk/email/user_activate.html diff --git a/library/language/uk/email/user_activate_passwd.tpl b/library/language/uk/email/user_activate_passwd.html similarity index 100% rename from library/language/uk/email/user_activate_passwd.tpl rename to library/language/uk/email/user_activate_passwd.html diff --git a/library/language/uk/email/user_welcome.tpl b/library/language/uk/email/user_welcome.html similarity index 100% rename from library/language/uk/email/user_welcome.tpl rename to library/language/uk/email/user_welcome.html diff --git a/library/language/uk/email/user_welcome_inactive.tpl b/library/language/uk/email/user_welcome_inactive.html similarity index 100% rename from library/language/uk/email/user_welcome_inactive.tpl rename to library/language/uk/email/user_welcome_inactive.html diff --git a/library/language/uk/main.php b/library/language/uk/main.php index 90202f122..738d0c851 100644 --- a/library/language/uk/main.php +++ b/library/language/uk/main.php @@ -1,8 +1,5 @@ 'тимчасова директорія не знайдено', UPLOAD_ERR_CANT_WRITE => 'помилка запису', UPLOAD_ERR_EXTENSION => 'завантаження зупинено через розширення', -); \ No newline at end of file +); + +// Captcha +$lang['CAPTCHA'] = 'Перевірка, що ви не робот'; +$lang['CAPTCHA_WRONG'] = 'Ви не змогли підтвердити, що ви не робот'; \ No newline at end of file diff --git a/login.php b/login.php index 9258210db..f16742e53 100644 --- a/login.php +++ b/login.php @@ -84,9 +84,9 @@ if (isset($_POST['login'])) } // Captcha - if ($need_captcha && !CAPTCHA()->verify_code()) + if ($need_captcha && !bb_captcha('check') && !$bb_cfg['captcha']['disabled']) { - $login_errors[] = $lang['CONFIRM_CODE_WRONG']; + $login_errors[] = $lang['CAPTCHA_WRONG']; } if (!$login_errors) @@ -126,7 +126,7 @@ if (IS_GUEST || $mod_admin_login) 'ERROR_MESSAGE' => join('
', $login_errors), 'ADMIN_LOGIN' => $mod_admin_login, 'REDIRECT_URL' => htmlCHR($redirect_url), - 'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '', + 'CAPTCHA_HTML' => ($need_captcha && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : '', 'PAGE_TITLE' => $lang['LOGIN'], 'S_LOGIN_ACTION' => LOGIN_URL, )); diff --git a/posting.php b/posting.php index ad8bfddcf..6c02c0954 100644 --- a/posting.php +++ b/posting.php @@ -696,7 +696,7 @@ $template->assign_vars(array( 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id", 'USERNAME' => @$username, - 'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '', + 'CAPTCHA_HTML' => (IS_GUEST) ? bb_captcha('get') : '', 'SUBJECT' => $subject, 'MESSAGE' => $message, diff --git a/styles/templates/admin/index.tpl b/styles/templates/admin/index.tpl index ab6721255..56585ab2d 100644 --- a/styles/templates/admin/index.tpl +++ b/styles/templates/admin/index.tpl @@ -3,7 +3,7 @@ - + {L_ADMIN} diff --git a/styles/templates/default/login.tpl b/styles/templates/default/login.tpl index 6e232e03c..ec828d54b 100644 --- a/styles/templates/default/login.tpl +++ b/styles/templates/default/login.tpl @@ -32,7 +32,7 @@ - {L_CODE} + {L_CAPTCHA}: {CAPTCHA_HTML} diff --git a/styles/templates/default/page_header.tpl b/styles/templates/default/page_header.tpl index 8eb718770..658f72fa1 100644 --- a/styles/templates/default/page_header.tpl +++ b/styles/templates/default/page_header.tpl @@ -2,7 +2,7 @@ <!-- IF PAGE_TITLE -->{PAGE_TITLE} :: {SITENAME}<!-- ELSE -->{SITENAME}<!-- ENDIF --> - + {META} diff --git a/styles/templates/default/posting_editor.tpl b/styles/templates/default/posting_editor.tpl index 78a88d1f3..74e2e1e8e 100644 --- a/styles/templates/default/posting_editor.tpl +++ b/styles/templates/default/posting_editor.tpl @@ -98,7 +98,7 @@ ajax.callback.posts = function(data) {