reCAPTCHA и другое
Удаляем старую капчу и заменяем ее на рекапчу второй версии; заменяеем подключение языковых файлов, и связанных с ними параметров; исправление ошибки с путем к карктинке званий в админке; исправление ошибки с неверной английской локалью. После обновления необходимо выполнить следующие запросы к базе: DROP TABLE IF EXISTS `bb_captcha`; DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php';
1
.gitignore
vendored
|
@ -6,7 +6,6 @@ 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/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']) ? '<img src="../'. $rank_info['rank_image'] .'" />' : '',
|
||||
|
||||
|
|
10
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 = '<form action="'. DOWNLOAD_URL . $attachment['attach_id'] .'" method="post">';
|
||||
$message .= $lang['CONFIRM_CODE'];
|
||||
$message .= '<div class="mrg_10">'. CAPTCHA()->get_html() .'</div>';
|
||||
$message .= $lang['CAPTCHA'].':';
|
||||
$message .= '<div class="mrg_10" align="center">'. bb_captcha('get') .'</div>';
|
||||
$message .= '<input type="hidden" name="redirect_url" value="'. $redirect_url .'" />';
|
||||
$message .= '<input type="submit" class="bold" value="'. $lang['SUBMIT'] .'" /> ';
|
||||
$message .= '<input type="button" class="bold" value="'. $lang['GO_BACK'] .'" onclick="document.location.href = \''. $redirect_url .'\';" />';
|
||||
|
|
|
@ -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`
|
||||
-- ----------------------------
|
||||
|
@ -591,7 +576,6 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'Clean search results', 'clean_search_res
|
|||
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', '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');
|
||||
|
|
|
@ -18,4 +18,8 @@ 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';
|
||||
UPDATE `bb_cron` SET `cron_script` = 'board_maintenance.php' WHERE `cron_script` = 'bb_maintenance.php';
|
||||
|
||||
// 2.1.5
|
||||
DROP TABLE IF EXISTS `bb_captcha`;
|
||||
DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php';
|
|
@ -66,10 +66,6 @@ switch($mode)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'refresh_captcha';
|
||||
$html = CAPTCHA()->get_html();
|
||||
break;
|
||||
}
|
||||
|
||||
$this->response['html'] = $html;
|
||||
|
|
|
@ -73,7 +73,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
|||
|
||||
// Version info
|
||||
$bb_cfg['tp_version'] = '2.1.5';
|
||||
$bb_cfg['tp_release_date'] = '**-12-2014';
|
||||
$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
|
||||
|
@ -621,11 +634,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
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
order allow,deny
|
||||
deny from all
|
|
@ -1,398 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* Captcha
|
||||
*/
|
||||
class captcha_common
|
||||
{
|
||||
var $cfg = array(); // конфиг
|
||||
var $can_bypass = false; // может обойти капчу
|
||||
var $cap_img_total = 300; // количество текущих картинок
|
||||
var $new_per_minute = 10; // сколько генерить новых, столько же будет помечаться для удаления
|
||||
var $key_ttl = 300; // время жизни _code_ ключа
|
||||
var $cap_sid_len = 20; // длина sid'a
|
||||
var $cap_min_chars = 3; // минимум символов на картинке
|
||||
var $cap_max_chars = 5; // максимум
|
||||
var $img_ext = 'jpg';
|
||||
|
||||
var $cap_sid_key = 'cap_sid'; // ключи/значения в $_POST
|
||||
var $cap_sid_val = '';
|
||||
var $curr_code_key = '';
|
||||
var $prev_code_key = '';
|
||||
|
||||
var $new_cap_id = 0;
|
||||
var $new_cap_sid = '';
|
||||
var $new_code_key = '';
|
||||
var $new_cap_code = '';
|
||||
var $new_img_url = '';
|
||||
var $new_img_path = '';
|
||||
var $new_img_bin = '';
|
||||
|
||||
function captcha_common ($cfg)
|
||||
{
|
||||
$this->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 '
|
||||
<div><img src="'. $this->new_img_url .'?'. mt_rand() .'" width="120" height="72" alt="pic" /></div>
|
||||
<input type="hidden" name="'. $this->cap_sid_key .'" value="'. $this->new_cap_sid .'" />
|
||||
<input type="text" name="'. $this->new_code_key .'" value="" size="25" class="bold" />
|
||||
';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
|
@ -48,6 +48,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|||
* @author Nasibullin Rinat
|
||||
* @version 1.4.3
|
||||
*/
|
||||
|
||||
class Text_LangCorrect
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
139
library/includes/classes/recaptcha.php
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
* - Documentation and latest version
|
||||
* https://developers.google.com/recaptcha/docs/php
|
||||
* - Get a reCAPTCHA API Key
|
||||
* https://www.google.com/recaptcha/admin/create
|
||||
* - Discussion group
|
||||
* http://groups.google.com/group/recaptcha
|
||||
*
|
||||
* @copyright Copyright (c) 2014, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A ReCaptchaResponse is returned from checkAnswer().
|
||||
*/
|
||||
class ReCaptchaResponse
|
||||
{
|
||||
public $success;
|
||||
public $errorCodes;
|
||||
}
|
||||
|
||||
class ReCaptcha
|
||||
{
|
||||
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
|
||||
private static $_siteVerifyUrl = "https://www.google.com/recaptcha/api/siteverify?";
|
||||
private $_secret;
|
||||
private static $_version = "php_1.0";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $secret shared secret between site and ReCAPTCHA server.
|
||||
*/
|
||||
function ReCaptcha($secret)
|
||||
{
|
||||
if ($secret == null || $secret == "") {
|
||||
die("To use Google reCAPTCHA you must get an API key from <a href='" . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
|
||||
}
|
||||
$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;
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|||
* @author Nasibullin Rinat
|
||||
* @version 1.1.0
|
||||
*/
|
||||
|
||||
class ReflectionTypeHint
|
||||
{
|
||||
protected static $hints = array(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
//
|
||||
// Создание новых картинок
|
||||
//
|
||||
$cap_img_total = CAPTCHA()->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");
|
||||
}
|
|
@ -2588,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;
|
||||
|
@ -2788,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 "
|
||||
<script type=\"text/javascript\">
|
||||
var onloadCallback = function() {
|
||||
grecaptcha.render('tp-captcha', {
|
||||
'sitekey' : '" . $public . "',
|
||||
'theme' : '" . $theme . "',
|
||||
'callback' : '" . $callback . "'
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<div id=\"tp-captcha\"></div>
|
||||
<script src=\"https://www.google.com/recaptcha/api.js?onload=onloadCallback&hl=" . $lang . "&render=explicit\" async defer></script>";
|
||||
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;
|
||||
}
|
|
@ -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)) ? '<br />' . $lang['CONFIRM_CODE_WRONG'] : $lang['CONFIRM_CODE_WRONG'];
|
||||
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['CAPTCHA_WRONG'] : $lang['CAPTCHA_WRONG'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@ function language_select ($default_lang, $select_name = 'language')
|
|||
|
||||
$lang_select = '<select name="'. $select_name .'">';
|
||||
$x = 0;
|
||||
foreach ($bb_cfg['languages'] as $folder => $name)
|
||||
foreach ($bb_cfg['lang'] as $key => $data)
|
||||
{
|
||||
$selected = '';
|
||||
if ($folder == $default_lang) $selected = ' selected="selected"';
|
||||
$lang_select .= '<option value="'. $folder .'"'. $selected .'>'. $name .'</option>';
|
||||
if ($key == $default_lang) $selected = ' selected="selected"';
|
||||
$lang_select .= '<option value="'. $key .'"'. $selected .'>'. $data['name'] .'</option>';
|
||||
$x++;
|
||||
}
|
||||
$lang_select .= '</select>';
|
||||
return ($x > 1) ? $lang_select : reset($bb_cfg['languages']);
|
||||
return ($x > 1) ? $lang_select : reset($bb_cfg['lang'])['name'];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -614,6 +614,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();
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,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'),
|
||||
|
|
|
@ -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",
|
||||
));
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
setlocale(LC_ALL, 'eu_US.UTF-8');
|
||||
$lang['CONTENT_ENCODING'] = 'UTF-8';
|
||||
|
||||
// Common, these terms are used extensively on several pages
|
||||
$lang['ADMIN'] = 'Administrating';
|
||||
$lang['FORUM'] = 'Forum';
|
||||
|
@ -659,12 +656,6 @@ $lang['COPYRIGHT_HOLDERS'] = 'For copyright holders';
|
|||
$lang['ADVERT'] = 'Advertise on this site';
|
||||
$lang['NOT_FOUND'] = 'File not found';
|
||||
|
||||
// Visual confirmation system strings
|
||||
$lang['CONFIRM_CODE_WRONG'] = 'The confirmation code you entered was incorrect';
|
||||
$lang['CONFIRM_CODE_IMPAIRED'] = 'If you are visually impaired or cannot otherwise read this code please contact the %sAdministrator%s for help.';
|
||||
$lang['CONFIRM_CODE'] = 'Confirmation code';
|
||||
$lang['CONFIRM_CODE_EXPLAIN'] = 'Enter the code exactly as you see it. The code is case sensitive and zero has a diagonal line through it.';
|
||||
|
||||
// Memberslist
|
||||
$lang['SORT'] = 'Sort';
|
||||
$lang['SORT_TOP_TEN'] = 'Top Ten Posters';
|
||||
|
@ -2800,4 +2791,8 @@ $lang['UPLOAD_ERRORS'] = array(
|
|||
UPLOAD_ERR_NO_TMP_DIR => 'temporary directory not found',
|
||||
UPLOAD_ERR_CANT_WRITE => 'write error',
|
||||
UPLOAD_ERR_EXTENSION => 'upload stopped by extension',
|
||||
);
|
||||
);
|
||||
|
||||
// Captcha
|
||||
$lang['CAPTCHA'] = 'Check that you are not a robot';
|
||||
$lang['CAPTCHA_WRONG'] = 'You could not confirm that you are not a robot';
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
setlocale(LC_ALL, 'ru_RU.UTF-8');
|
||||
$lang['CONTENT_ENCODING'] = 'UTF-8';
|
||||
|
||||
// Common, these terms are used extensively on several pages
|
||||
$lang['ADMIN'] = 'Администрирование';
|
||||
$lang['FORUM'] = 'Форум';
|
||||
|
@ -659,12 +656,6 @@ $lang['COPYRIGHT_HOLDERS'] = 'Для правообладателей';
|
|||
$lang['ADVERT'] = 'Реклама на сайте';
|
||||
$lang['NOT_FOUND'] = 'Файл не найден';
|
||||
|
||||
// Visual confirmation system strings
|
||||
$lang['CONFIRM_CODE_WRONG'] = 'Вы ввели неверный код подтверждения';
|
||||
$lang['CONFIRM_CODE_IMPAIRED'] = 'Если у вас плохое зрение или вы не можете прочесть этот код по какой-то другой причине, то обратитесь за помощью к %sАдминистратору%s.';
|
||||
$lang['CONFIRM_CODE'] = 'Код подтверждения';
|
||||
$lang['CONFIRM_CODE_EXPLAIN'] = 'Введите код в точности так, как вы его видите. Код является регистро-зависимым, а символ нуля имеет косую линию внутри цифры.';
|
||||
|
||||
// Memberslist
|
||||
$lang['SORT'] = 'Упорядочить';
|
||||
$lang['SORT_TOP_TEN'] = 'десять самых активных участников';
|
||||
|
@ -2800,4 +2791,8 @@ $lang['UPLOAD_ERRORS'] = array(
|
|||
UPLOAD_ERR_NO_TMP_DIR => 'временная директория не найдена',
|
||||
UPLOAD_ERR_CANT_WRITE => 'ошибка записи',
|
||||
UPLOAD_ERR_EXTENSION => 'загрузка остановлена из-за расширения',
|
||||
);
|
||||
);
|
||||
|
||||
// Captcha
|
||||
$lang['CAPTCHA'] = 'Проверка, что вы не робот';
|
||||
$lang['CAPTCHA_WRONG'] = 'Вы не смогли подтвердить, что вы не робот';
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
setlocale(LC_ALL, 'uk_UA.UTF-8');
|
||||
$lang['CONTENT_ENCODING'] = 'UTF-8';
|
||||
|
||||
// Common, these terms are used extensively on several pages
|
||||
$lang['ADMIN'] = 'Адміністрування';
|
||||
$lang['FORUM'] = 'Форум';
|
||||
|
@ -659,12 +656,6 @@ $lang['COPYRIGHT_HOLDERS'] = 'Для правовласників';
|
|||
$lang['ADVERT'] = 'Реклама на сайті';
|
||||
$lang['NOT_FOUND'] = 'Файл не знайдено';
|
||||
|
||||
// Visual confirmation system strings
|
||||
$lang['CONFIRM_CODE_WRONG'] = 'Ви ввели неправильний код підтвердження';
|
||||
$lang['CONFIRM_CODE_IMPAIRED'] = 'Якщо у вас поганий зір або ви не можете прочитати цей код по якійсь іншій причині, то зверніться за допомогою до %sАдміністратору%s.';
|
||||
$lang['CONFIRM_CODE'] = 'Код підтвердження';
|
||||
$lang['CONFIRM_CODE_EXPLAIN'] = 'Введіть код точно так, як ви його бачите. Код є реєстро-залежним, а символ нуля має косу лінію всередині цифри.';
|
||||
|
||||
// Memberslist
|
||||
$lang['SORT'] = 'Упорядкувати';
|
||||
$lang['SORT_TOP_TEN'] = 'десять найактивніших учасників';
|
||||
|
@ -2800,4 +2791,8 @@ $lang['UPLOAD_ERRORS'] = array(
|
|||
UPLOAD_ERR_NO_TMP_DIR => 'тимчасова директорія не знайдено',
|
||||
UPLOAD_ERR_CANT_WRITE => 'помилка запису',
|
||||
UPLOAD_ERR_EXTENSION => 'завантаження зупинено через розширення',
|
||||
);
|
||||
);
|
||||
|
||||
// Captcha
|
||||
$lang['CAPTCHA'] = 'Перевірка, що ви не робот';
|
||||
$lang['CAPTCHA_WRONG'] = 'Ви не змогли підтвердити, що ви не робот';
|
|
@ -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('<br />', $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,
|
||||
));
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={L_CONTENT_ENCODING}" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<title>{L_ADMIN}</title>
|
||||
</head>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</tr>
|
||||
<!-- IF CAPTCHA_HTML -->
|
||||
<tr>
|
||||
<td class="tRight nowrap">{L_CODE}</td>
|
||||
<td class="tRight nowrap">{L_CAPTCHA}:</td>
|
||||
<td>{CAPTCHA_HTML}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title><!-- IF PAGE_TITLE -->{PAGE_TITLE} :: {SITENAME}<!-- ELSE -->{SITENAME}<!-- ENDIF --></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={L_CONTENT_ENCODING}" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta property="og:image" content="{SITE_URL}styles/images/logo/logo.png" />
|
||||
{META}
|
||||
|
|
|
@ -98,7 +98,7 @@ ajax.callback.posts = function(data) {
|
|||
|
||||
<div class="mrg_8 tCenter">
|
||||
<div id="post-buttons-block" style="display: none;">
|
||||
<div class="pad_4">{CAPTCHA_HTML}</div>
|
||||
<div class="pad_4" align="center">{CAPTCHA_HTML}</div>
|
||||
<input type="submit" name="preview" value="{L_PREVIEW}" id="post-preview-btn" onclick="$('#post-submit').remove();">
|
||||
<input onclick="submitted = true;" title="Ctrl+Enter" type="submit" name="post" class="bold" value="{L_SUBMIT}" id="post-submit-btn">
|
||||
<input type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#message').val()});">
|
||||
|
|
|
@ -92,8 +92,8 @@ document.write('<input type="hidden" name="user_timezone" value="'+tz+'" />');
|
|||
</tr>
|
||||
<!-- IF CAPTCHA_HTML -->
|
||||
<tr>
|
||||
<td class="prof-title">{L_CONFIRM_CODE}: *</td>
|
||||
<td><span id="refresh_captcha">{CAPTCHA_HTML}</span> <img align="middle" src="{SITE_URL}styles/images/pic_loading.gif" title="{L_UPDATE}" onclick="ajax.exec({ action: 'user_register', mode: 'refresh_captcha'}); return false;" /></td>
|
||||
<td class="prof-title">{L_CAPTCHA}: *</td>
|
||||
<td>{CAPTCHA_HTML}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF EDIT_PROFILE -->
|
||||
|
|
|
@ -26,8 +26,8 @@ ajax.callback.user_register = function(data){
|
|||
</tr>
|
||||
<!-- IF CAPTCHA_HTML -->
|
||||
<tr>
|
||||
<td>{L_CONFIRM_CODE}:</td>
|
||||
<td><span id="refresh_captcha">{CAPTCHA_HTML}</span> <img align="middle" src="./styles/images/pic_loading.gif" title="{L_UPDATE}" onclick="ajax.exec({ action: 'user_register', mode: 'refresh_captcha'}); return false;"></td>
|
||||
<td>{L_CAPTCHA}: *</td>
|
||||
<td>{CAPTCHA_HTML}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
|
|
|
@ -863,7 +863,7 @@ if ($bb_cfg['show_quick_reply'])
|
|||
'QUICK_REPLY' => true,
|
||||
'QR_POST_ACTION' => POSTING_URL,
|
||||
'QR_TOPIC_ID' => $topic_id,
|
||||
'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '',
|
||||
'CAPTCHA_HTML' => (IS_GUEST) ? bb_captcha('get') : '',
|
||||
));
|
||||
|
||||
if (!IS_GUEST)
|
||||
|
|