Дополнение. Исправление inconsistent line separators - переход на стандарт LF. Никакие изменения в файлы помимо этого не вносились.
This commit is contained in:
Exile 2014-08-01 16:37:48 +04:00
commit 22f5a4a701
107 changed files with 45624 additions and 45624 deletions

View file

@ -1,45 +1,45 @@
Уважаемые пользователи TorrentPier II!
За помощь, оказанную в развитии нашего движка, выражаем особую благодарность нижеперечисленным участникам форума:
***************************
** Сборы 2013 года **
***************************
emilio13
UralSOFT
aik
Sarymian
eve
Алексей Письменский
qaqra
rserg99
leszav
Dr_Brown
Bullit
Triceratop (http://goldenshara.com/)
Ramzess
****************************
** Сборы 2014 года **
****************************
SamSeGo
alesel (http://sporttracker.kz/)
Bullit
igorsaevets
vasilich619
wint1000 (http://asmlocator.ru/)
Philstone (http://worldofminecraft.su/)
Nightwolf
nord51
Вася
*****************************
** Прочая информация **
*****************************
Большое вам всем спасибо за помощь.
Если в данных списках кто-то не указан, либо если вы хотите указать дополнительно адрес своего трекера, отправьте письмо по адресу admin@torrentpier.me,
Уважаемые пользователи TorrentPier II!
За помощь, оказанную в развитии нашего движка, выражаем особую благодарность нижеперечисленным участникам форума:
***************************
** Сборы 2013 года **
***************************
emilio13
UralSOFT
aik
Sarymian
eve
Алексей Письменский
qaqra
rserg99
leszav
Dr_Brown
Bullit
Triceratop (http://goldenshara.com/)
Ramzess
****************************
** Сборы 2014 года **
****************************
SamSeGo
alesel (http://sporttracker.kz/)
Bullit
igorsaevets
vasilich619
wint1000 (http://asmlocator.ru/)
Philstone (http://worldofminecraft.su/)
Nightwolf
nord51
Вася
*****************************
** Прочая информация **
*****************************
Большое вам всем спасибо за помощь.
Если в данных списках кто-то не указан, либо если вы хотите указать дополнительно адрес своего трекера, отправьте письмо по адресу admin@torrentpier.me,
с указанием вашего ника на форуме и адреса вашего трекера, дабы мы могли вас добавить в этот список.

View file

@ -1,145 +1,145 @@
user www www;
worker_processes 4;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
worker_rlimit_nofile 1024;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] $request '
# '"$status" $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#log_format IP .$remote_addr.;
access_log off;
server_tokens off;
reset_timedout_connection on;
sendfile on;
# http://en.wikipedia.org/wiki/Asynchronous_I/O
# aio sendfile;
output_buffers 1 64k;
tcp_nopush on;
tcp_nodelay on;
send_lowat 12000;
log_not_found off;
keepalive_timeout 65;
limit_req_zone $binary_remote_addr zone=one:16m rate=5r/s;
gzip on;
gzip_vary on;
gzip_min_length 2048;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_proxied any;
gzip_disable "msie6";
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
client_max_body_size 10m;
large_client_header_buffers 4 8k;
client_body_temp_path /tmp/nginx/client_temp 1 2;
server {
#listen 80 default sndbuf=32k rcvbuf=8k accept_filter=httpready;
#listen [::]:80 default sndbuf=32k rcvbuf=8k accept_filter=httpready;
listen 80 default sndbuf=32k rcvbuf=8k;
server_name sitedomain.ru;
charset utf8;
access_log off;
location / {
root /var/www;
index index.html index.htm index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
# pass the PHP scripts to FastCGI server listening on /tmp/php.sock;
#
location ~ \.php$ {
#limit_req zone=one burst=20 nodelay;
#limit_req_log_level info;
root /var/www;
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php.sock; # 127.0.0.1:9000;
fastcgi_intercept_errors on;
# FreeBSD Optimization
fastcgi_pass_request_body off;
client_body_in_file_only clean;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Old XBTT config
# location ^~ /bt/ {
# access_log off;
# if ( $query_string ~ "^uk=([^&?]{10})[&?]+(.*)$" ) {
# set $uk $1;
# set $qs $2&ip=$remote_addr;
# }
# if ( $query_string ~ "^uk=([^&?]{10})[&?]+((.*&|)ip=.*)$" ) {
# set $uk $1;
# set $qs $2;
# }
# if ( $qs ) {
# rewrite ^.*/([a-z]+)(\.php|)$ /$uk/$1?$qs break;
# }
# rewrite ^/?(.*)$ /$1?ip=$remote_addr&$query_string break;
# proxy_pass http://127.0.0.1:2710/;
# }
# Cached Images
location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
root /var/www;
access_log off;
expires 30d;
add_header Cache-Control public;
}
location ~ \/admin|backup\/ {
deny all;
# allow YOUR_IP;
}
# Deny folder (Sec. lvl1)
location ~ \/(cache|log|attach_mod|config|includes|language|triggers)\/ {
deny all;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
# deny sql,tpl,db,inc,log
location ~ /\.ht {
deny all;
}
location ~ \.(.*sql|tpl|db|inc|log)$ {
deny all;
}
}
user www www;
worker_processes 4;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
worker_rlimit_nofile 1024;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] $request '
# '"$status" $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#log_format IP .$remote_addr.;
access_log off;
server_tokens off;
reset_timedout_connection on;
sendfile on;
# http://en.wikipedia.org/wiki/Asynchronous_I/O
# aio sendfile;
output_buffers 1 64k;
tcp_nopush on;
tcp_nodelay on;
send_lowat 12000;
log_not_found off;
keepalive_timeout 65;
limit_req_zone $binary_remote_addr zone=one:16m rate=5r/s;
gzip on;
gzip_vary on;
gzip_min_length 2048;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_proxied any;
gzip_disable "msie6";
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
client_max_body_size 10m;
large_client_header_buffers 4 8k;
client_body_temp_path /tmp/nginx/client_temp 1 2;
server {
#listen 80 default sndbuf=32k rcvbuf=8k accept_filter=httpready;
#listen [::]:80 default sndbuf=32k rcvbuf=8k accept_filter=httpready;
listen 80 default sndbuf=32k rcvbuf=8k;
server_name sitedomain.ru;
charset utf8;
access_log off;
location / {
root /var/www;
index index.html index.htm index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
# pass the PHP scripts to FastCGI server listening on /tmp/php.sock;
#
location ~ \.php$ {
#limit_req zone=one burst=20 nodelay;
#limit_req_log_level info;
root /var/www;
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php.sock; # 127.0.0.1:9000;
fastcgi_intercept_errors on;
# FreeBSD Optimization
fastcgi_pass_request_body off;
client_body_in_file_only clean;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Old XBTT config
# location ^~ /bt/ {
# access_log off;
# if ( $query_string ~ "^uk=([^&?]{10})[&?]+(.*)$" ) {
# set $uk $1;
# set $qs $2&ip=$remote_addr;
# }
# if ( $query_string ~ "^uk=([^&?]{10})[&?]+((.*&|)ip=.*)$" ) {
# set $uk $1;
# set $qs $2;
# }
# if ( $qs ) {
# rewrite ^.*/([a-z]+)(\.php|)$ /$uk/$1?$qs break;
# }
# rewrite ^/?(.*)$ /$1?ip=$remote_addr&$query_string break;
# proxy_pass http://127.0.0.1:2710/;
# }
# Cached Images
location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
root /var/www;
access_log off;
expires 30d;
add_header Cache-Control public;
}
location ~ \/admin|backup\/ {
deny all;
# allow YOUR_IP;
}
# Deny folder (Sec. lvl1)
location ~ \/(cache|log|attach_mod|config|includes|language|triggers)\/ {
deny all;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
# deny sql,tpl,db,inc,log
location ~ /\.ht {
deny all;
}
location ~ \.(.*sql|tpl|db|inc|log)$ {
deny all;
}
}
}

View file

@ -1,104 +1,104 @@
source torrentpier
{
type = mysql
sql_host = localhost
sql_user = user
sql_pass = pass
sql_db = dbase
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
sql_query_pre = SET CHARACTER_SET_CLIENT=utf8
}
source topics: torrentpier
{
sql_query = \
SELECT topic_id, forum_id, topic_title \
FROM bb_topics \
WHERE topic_id BETWEEN $start AND $end
sql_query_range = SELECT MIN(topic_id), MAX(topic_id) FROM bb_topics
sql_range_step = 100000
sql_attr_uint = forum_id
sql_ranged_throttle = 50
sql_query_info = SELECT * FROM bb_topics WHERE topic_id = $id
}
source posts: torrentpier
{
sql_query = \
SELECT pt.post_id, pt.post_text, t.topic_title, t.topic_id, t.forum_id \
FROM bb_posts_text pt \
LEFT JOIN bb_topics t on pt.post_id = t.topic_first_post_id \
WHERE pt.post_id BETWEEN $start AND $end
sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM bb_posts_text
sql_range_step = 100000
sql_attr_uint = topic_id
sql_attr_uint = forum_id
sql_ranged_throttle = 50
sql_query_info = SELECT * FROM bb_posts_text WHERE post_id = $id
}
source users: torrentpier
{
sql_query = \
SELECT user_id, username \
FROM bb_users \
WHERE user_id BETWEEN $start AND $end
sql_query_range = SELECT 1, MAX(user_id) FROM bb_users
sql_range_step = 1000
sql_query_info = SELECT * FROM bb_users WHERE user_id = $id
}
index topics
{
docinfo = extern
morphology = stem_enru
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42C->U+430..U+44C, U+42E..U+42F->U+44E..U+44F, U+430..U+44C, U+44E..U+44F, U+0401->U+0435, U+0451->U+0435, U+042D->U+0435, U+044D->U+0435
min_prefix_len = 0
min_infix_len = 0
min_word_len = 1
min_stemming_len = 4
enable_star = 1
phrase_boundary = :, - , . , $
phrase_boundary_step = 1
html_strip = 1
path = ./sphinx/data/topics
source = topics
}
index posts: topics
{
path = ./sphinx/data/posts
source = posts
}
index users: topics
{
path = ./sphinx/data/users
source = users
}
indexer
{
mem_limit = 256M
}
searchd
{
listen = 127.0.0.1:3312
log = ./sphinx/log/searchd.log
query_log = ./sphinx/log/query.log
read_timeout = 5
max_children = 15
max_matches = 5000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
pid_file = ./sphinx/searchd.pid
source torrentpier
{
type = mysql
sql_host = localhost
sql_user = user
sql_pass = pass
sql_db = dbase
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
sql_query_pre = SET CHARACTER_SET_CLIENT=utf8
}
source topics: torrentpier
{
sql_query = \
SELECT topic_id, forum_id, topic_title \
FROM bb_topics \
WHERE topic_id BETWEEN $start AND $end
sql_query_range = SELECT MIN(topic_id), MAX(topic_id) FROM bb_topics
sql_range_step = 100000
sql_attr_uint = forum_id
sql_ranged_throttle = 50
sql_query_info = SELECT * FROM bb_topics WHERE topic_id = $id
}
source posts: torrentpier
{
sql_query = \
SELECT pt.post_id, pt.post_text, t.topic_title, t.topic_id, t.forum_id \
FROM bb_posts_text pt \
LEFT JOIN bb_topics t on pt.post_id = t.topic_first_post_id \
WHERE pt.post_id BETWEEN $start AND $end
sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM bb_posts_text
sql_range_step = 100000
sql_attr_uint = topic_id
sql_attr_uint = forum_id
sql_ranged_throttle = 50
sql_query_info = SELECT * FROM bb_posts_text WHERE post_id = $id
}
source users: torrentpier
{
sql_query = \
SELECT user_id, username \
FROM bb_users \
WHERE user_id BETWEEN $start AND $end
sql_query_range = SELECT 1, MAX(user_id) FROM bb_users
sql_range_step = 1000
sql_query_info = SELECT * FROM bb_users WHERE user_id = $id
}
index topics
{
docinfo = extern
morphology = stem_enru
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42C->U+430..U+44C, U+42E..U+42F->U+44E..U+44F, U+430..U+44C, U+44E..U+44F, U+0401->U+0435, U+0451->U+0435, U+042D->U+0435, U+044D->U+0435
min_prefix_len = 0
min_infix_len = 0
min_word_len = 1
min_stemming_len = 4
enable_star = 1
phrase_boundary = :, - , . , $
phrase_boundary_step = 1
html_strip = 1
path = ./sphinx/data/topics
source = topics
}
index posts: topics
{
path = ./sphinx/data/posts
source = posts
}
index users: topics
{
path = ./sphinx/data/users
source = users
}
indexer
{
mem_limit = 256M
}
searchd
{
listen = 127.0.0.1:3312
log = ./sphinx/log/searchd.log
query_log = ./sphinx/log/query.log
read_timeout = 5
max_children = 15
max_matches = 5000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
pid_file = ./sphinx/searchd.pid
}

View file

@ -1,21 +1,21 @@
TBDev Yuna Scatari Edition pre6 to TorrentPier 1.0.x converter.
Quick guide:
1. Install and configure TorrentPier 1.0.0 or higher.
2. Import your TBDevYSE database into TorrentPier database (concretely 'comments', 'categories', 'torrents' and 'users' tables).
3. Put the contents of folder 'root' into your TorrentPier root.
4. Configure 'converter/settings.php' for optimal settings.
5. Run convert.php.
6. See 'converter/passwords.php' for new password to login under admin account.
7. Resychronize statistics using admin panel.
8. Make your new tracker popular!
----
9. If you need to notify users for new passwords (which are needed to login in TorrentPier) via TBDevYSE PM system,
copy two files: automatically generated 'converter/passwords.php' and 'for_tbdev/pass.php' to your TBDevYSE root and run pass.php
(Don't forget to remove these files after completion).
You allow to change message text, see $msg in pass.php for this.
10. If you want to redirect peers from older announce to new announce everytime, replace original TBDev's announce.php with
'for_tbdev/announce.php'
Cheers, RoadTrain.
TBDev Yuna Scatari Edition pre6 to TorrentPier 1.0.x converter.
Quick guide:
1. Install and configure TorrentPier 1.0.0 or higher.
2. Import your TBDevYSE database into TorrentPier database (concretely 'comments', 'categories', 'torrents' and 'users' tables).
3. Put the contents of folder 'root' into your TorrentPier root.
4. Configure 'converter/settings.php' for optimal settings.
5. Run convert.php.
6. See 'converter/passwords.php' for new password to login under admin account.
7. Resychronize statistics using admin panel.
8. Make your new tracker popular!
----
9. If you need to notify users for new passwords (which are needed to login in TorrentPier) via TBDevYSE PM system,
copy two files: automatically generated 'converter/passwords.php' and 'for_tbdev/pass.php' to your TBDevYSE root and run pass.php
(Don't forget to remove these files after completion).
You allow to change message text, see $msg in pass.php for this.
10. If you want to redirect peers from older announce to new announce everytime, replace original TBDev's announce.php with
'for_tbdev/announce.php'
Cheers, RoadTrain.
http://torrentpier.me/

View file

@ -1,46 +1,46 @@
<?php
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
$new_tr_url = "http://torrentpier.me/"; // with ending slash
$subject = "Переезд на новый движок";
$msg = '[b]Внимание![/b] Наш трекер переехал на новый движок! Адрес трекера - [url='.$new_tr_url.']'.$new_tr_url.'[/url]
Вся база перенесена на новый движок, регистрироваться заново не надо.
Войти на трекер можно [url='.$new_tr_url.'login.php]здесь[/url]. Ваши данные на новом трекере:
[b]Логин:[/b] %s
[b]Пароль:[/b] %s
Сменить пароль можно после входа на трекер в [url='.$new_tr_url.'profile.php?mode=editprofile]настройках[/url].';
if (empty($_POST['confirm']))
{
stdhead();
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<input type="submit" name="confirm" value="Start mass PM" />
</form>
</center>
';
}
else
{
if(!file_exists('passwords.php')) stderr($tracker_lang['error'], 'passwords.php not exists');
include('passwords.php');
stdhead();
foreach ($passwords as $user)
{
$msg_sql = sprintf($msg, $user['username'], $user['new_passwd']);
sql_query("INSERT INTO messages (receiver, added, subject, msg) VALUES({$user['tb_user_id']}, NOW(), ".sqlesc($subject).", ".sqlesc($msg_sql).")");
}
stdmsg('OK', 'Mass PM succesful');
}
<?php
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
$new_tr_url = "http://torrentpier.me/"; // with ending slash
$subject = "Переезд на новый движок";
$msg = '[b]Внимание![/b] Наш трекер переехал на новый движок! Адрес трекера - [url='.$new_tr_url.']'.$new_tr_url.'[/url]
Вся база перенесена на новый движок, регистрироваться заново не надо.
Войти на трекер можно [url='.$new_tr_url.'login.php]здесь[/url]. Ваши данные на новом трекере:
[b]Логин:[/b] %s
[b]Пароль:[/b] %s
Сменить пароль можно после входа на трекер в [url='.$new_tr_url.'profile.php?mode=editprofile]настройках[/url].';
if (empty($_POST['confirm']))
{
stdhead();
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<input type="submit" name="confirm" value="Start mass PM" />
</form>
</center>
';
}
else
{
if(!file_exists('passwords.php')) stderr($tracker_lang['error'], 'passwords.php not exists');
include('passwords.php');
stdhead();
foreach ($passwords as $user)
{
$msg_sql = sprintf($msg, $user['username'], $user['new_passwd']);
sql_query("INSERT INTO messages (receiver, added, subject, msg) VALUES({$user['tb_user_id']}, NOW(), ".sqlesc($subject).", ".sqlesc($msg_sql).")");
}
stdmsg('OK', 'Mass PM succesful');
}
stdfoot();

View file

@ -1,262 +1,262 @@
<?php
define ('IN_FORUM', true);
define ('IN_SERVICE', true);
define ('BB_ROOT', './');
require (BB_ROOT .'common.php');
require (BB_ROOT .'converter/constants.php');
require (BB_ROOT .'converter/settings.php');
require (BB_ROOT .'converter/functions.php');
// Start session management
$user->session_start();
if (!IS_ADMIN) die("Restricted access");
while (@ob_end_flush());
ob_implicit_flush();
error_reporting(E_ALL);
@ini_set('display_errors', 1);
?>
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<?php
if (empty($_POST['confirm']))
{
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<input type="submit" name="confirm" value="Start convert" />
</form>
</center>
</body>
';
exit;
}
else
{
@ini_set('memory_limit', '512M');
@ini_set('max_execution_time', @ini_get('max_execution_time') + 1200);
// Step 1: Converting Users
if (CONVERT_USERS)
{
if (CLEAN)
{
tp_users_cleanup();
print_ok ("Users cleared");
}
$max_uid = (int) get_max_val(BB_USERS, 'user_id');
$max_uid = ($max_uid > 1) ? $max_uid : 1;
$users_count = (int) get_count(TB_USERS_TABLE, 'id');
$loops = (int) ceil($users_count / C_USERS_PER_ONCE);
$pass = array();
switch(TR_TYPE)
{
case 'yse':
$_sql = 'avatar, ';
break;
default:
$_sql = '';
break;
}
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_USERS_PER_ONCE;
$offset = C_USERS_PER_ONCE;
$sql = "
SELECT
id, username, email, status, UNIX_TIMESTAMP(added) AS added, UNIX_TIMESTAMP(last_access) AS last_access,
class, icq, msn, aim, yahoo, website, $_sql
uploaded, downloaded, enabled, language
FROM ". TB_USERS_TABLE ."
ORDER BY id
LIMIT $start, $offset";
$users = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($users as $user)
{
$user['id'] += $max_uid;
$user['password'] = make_rand_str(15);
convert_user($user);
$pass[] = array(
'tb_user_id' => $user['id'] - $max_uid,
'username' => $user['username'],
'new_passwd' => $user['password'],
);
}
}
$passf = fopen('./converter/passwords.php', 'w');
$to_write = "<?php \n";
$to_write .= '$passwords = '. var_export($pass, true) .';';
fwrite($passf, $to_write);
fclose($passf);
set_auto_increment(BB_USERS, 'user_id');
print_ok ("Total $users_count users from TBDev converted");
unset($users, $pass, $to_write);
}
if (CONVERT_TORRENTS)
{
require_once(INC_DIR .'functions_post.php');
require_once(INC_DIR .'bbcode.php');
if (CLEAN)
{
tp_categories_cleanup();
tp_forums_cleanup();
tp_topics_cleanup();
print_ok ("Categories, forums and topics cleared");
}
$max_uid = !empty($max_uid) ? $max_uid : 1;
//Create a category for torrents
$max_cat_id = (int) get_max_val(BB_CATEGORIES, 'cat_id');
$tr_cat_id = $max_cat_id + 1;
$tp_cat_data = array(
"cat_id" => $tr_cat_id,
"cat_title" => 'Tracker',
);
tp_add_category($tp_cat_data);
set_auto_increment(BB_CATEGORIES, 'cat_id');
unset($tp_cat_data);
$cats = $db->fetch_rowset("SELECT id, sort, name FROM ". TB_CATEGORIES_TABLE);
DB()->sql_freeresult();
$max_forum_id = (int) get_max_val(BB_FORUMS, 'forum_id');
foreach ($cats as $cat)
{
$cat['id'] += $max_forum_id;
$cat['cat_id'] = $tr_cat_id;
convert_cat($cat);
}
set_auto_increment(BB_FORUMS, 'forum_id');
print_ok ("Categories from TBDev converted");
unset($cats);
// Start of torrents converting
switch(TR_TYPE)
{
case 'yse':
$_sql = 'image1, image2, ';
break;
case 'sky':
$_sql = 'poster, screenshot1, screenshot2, screenshot3, screenshot4, ';
break;
default:
$_sql = '';
break;
}
$max_topic_id = (int) get_max_val(BB_TOPICS, 'topic_id');
$max_post_id = (int) get_max_val(BB_POSTS, 'post_id');
$max_attach_id = (int) get_max_val(BB_ATTACHMENTS, 'attach_id');
$torrents_count = (int) get_count(TB_TORRENTS_TABLE, 'id');
$loops = (int) ceil($torrents_count / C_TORRENTS_PER_ONCE);
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
$sql = "
SELECT
id, info_hash, name, filename, search_text, descr, $_sql
category, UNIX_TIMESTAMP(added) AS added, size, views,
UNIX_TIMESTAMP(last_action) AS lastseed, times_completed, owner, sticky
FROM ". TB_TORRENTS_TABLE ."
ORDER BY id
LIMIT $start, $offset";
$torrents = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($torrents as $torrent)
{
$torrent['topic_id'] = $torrent['id'] + $max_topic_id;
$torrent['post_id'] = $torrent['id'] + $max_post_id;
$torrent['attach_id'] = $torrent['id'] + $max_attach_id;
$torrent['owner'] += $max_uid;
$torrent['descr'] = append_images($torrent);
convert_torrent($torrent);
//print_r($torrent);
}
}
set_auto_increment(BB_TOPICS, 'topic_id');
set_auto_increment(BB_POSTS, 'post_id');
print_ok ("Total $torrents_count torrents from TBDev converted");
unset($torrents);
if (CONVERT_COMMENTS)
{
$max_post_id = (int) get_max_val(BB_POSTS, 'post_id');
$max_topic_id = (int) get_max_val(BB_TOPICS, 'topic_id');
$max_attach_id = (int) get_max_val(BB_ATTACHMENTS, 'attach_id');
$comments_count = (int) get_count(TB_COMMENTS_TABLE, 'id');
$loops = (int) ceil($comments_count / C_COMMENTS_PER_ONCE);
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_COMMENTS_PER_ONCE;
$offset = C_COMMENTS_PER_ONCE;
$sql = "
SELECT
c.id, c.user, c.torrent, c.text, tor.category,
UNIX_TIMESTAMP(c.added) AS added, UNIX_TIMESTAMP(c.editedat) AS editedat, c.ip
FROM ". TB_COMMENTS_TABLE ." c
LEFT JOIN ". TB_TORRENTS_TABLE ." tor ON(tor.id = c.torrent)
WHERE c.torrent <> 0
ORDER BY c.id
LIMIT $start, $offset";
$comments = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($comments as $comment)
{
$comment['user'] += $max_uid;
$comment['id'] += $max_post_id;
convert_comment($comment);
}
}
unset($comments);
set_auto_increment(BB_POSTS, 'post_id');
print_ok ("Total $comments_count comments from TBDev converted");
}
}
?>
</div>
<br />
Converting completed.
</body>
</html>
<?php
define ('IN_FORUM', true);
define ('IN_SERVICE', true);
define ('BB_ROOT', './');
require (BB_ROOT .'common.php');
require (BB_ROOT .'converter/constants.php');
require (BB_ROOT .'converter/settings.php');
require (BB_ROOT .'converter/functions.php');
// Start session management
$user->session_start();
if (!IS_ADMIN) die("Restricted access");
while (@ob_end_flush());
ob_implicit_flush();
error_reporting(E_ALL);
@ini_set('display_errors', 1);
?>
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<?php
if (empty($_POST['confirm']))
{
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<input type="submit" name="confirm" value="Start convert" />
</form>
</center>
</body>
';
exit;
}
else
{
@ini_set('memory_limit', '512M');
@ini_set('max_execution_time', @ini_get('max_execution_time') + 1200);
// Step 1: Converting Users
if (CONVERT_USERS)
{
if (CLEAN)
{
tp_users_cleanup();
print_ok ("Users cleared");
}
$max_uid = (int) get_max_val(BB_USERS, 'user_id');
$max_uid = ($max_uid > 1) ? $max_uid : 1;
$users_count = (int) get_count(TB_USERS_TABLE, 'id');
$loops = (int) ceil($users_count / C_USERS_PER_ONCE);
$pass = array();
switch(TR_TYPE)
{
case 'yse':
$_sql = 'avatar, ';
break;
default:
$_sql = '';
break;
}
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_USERS_PER_ONCE;
$offset = C_USERS_PER_ONCE;
$sql = "
SELECT
id, username, email, status, UNIX_TIMESTAMP(added) AS added, UNIX_TIMESTAMP(last_access) AS last_access,
class, icq, msn, aim, yahoo, website, $_sql
uploaded, downloaded, enabled, language
FROM ". TB_USERS_TABLE ."
ORDER BY id
LIMIT $start, $offset";
$users = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($users as $user)
{
$user['id'] += $max_uid;
$user['password'] = make_rand_str(15);
convert_user($user);
$pass[] = array(
'tb_user_id' => $user['id'] - $max_uid,
'username' => $user['username'],
'new_passwd' => $user['password'],
);
}
}
$passf = fopen('./converter/passwords.php', 'w');
$to_write = "<?php \n";
$to_write .= '$passwords = '. var_export($pass, true) .';';
fwrite($passf, $to_write);
fclose($passf);
set_auto_increment(BB_USERS, 'user_id');
print_ok ("Total $users_count users from TBDev converted");
unset($users, $pass, $to_write);
}
if (CONVERT_TORRENTS)
{
require_once(INC_DIR .'functions_post.php');
require_once(INC_DIR .'bbcode.php');
if (CLEAN)
{
tp_categories_cleanup();
tp_forums_cleanup();
tp_topics_cleanup();
print_ok ("Categories, forums and topics cleared");
}
$max_uid = !empty($max_uid) ? $max_uid : 1;
//Create a category for torrents
$max_cat_id = (int) get_max_val(BB_CATEGORIES, 'cat_id');
$tr_cat_id = $max_cat_id + 1;
$tp_cat_data = array(
"cat_id" => $tr_cat_id,
"cat_title" => 'Tracker',
);
tp_add_category($tp_cat_data);
set_auto_increment(BB_CATEGORIES, 'cat_id');
unset($tp_cat_data);
$cats = $db->fetch_rowset("SELECT id, sort, name FROM ". TB_CATEGORIES_TABLE);
DB()->sql_freeresult();
$max_forum_id = (int) get_max_val(BB_FORUMS, 'forum_id');
foreach ($cats as $cat)
{
$cat['id'] += $max_forum_id;
$cat['cat_id'] = $tr_cat_id;
convert_cat($cat);
}
set_auto_increment(BB_FORUMS, 'forum_id');
print_ok ("Categories from TBDev converted");
unset($cats);
// Start of torrents converting
switch(TR_TYPE)
{
case 'yse':
$_sql = 'image1, image2, ';
break;
case 'sky':
$_sql = 'poster, screenshot1, screenshot2, screenshot3, screenshot4, ';
break;
default:
$_sql = '';
break;
}
$max_topic_id = (int) get_max_val(BB_TOPICS, 'topic_id');
$max_post_id = (int) get_max_val(BB_POSTS, 'post_id');
$max_attach_id = (int) get_max_val(BB_ATTACHMENTS, 'attach_id');
$torrents_count = (int) get_count(TB_TORRENTS_TABLE, 'id');
$loops = (int) ceil($torrents_count / C_TORRENTS_PER_ONCE);
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
$sql = "
SELECT
id, info_hash, name, filename, search_text, descr, $_sql
category, UNIX_TIMESTAMP(added) AS added, size, views,
UNIX_TIMESTAMP(last_action) AS lastseed, times_completed, owner, sticky
FROM ". TB_TORRENTS_TABLE ."
ORDER BY id
LIMIT $start, $offset";
$torrents = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($torrents as $torrent)
{
$torrent['topic_id'] = $torrent['id'] + $max_topic_id;
$torrent['post_id'] = $torrent['id'] + $max_post_id;
$torrent['attach_id'] = $torrent['id'] + $max_attach_id;
$torrent['owner'] += $max_uid;
$torrent['descr'] = append_images($torrent);
convert_torrent($torrent);
//print_r($torrent);
}
}
set_auto_increment(BB_TOPICS, 'topic_id');
set_auto_increment(BB_POSTS, 'post_id');
print_ok ("Total $torrents_count torrents from TBDev converted");
unset($torrents);
if (CONVERT_COMMENTS)
{
$max_post_id = (int) get_max_val(BB_POSTS, 'post_id');
$max_topic_id = (int) get_max_val(BB_TOPICS, 'topic_id');
$max_attach_id = (int) get_max_val(BB_ATTACHMENTS, 'attach_id');
$comments_count = (int) get_count(TB_COMMENTS_TABLE, 'id');
$loops = (int) ceil($comments_count / C_COMMENTS_PER_ONCE);
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_COMMENTS_PER_ONCE;
$offset = C_COMMENTS_PER_ONCE;
$sql = "
SELECT
c.id, c.user, c.torrent, c.text, tor.category,
UNIX_TIMESTAMP(c.added) AS added, UNIX_TIMESTAMP(c.editedat) AS editedat, c.ip
FROM ". TB_COMMENTS_TABLE ." c
LEFT JOIN ". TB_TORRENTS_TABLE ." tor ON(tor.id = c.torrent)
WHERE c.torrent <> 0
ORDER BY c.id
LIMIT $start, $offset";
$comments = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($comments as $comment)
{
$comment['user'] += $max_uid;
$comment['id'] += $max_post_id;
convert_comment($comment);
}
}
unset($comments);
set_auto_increment(BB_POSTS, 'post_id');
print_ok ("Total $comments_count comments from TBDev converted");
}
}
?>
</div>
<br />
Converting completed.
</body>
</html>
<?php } ?>

View file

@ -1,8 +1,8 @@
<?php
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
<?php
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');

View file

@ -1,19 +1,19 @@
<?php
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once
<?php
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once

View file

@ -1,8 +1,8 @@
<?php
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
<?php
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');

View file

@ -1,19 +1,19 @@
<?php
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once
<?php
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once

View file

@ -1,76 +1,76 @@
<?php
define('IN_FORUM', true);
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_users` (
`topic_id` int(10) unsigned NOT NULL,
`user_id` int(11) NOT NULL,
`vote_ip` varchar(32) NOT NULL,
`vote_dt` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`topic_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_votes` (
`topic_id` int(10) unsigned NOT NULL,
`vote_id` tinyint(4) unsigned NOT NULL,
`vote_text` varchar(255) NOT NULL,
`vote_result` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`topic_id`,`vote_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
topic_id, 0, vote_text, 0
FROM bb_vote_desc;
");
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
d.topic_id, r.vote_option_id, r.vote_option_text, r.vote_result
FROM bb_vote_desc d, bb_vote_results r
WHERE
d.vote_id = r.vote_id;
");
DB()->query("
INSERT IGNORE INTO bb_poll_users
(topic_id, user_id, vote_ip)
SELECT
d.topic_id, v.vote_user_id, v.vote_user_ip
FROM bb_vote_desc d, bb_vote_voters v
WHERE
d.vote_id = v.vote_id
AND v.vote_user_id > 0;
");
DB()->query("DROP TABLE IF EXISTS bb_vote_desc");
DB()->query("DROP TABLE IF EXISTS bb_vote_results");
DB()->query("DROP TABLE IF EXISTS bb_vote_voters");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R575)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
<?php
define('IN_FORUM', true);
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_users` (
`topic_id` int(10) unsigned NOT NULL,
`user_id` int(11) NOT NULL,
`vote_ip` varchar(32) NOT NULL,
`vote_dt` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`topic_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_votes` (
`topic_id` int(10) unsigned NOT NULL,
`vote_id` tinyint(4) unsigned NOT NULL,
`vote_text` varchar(255) NOT NULL,
`vote_result` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`topic_id`,`vote_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
topic_id, 0, vote_text, 0
FROM bb_vote_desc;
");
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
d.topic_id, r.vote_option_id, r.vote_option_text, r.vote_result
FROM bb_vote_desc d, bb_vote_results r
WHERE
d.vote_id = r.vote_id;
");
DB()->query("
INSERT IGNORE INTO bb_poll_users
(topic_id, user_id, vote_ip)
SELECT
d.topic_id, v.vote_user_id, v.vote_user_ip
FROM bb_vote_desc d, bb_vote_voters v
WHERE
d.vote_id = v.vote_id
AND v.vote_user_id > 0;
");
DB()->query("DROP TABLE IF EXISTS bb_vote_desc");
DB()->query("DROP TABLE IF EXISTS bb_vote_results");
DB()->query("DROP TABLE IF EXISTS bb_vote_voters");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R575)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}

View file

@ -1,9 +1,9 @@
## Set charset server
AddDefaultCharset UTF-8
## Access control
Options All -Indexes
<FilesMatch "\.(.*sql|tpl|inc|db|log)|(config|common).php$">
deny from all
## Set charset server
AddDefaultCharset UTF-8
## Access control
Options All -Indexes
<FilesMatch "\.(.*sql|tpl|inc|db|log)|(config|common).php$">
deny from all
</FilesMatch>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,154 +1,154 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Configuration'] = basename(__FILE__) .'?mode=config';
$module['Mods']['Configuration'] = basename(__FILE__) .'?mode=config_mods';
return;
}
require('./pagestart.php');
// ACP Header - END
require(INC_DIR .'functions_selects.php');
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$return_links = array(
'index' => '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'),
'config' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG'], '<a href="admin_board.php?mode=config">', '</a>'),
'config_mods' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG_MODS'], '<a href="admin_board.php?mode=config_mods">', '</a>')
);
//
// Pull all config data
//
$sql = "SELECT * FROM " . BB_CONFIG;
if(!$result = DB()->sql_query($sql))
{
bb_die('Could not query config information in admin_board');
}
else
{
while( $row = DB()->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name])
{
if ($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release') $new[$config_name] = serialize($new[$config_name]);
if ($config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') $new[$config_name] = serialize($new[$config_name]);
bb_update_config(array($config_name => $new[$config_name]));
}
}
if (isset($_POST['submit']))
{
bb_die($lang['CONFIG_UPDATED'] . $return_links[$mode] . $return_links['index']);
}
}
switch($mode)
{
case 'config_mods':
$template->assign_vars(array(
'S_CONFIG_ACTION' => 'admin_board.php?mode=config_mods',
'CONFIG_MODS' => true,
'REPORTS_ENABLED' => $new['reports_enabled'],
'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'],
'GENDER' => $new['gender'],
'CALLSEED' => $new['callseed'],
'TOR_STATS' => $new['tor_stats'],
'SHOW_LATEST_NEWS' => $new['show_latest_news'],
'MAX_NEWS_TITLE' => $new['max_news_title'],
'LATEST_NEWS_COUNT' => $new['latest_news_count'],
'LATEST_NEWS_FORUM_ID' => $new['latest_news_forum_id'],
'SHOW_NETWORK_NEWS' => $new['show_network_news'],
'MAX_NET_TITLE' => $new['max_net_title'],
'NETWORK_NEWS_COUNT' => $new['network_news_count'],
'NETWORK_NEWS_FORUM_ID' => $new['network_news_forum_id'],
'WHOIS_INFO' => $new['whois_info'],
'SHOW_MOD_INDEX' => $new['show_mod_index'],
'BIRTHDAY_ENABLED' => $new['birthday_enabled'],
'BIRTHDAY_MAX_AGE' => $new['birthday_max_age'],
'BIRTHDAY_MIN_AGE' => $new['birthday_min_age'],
'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'],
'PREMOD' => $new['premod'],
'TOR_COMMENT' => $new['tor_comment'],
'NEW_TPLS' => $new['new_tpls'],
'SEED_BONUS_ENABLED' => $new['seed_bonus_enabled'],
'SEED_BONUS_TOR_SIZE' => $new['seed_bonus_tor_size'],
'SEED_BONUS_USER_REGDATE' => $new['seed_bonus_user_regdate'],
));
if ($new['seed_bonus_points'] && $new['seed_bonus_release'])
{
$seed_bonus = unserialize($new['seed_bonus_points']);
$seed_release = unserialize($new['seed_bonus_release']);
foreach ($seed_bonus as $i => $row)
{
if (!$row || !$seed_release[$i]) continue;
$template->assign_block_vars('seed_bonus', array(
'RELEASE' => $seed_release[$i],
'POINTS' => $row,
));
}
}
if ($new['bonus_upload'] && $new['bonus_upload_price'])
{
$upload_row = unserialize($new['bonus_upload']);
$price_row = unserialize($new['bonus_upload_price']);
foreach ($upload_row as $i => $row)
{
if (!$row || !$price_row[$i]) continue;
$template->assign_block_vars('bonus_upload', array(
'UP' => $row,
'PRICE' => $price_row[$i],
));
}
}
break;
default:
$template->assign_vars(array(
'S_CONFIG_ACTION' => 'admin_board.php?mode=config',
'CONFIG' => true,
'SITENAME' => htmlCHR($new['sitename']),
'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),
'DISABLE_BOARD' => ($new['board_disable']) ? true : false,
'ALLOW_AUTOLOGIN' => ($new['allow_autologin']) ? true : false,
'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
'MAX_POLL_OPTIONS' => $new['max_poll_options'],
'FLOOD_INTERVAL' => $new['flood_interval'],
'TOPICS_PER_PAGE' => $new['topics_per_page'],
'POSTS_PER_PAGE' => $new['posts_per_page'],
'HOT_TOPIC' => $new['hot_threshold'],
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
'LANG_SELECT' => language_select($new['default_lang'], 'default_lang'),
'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => ($new['prune_enable']) ? true : false,
'ALLOW_BBCODE' => ($new['allow_bbcode']) ? true : false,
'ALLOW_SMILIES' => ($new['allow_smilies']) ? true : false,
'ALLOW_SIG' => ($new['allow_sig']) ? true : false,
'SIG_SIZE' => $new['max_sig_chars'],
'ALLOW_NAMECHANGE' => ($new['allow_namechange']) ? true : false,
'SMILIES_PATH' => $new['smilies_path'],
));
break;
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Configuration'] = basename(__FILE__) .'?mode=config';
$module['Mods']['Configuration'] = basename(__FILE__) .'?mode=config_mods';
return;
}
require('./pagestart.php');
// ACP Header - END
require(INC_DIR .'functions_selects.php');
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$return_links = array(
'index' => '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'),
'config' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG'], '<a href="admin_board.php?mode=config">', '</a>'),
'config_mods' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG_MODS'], '<a href="admin_board.php?mode=config_mods">', '</a>')
);
//
// Pull all config data
//
$sql = "SELECT * FROM " . BB_CONFIG;
if(!$result = DB()->sql_query($sql))
{
bb_die('Could not query config information in admin_board');
}
else
{
while( $row = DB()->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name])
{
if ($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release') $new[$config_name] = serialize($new[$config_name]);
if ($config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') $new[$config_name] = serialize($new[$config_name]);
bb_update_config(array($config_name => $new[$config_name]));
}
}
if (isset($_POST['submit']))
{
bb_die($lang['CONFIG_UPDATED'] . $return_links[$mode] . $return_links['index']);
}
}
switch($mode)
{
case 'config_mods':
$template->assign_vars(array(
'S_CONFIG_ACTION' => 'admin_board.php?mode=config_mods',
'CONFIG_MODS' => true,
'REPORTS_ENABLED' => $new['reports_enabled'],
'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'],
'GENDER' => $new['gender'],
'CALLSEED' => $new['callseed'],
'TOR_STATS' => $new['tor_stats'],
'SHOW_LATEST_NEWS' => $new['show_latest_news'],
'MAX_NEWS_TITLE' => $new['max_news_title'],
'LATEST_NEWS_COUNT' => $new['latest_news_count'],
'LATEST_NEWS_FORUM_ID' => $new['latest_news_forum_id'],
'SHOW_NETWORK_NEWS' => $new['show_network_news'],
'MAX_NET_TITLE' => $new['max_net_title'],
'NETWORK_NEWS_COUNT' => $new['network_news_count'],
'NETWORK_NEWS_FORUM_ID' => $new['network_news_forum_id'],
'WHOIS_INFO' => $new['whois_info'],
'SHOW_MOD_INDEX' => $new['show_mod_index'],
'BIRTHDAY_ENABLED' => $new['birthday_enabled'],
'BIRTHDAY_MAX_AGE' => $new['birthday_max_age'],
'BIRTHDAY_MIN_AGE' => $new['birthday_min_age'],
'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'],
'PREMOD' => $new['premod'],
'TOR_COMMENT' => $new['tor_comment'],
'NEW_TPLS' => $new['new_tpls'],
'SEED_BONUS_ENABLED' => $new['seed_bonus_enabled'],
'SEED_BONUS_TOR_SIZE' => $new['seed_bonus_tor_size'],
'SEED_BONUS_USER_REGDATE' => $new['seed_bonus_user_regdate'],
));
if ($new['seed_bonus_points'] && $new['seed_bonus_release'])
{
$seed_bonus = unserialize($new['seed_bonus_points']);
$seed_release = unserialize($new['seed_bonus_release']);
foreach ($seed_bonus as $i => $row)
{
if (!$row || !$seed_release[$i]) continue;
$template->assign_block_vars('seed_bonus', array(
'RELEASE' => $seed_release[$i],
'POINTS' => $row,
));
}
}
if ($new['bonus_upload'] && $new['bonus_upload_price'])
{
$upload_row = unserialize($new['bonus_upload']);
$price_row = unserialize($new['bonus_upload_price']);
foreach ($upload_row as $i => $row)
{
if (!$row || !$price_row[$i]) continue;
$template->assign_block_vars('bonus_upload', array(
'UP' => $row,
'PRICE' => $price_row[$i],
));
}
}
break;
default:
$template->assign_vars(array(
'S_CONFIG_ACTION' => 'admin_board.php?mode=config',
'CONFIG' => true,
'SITENAME' => htmlCHR($new['sitename']),
'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),
'DISABLE_BOARD' => ($new['board_disable']) ? true : false,
'ALLOW_AUTOLOGIN' => ($new['allow_autologin']) ? true : false,
'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
'MAX_POLL_OPTIONS' => $new['max_poll_options'],
'FLOOD_INTERVAL' => $new['flood_interval'],
'TOPICS_PER_PAGE' => $new['topics_per_page'],
'POSTS_PER_PAGE' => $new['posts_per_page'],
'HOT_TOPIC' => $new['hot_threshold'],
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
'LANG_SELECT' => language_select($new['default_lang'], 'default_lang'),
'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => ($new['prune_enable']) ? true : false,
'ALLOW_BBCODE' => ($new['allow_bbcode']) ? true : false,
'ALLOW_SMILIES' => ($new['allow_smilies']) ? true : false,
'ALLOW_SIG' => ($new['allow_sig']) ? true : false,
'SIG_SIZE' => $new['max_sig_chars'],
'ALLOW_NAMECHANGE' => ($new['allow_namechange']) ? true : false,
'SMILIES_PATH' => $new['smilies_path'],
));
break;
}
print_page('admin_board.tpl', 'admin');

View file

@ -1,152 +1,152 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['TorrentPier']['Forum_Config'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$max_forum_name_len = 30;
$max_forum_rows = 25;
require(INC_DIR .'functions_admin_torrent.php');
$submit = isset($_POST['submit']);
$confirm = isset($_POST['confirm']);
$cfg = array();
// All config names with default values
$default_cfg_str = array(
'bt_announce_url' => 'http://demo.torrentpier.me/bt/',
);
$default_cfg_bool = array(
'bt_disable_dht' => 1,
'bt_show_peers' => 1,
'bt_add_auth_key' => 1,
'bt_show_dl_list' => 0,
'bt_dl_list_only_1st_page' => 1,
'bt_dl_list_only_count' => 1,
'bt_replace_ann_url' => 1,
'bt_show_ip_only_moder' => 1,
'bt_show_port_only_moder' => 1,
'bt_check_announce_url' => 0,
'bt_show_dl_list_buttons' => 1,
'bt_show_dl_but_will' => 1,
'bt_show_dl_but_down' => 0,
'bt_show_dl_but_compl' => 1,
'bt_show_dl_but_cancel' => 1,
'bt_show_dl_stat_on_index' => 1,
'bt_newtopic_auto_reg' => 1,
'bt_tor_browse_only_reg' => 1,
'bt_search_bool_mode' => 1,
'bt_allow_spmode_change' => 1,
'bt_del_addit_ann_urls' => 1,
'bt_set_dltype_on_tor_reg' => 1,
'bt_unset_dltype_on_tor_unreg' => 1,
);
$default_cfg_num = array(
'bt_show_peers_mode' => SHOW_PEERS_COUNT,
);
$default_cfg = array_merge($default_cfg_str, $default_cfg_bool, $default_cfg_num);
$db_fields_bool = array(
'allow_reg_tracker' => 0, // Allowed forums for registering torrents on tracker
'allow_porno_topic' => 0, // Allowed forums for porno topics
'self_moderated' => 0, // Users can move theirs topic to another forum
);
// Get config
$cfg = bb_get_config(BB_CONFIG, true, false);
// Submit new config
if ($submit && $confirm)
{
foreach ($db_fields_bool as $field_name => $field_def_val)
{
update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val);
}
update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str');
update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool');
update_config_table(BB_CONFIG, $default_cfg_num, $cfg, 'num');
$datastore->update('cat_forums');
bb_die($lang['CONFIG_UPD'] .'<br /><br />'. sprintf($lang['RETURN_CONFIG'], '<a href="admin_bt_forum_cfg.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
// Set template vars
set_tpl_vars ($default_cfg_str, $cfg);
set_tpl_vars_lang ($default_cfg_str);
set_tpl_vars_bool ($default_cfg_bool, $cfg);
set_tpl_vars_lang ($default_cfg_bool);
set_tpl_vars ($default_cfg_num, $cfg);
set_tpl_vars_lang ($default_cfg_num);
set_tpl_vars_lang ($db_fields_bool);
// Get Forums list
$sql = "SELECT f.*
FROM ". BB_CATEGORIES ." c, ". BB_FORUMS ." f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain forum names');
}
$rowset = DB()->sql_fetchrowset($result);
$forum_rows = min($max_forum_rows, count($rowset));
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$$field_name = '';
}
foreach ($rowset as $rid => $forum)
{
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$forum_name = $forum['forum_name'];
$selected = ($forum[$field_name]) ? ' selected="selected"' : '';
$forum_name = str_short($forum_name, $max_forum_name_len);
$$field_name .= '<option value="'. $forum['forum_id'] .'" '. $selected .'>&nbsp;' . (($forum['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($forum_name) ."</option>\n";
}
}
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$$field_name = '<select name="'. $field_name ."[]\" multiple=\"multiple\" size=\"$forum_rows\">". $$field_name .'</select>';
$template->assign_vars(array('S_'. strtoupper($field_name) => $$field_name));
}
$template->assign_vars(array(
'L_BT_SHOW_PEERS_MODE_COUNT' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_COUNT'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_COUNT'],
'L_BT_SHOW_PEERS_MODE_NAMES' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_NAMES'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_NAMES'],
'L_BT_SHOW_PEERS_MODE_FULL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_FULL'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_FULL'],
'BT_SHOW_PEERS_MODE_COUNT_VAL' => SHOW_PEERS_COUNT,
'BT_SHOW_PEERS_MODE_NAMES_VAL' => SHOW_PEERS_NAMES,
'BT_SHOW_PEERS_MODE_FULL_VAL' => SHOW_PEERS_FULL,
'BT_SHOW_PEERS_MODE_COUNT_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT) ? HTML_CHECKED : '',
'BT_SHOW_PEERS_MODE_NAMES_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES) ? HTML_CHECKED : '',
'BT_SHOW_PEERS_MODE_FULL_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL) ? HTML_CHECKED : '',
'S_HIDDEN_FIELDS' => '',
'S_CONFIG_ACTION' => 'admin_bt_forum_cfg.php',
));
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['TorrentPier']['Forum_Config'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$max_forum_name_len = 30;
$max_forum_rows = 25;
require(INC_DIR .'functions_admin_torrent.php');
$submit = isset($_POST['submit']);
$confirm = isset($_POST['confirm']);
$cfg = array();
// All config names with default values
$default_cfg_str = array(
'bt_announce_url' => 'http://demo.torrentpier.me/bt/',
);
$default_cfg_bool = array(
'bt_disable_dht' => 1,
'bt_show_peers' => 1,
'bt_add_auth_key' => 1,
'bt_show_dl_list' => 0,
'bt_dl_list_only_1st_page' => 1,
'bt_dl_list_only_count' => 1,
'bt_replace_ann_url' => 1,
'bt_show_ip_only_moder' => 1,
'bt_show_port_only_moder' => 1,
'bt_check_announce_url' => 0,
'bt_show_dl_list_buttons' => 1,
'bt_show_dl_but_will' => 1,
'bt_show_dl_but_down' => 0,
'bt_show_dl_but_compl' => 1,
'bt_show_dl_but_cancel' => 1,
'bt_show_dl_stat_on_index' => 1,
'bt_newtopic_auto_reg' => 1,
'bt_tor_browse_only_reg' => 1,
'bt_search_bool_mode' => 1,
'bt_allow_spmode_change' => 1,
'bt_del_addit_ann_urls' => 1,
'bt_set_dltype_on_tor_reg' => 1,
'bt_unset_dltype_on_tor_unreg' => 1,
);
$default_cfg_num = array(
'bt_show_peers_mode' => SHOW_PEERS_COUNT,
);
$default_cfg = array_merge($default_cfg_str, $default_cfg_bool, $default_cfg_num);
$db_fields_bool = array(
'allow_reg_tracker' => 0, // Allowed forums for registering torrents on tracker
'allow_porno_topic' => 0, // Allowed forums for porno topics
'self_moderated' => 0, // Users can move theirs topic to another forum
);
// Get config
$cfg = bb_get_config(BB_CONFIG, true, false);
// Submit new config
if ($submit && $confirm)
{
foreach ($db_fields_bool as $field_name => $field_def_val)
{
update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val);
}
update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str');
update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool');
update_config_table(BB_CONFIG, $default_cfg_num, $cfg, 'num');
$datastore->update('cat_forums');
bb_die($lang['CONFIG_UPD'] .'<br /><br />'. sprintf($lang['RETURN_CONFIG'], '<a href="admin_bt_forum_cfg.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
// Set template vars
set_tpl_vars ($default_cfg_str, $cfg);
set_tpl_vars_lang ($default_cfg_str);
set_tpl_vars_bool ($default_cfg_bool, $cfg);
set_tpl_vars_lang ($default_cfg_bool);
set_tpl_vars ($default_cfg_num, $cfg);
set_tpl_vars_lang ($default_cfg_num);
set_tpl_vars_lang ($db_fields_bool);
// Get Forums list
$sql = "SELECT f.*
FROM ". BB_CATEGORIES ." c, ". BB_FORUMS ." f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain forum names');
}
$rowset = DB()->sql_fetchrowset($result);
$forum_rows = min($max_forum_rows, count($rowset));
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$$field_name = '';
}
foreach ($rowset as $rid => $forum)
{
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$forum_name = $forum['forum_name'];
$selected = ($forum[$field_name]) ? ' selected="selected"' : '';
$forum_name = str_short($forum_name, $max_forum_name_len);
$$field_name .= '<option value="'. $forum['forum_id'] .'" '. $selected .'>&nbsp;' . (($forum['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($forum_name) ."</option>\n";
}
}
foreach ($db_fields_bool as $field_name => $field_def_val)
{
$$field_name = '<select name="'. $field_name ."[]\" multiple=\"multiple\" size=\"$forum_rows\">". $$field_name .'</select>';
$template->assign_vars(array('S_'. strtoupper($field_name) => $$field_name));
}
$template->assign_vars(array(
'L_BT_SHOW_PEERS_MODE_COUNT' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_COUNT'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_COUNT'],
'L_BT_SHOW_PEERS_MODE_NAMES' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_NAMES'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_NAMES'],
'L_BT_SHOW_PEERS_MODE_FULL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL) ? '<u>'. $lang['BT_SHOW_PEERS_MODE_FULL'] .'</u>' : $lang['BT_SHOW_PEERS_MODE_FULL'],
'BT_SHOW_PEERS_MODE_COUNT_VAL' => SHOW_PEERS_COUNT,
'BT_SHOW_PEERS_MODE_NAMES_VAL' => SHOW_PEERS_NAMES,
'BT_SHOW_PEERS_MODE_FULL_VAL' => SHOW_PEERS_FULL,
'BT_SHOW_PEERS_MODE_COUNT_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT) ? HTML_CHECKED : '',
'BT_SHOW_PEERS_MODE_NAMES_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES) ? HTML_CHECKED : '',
'BT_SHOW_PEERS_MODE_FULL_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL) ? HTML_CHECKED : '',
'S_HIDDEN_FIELDS' => '',
'S_CONFIG_ACTION' => 'admin_bt_forum_cfg.php',
));
print_page('admin_bt_forum_cfg.tpl', 'admin');

View file

@ -1,66 +1,66 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
if(IS_SUPER_ADMIN){
$module['TorrentPier']['Tracker_Config'] = basename(__FILE__);}
return;
}
require('./pagestart.php');
// ACP Header - END
if(!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
require(INC_DIR .'functions_admin_torrent.php');
$submit = isset($_POST['submit']);
$confirmed = isset($_POST['confirm']);
// All config names with default values
$default_cfg_str = array(
'off_reason' => 'Tracker is disabled',
'browser_redirect_url' => 'http://demo.torrentpier.me/',
);
$default_cfg_bool = array(
'autoclean' => 1,
'off' => 0,
'compact_mode' => 1,
'update_dlstat' => 1,
'limit_active_tor' => 0,
'limit_concurrent_ips' => 0,
);
$default_cfg_num = array(
'numwant' => 50,
'expire_factor' => 4,
'limit_seed_count' => 20,
'limit_leech_count' => 4,
'leech_expire_factor' => 60,
'limit_seed_ips' => 0,
'limit_leech_ips' => 0,
);
// Set template vars
set_tpl_vars ($default_cfg_str, $tr_cfg);
set_tpl_vars_lang ($default_cfg_str);
set_tpl_vars_bool ($default_cfg_bool, $tr_cfg);
set_tpl_vars_lang ($default_cfg_bool);
set_tpl_vars ($default_cfg_num, $tr_cfg);
set_tpl_vars_lang ($default_cfg_num);
$template->assign_vars(array(
'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'],
'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'],
'PASSKEY_KEY' => $bb_cfg['passkey_key'],
'GOLD_SILVER_ENABLED' => $tr_cfg['gold_silver_enabled'],
'DISABLE_SUBMIT' => true,
'S_HIDDEN_FIELDS' => '',
'S_CONFIG_ACTION' => 'admin_bt_tracker_cfg.php',
));
<?php
// ACP Header - START
if (!empty($setmodules))
{
if(IS_SUPER_ADMIN){
$module['TorrentPier']['Tracker_Config'] = basename(__FILE__);}
return;
}
require('./pagestart.php');
// ACP Header - END
if(!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
require(INC_DIR .'functions_admin_torrent.php');
$submit = isset($_POST['submit']);
$confirmed = isset($_POST['confirm']);
// All config names with default values
$default_cfg_str = array(
'off_reason' => 'Tracker is disabled',
'browser_redirect_url' => 'http://demo.torrentpier.me/',
);
$default_cfg_bool = array(
'autoclean' => 1,
'off' => 0,
'compact_mode' => 1,
'update_dlstat' => 1,
'limit_active_tor' => 0,
'limit_concurrent_ips' => 0,
);
$default_cfg_num = array(
'numwant' => 50,
'expire_factor' => 4,
'limit_seed_count' => 20,
'limit_leech_count' => 4,
'leech_expire_factor' => 60,
'limit_seed_ips' => 0,
'limit_leech_ips' => 0,
);
// Set template vars
set_tpl_vars ($default_cfg_str, $tr_cfg);
set_tpl_vars_lang ($default_cfg_str);
set_tpl_vars_bool ($default_cfg_bool, $tr_cfg);
set_tpl_vars_lang ($default_cfg_bool);
set_tpl_vars ($default_cfg_num, $tr_cfg);
set_tpl_vars_lang ($default_cfg_num);
$template->assign_vars(array(
'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'],
'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'],
'PASSKEY_KEY' => $bb_cfg['passkey_key'],
'GOLD_SILVER_ENABLED' => $tr_cfg['gold_silver_enabled'],
'DISABLE_SUBMIT' => true,
'S_HIDDEN_FIELDS' => '',
'S_CONFIG_ACTION' => 'admin_bt_tracker_cfg.php',
));
print_page('admin_bt_tracker_cfg.tpl', 'admin');

View file

@ -1,97 +1,97 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Disallow'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$message = '';
if( isset($_POST['add_name']) )
{
include(INC_DIR .'functions_validate.php');
$disallowed_user = ( isset($_POST['disallowed_user']) ) ? trim($_POST['disallowed_user']) : trim($_GET['disallowed_user']);
if ($disallowed_user == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
if( !validate_username($disallowed_user) )
{
$message = $lang['DISALLOWED_ALREADY'];
}
else
{
$sql = "INSERT INTO " . BB_DISALLOW . " (disallow_username) VALUES('" . DB()->escape($disallowed_user) . "')";
$result = DB()->sql_query( $sql );
if (!$result)
{
bb_die('Could not add disallowed user');
}
$message = $lang['DISALLOW_SUCCESSFUL'];
}
$message .= '<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') . '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
elseif (isset($_POST['delete_name']))
{
$disallowed_id = (isset($_POST['disallowed_id']) ) ? intval( $_POST['disallowed_id'] ) : intval( $_GET['disallowed_id']);
$sql = "DELETE FROM " . BB_DISALLOW . " WHERE disallow_id = $disallowed_id";
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not removed disallowed user');
}
$message .= $lang['DISALLOWED_DELETED'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Grab the current list of disallowed usernames...
//
$sql = "SELECT * FROM " . BB_DISALLOW;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not get disallowed users');
}
$disallowed = DB()->sql_fetchrowset($result);
//
// Ok now generate the info for the template, which will be put out no matter
// what mode we are in.
//
$disallow_select = '<select name="disallowed_id">';
if( count($disallowed) <= 0 )
{
$disallow_select .= '<option value="">' . $lang['NO_DISALLOWED'] . '</option>';
}
else
{
for( $i = 0; $i < count($disallowed); $i++ )
{
$disallow_select .= '<option value="' . $disallowed[$i]['disallow_id'] . '">' . $disallowed[$i]['disallow_username'] . '</option>';
}
}
$disallow_select .= '</select>';
$template->assign_vars(array(
'S_DISALLOW_SELECT' => $disallow_select,
'S_FORM_ACTION' => 'admin_disallow.php',
));
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Disallow'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$message = '';
if( isset($_POST['add_name']) )
{
include(INC_DIR .'functions_validate.php');
$disallowed_user = ( isset($_POST['disallowed_user']) ) ? trim($_POST['disallowed_user']) : trim($_GET['disallowed_user']);
if ($disallowed_user == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
if( !validate_username($disallowed_user) )
{
$message = $lang['DISALLOWED_ALREADY'];
}
else
{
$sql = "INSERT INTO " . BB_DISALLOW . " (disallow_username) VALUES('" . DB()->escape($disallowed_user) . "')";
$result = DB()->sql_query( $sql );
if (!$result)
{
bb_die('Could not add disallowed user');
}
$message = $lang['DISALLOW_SUCCESSFUL'];
}
$message .= '<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') . '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
elseif (isset($_POST['delete_name']))
{
$disallowed_id = (isset($_POST['disallowed_id']) ) ? intval( $_POST['disallowed_id'] ) : intval( $_GET['disallowed_id']);
$sql = "DELETE FROM " . BB_DISALLOW . " WHERE disallow_id = $disallowed_id";
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not removed disallowed user');
}
$message .= $lang['DISALLOWED_DELETED'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Grab the current list of disallowed usernames...
//
$sql = "SELECT * FROM " . BB_DISALLOW;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not get disallowed users');
}
$disallowed = DB()->sql_fetchrowset($result);
//
// Ok now generate the info for the template, which will be put out no matter
// what mode we are in.
//
$disallow_select = '<select name="disallowed_id">';
if( count($disallowed) <= 0 )
{
$disallow_select .= '<option value="">' . $lang['NO_DISALLOWED'] . '</option>';
}
else
{
for( $i = 0; $i < count($disallowed); $i++ )
{
$disallow_select .= '<option value="' . $disallowed[$i]['disallow_id'] . '">' . $disallowed[$i]['disallow_username'] . '</option>';
}
}
$disallow_select .= '</select>';
$template->assign_vars(array(
'S_DISALLOW_SELECT' => $disallow_select,
'S_FORM_ACTION' => 'admin_disallow.php',
));
print_page('admin_disallow.tpl', 'admin');

File diff suppressed because it is too large Load diff

View file

@ -1,63 +1,63 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Prune'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$all_forums = -1;
$pruned_total = 0;
$prune_performed = false;
if (isset($_REQUEST['submit']))
{
if (!$var =& $_REQUEST['f'] OR !$f_selected = get_id_ary($var))
{
bb_die('Forum not selected');
}
if (!$var =& $_REQUEST['prunedays'] OR !$prunedays = abs(intval($var)))
{
bb_die($lang['NOT_DAYS']);
}
$prunetime = TIMENOW - 86400*$prunedays;
$forum_csv = in_array($all_forums, $f_selected) ? $all_forums : join(',', $f_selected);
$where_sql = ($forum_csv != $all_forums) ? "WHERE forum_id IN($forum_csv)" : '';
$sql = "SELECT forum_id, forum_name FROM ". BB_FORUMS ." $where_sql";
foreach (DB()->fetch_rowset($sql) as $i => $row)
{
$pruned_topics = topic_delete('prune', $row['forum_id'], $prunetime, !empty($_POST['prune_all_topic_types']));
$pruned_total += $pruned_topics;
$prune_performed = true;
$template->assign_block_vars('pruned', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'FORUM_NAME' => htmlCHR($row['forum_name']),
'PRUNED_TOPICS' => $pruned_topics,
));
}
if (!$prune_performed)
{
bb_die($lang['NONE_SELECTED']);
}
if (!$pruned_total)
{
bb_die($lang['NO_SEARCH_MATCH']);
}
}
$template->assign_vars(array(
'PRUNED_TOTAL' => $pruned_total,
'S_PRUNE_ACTION' => basename(__FILE__),
'SEL_FORUM' => get_forum_select('admin', 'f[]', null, 65, 16, '', $all_forums),
));
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Prune'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$all_forums = -1;
$pruned_total = 0;
$prune_performed = false;
if (isset($_REQUEST['submit']))
{
if (!$var =& $_REQUEST['f'] OR !$f_selected = get_id_ary($var))
{
bb_die('Forum not selected');
}
if (!$var =& $_REQUEST['prunedays'] OR !$prunedays = abs(intval($var)))
{
bb_die($lang['NOT_DAYS']);
}
$prunetime = TIMENOW - 86400*$prunedays;
$forum_csv = in_array($all_forums, $f_selected) ? $all_forums : join(',', $f_selected);
$where_sql = ($forum_csv != $all_forums) ? "WHERE forum_id IN($forum_csv)" : '';
$sql = "SELECT forum_id, forum_name FROM ". BB_FORUMS ." $where_sql";
foreach (DB()->fetch_rowset($sql) as $i => $row)
{
$pruned_topics = topic_delete('prune', $row['forum_id'], $prunetime, !empty($_POST['prune_all_topic_types']));
$pruned_total += $pruned_topics;
$prune_performed = true;
$template->assign_block_vars('pruned', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'FORUM_NAME' => htmlCHR($row['forum_name']),
'PRUNED_TOPICS' => $pruned_topics,
));
}
if (!$prune_performed)
{
bb_die($lang['NONE_SELECTED']);
}
if (!$pruned_total)
{
bb_die($lang['NO_SEARCH_MATCH']);
}
}
$template->assign_vars(array(
'PRUNED_TOTAL' => $pruned_total,
'S_PRUNE_ACTION' => basename(__FILE__),
'SEL_FORUM' => get_forum_select('admin', 'f[]', null, 65, 16, '', $all_forums),
));
print_page('admin_forum_prune.tpl', 'admin');

View file

@ -1,254 +1,254 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Permissions'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
// View Read Reply Edit Delete Vote Poll PostAttach DownAttach PostTopic Sticky Announce
$simple_auth_ary = array(
/* Public */ 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_ALL, AUTH_ALL, AUTH_MOD, AUTH_MOD), // Public
/* Reg */ 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD), // Registered
/* Reg [Hid] */ 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD), // Registered [Hidden]
/* Priv */ 3 => array(AUTH_REG, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD), // Private
/* Priv [Hid] */ 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD), // Private [Hidden]
/* MOD */ 5 => array(AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators
/* MOD [Hid] */ 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators [Hidden]
);
$simple_auth_types = array(
$lang['PUBLIC'],
$lang['REGISTERED'],
$lang['REGISTERED'] .' ['. $lang['HIDDEN'] .']',
$lang['PRIVATE'],
$lang['PRIVATE'] .' ['. $lang['HIDDEN'] .']',
$lang['MODERATORS'],
$lang['MODERATORS'] .' ['. $lang['HIDDEN'] .']',
);
$field_names = array();
foreach ($forum_auth_fields as $auth_type)
{
$field_names[$auth_type] = $lang[strtoupper($auth_type)];
}
$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if (@$_REQUEST[POST_FORUM_URL])
{
$forum_id = (int) $_REQUEST[POST_FORUM_URL];
$forum_sql = "WHERE forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
if( isset($_GET['adv']) )
{
$adv = intval($_GET['adv']);
}
else
{
unset($adv);
}
//
// Start program proper
//
if( isset($_POST['submit']) )
{
$sql = '';
if(!empty($forum_id))
{
if(isset($_POST['simpleauth']))
{
$simple_ary = $simple_auth_ary[intval($_POST['simpleauth'])];
for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
}
if (is_array($simple_ary))
{
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
}
else
{
for ($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ($forum_auth_fields[$i] == 'auth_vote')
{
if ($_POST['auth_vote'] == AUTH_ALL)
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table');
}
}
$forum_sql = '';
$adv = 0;
}
$datastore->update('cat_forums');
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="'."admin_forumauth.php".'">', "</a>"));
} // End of submit
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
$forum_rows = DB()->fetch_rowset("SELECT * FROM ". BB_FORUMS ." $forum_sql");
if (empty($forum_id))
{
// Output the selection table if no forum id was specified
$template->assign_vars(array(
'TPL_AUTH_SELECT_FORUM' => true,
'S_AUTH_ACTION' => "admin_forumauth.php",
'S_AUTH_SELECT' => get_forum_select('admin', 'f', null, 80),
));
}
else
{
// Output the authorisation details if an id was specified
$forum_name = $forum_rows[0]['forum_name'];
@reset($simple_auth_ary);
while (list($key, $auth_levels) = each($simple_auth_ary))
{
$matched = 1;
for ($k = 0; $k < count($auth_levels); $k++)
{
$matched_type = $key;
if ($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k])
{
$matched = 0;
}
}
if ( $matched )
{
break;
}
}
//
// If we didn't get a match above then we
// automatically switch into 'advanced' mode
//
if ( !isset($adv) && !$matched )
{
$adv = 1;
}
$s_column_span = 0;
if (empty($adv))
{
$simple_auth = '<select name="simpleauth">';
for($j = 0; $j < count($simple_auth_types); $j++)
{
$selected = ( $matched_type == $j ) ? ' selected="selected"' : '';
$simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
}
$simple_auth .= '</select>';
$template->assign_block_vars('forum_auth', array(
'CELL_TITLE' => $lang['SIMPLE_MODE'],
'S_AUTH_LEVELS_SELECT' => $simple_auth,
));
$s_column_span++;
}
else
{
//
// Output values of individual
// fields
//
for ($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = '&nbsp;<select name="' . $forum_auth_fields[$j] . '">';
for ($k = 0; $k < count($forum_auth_levels); $k++)
{
$selected = ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . strtoupper($forum_auth_levels[$k])] . '</OPTION>';
}
$custom_auth[$j] .= '</select>&nbsp;';
$cell_title = $field_names[$forum_auth_fields[$j]];
$template->assign_block_vars('forum_auth', array(
'CELL_TITLE' => $cell_title,
'S_AUTH_LEVELS_SELECT' => $custom_auth[$j],
));
$s_column_span++;
}
}
$adv_mode = ( empty($adv) ) ? '1' : '0';
$switch_mode = "admin_forumauth.php?f=$forum_id&amp;adv=$adv_mode";
$switch_mode_text = ( empty($adv) ) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
$template->assign_vars(array(
'TPL_EDIT_FORUM_AUTH' => true,
'FORUM_NAME' => htmlCHR($forum_name),
'U_SWITCH_MODE' => $u_switch_mode,
'S_FORUMAUTH_ACTION' => "admin_forumauth.php",
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Permissions'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
// View Read Reply Edit Delete Vote Poll PostAttach DownAttach PostTopic Sticky Announce
$simple_auth_ary = array(
/* Public */ 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_ALL, AUTH_ALL, AUTH_MOD, AUTH_MOD), // Public
/* Reg */ 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD), // Registered
/* Reg [Hid] */ 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD), // Registered [Hidden]
/* Priv */ 3 => array(AUTH_REG, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD), // Private
/* Priv [Hid] */ 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD), // Private [Hidden]
/* MOD */ 5 => array(AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators
/* MOD [Hid] */ 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators [Hidden]
);
$simple_auth_types = array(
$lang['PUBLIC'],
$lang['REGISTERED'],
$lang['REGISTERED'] .' ['. $lang['HIDDEN'] .']',
$lang['PRIVATE'],
$lang['PRIVATE'] .' ['. $lang['HIDDEN'] .']',
$lang['MODERATORS'],
$lang['MODERATORS'] .' ['. $lang['HIDDEN'] .']',
);
$field_names = array();
foreach ($forum_auth_fields as $auth_type)
{
$field_names[$auth_type] = $lang[strtoupper($auth_type)];
}
$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if (@$_REQUEST[POST_FORUM_URL])
{
$forum_id = (int) $_REQUEST[POST_FORUM_URL];
$forum_sql = "WHERE forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
if( isset($_GET['adv']) )
{
$adv = intval($_GET['adv']);
}
else
{
unset($adv);
}
//
// Start program proper
//
if( isset($_POST['submit']) )
{
$sql = '';
if(!empty($forum_id))
{
if(isset($_POST['simpleauth']))
{
$simple_ary = $simple_auth_ary[intval($_POST['simpleauth'])];
for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
}
if (is_array($simple_ary))
{
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
}
else
{
for ($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ($forum_auth_fields[$i] == 'auth_vote')
{
if ($_POST['auth_vote'] == AUTH_ALL)
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table');
}
}
$forum_sql = '';
$adv = 0;
}
$datastore->update('cat_forums');
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="'."admin_forumauth.php".'">', "</a>"));
} // End of submit
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
$forum_rows = DB()->fetch_rowset("SELECT * FROM ". BB_FORUMS ." $forum_sql");
if (empty($forum_id))
{
// Output the selection table if no forum id was specified
$template->assign_vars(array(
'TPL_AUTH_SELECT_FORUM' => true,
'S_AUTH_ACTION' => "admin_forumauth.php",
'S_AUTH_SELECT' => get_forum_select('admin', 'f', null, 80),
));
}
else
{
// Output the authorisation details if an id was specified
$forum_name = $forum_rows[0]['forum_name'];
@reset($simple_auth_ary);
while (list($key, $auth_levels) = each($simple_auth_ary))
{
$matched = 1;
for ($k = 0; $k < count($auth_levels); $k++)
{
$matched_type = $key;
if ($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k])
{
$matched = 0;
}
}
if ( $matched )
{
break;
}
}
//
// If we didn't get a match above then we
// automatically switch into 'advanced' mode
//
if ( !isset($adv) && !$matched )
{
$adv = 1;
}
$s_column_span = 0;
if (empty($adv))
{
$simple_auth = '<select name="simpleauth">';
for($j = 0; $j < count($simple_auth_types); $j++)
{
$selected = ( $matched_type == $j ) ? ' selected="selected"' : '';
$simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
}
$simple_auth .= '</select>';
$template->assign_block_vars('forum_auth', array(
'CELL_TITLE' => $lang['SIMPLE_MODE'],
'S_AUTH_LEVELS_SELECT' => $simple_auth,
));
$s_column_span++;
}
else
{
//
// Output values of individual
// fields
//
for ($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = '&nbsp;<select name="' . $forum_auth_fields[$j] . '">';
for ($k = 0; $k < count($forum_auth_levels); $k++)
{
$selected = ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . strtoupper($forum_auth_levels[$k])] . '</OPTION>';
}
$custom_auth[$j] .= '</select>&nbsp;';
$cell_title = $field_names[$forum_auth_fields[$j]];
$template->assign_block_vars('forum_auth', array(
'CELL_TITLE' => $cell_title,
'S_AUTH_LEVELS_SELECT' => $custom_auth[$j],
));
$s_column_span++;
}
}
$adv_mode = ( empty($adv) ) ? '1' : '0';
$switch_mode = "admin_forumauth.php?f=$forum_id&amp;adv=$adv_mode";
$switch_mode_text = ( empty($adv) ) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
$template->assign_vars(array(
'TPL_EDIT_FORUM_AUTH' => true,
'FORUM_NAME' => htmlCHR($forum_name),
'U_SWITCH_MODE' => $u_switch_mode,
'S_FORUMAUTH_ACTION' => "admin_forumauth.php",
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
print_page('admin_forumauth.tpl', 'admin');

View file

@ -1,366 +1,366 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Permissions_List'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
// View Read Post Reply Edit Delete Sticky Announce Vote Poll PostAttach Download
$simple_auth_ary = array(
/* Public */ 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_ALL), // Public
/* Reg */ 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG), // Registered
/* Reg [Hid] */ 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG), // Registered [Hidden]
/* Priv */ 3 => array(AUTH_REG, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL), // Private
/* Priv [Hid] */ 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL), // Private [Hidden]
/* MOD */ 5 => array(AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators
/* MOD [Hid] */ 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators [Hidden]
);
$simple_auth_types = array(
$lang['PUBLIC'],
$lang['REGISTERED'],
$lang['REGISTERED'] .' ['. $lang['HIDDEN'] .']',
$lang['PRIVATE'],
$lang['PRIVATE'] .' ['. $lang['HIDDEN'] .']',
$lang['MODERATORS'],
$lang['MODERATORS'] .' ['. $lang['HIDDEN'] .']',
);
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
$field_names = array();
foreach ($forum_auth_fields as $auth_type)
{
$field_names[$auth_type] = $lang[strtoupper($auth_type)];
}
$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if(isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL]))
{
$forum_id = (isset($_POST[POST_FORUM_URL])) ? intval($_POST[POST_FORUM_URL]) : intval($_GET[POST_FORUM_URL]);
$forum_sql = "AND forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
if(isset($_GET[POST_CAT_URL]) || isset($_POST[POST_CAT_URL]))
{
$cat_id = (isset($_POST[POST_CAT_URL])) ? intval($_POST[POST_CAT_URL]) : intval($_GET[POST_CAT_URL]);
$cat_sql = "AND c.cat_id = $cat_id";
}
else
{
unset($cat_id);
$cat_sql = '';
}
if( isset($_GET['adv']) )
{
$adv = intval($_GET['adv']);
}
else
{
unset($adv);
}
//
// Start program proper
//
if( isset($_POST['submit']) )
{
$sql = '';
if(!empty($forum_id))
{
if(isset($_POST['simpleauth']))
{
$simple_ary = $simple_auth_ary[intval($_POST['simpleauth'])];
for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
}
if (is_array($simple_ary))
{
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
}
else
{
for($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ( $forum_auth_fields[$i] == 'auth_vote' )
{
if ( $_POST['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table #1');
}
}
$forum_sql = '';
$adv = 0;
}
elseif (!empty($cat_id))
{
for ($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ($forum_auth_fields[$i] == 'auth_vote')
{
if ( $_POST['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE cat_id = $cat_id";
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table #2');
}
}
$cat_sql = '';
}
$datastore->update('cat_forums');
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', "</a>"));
} // End of submit
//
// Get required information, either all forums if
// no id was specified or just the requsted forum
// or category if it was
//
$sql = "SELECT f.*
FROM " . BB_FORUMS . " f, " . BB_CATEGORIES . " c
WHERE c.cat_id = f.cat_id
$forum_sql $cat_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not obtain forum list');
}
$forum_rows = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
if( empty($forum_id) && empty($cat_id) )
{
//
// Output the summary list if no forum id was
// specified
//
$template->assign_vars(array(
'TPL_AUTH_FORUM_LIST' => true,
'S_COLUMN_SPAN' => count($forum_auth_fields)+1,
));
for ($i = 0; $i<count($forum_auth_fields); $i++)
{
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
));
}
// Obtain the category list
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . BB_CATEGORIES . " c
ORDER BY c.cat_order";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query categories list #1');
}
$category_rows = DB()->sql_fetchrowset($result);
$cat_count = count($category_rows);
for ($i=0; $i<$cat_count; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
$template->assign_block_vars('cat_row', array(
'CAT_NAME' => htmlCHR($category_rows[$i]['cat_title']),
'CAT_URL' => 'admin_forumauth_list.php'.'?'.POST_CAT_URL.'='.$category_rows[$i]['cat_id'])
);
for ($j=0; $j<count($forum_rows); $j++)
{
if ( $cat_id == $forum_rows[$j]['cat_id'] )
{
$template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="'.(($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen').'" href="admin_forumauth.php?'. POST_FORUM_URL .'='. $forum_rows[$j]['forum_id'] .'">'. htmlCHR($forum_rows[$j]['forum_name']) .'</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
));
for ($k=0; $k<count($forum_auth_fields); $k++)
{
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
for ($l=0; $l<count($forum_auth_const); $l++)
{
if ($item_auth_value == $forum_auth_const[$l])
{
$item_auth_level = $forum_auth_levels[$l];
break;
}
}
$template->assign_block_vars('cat_row.forum_row.forum_auth_data', array(
'CELL_VALUE' => $lang['FORUM_' . $item_auth_level],
'AUTH_EXPLAIN' => sprintf($lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $forum_auth_fields[$k])], $lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $item_auth_level)]))
);
}
}
}
}
}
else
{
//
// output the authorisation details if an category id was
// specified
//
//
// first display the current details for all forums
// in the category
//
for ($i = 0; $i<count($forum_auth_fields); $i++)
{
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
));
}
// obtain the category list
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . BB_CATEGORIES . " c
WHERE c.cat_id = $cat_id
ORDER BY c.cat_order";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query categories list #2');
}
$category_rows = DB()->sql_fetchrowset($result);
$cat_id = $category_rows[0]['cat_id'];
$cat_name = $category_rows[0]['cat_title'];
$template->assign_block_vars('cat_row', array(
'CAT_NAME' => htmlCHR($cat_name),
'CAT_URL' => 'admin_forumauth_list.php?'. POST_CAT_URL .'='. $cat_id)
);
for ($j=0; $j<count($forum_rows); $j++)
{
if ( $cat_id == $forum_rows[$j]['cat_id'] )
{
$template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="'.(($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen').'" href="admin_forumauth.php?'. POST_FORUM_URL .'='. $forum_rows[$j]['forum_id'] .'">'. htmlCHR($forum_rows[$j]['forum_name']) .'</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
));
for ($k=0; $k<count($forum_auth_fields); $k++)
{
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
for ($l=0; $l<count($forum_auth_const); $l++)
{
if ($item_auth_value == $forum_auth_const[$l])
{
$item_auth_level = $forum_auth_levels[$l];
break;
}
}
$template->assign_block_vars('cat_row.forum_row.forum_auth_data', array(
'CELL_VALUE' => $lang['FORUM_' . $item_auth_level],
'AUTH_EXPLAIN' => sprintf($lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $forum_auth_fields[$k])], $lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $item_auth_level)]))
);
}
}
}
//
// next generate the information to allow the permissions to be changed
// note: we always read from the first forum in the category
//
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = '<select name="' . $forum_auth_fields[$j] . '">';
for($k = 0; $k < count($forum_auth_levels); $k++)
{
$selected = ( !empty($forum_rows) && $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . $forum_auth_levels[$k]] . '</option>';
}
$custom_auth[$j] .= '</select>';
$template->assign_block_vars('forum_auth_data', array(
'S_AUTH_LEVELS_SELECT' => $custom_auth[$j])
);
}
//
// finally pass any remaining items to the template
//
$s_hidden_fields = '<input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '">';
$template->assign_vars(array(
'TPL_AUTH_CAT' => true,
'CAT_NAME' => htmlCHR($cat_name),
'S_FORUMAUTH_ACTION' => "admin_forumauth_list.php",
'S_COLUMN_SPAN' => count($forum_auth_fields)+1,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Forums']['Permissions_List'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
// View Read Post Reply Edit Delete Sticky Announce Vote Poll PostAttach Download
$simple_auth_ary = array(
/* Public */ 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_ALL), // Public
/* Reg */ 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG), // Registered
/* Reg [Hid] */ 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG), // Registered [Hidden]
/* Priv */ 3 => array(AUTH_REG, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL), // Private
/* Priv [Hid] */ 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL), // Private [Hidden]
/* MOD */ 5 => array(AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators
/* MOD [Hid] */ 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), // Moderators [Hidden]
);
$simple_auth_types = array(
$lang['PUBLIC'],
$lang['REGISTERED'],
$lang['REGISTERED'] .' ['. $lang['HIDDEN'] .']',
$lang['PRIVATE'],
$lang['PRIVATE'] .' ['. $lang['HIDDEN'] .']',
$lang['MODERATORS'],
$lang['MODERATORS'] .' ['. $lang['HIDDEN'] .']',
);
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
$field_names = array();
foreach ($forum_auth_fields as $auth_type)
{
$field_names[$auth_type] = $lang[strtoupper($auth_type)];
}
$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if(isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL]))
{
$forum_id = (isset($_POST[POST_FORUM_URL])) ? intval($_POST[POST_FORUM_URL]) : intval($_GET[POST_FORUM_URL]);
$forum_sql = "AND forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
if(isset($_GET[POST_CAT_URL]) || isset($_POST[POST_CAT_URL]))
{
$cat_id = (isset($_POST[POST_CAT_URL])) ? intval($_POST[POST_CAT_URL]) : intval($_GET[POST_CAT_URL]);
$cat_sql = "AND c.cat_id = $cat_id";
}
else
{
unset($cat_id);
$cat_sql = '';
}
if( isset($_GET['adv']) )
{
$adv = intval($_GET['adv']);
}
else
{
unset($adv);
}
//
// Start program proper
//
if( isset($_POST['submit']) )
{
$sql = '';
if(!empty($forum_id))
{
if(isset($_POST['simpleauth']))
{
$simple_ary = $simple_auth_ary[intval($_POST['simpleauth'])];
for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
}
if (is_array($simple_ary))
{
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
}
else
{
for($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ( $forum_auth_fields[$i] == 'auth_vote' )
{
if ( $_POST['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE forum_id = $forum_id";
}
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table #1');
}
}
$forum_sql = '';
$adv = 0;
}
elseif (!empty($cat_id))
{
for ($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($_POST[$forum_auth_fields[$i]]);
if ($forum_auth_fields[$i] == 'auth_vote')
{
if ( $_POST['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . BB_FORUMS . " SET $sql WHERE cat_id = $cat_id";
if ($sql != '')
{
if (!DB()->sql_query($sql))
{
bb_die('Could not update auth table #2');
}
}
$cat_sql = '';
}
$datastore->update('cat_forums');
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', "</a>"));
} // End of submit
//
// Get required information, either all forums if
// no id was specified or just the requsted forum
// or category if it was
//
$sql = "SELECT f.*
FROM " . BB_FORUMS . " f, " . BB_CATEGORIES . " c
WHERE c.cat_id = f.cat_id
$forum_sql $cat_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not obtain forum list');
}
$forum_rows = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
if( empty($forum_id) && empty($cat_id) )
{
//
// Output the summary list if no forum id was
// specified
//
$template->assign_vars(array(
'TPL_AUTH_FORUM_LIST' => true,
'S_COLUMN_SPAN' => count($forum_auth_fields)+1,
));
for ($i = 0; $i<count($forum_auth_fields); $i++)
{
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
));
}
// Obtain the category list
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . BB_CATEGORIES . " c
ORDER BY c.cat_order";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query categories list #1');
}
$category_rows = DB()->sql_fetchrowset($result);
$cat_count = count($category_rows);
for ($i=0; $i<$cat_count; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
$template->assign_block_vars('cat_row', array(
'CAT_NAME' => htmlCHR($category_rows[$i]['cat_title']),
'CAT_URL' => 'admin_forumauth_list.php'.'?'.POST_CAT_URL.'='.$category_rows[$i]['cat_id'])
);
for ($j=0; $j<count($forum_rows); $j++)
{
if ( $cat_id == $forum_rows[$j]['cat_id'] )
{
$template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="'.(($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen').'" href="admin_forumauth.php?'. POST_FORUM_URL .'='. $forum_rows[$j]['forum_id'] .'">'. htmlCHR($forum_rows[$j]['forum_name']) .'</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
));
for ($k=0; $k<count($forum_auth_fields); $k++)
{
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
for ($l=0; $l<count($forum_auth_const); $l++)
{
if ($item_auth_value == $forum_auth_const[$l])
{
$item_auth_level = $forum_auth_levels[$l];
break;
}
}
$template->assign_block_vars('cat_row.forum_row.forum_auth_data', array(
'CELL_VALUE' => $lang['FORUM_' . $item_auth_level],
'AUTH_EXPLAIN' => sprintf($lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $forum_auth_fields[$k])], $lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $item_auth_level)]))
);
}
}
}
}
}
else
{
//
// output the authorisation details if an category id was
// specified
//
//
// first display the current details for all forums
// in the category
//
for ($i = 0; $i<count($forum_auth_fields); $i++)
{
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
));
}
// obtain the category list
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . BB_CATEGORIES . " c
WHERE c.cat_id = $cat_id
ORDER BY c.cat_order";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query categories list #2');
}
$category_rows = DB()->sql_fetchrowset($result);
$cat_id = $category_rows[0]['cat_id'];
$cat_name = $category_rows[0]['cat_title'];
$template->assign_block_vars('cat_row', array(
'CAT_NAME' => htmlCHR($cat_name),
'CAT_URL' => 'admin_forumauth_list.php?'. POST_CAT_URL .'='. $cat_id)
);
for ($j=0; $j<count($forum_rows); $j++)
{
if ( $cat_id == $forum_rows[$j]['cat_id'] )
{
$template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="'.(($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen').'" href="admin_forumauth.php?'. POST_FORUM_URL .'='. $forum_rows[$j]['forum_id'] .'">'. htmlCHR($forum_rows[$j]['forum_name']) .'</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
));
for ($k=0; $k<count($forum_auth_fields); $k++)
{
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
for ($l=0; $l<count($forum_auth_const); $l++)
{
if ($item_auth_value == $forum_auth_const[$l])
{
$item_auth_level = $forum_auth_levels[$l];
break;
}
}
$template->assign_block_vars('cat_row.forum_row.forum_auth_data', array(
'CELL_VALUE' => $lang['FORUM_' . $item_auth_level],
'AUTH_EXPLAIN' => sprintf($lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $forum_auth_fields[$k])], $lang[strtoupper('FORUM_AUTH_LIST_EXPLAIN_' . $item_auth_level)]))
);
}
}
}
//
// next generate the information to allow the permissions to be changed
// note: we always read from the first forum in the category
//
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = '<select name="' . $forum_auth_fields[$j] . '">';
for($k = 0; $k < count($forum_auth_levels); $k++)
{
$selected = ( !empty($forum_rows) && $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . $forum_auth_levels[$k]] . '</option>';
}
$custom_auth[$j] .= '</select>';
$template->assign_block_vars('forum_auth_data', array(
'S_AUTH_LEVELS_SELECT' => $custom_auth[$j])
);
}
//
// finally pass any remaining items to the template
//
$s_hidden_fields = '<input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '">';
$template->assign_vars(array(
'TPL_AUTH_CAT' => true,
'CAT_NAME' => htmlCHR($cat_name),
'S_FORUMAUTH_ACTION' => "admin_forumauth_list.php",
'S_COLUMN_SPAN' => count($forum_auth_fields)+1,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
}
print_page('admin_forumauth_list.tpl', 'admin');

File diff suppressed because it is too large Load diff

View file

@ -1,104 +1,104 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Mods']['Mass_Email'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
@set_time_limit(1200);
$subject = (string) trim(request_var('subject', ''));
$message = (string) request_var('message', '');
$group_id = (int) request_var(POST_GROUPS_URL, 0);
$errors = $user_id_sql = array();
if (isset($_POST['submit']))
{
if (!$subject) $errors[] = $lang['EMPTY_SUBJECT'];
if (!$message) $errors[] = $lang['EMPTY_MESSAGE'];
if (!$group_id) $errors[] = $lang['GROUP_NOT_EXIST'];
if (!$errors)
{
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
$user_id_sql[] = ','. $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
if ($group_id != -1)
{
$user_list = DB()->fetch_rowset("
SELECT u.username, u.user_email, u.user_lang
FROM ". BB_USERS ." u, ". BB_USER_GROUP ." ug
WHERE ug.group_id = $group_id
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_active = 1
AND u.user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
else
{
$user_list = DB()->fetch_rowset("
SELECT username, user_email, user_lang
FROM ". BB_USERS ."
WHERE user_active = 1
AND user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
require(INC_DIR .'emailer.class.php');
foreach ($user_list as $i => $row)
{
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('admin_send_email');
$emailer->assign_vars(array(
'SUBJECT' => html_entity_decode($subject),
'MESSAGE' => html_entity_decode($message),
));
$emailer->send();
$emailer->reset();
}
}
}
//
// Generate page
//
$sql = "SELECT group_id, group_name
FROM ". BB_GROUPS ."
WHERE group_single_user = 0
ORDER BY group_name
";
$groups = array('-- '. $lang['ALL_USERS'] .' --' => -1);
foreach (DB()->fetch_rowset($sql) as $row)
{
$groups[$row['group_name']] = $row['group_id'];
}
$template->assign_vars(array(
'MESSAGE' => $message,
'SUBJECT' => $subject,
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'S_USER_ACTION' => 'admin_mass_email.php',
'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups),
));
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Mods']['Mass_Email'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
@set_time_limit(1200);
$subject = (string) trim(request_var('subject', ''));
$message = (string) request_var('message', '');
$group_id = (int) request_var(POST_GROUPS_URL, 0);
$errors = $user_id_sql = array();
if (isset($_POST['submit']))
{
if (!$subject) $errors[] = $lang['EMPTY_SUBJECT'];
if (!$message) $errors[] = $lang['EMPTY_MESSAGE'];
if (!$group_id) $errors[] = $lang['GROUP_NOT_EXIST'];
if (!$errors)
{
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
$user_id_sql[] = ','. $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
if ($group_id != -1)
{
$user_list = DB()->fetch_rowset("
SELECT u.username, u.user_email, u.user_lang
FROM ". BB_USERS ." u, ". BB_USER_GROUP ." ug
WHERE ug.group_id = $group_id
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_active = 1
AND u.user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
else
{
$user_list = DB()->fetch_rowset("
SELECT username, user_email, user_lang
FROM ". BB_USERS ."
WHERE user_active = 1
AND user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
require(INC_DIR .'emailer.class.php');
foreach ($user_list as $i => $row)
{
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('admin_send_email');
$emailer->assign_vars(array(
'SUBJECT' => html_entity_decode($subject),
'MESSAGE' => html_entity_decode($message),
));
$emailer->send();
$emailer->reset();
}
}
}
//
// Generate page
//
$sql = "SELECT group_id, group_name
FROM ". BB_GROUPS ."
WHERE group_single_user = 0
ORDER BY group_name
";
$groups = array('-- '. $lang['ALL_USERS'] .' --' => -1);
foreach (DB()->fetch_rowset($sql) as $row)
{
$groups[$row['group_name']] = $row['group_id'];
}
$template->assign_vars(array(
'MESSAGE' => $message,
'SUBJECT' => $subject,
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'S_USER_ACTION' => 'admin_mass_email.php',
'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups),
));
print_page('admin_mass_email.tpl', 'admin');

View file

@ -1,258 +1,258 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Ranks'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$_POST['special_rank'] = 1;
$_POST['min_posts'] = -1;
if(isset($_GET['mode']) || isset($_POST['mode']))
{
$mode = isset($_GET['mode']) ? $_GET['mode'] : $_POST['mode'];
}
else
{
//
// These could be entered via a form button
//
if (isset($_POST['add']))
{
$mode = 'add';
}
elseif (isset($_POST['save']))
{
$mode = 'save';
}
else
{
$mode = '';
}
}
if ($mode != '')
{
if ($mode == 'edit' || $mode == 'add')
{
//
// They want to add a new rank, show the form.
//
$rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
$s_hidden_fields = '';
if ($mode == 'edit')
{
if (empty($rank_id))
{
bb_die($lang['MUST_SELECT_RANK']);
}
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain ranks data #1');
}
$rank_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="'. $rank_id .'" />';
}
else
{
$rank_info['rank_special'] = 0;
}
$s_hidden_fields .= '<input type="hidden" name="mode" value="save" />';
$rank_is_special = !empty($rank_info['rank_special']) ? HTML_CHECKED : '';
$rank_is_not_special = empty($rank_info['rank_special']) ? HTML_CHECKED : '';
$template->assign_vars(array(
'TPL_RANKS_EDIT' => true,
'RANK' => !empty($rank_info['rank_title']) ? $rank_info['rank_title'] : '',
'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',
'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '',
'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '<img src="../'. $rank_info['rank_image'] .'" />' : '',
'S_RANK_ACTION' => "admin_ranks.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
elseif ($mode == 'save')
{
//
// Ok, they sent us our info, let's update it.
//
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0;
$rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : '';
$rank_style = (isset($_POST['style'])) ? trim($_POST['style']) : '';
$special_rank = ($_POST['special_rank'] == 1) ? TRUE : 0;
$min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1;
$rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : '';
if ($rank_title == '')
{
bb_die($lang['MUST_SELECT_RANK']);
}
if ($special_rank == 1)
{
$max_posts = -1;
$min_posts = -1;
}
//
// The rank image has to be a jpg, gif or png
//
if ($rank_image != '')
{
if (!preg_match('/(\.gif|\.png|\.jpg)$/is', $rank_image))
{
$rank_image = '';
}
}
if ($rank_id)
{
if (!$special_rank)
{
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
}
}
$sql = "UPDATE " . BB_RANKS . "
SET rank_title = '". DB()->escape($rank_title) ."',
rank_special = $special_rank,
rank_min = $min_posts,
rank_image = '". DB()->escape($rank_image) . "',
rank_style = '". DB()->escape($rank_style) ."'
WHERE rank_id = $rank_id";
$message = $lang['RANK_UPDATED'];
}
else
{
$sql = "INSERT INTO " . BB_RANKS . " (rank_title, rank_special, rank_min, rank_image, rank_style)
VALUES ('". DB()->escape($rank_title) ."', $special_rank, $min_posts, '". DB()->escape($rank_image) ."', '". DB()->escape($rank_style) ."')";
$message = $lang['RANK_ADDED'];
}
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not update / insert into ranks table');
}
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
$datastore->update('ranks');
bb_die($message);
}
elseif ($mode == 'delete')
{
//
// Ok, they want to delete their rank
//
if (isset($_POST['id']) || isset($_GET['id']))
{
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']);
}
else
{
$rank_id = 0;
}
if ($rank_id)
{
$sql = "DELETE FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not delete rank data');
}
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
}
$datastore->update('ranks');
bb_die($lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
bb_die($lang['MUST_SELECT_RANK']);
}
}
else
{
bb_die('Invalid mode');
}
}
else
{
//
// Show the default page
//
$sql = "SELECT * FROM " . BB_RANKS . " ORDER BY rank_min, rank_title";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain ranks data #2');
}
$rank_count = DB()->num_rows($result);
$rank_rows = DB()->sql_fetchrowset($result);
$template->assign_vars(array(
'TPL_RANKS_LIST' => true,
'S_RANKS_ACTION' => "admin_ranks.php",
));
for ($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
if ($special_rank == 1)
{
$rank_min = $rank_max = '-';
}
$row_class = !($i % 2) ? 'row1' : 'row2';
$rank_is_special = ($special_rank) ? $lang['YES'] : $lang['NO'];
$template->assign_block_vars('ranks', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank,
'STYLE' => $rank_rows[$i]['rank_style'],
'IMAGE_DISPLAY' => ($rank_rows[$i]['rank_image']) ? '<img src="../'. $rank_rows[$i]['rank_image'] .'" />' : '',
'SPECIAL_RANK' => $rank_is_special,
'RANK_MIN' => $rank_min,
'U_RANK_EDIT' => "admin_ranks.php?mode=edit&amp;id=$rank_id",
'U_RANK_DELETE' => "admin_ranks.php?mode=delete&amp;id=$rank_id",
));
}
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Ranks'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
$_POST['special_rank'] = 1;
$_POST['min_posts'] = -1;
if(isset($_GET['mode']) || isset($_POST['mode']))
{
$mode = isset($_GET['mode']) ? $_GET['mode'] : $_POST['mode'];
}
else
{
//
// These could be entered via a form button
//
if (isset($_POST['add']))
{
$mode = 'add';
}
elseif (isset($_POST['save']))
{
$mode = 'save';
}
else
{
$mode = '';
}
}
if ($mode != '')
{
if ($mode == 'edit' || $mode == 'add')
{
//
// They want to add a new rank, show the form.
//
$rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
$s_hidden_fields = '';
if ($mode == 'edit')
{
if (empty($rank_id))
{
bb_die($lang['MUST_SELECT_RANK']);
}
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain ranks data #1');
}
$rank_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="'. $rank_id .'" />';
}
else
{
$rank_info['rank_special'] = 0;
}
$s_hidden_fields .= '<input type="hidden" name="mode" value="save" />';
$rank_is_special = !empty($rank_info['rank_special']) ? HTML_CHECKED : '';
$rank_is_not_special = empty($rank_info['rank_special']) ? HTML_CHECKED : '';
$template->assign_vars(array(
'TPL_RANKS_EDIT' => true,
'RANK' => !empty($rank_info['rank_title']) ? $rank_info['rank_title'] : '',
'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',
'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '',
'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '<img src="../'. $rank_info['rank_image'] .'" />' : '',
'S_RANK_ACTION' => "admin_ranks.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
elseif ($mode == 'save')
{
//
// Ok, they sent us our info, let's update it.
//
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0;
$rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : '';
$rank_style = (isset($_POST['style'])) ? trim($_POST['style']) : '';
$special_rank = ($_POST['special_rank'] == 1) ? TRUE : 0;
$min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1;
$rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : '';
if ($rank_title == '')
{
bb_die($lang['MUST_SELECT_RANK']);
}
if ($special_rank == 1)
{
$max_posts = -1;
$min_posts = -1;
}
//
// The rank image has to be a jpg, gif or png
//
if ($rank_image != '')
{
if (!preg_match('/(\.gif|\.png|\.jpg)$/is', $rank_image))
{
$rank_image = '';
}
}
if ($rank_id)
{
if (!$special_rank)
{
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
}
}
$sql = "UPDATE " . BB_RANKS . "
SET rank_title = '". DB()->escape($rank_title) ."',
rank_special = $special_rank,
rank_min = $min_posts,
rank_image = '". DB()->escape($rank_image) . "',
rank_style = '". DB()->escape($rank_style) ."'
WHERE rank_id = $rank_id";
$message = $lang['RANK_UPDATED'];
}
else
{
$sql = "INSERT INTO " . BB_RANKS . " (rank_title, rank_special, rank_min, rank_image, rank_style)
VALUES ('". DB()->escape($rank_title) ."', $special_rank, $min_posts, '". DB()->escape($rank_image) ."', '". DB()->escape($rank_style) ."')";
$message = $lang['RANK_ADDED'];
}
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not update / insert into ranks table');
}
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
$datastore->update('ranks');
bb_die($message);
}
elseif ($mode == 'delete')
{
//
// Ok, they want to delete their rank
//
if (isset($_POST['id']) || isset($_GET['id']))
{
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']);
}
else
{
$rank_id = 0;
}
if ($rank_id)
{
$sql = "DELETE FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not delete rank data');
}
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
}
$datastore->update('ranks');
bb_die($lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
bb_die($lang['MUST_SELECT_RANK']);
}
}
else
{
bb_die('Invalid mode');
}
}
else
{
//
// Show the default page
//
$sql = "SELECT * FROM " . BB_RANKS . " ORDER BY rank_min, rank_title";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain ranks data #2');
}
$rank_count = DB()->num_rows($result);
$rank_rows = DB()->sql_fetchrowset($result);
$template->assign_vars(array(
'TPL_RANKS_LIST' => true,
'S_RANKS_ACTION' => "admin_ranks.php",
));
for ($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
if ($special_rank == 1)
{
$rank_min = $rank_max = '-';
}
$row_class = !($i % 2) ? 'row1' : 'row2';
$rank_is_special = ($special_rank) ? $lang['YES'] : $lang['NO'];
$template->assign_block_vars('ranks', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank,
'STYLE' => $rank_rows[$i]['rank_style'],
'IMAGE_DISPLAY' => ($rank_rows[$i]['rank_image']) ? '<img src="../'. $rank_rows[$i]['rank_image'] .'" />' : '',
'SPECIAL_RANK' => $rank_is_special,
'RANK_MIN' => $rank_min,
'U_RANK_EDIT' => "admin_ranks.php?mode=edit&amp;id=$rank_id",
'U_RANK_DELETE' => "admin_ranks.php?mode=delete&amp;id=$rank_id",
));
}
}
print_page('admin_ranks.tpl', 'admin');

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,373 +1,373 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Smilies'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
// Check to see what mode we should operate in
if( isset($_POST['mode']) || isset($_GET['mode']) )
{
$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = '';
}
$delimeter = '=+:';
// Read a listing of uploaded smilies for use in the add or edit smliey code
$dir = @opendir(BB_ROOT . $bb_cfg['smilies_path']);
while ($file = @readdir($dir))
{
if (!@is_dir(bb_realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file)))
{
$img_size = @getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
if ($img_size[0] && $img_size[1])
{
$smiley_images[] = $file;
}
else if (preg_match('/.pak$/i', $file))
{
$smiley_paks[] = $file;
}
}
}
@closedir($dir);
// Select main mode
if (isset($_GET['import_pack']) || isset($_POST['import_pack']))
{
$smile_pak = (string) request_var('smile_pak', '');
$clear_current = (int) request_var('clear_current', '');
$replace_existing = (int) request_var('replace', '');
if (!empty($smile_pak))
{
// The user has already selected a smile_pak file.. Import it
if (!empty($clear_current))
{
$sql = "DELETE FROM " . BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not delete current smilies');
}
$datastore->update('smile_replacements');
}
else
{
$sql = "SELECT code FROM ". BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not get current smilies');
}
$cur_smilies = DB()->sql_fetchrowset($result);
for ($i = 0; $i < count($cur_smilies); $i++)
{
$k = $cur_smilies[$i]['code'];
$smiles[$k] = 1;
}
}
$fcontents = @file(BB_ROOT . $bb_cfg['smilies_path'] . '/'. $smile_pak);
if (empty($fcontents))
{
bb_die('Could not read smiley pak file');
}
for ($i = 0; $i < count($fcontents); $i++)
{
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
for ($j = 2; $j < count($smile_data); $j++)
{
// Replace > and < with the proper html_entities for matching
$smile_data[$j] = str_replace('<', '&lt;', $smile_data[$j]);
$smile_data[$j] = str_replace('>', '&gt;', $smile_data[$j]);
$k = $smile_data[$j];
if (isset($smiles[$k]))
{
if( !empty($replace_existing) )
{
$sql = "UPDATE " . BB_SMILIES . "
SET smile_url = '" . DB()->escape($smile_data[0]) . "', emoticon = '" . DB()->escape($smile_data[1]) . "'
WHERE code = '" . DB()->escape($smile_data[$j]) . "'";
}
else
{
$sql = '';
}
}
else
{
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
VALUES('" . DB()->escape($smile_data[$j]) . "', '" . DB()->escape($smile_data[0]) . "', '" . DB()->escape($smile_data[1]) . "')";
}
if ($sql != '')
{
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not update smilies #1');
}
$datastore->update('smile_replacements');
}
}
}
bb_die($lang['SMILEY_IMPORT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
// Display the script to get the smile_pak cfg file
$smile_paks_select = '<select name="smile_pak"><option value="">' . $lang['SELECT_PAK'] . '</option>';
while (list($key, $value) = @each($smiley_paks))
{
if (!empty($value))
{
$smile_paks_select .= '<option>' . $value . '</option>';
}
}
$smile_paks_select .= '</select>';
$hidden_vars = '<input type="hidden" name="mode" value="import">';
$template->assign_vars(array(
'TPL_SMILE_IMPORT' => true,
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_SMILE_SELECT' => $smile_paks_select,
'S_HIDDEN_FIELDS' => $hidden_vars,
));
}
}
else if (isset($_POST['export_pack']) || isset($_GET['export_pack']))
{
$export_pack = (string) request_var('export_pack', '');
if ($export_pack == 'send')
{
$sql = "SELECT * FROM " . BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not get smiley list');
}
$resultset = DB()->sql_fetchrowset($result);
$smile_pak = '';
for ($i = 0; $i < count($resultset); $i++)
{
$smile_pak .= $resultset[$i]['smile_url'] . $delimeter;
$smile_pak .= $resultset[$i]['emoticon'] . $delimeter;
$smile_pak .= $resultset[$i]['code'] . "\n";
}
header("Content-Type: text/x-delimtext; name=\"smiles.pak\"");
header("Content-disposition: attachment; filename=smiles.pak");
echo $smile_pak;
exit;
}
bb_die(sprintf($lang['EXPORT_SMILES'], '<a href="admin_smilies.php?export_pack=send">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else if (isset($_POST['add']) || isset($_GET['add']))
{
$filename_list = '';
for ($i = 0; $i < count($smiley_images); $i++)
{
$filename_list .= '<option value="'. $smiley_images[$i] .'">'. $smiley_images[$i] .'</option>';
}
$s_hidden_fields = '<input type="hidden" name="mode" value="savenew" />';
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_images[0],
'S_SMILEY_ACTION' => "admin_smilies.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
));
}
else if ( $mode != '' )
{
switch( $mode )
{
case 'delete':
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
$smiley_id = intval($smiley_id);
$sql = "DELETE FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not delete smiley');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
case 'edit':
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
$smiley_id = intval($smiley_id);
$sql = "SELECT * FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not obtain emoticon information');
}
$smile_data = DB()->sql_fetchrow($result);
$filename_list = '';
for ($i = 0; $i < count($smiley_images); $i++)
{
if ($smiley_images[$i] == $smile_data['smile_url'])
{
$smiley_selected = 'selected="selected"';
$smiley_edit_img = $smiley_images[$i];
}
else
{
$smiley_selected = '';
}
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
}
$s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="smile_id" value="'. $smile_data['smilies_id'] .'" />';
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
'SMILEY_CODE' => $smile_data['code'],
'SMILEY_EMOTICON' => $smile_data['emoticon'],
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
'S_SMILEY_ACTION' => "admin_smilies.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
));
break;
case 'save':
$smile_code = ( isset($_POST['smile_code']) ) ? trim($_POST['smile_code']) : trim($_GET['smile_code']);
$smile_url = ( isset($_POST['smile_url']) ) ? trim($_POST['smile_url']) : trim($_GET['smile_url']);
$smile_url = bb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? trim($_POST['smile_emotion']) : trim($_GET['smile_emotion']);
$smile_id = ( isset($_POST['smile_id']) ) ? intval($_POST['smile_id']) : intval($_GET['smile_id']);
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
// Convert < and > to proper htmlentities for parsing
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
// Proceed with updating the smiley table
$sql = "UPDATE " . BB_SMILIES . "
SET code = '" . DB()->escape($smile_code) . "', smile_url = '" . DB()->escape($smile_url) . "', emoticon = '" . DB()->escape($smile_emotion) . "'
WHERE smilies_id = $smile_id";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not update smilies #2');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_EDIT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
case 'savenew':
$smile_code = ( isset($_POST['smile_code']) ) ? $_POST['smile_code'] : $_GET['smile_code'];
$smile_url = ( isset($_POST['smile_url']) ) ? $_POST['smile_url'] : $_GET['smile_url'];
$smile_url = bb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? $_POST['smile_emotion'] : $_GET['smile_emotion'];
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
$smile_emotion = trim($smile_emotion);
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
// Convert < and > to proper htmlentities for parsing
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
// Save the data to the smiley table
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
VALUES ('" . DB()->escape($smile_code) . "', '" . DB()->escape($smile_url) . "', '" . DB()->escape($smile_emotion) . "')";
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not insert new smiley');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_ADD_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
}
}
else
{
$sql = "SELECT * FROM " . BB_SMILIES;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not obtain smileys from database');
}
$smilies = DB()->sql_fetchrowset($result);
$template->assign_vars(array(
'TPL_SMILE_MAIN' => true,
'S_HIDDEN_FIELDS' => @$s_hidden_fields,
'S_SMILEY_ACTION' => 'admin_smilies.php',
));
// Loop throuh the rows of smilies setting block vars for the template
for ($i = 0; $i < count($smilies); $i++)
{
// Replace htmlentites for < and > with actual character
$smilies[$i]['code'] = str_replace('&lt;', '<', $smilies[$i]['code']);
$smilies[$i]['code'] = str_replace('&gt;', '>', $smilies[$i]['code']);
$row_class = !($i % 2) ? 'row1' : 'row2';
$template->assign_block_vars('smiles', array(
'ROW_CLASS' => $row_class,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] .'/'. $smilies[$i]['smile_url'],
'CODE' => $smilies[$i]['code'],
'EMOT' => $smilies[$i]['emoticon'],
'U_SMILEY_EDIT' => "admin_smilies.php?mode=edit&amp;id=". $smilies[$i]['smilies_id'],
'U_SMILEY_DELETE' => "admin_smilies.php?mode=delete&amp;id=". $smilies[$i]['smilies_id'],
));
}
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Smilies'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
// Check to see what mode we should operate in
if( isset($_POST['mode']) || isset($_GET['mode']) )
{
$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = '';
}
$delimeter = '=+:';
// Read a listing of uploaded smilies for use in the add or edit smliey code
$dir = @opendir(BB_ROOT . $bb_cfg['smilies_path']);
while ($file = @readdir($dir))
{
if (!@is_dir(bb_realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file)))
{
$img_size = @getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
if ($img_size[0] && $img_size[1])
{
$smiley_images[] = $file;
}
else if (preg_match('/.pak$/i', $file))
{
$smiley_paks[] = $file;
}
}
}
@closedir($dir);
// Select main mode
if (isset($_GET['import_pack']) || isset($_POST['import_pack']))
{
$smile_pak = (string) request_var('smile_pak', '');
$clear_current = (int) request_var('clear_current', '');
$replace_existing = (int) request_var('replace', '');
if (!empty($smile_pak))
{
// The user has already selected a smile_pak file.. Import it
if (!empty($clear_current))
{
$sql = "DELETE FROM " . BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not delete current smilies');
}
$datastore->update('smile_replacements');
}
else
{
$sql = "SELECT code FROM ". BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not get current smilies');
}
$cur_smilies = DB()->sql_fetchrowset($result);
for ($i = 0; $i < count($cur_smilies); $i++)
{
$k = $cur_smilies[$i]['code'];
$smiles[$k] = 1;
}
}
$fcontents = @file(BB_ROOT . $bb_cfg['smilies_path'] . '/'. $smile_pak);
if (empty($fcontents))
{
bb_die('Could not read smiley pak file');
}
for ($i = 0; $i < count($fcontents); $i++)
{
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
for ($j = 2; $j < count($smile_data); $j++)
{
// Replace > and < with the proper html_entities for matching
$smile_data[$j] = str_replace('<', '&lt;', $smile_data[$j]);
$smile_data[$j] = str_replace('>', '&gt;', $smile_data[$j]);
$k = $smile_data[$j];
if (isset($smiles[$k]))
{
if( !empty($replace_existing) )
{
$sql = "UPDATE " . BB_SMILIES . "
SET smile_url = '" . DB()->escape($smile_data[0]) . "', emoticon = '" . DB()->escape($smile_data[1]) . "'
WHERE code = '" . DB()->escape($smile_data[$j]) . "'";
}
else
{
$sql = '';
}
}
else
{
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
VALUES('" . DB()->escape($smile_data[$j]) . "', '" . DB()->escape($smile_data[0]) . "', '" . DB()->escape($smile_data[1]) . "')";
}
if ($sql != '')
{
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not update smilies #1');
}
$datastore->update('smile_replacements');
}
}
}
bb_die($lang['SMILEY_IMPORT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
// Display the script to get the smile_pak cfg file
$smile_paks_select = '<select name="smile_pak"><option value="">' . $lang['SELECT_PAK'] . '</option>';
while (list($key, $value) = @each($smiley_paks))
{
if (!empty($value))
{
$smile_paks_select .= '<option>' . $value . '</option>';
}
}
$smile_paks_select .= '</select>';
$hidden_vars = '<input type="hidden" name="mode" value="import">';
$template->assign_vars(array(
'TPL_SMILE_IMPORT' => true,
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_SMILE_SELECT' => $smile_paks_select,
'S_HIDDEN_FIELDS' => $hidden_vars,
));
}
}
else if (isset($_POST['export_pack']) || isset($_GET['export_pack']))
{
$export_pack = (string) request_var('export_pack', '');
if ($export_pack == 'send')
{
$sql = "SELECT * FROM " . BB_SMILIES;
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not get smiley list');
}
$resultset = DB()->sql_fetchrowset($result);
$smile_pak = '';
for ($i = 0; $i < count($resultset); $i++)
{
$smile_pak .= $resultset[$i]['smile_url'] . $delimeter;
$smile_pak .= $resultset[$i]['emoticon'] . $delimeter;
$smile_pak .= $resultset[$i]['code'] . "\n";
}
header("Content-Type: text/x-delimtext; name=\"smiles.pak\"");
header("Content-disposition: attachment; filename=smiles.pak");
echo $smile_pak;
exit;
}
bb_die(sprintf($lang['EXPORT_SMILES'], '<a href="admin_smilies.php?export_pack=send">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else if (isset($_POST['add']) || isset($_GET['add']))
{
$filename_list = '';
for ($i = 0; $i < count($smiley_images); $i++)
{
$filename_list .= '<option value="'. $smiley_images[$i] .'">'. $smiley_images[$i] .'</option>';
}
$s_hidden_fields = '<input type="hidden" name="mode" value="savenew" />';
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_images[0],
'S_SMILEY_ACTION' => "admin_smilies.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
));
}
else if ( $mode != '' )
{
switch( $mode )
{
case 'delete':
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
$smiley_id = intval($smiley_id);
$sql = "DELETE FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not delete smiley');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
case 'edit':
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
$smiley_id = intval($smiley_id);
$sql = "SELECT * FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not obtain emoticon information');
}
$smile_data = DB()->sql_fetchrow($result);
$filename_list = '';
for ($i = 0; $i < count($smiley_images); $i++)
{
if ($smiley_images[$i] == $smile_data['smile_url'])
{
$smiley_selected = 'selected="selected"';
$smiley_edit_img = $smiley_images[$i];
}
else
{
$smiley_selected = '';
}
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
}
$s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="smile_id" value="'. $smile_data['smilies_id'] .'" />';
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
'SMILEY_CODE' => $smile_data['code'],
'SMILEY_EMOTICON' => $smile_data['emoticon'],
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
'S_SMILEY_ACTION' => "admin_smilies.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
));
break;
case 'save':
$smile_code = ( isset($_POST['smile_code']) ) ? trim($_POST['smile_code']) : trim($_GET['smile_code']);
$smile_url = ( isset($_POST['smile_url']) ) ? trim($_POST['smile_url']) : trim($_GET['smile_url']);
$smile_url = bb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? trim($_POST['smile_emotion']) : trim($_GET['smile_emotion']);
$smile_id = ( isset($_POST['smile_id']) ) ? intval($_POST['smile_id']) : intval($_GET['smile_id']);
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
// Convert < and > to proper htmlentities for parsing
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
// Proceed with updating the smiley table
$sql = "UPDATE " . BB_SMILIES . "
SET code = '" . DB()->escape($smile_code) . "', smile_url = '" . DB()->escape($smile_url) . "', emoticon = '" . DB()->escape($smile_emotion) . "'
WHERE smilies_id = $smile_id";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not update smilies #2');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_EDIT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
case 'savenew':
$smile_code = ( isset($_POST['smile_code']) ) ? $_POST['smile_code'] : $_GET['smile_code'];
$smile_url = ( isset($_POST['smile_url']) ) ? $_POST['smile_url'] : $_GET['smile_url'];
$smile_url = bb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? $_POST['smile_emotion'] : $_GET['smile_emotion'];
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
$smile_emotion = trim($smile_emotion);
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
}
// Convert < and > to proper htmlentities for parsing
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
// Save the data to the smiley table
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
VALUES ('" . DB()->escape($smile_code) . "', '" . DB()->escape($smile_url) . "', '" . DB()->escape($smile_emotion) . "')";
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not insert new smiley');
}
$datastore->update('smile_replacements');
bb_die($lang['SMILEY_ADD_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
}
}
else
{
$sql = "SELECT * FROM " . BB_SMILIES;
$result = DB()->sql_query($sql);
if (!$result)
{
bb_die('Could not obtain smileys from database');
}
$smilies = DB()->sql_fetchrowset($result);
$template->assign_vars(array(
'TPL_SMILE_MAIN' => true,
'S_HIDDEN_FIELDS' => @$s_hidden_fields,
'S_SMILEY_ACTION' => 'admin_smilies.php',
));
// Loop throuh the rows of smilies setting block vars for the template
for ($i = 0; $i < count($smilies); $i++)
{
// Replace htmlentites for < and > with actual character
$smilies[$i]['code'] = str_replace('&lt;', '<', $smilies[$i]['code']);
$smilies[$i]['code'] = str_replace('&gt;', '>', $smilies[$i]['code']);
$row_class = !($i % 2) ? 'row1' : 'row2';
$template->assign_block_vars('smiles', array(
'ROW_CLASS' => $row_class,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] .'/'. $smilies[$i]['smile_url'],
'CODE' => $smilies[$i]['code'],
'EMOT' => $smilies[$i]['emoticon'],
'U_SMILEY_EDIT' => "admin_smilies.php?mode=edit&amp;id=". $smilies[$i]['smilies_id'],
'U_SMILEY_DELETE' => "admin_smilies.php?mode=delete&amp;id=". $smilies[$i]['smilies_id'],
));
}
}
print_page('admin_smilies.tpl', 'admin');

View file

@ -1,476 +1,476 @@
<?php
$max_forum_name_length = 50;
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Permissions'] = basename(__FILE__) .'?mode=user';
$module['Groups']['Permissions'] = basename(__FILE__) .'?mode=group';
return;
}
require('./pagestart.php');
// ACP Header - END
require(INC_DIR .'functions_group.php');
$yes_sign = '&radic;';
$no_sign = 'x';
$group_id = (int) @$_REQUEST['g'];
$user_id = (int) @$_REQUEST['u'];
$cat_id = (int) @$_REQUEST['c'];
$mode = (string) @$_REQUEST['mode'];
$submit = isset($_POST['submit']);
$group_data = array();
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
if ($submit && $mode == 'user')
{
$this_user_level = null;
// Obtain relevant data for this user
if (!$row = get_userdata($user_id))
{
bb_die($lang['NO_SUCH_USER']);
}
$this_user_level = $row['user_level'];
// Get "single_user" group_id for this user
$sql = "SELECT g.group_id
FROM ". BB_USER_GROUP ." ug, ". BB_GROUPS ." g
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
AND g.group_single_user = 1";
if ($row = DB()->fetch_row($sql))
{
$group_id = $row['group_id'];
}
else
{
$group_id = create_user_group($user_id);
}
if (!$group_id || !$user_id || is_null($this_user_level))
{
trigger_error('data missing', E_USER_ERROR);
}
// Make user an admin (if already user)
if (@$_POST['userlevel'] === 'admin')
{
if ($userdata['user_id'] == $user_id || $user_id == GUEST_UID || $user_id == BOT_UID)
{
bb_die("Could not update admin status");
}
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". ADMIN ." WHERE user_id = $user_id LIMIT 1");
// Delete any entries in auth_access, they are not required if user is becoming an admin
delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
// Make admin a user (if already admin)
else if (@$_POST['userlevel'] === 'user')
{
// ignore if you're trying to change yourself from an admin to user!
if ($userdata['user_id'] == $user_id)
{
bb_die("Could not update admin status<br /><br />Could not change yourself from an admin to user");
}
// Update users level, reset to USER
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". USER ." WHERE user_id = $user_id LIMIT 1");
delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Submit new USER permissions
//
$auth = array();
if (is_array(@$_POST['auth']))
{
array_deep($_POST['auth'], 'intval');
foreach ($_POST['auth'] as $f_id => $bf_ary)
{
if (array_sum($bf_ary))
{
$auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
}
}
}
delete_permissions($group_id, null, $cat_id);
store_permissions($group_id, $auth);
update_user_level($user_id);
$l_auth_return = ($mode == 'user') ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Submit new GROUP permissions
//
else if ($submit && $mode == 'group' && is_array(@$_POST['auth']))
{
if (!$group_data = get_group_data($group_id))
{
bb_die($lang['GROUP_NOT_EXIST']);
}
$auth = array();
array_deep($_POST['auth'], 'intval');
foreach ($_POST['auth'] as $f_id => $bf_ary)
{
if (array_sum($bf_ary))
{
$auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
}
}
delete_permissions($group_id, null, $cat_id);
store_permissions($group_id, $auth);
update_user_level('all');
$l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Front end (changing permissions)
//
if ($mode == 'user' && (!empty($_POST['username']) || $user_id))
{
$page_cfg['quirks_mode'] = true;
if (!empty($_POST['username']))
{
$this_userdata = get_userdata($_POST['username'], true);
$user_id = $this_userdata['user_id'];
}
else
{
$this_userdata = get_userdata($user_id);
}
if (!$this_userdata)
{
bb_die($lang['NO_SUCH_USER']);
}
if (!$forums = $datastore->get('cat_forums'))
{
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$base_url = basename(__FILE__) ."?mode=user&amp;u=$user_id";
$ug_data = $this_userdata;
$ug_data['session_logged_in'] = 1;
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_USER_ONLY);
$g_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_GROUP_ONLY);
foreach ($forums['c'] as $c_id => $c_data)
{
$template->assign_block_vars('c', array(
'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;c=$c_id",
));
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
{
continue;
}
foreach ($c_data['forums'] as $f_id)
{
$f_data = $forums['f'][$f_id];
$auth_mod = ($u_access[$f_id]['auth_mod'] || $g_access[$f_id]['auth_mod']);
$disabled = $g_access[$f_id]['auth_mod'];
$template->assign_block_vars('c.f', array(
'DISABLED' => $disabled,
'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool) $auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NONE'],
'MOD_CLASS' => ($auth_mod) ? (($disabled) ? 'yesDisabled' : 'yesMOD') : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0,
));
foreach ($forum_auth_fields as $auth_type)
{
$bf_num = $bf['forum_perm'][$auth_type];
$f_perm = $f_data[$auth_type];
$auth_via_acl = ($u_access[$f_id][$auth_type] || $g_access[$f_id][$auth_type]);
if ($f_perm == AUTH_ACL)
{
$disabled = ($auth_mod || $g_access[$f_id][$auth_type]);
$perm_sign = ($auth_via_acl || $auth_mod) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
}
else
{
$disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no';
}
$template->assign_block_vars('c.f.acl', array(
'DISABLED' => $disabled,
'PERM_SIGN' => $perm_sign,
'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0,
));
}
}
}
$template->assign_vars(array(
'AUTH_MOD_BF' => AUTH_MOD,
));
$s_column_span = 2;
foreach ($forum_auth_fields as $auth_type)
{
$template->assign_block_vars('acltype', array(
'ACL_TYPE_NAME' => preg_replace("#(.{5})#u", "\\1<br />", $lang[strtoupper($auth_type)]),
'ACL_TYPE_BF' => $bf['forum_perm'][$auth_type],
));
$s_column_span++;
}
unset($forums, $u_access, $g_access);
$datastore->rm('cat_forums');
$s_hidden_fields = '
<input type="hidden" name="mode" value="'. $mode .'" />
<input type="hidden" name="'. POST_USERS_URL .'" value="'. $user_id .'" />
';
$s_user_type = ($this_userdata['user_level'] == ADMIN) ? '
<select name="userlevel">
<option value="admin" selected="selected">'. $lang['AUTH_ADMIN'] .'</option>
<option value="user">'. $lang['AUTH_USER'] .'</option>
</select>
' : '
<select name="userlevel">
<option value="admin">'. $lang['AUTH_ADMIN'] .'</option>
<option value="user" selected="selected">'. $lang['AUTH_USER'] .'</option>
</select>
';
$template->assign_block_vars('switch_user_auth', array());
$template->assign_vars(array(
'TPL_AUTH_UG_MAIN' => true,
'USER_OR_GROUPNAME' => $this_userdata['username'],
'USER_LEVEL' => $lang['USER_LEVEL'] .' : '. $s_user_type,
'USER_GROUP_MEMBERSHIPS' => $lang['GROUP_MEMBERSHIPS'],
));
$template->assign_vars(array(
'T_USER_OR_GROUPNAME' => $lang['USERNAME'],
'T_AUTH_TITLE' => $lang['AUTH_CONTROL_USER'],
'T_AUTH_EXPLAIN' => $lang['USER_AUTH_EXPLAIN'],
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else if ($mode == 'group' && $group_id)
{
$page_cfg['quirks_mode'] = true;
if (!$group_data = get_group_data($group_id))
{
bb_die($lang['GROUP_NOT_EXIST']);
}
if (!$forums = $datastore->get('cat_forums'))
{
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$base_url = basename(__FILE__) ."?mode=group&amp;g=$group_id";
$ug_data = array('group_id' => $group_id);
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data);
foreach ($forums['c'] as $c_id => $c_data)
{
$template->assign_block_vars('c', array(
'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;c=$c_id",
));
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
{
continue;
}
foreach ($c_data['forums'] as $f_id)
{
$f_data = $forums['f'][$f_id];
$auth_mod = $u_access[$f_id]['auth_mod'];
$template->assign_block_vars('c.f', array(
'DISABLED' => false,
'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool) $auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NO'],
'MOD_CLASS' => ($auth_mod) ? 'yesMOD' : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0,
));
foreach ($forum_auth_fields as $auth_type)
{
$bf_num = $bf['forum_perm'][$auth_type];
$f_perm = $f_data[$auth_type];
$auth_via_acl = $u_access[$f_id][$auth_type];
if ($f_perm == AUTH_ACL)
{
$disabled = $auth_mod;
$perm_sign = ($auth_via_acl || $auth_mod) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
}
else
{
$disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no';
}
$template->assign_block_vars('c.f.acl', array(
'DISABLED' => $disabled,
'PERM_SIGN' => $perm_sign,
'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0,
));
}
}
}
$template->assign_vars(array(
'AUTH_MOD_BF' => AUTH_MOD,
));
$s_column_span = 2;
foreach ($forum_auth_fields as $auth_type)
{
$template->assign_block_vars('acltype', array(
'ACL_TYPE_NAME' => preg_replace("#(.{5})#u", "\\1<br />", $lang[strtoupper($auth_type)]),
'ACL_TYPE_BF' => $bf['forum_perm'][$auth_type],
));
$s_column_span++;
}
unset($forums, $ug_data, $u_access);
$datastore->rm('cat_forums');
$s_hidden_fields = '
<input type="hidden" name="mode" value="'. $mode .'" />
<input type="hidden" name="g" value="'. $group_id .'" />
';
$template->assign_vars(array(
'TPL_AUTH_UG_MAIN' => true,
'T_USER_OR_GROUPNAME' => $lang['GROUP_NAME'],
'USER_LEVEL' => false,
'T_AUTH_TITLE' => $lang['AUTH_CONTROL_GROUP'],
'T_AUTH_EXPLAIN' => $lang['GROUP_AUTH_EXPLAIN'],
'USER_OR_GROUPNAME' => htmlCHR($group_data['group_name']),
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else
{
// Select a user/group
if ($mode == 'user')
{
$template->assign_vars(array(
'TPL_SELECT_USER' => true,
'U_SEARCH_USER' => BB_ROOT ."search.php?mode=searchuser",
));
}
else
{
$template->assign_vars(array(
'TPL_SELECT_GROUP' => true,
'S_GROUP_SELECT' => get_select('groups'),
));
}
$s_hidden_fields = '<input type="hidden" name="mode" value="'. $mode .'" />';
$template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
$template->assign_vars(array(
'YES_SIGN' => $yes_sign,
'NO_SIGN' => $no_sign,
'T_MOD_YES' => $lang['MODERATOR'],
'T_MOD_NO' => $lang['NO'],
'S_AUTH_ACTION' => "admin_ug_auth.php",
'SELECTED_CAT' => !empty($_REQUEST['c']) ? $_REQUEST['c'] : '',
'U_ALL_FORUMS' => !empty($base_url) ? "$base_url&amp;c=all" : '',
));
<?php
$max_forum_name_length = 50;
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Permissions'] = basename(__FILE__) .'?mode=user';
$module['Groups']['Permissions'] = basename(__FILE__) .'?mode=group';
return;
}
require('./pagestart.php');
// ACP Header - END
require(INC_DIR .'functions_group.php');
$yes_sign = '&radic;';
$no_sign = 'x';
$group_id = (int) @$_REQUEST['g'];
$user_id = (int) @$_REQUEST['u'];
$cat_id = (int) @$_REQUEST['c'];
$mode = (string) @$_REQUEST['mode'];
$submit = isset($_POST['submit']);
$group_data = array();
$forum_auth_fields = array(
'auth_view',
'auth_read',
'auth_reply',
'auth_edit',
'auth_delete',
'auth_vote',
'auth_pollcreate',
'auth_attachments',
'auth_download',
'auth_post',
'auth_sticky',
'auth_announce',
);
if ($submit && $mode == 'user')
{
$this_user_level = null;
// Obtain relevant data for this user
if (!$row = get_userdata($user_id))
{
bb_die($lang['NO_SUCH_USER']);
}
$this_user_level = $row['user_level'];
// Get "single_user" group_id for this user
$sql = "SELECT g.group_id
FROM ". BB_USER_GROUP ." ug, ". BB_GROUPS ." g
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
AND g.group_single_user = 1";
if ($row = DB()->fetch_row($sql))
{
$group_id = $row['group_id'];
}
else
{
$group_id = create_user_group($user_id);
}
if (!$group_id || !$user_id || is_null($this_user_level))
{
trigger_error('data missing', E_USER_ERROR);
}
// Make user an admin (if already user)
if (@$_POST['userlevel'] === 'admin')
{
if ($userdata['user_id'] == $user_id || $user_id == GUEST_UID || $user_id == BOT_UID)
{
bb_die("Could not update admin status");
}
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". ADMIN ." WHERE user_id = $user_id LIMIT 1");
// Delete any entries in auth_access, they are not required if user is becoming an admin
delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
// Make admin a user (if already admin)
else if (@$_POST['userlevel'] === 'user')
{
// ignore if you're trying to change yourself from an admin to user!
if ($userdata['user_id'] == $user_id)
{
bb_die("Could not update admin status<br /><br />Could not change yourself from an admin to user");
}
// Update users level, reset to USER
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". USER ." WHERE user_id = $user_id LIMIT 1");
delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Submit new USER permissions
//
$auth = array();
if (is_array(@$_POST['auth']))
{
array_deep($_POST['auth'], 'intval');
foreach ($_POST['auth'] as $f_id => $bf_ary)
{
if (array_sum($bf_ary))
{
$auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
}
}
}
delete_permissions($group_id, null, $cat_id);
store_permissions($group_id, $auth);
update_user_level($user_id);
$l_auth_return = ($mode == 'user') ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Submit new GROUP permissions
//
else if ($submit && $mode == 'group' && is_array(@$_POST['auth']))
{
if (!$group_data = get_group_data($group_id))
{
bb_die($lang['GROUP_NOT_EXIST']);
}
$auth = array();
array_deep($_POST['auth'], 'intval');
foreach ($_POST['auth'] as $f_id => $bf_ary)
{
if (array_sum($bf_ary))
{
$auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
}
}
delete_permissions($group_id, null, $cat_id);
store_permissions($group_id, $auth);
update_user_level('all');
$l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] .'<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
//
// Front end (changing permissions)
//
if ($mode == 'user' && (!empty($_POST['username']) || $user_id))
{
$page_cfg['quirks_mode'] = true;
if (!empty($_POST['username']))
{
$this_userdata = get_userdata($_POST['username'], true);
$user_id = $this_userdata['user_id'];
}
else
{
$this_userdata = get_userdata($user_id);
}
if (!$this_userdata)
{
bb_die($lang['NO_SUCH_USER']);
}
if (!$forums = $datastore->get('cat_forums'))
{
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$base_url = basename(__FILE__) ."?mode=user&amp;u=$user_id";
$ug_data = $this_userdata;
$ug_data['session_logged_in'] = 1;
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_USER_ONLY);
$g_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_GROUP_ONLY);
foreach ($forums['c'] as $c_id => $c_data)
{
$template->assign_block_vars('c', array(
'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;c=$c_id",
));
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
{
continue;
}
foreach ($c_data['forums'] as $f_id)
{
$f_data = $forums['f'][$f_id];
$auth_mod = ($u_access[$f_id]['auth_mod'] || $g_access[$f_id]['auth_mod']);
$disabled = $g_access[$f_id]['auth_mod'];
$template->assign_block_vars('c.f', array(
'DISABLED' => $disabled,
'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool) $auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NONE'],
'MOD_CLASS' => ($auth_mod) ? (($disabled) ? 'yesDisabled' : 'yesMOD') : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0,
));
foreach ($forum_auth_fields as $auth_type)
{
$bf_num = $bf['forum_perm'][$auth_type];
$f_perm = $f_data[$auth_type];
$auth_via_acl = ($u_access[$f_id][$auth_type] || $g_access[$f_id][$auth_type]);
if ($f_perm == AUTH_ACL)
{
$disabled = ($auth_mod || $g_access[$f_id][$auth_type]);
$perm_sign = ($auth_via_acl || $auth_mod) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
}
else
{
$disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no';
}
$template->assign_block_vars('c.f.acl', array(
'DISABLED' => $disabled,
'PERM_SIGN' => $perm_sign,
'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0,
));
}
}
}
$template->assign_vars(array(
'AUTH_MOD_BF' => AUTH_MOD,
));
$s_column_span = 2;
foreach ($forum_auth_fields as $auth_type)
{
$template->assign_block_vars('acltype', array(
'ACL_TYPE_NAME' => preg_replace("#(.{5})#u", "\\1<br />", $lang[strtoupper($auth_type)]),
'ACL_TYPE_BF' => $bf['forum_perm'][$auth_type],
));
$s_column_span++;
}
unset($forums, $u_access, $g_access);
$datastore->rm('cat_forums');
$s_hidden_fields = '
<input type="hidden" name="mode" value="'. $mode .'" />
<input type="hidden" name="'. POST_USERS_URL .'" value="'. $user_id .'" />
';
$s_user_type = ($this_userdata['user_level'] == ADMIN) ? '
<select name="userlevel">
<option value="admin" selected="selected">'. $lang['AUTH_ADMIN'] .'</option>
<option value="user">'. $lang['AUTH_USER'] .'</option>
</select>
' : '
<select name="userlevel">
<option value="admin">'. $lang['AUTH_ADMIN'] .'</option>
<option value="user" selected="selected">'. $lang['AUTH_USER'] .'</option>
</select>
';
$template->assign_block_vars('switch_user_auth', array());
$template->assign_vars(array(
'TPL_AUTH_UG_MAIN' => true,
'USER_OR_GROUPNAME' => $this_userdata['username'],
'USER_LEVEL' => $lang['USER_LEVEL'] .' : '. $s_user_type,
'USER_GROUP_MEMBERSHIPS' => $lang['GROUP_MEMBERSHIPS'],
));
$template->assign_vars(array(
'T_USER_OR_GROUPNAME' => $lang['USERNAME'],
'T_AUTH_TITLE' => $lang['AUTH_CONTROL_USER'],
'T_AUTH_EXPLAIN' => $lang['USER_AUTH_EXPLAIN'],
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else if ($mode == 'group' && $group_id)
{
$page_cfg['quirks_mode'] = true;
if (!$group_data = get_group_data($group_id))
{
bb_die($lang['GROUP_NOT_EXIST']);
}
if (!$forums = $datastore->get('cat_forums'))
{
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$base_url = basename(__FILE__) ."?mode=group&amp;g=$group_id";
$ug_data = array('group_id' => $group_id);
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data);
foreach ($forums['c'] as $c_id => $c_data)
{
$template->assign_block_vars('c', array(
'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;c=$c_id",
));
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
{
continue;
}
foreach ($c_data['forums'] as $f_id)
{
$f_data = $forums['f'][$f_id];
$auth_mod = $u_access[$f_id]['auth_mod'];
$template->assign_block_vars('c.f', array(
'DISABLED' => false,
'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool) $auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NO'],
'MOD_CLASS' => ($auth_mod) ? 'yesMOD' : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0,
));
foreach ($forum_auth_fields as $auth_type)
{
$bf_num = $bf['forum_perm'][$auth_type];
$f_perm = $f_data[$auth_type];
$auth_via_acl = $u_access[$f_id][$auth_type];
if ($f_perm == AUTH_ACL)
{
$disabled = $auth_mod;
$perm_sign = ($auth_via_acl || $auth_mod) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
}
else
{
$disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no';
}
$template->assign_block_vars('c.f.acl', array(
'DISABLED' => $disabled,
'PERM_SIGN' => $perm_sign,
'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0,
));
}
}
}
$template->assign_vars(array(
'AUTH_MOD_BF' => AUTH_MOD,
));
$s_column_span = 2;
foreach ($forum_auth_fields as $auth_type)
{
$template->assign_block_vars('acltype', array(
'ACL_TYPE_NAME' => preg_replace("#(.{5})#u", "\\1<br />", $lang[strtoupper($auth_type)]),
'ACL_TYPE_BF' => $bf['forum_perm'][$auth_type],
));
$s_column_span++;
}
unset($forums, $ug_data, $u_access);
$datastore->rm('cat_forums');
$s_hidden_fields = '
<input type="hidden" name="mode" value="'. $mode .'" />
<input type="hidden" name="g" value="'. $group_id .'" />
';
$template->assign_vars(array(
'TPL_AUTH_UG_MAIN' => true,
'T_USER_OR_GROUPNAME' => $lang['GROUP_NAME'],
'USER_LEVEL' => false,
'T_AUTH_TITLE' => $lang['AUTH_CONTROL_GROUP'],
'T_AUTH_EXPLAIN' => $lang['GROUP_AUTH_EXPLAIN'],
'USER_OR_GROUPNAME' => htmlCHR($group_data['group_name']),
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else
{
// Select a user/group
if ($mode == 'user')
{
$template->assign_vars(array(
'TPL_SELECT_USER' => true,
'U_SEARCH_USER' => BB_ROOT ."search.php?mode=searchuser",
));
}
else
{
$template->assign_vars(array(
'TPL_SELECT_GROUP' => true,
'S_GROUP_SELECT' => get_select('groups'),
));
}
$s_hidden_fields = '<input type="hidden" name="mode" value="'. $mode .'" />';
$template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
$template->assign_vars(array(
'YES_SIGN' => $yes_sign,
'NO_SIGN' => $no_sign,
'T_MOD_YES' => $lang['MODERATOR'],
'T_MOD_NO' => $lang['NO'],
'S_AUTH_ACTION' => "admin_ug_auth.php",
'SELECTED_CAT' => !empty($_REQUEST['c']) ? $_REQUEST['c'] : '',
'U_ALL_FORUMS' => !empty($base_url) ? "$base_url&amp;c=all" : '',
));
print_page('admin_ug_auth.tpl', 'admin');

View file

@ -1,364 +1,364 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Ban_Management'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
if ( isset($_POST['submit']) )
{
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
$user_list = array();
if (!empty($_POST['username']))
{
$this_userdata = get_userdata($_POST['username'], true);
if (!$this_userdata)
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
$user_list[] = $this_userdata['user_id'];
}
$ip_list = array();
if (isset($_POST['ban_ip']))
{
$ip_list_temp = explode(',', $_POST['ban_ip']);
for ($i = 0; $i < count($ip_list_temp); $i++)
{
if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode))
{
$ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5];
while ( $ip_1_counter <= $ip_1_end )
{
$ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
$ip_2_end = ( $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[6];
if ( $ip_2_counter == 0 && $ip_2_end == 254 )
{
$ip_2_counter = 255;
$ip_2_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.255.255.255");
}
while ( $ip_2_counter <= $ip_2_end )
{
$ip_3_counter = ( $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
$ip_3_end = ( $ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[7];
if ( $ip_3_counter == 0 && $ip_3_end == 254 )
{
$ip_3_counter = 255;
$ip_3_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.255.255");
}
while ( $ip_3_counter <= $ip_3_end )
{
$ip_4_counter = ( $ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
$ip_4_end = ( $ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end ) ? 254 : $ip_range_explode[8];
if ( $ip_4_counter == 0 && $ip_4_end == 254 )
{
$ip_4_counter = 255;
$ip_4_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255");
}
while ( $ip_4_counter <= $ip_4_end )
{
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter");
$ip_4_counter++;
}
$ip_3_counter++;
}
$ip_2_counter++;
}
$ip_1_counter++;
}
}
else if (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i])))
{
$ip = gethostbynamel(trim($ip_list_temp[$i]));
for ($j = 0; $j < count($ip); $j++)
{
if (!empty($ip[$j]))
{
$ip_list[] = encode_ip($ip[$j]);
}
}
}
else if (preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ip_list_temp[$i])))
{
$ip_list[] = encode_ip(str_replace('*', '255', trim($ip_list_temp[$i])));
}
}
}
$email_list = array();
if (isset($_POST['ban_email']))
{
$email_list_temp = explode(',', $_POST['ban_email']);
for ($i = 0; $i < count($email_list_temp); $i++)
{
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
{
$email_list[] = trim($email_list_temp[$i]);
}
}
}
$sql = "SELECT * FROM " . BB_BANLIST;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not obtain banlist information');
}
$current_banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$kill_session_sql = '';
for ($i = 0; $i < count($user_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($user_list[$i] == $current_banlist[$j]['ban_userid'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
$sql = "INSERT INTO " . BB_BANLIST . " (ban_userid) VALUES (" . $user_list[$i] . ")";
if (!DB()->sql_query($sql))
{
bb_die('Could not insert ban_userid info into database');
}
}
}
for ($i = 0; $i < count($ip_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($ip_list[$i] == $current_banlist[$j]['ban_ip'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
if (preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.')))
{
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, "."))) . "'";
}
else
{
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
}
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
$sql = "INSERT INTO " . BB_BANLIST . " (ban_ip) VALUES ('" . $ip_list[$i] . "')";
if ( !DB()->sql_query($sql) )
{
bb_die('Could not insert ban_ip info into database');
}
}
}
// Now we'll delete all entries from the session table
if ($kill_session_sql != '')
{
$sql = "DELETE FROM " . BB_SESSIONS . " WHERE $kill_session_sql";
if (!DB()->sql_query($sql))
{
bb_die('Could not delete banned sessions from database');
}
}
for ($i = 0; $i < count($email_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($email_list[$i] == $current_banlist[$j]['ban_email'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
$sql = "INSERT INTO " . BB_BANLIST . " (ban_email) VALUES ('" . DB()->escape($email_list[$i]) . "')";
if (!DB()->sql_query($sql))
{
bb_die('Could not insert ban_email info into database');
}
}
}
$where_sql = '';
if (isset($_POST['unban_user']))
{
$user_list = $_POST['unban_user'];
for ($i = 0; $i < count($user_list); $i++)
{
if ($user_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);
}
}
}
if (isset($_POST['unban_ip']))
{
$ip_list = $_POST['unban_ip'];
for ($i = 0; $i < count($ip_list); $i++)
{
if ($ip_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . DB()->escape($ip_list[$i]);
}
}
}
if (isset($_POST['unban_email']))
{
$email_list = $_POST['unban_email'];
for ($i = 0; $i < count($email_list); $i++)
{
if ($email_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . DB()->escape($email_list[$i]);
}
}
}
if ($where_sql != '')
{
$sql = "DELETE FROM " . BB_BANLIST . " WHERE ban_id IN ($where_sql)";
if (!DB()->sql_query($sql))
{
bb_die('Could not delete ban info from database');
}
}
bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
$template->assign_vars(array(
'S_BANLIST_ACTION' => 'admin_user_ban.php',
));
$userban_count = 0;
$ipban_count = 0;
$emailban_count = 0;
$sql = "SELECT b.ban_id, u.user_id, u.username
FROM " . BB_BANLIST . " b, " . BB_USERS . " u
WHERE u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> " . GUEST_UID . "
ORDER BY u.username ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not select current user_id ban list');
}
$user_list = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_userlist = '';
for ($i = 0; $i < count($user_list); $i++)
{
$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
$userban_count++;
}
if ($select_userlist == '')
{
$select_userlist = '<option value="-1">' . $lang['NO_BANNED_USERS'] . '</option>';
}
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
$sql = "SELECT ban_id, ban_ip, ban_email FROM ". BB_BANLIST ." ORDER BY ban_ip";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not select current ip ban list');
}
$banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_iplist = '';
$select_emaillist = '';
for ($i = 0; $i < count($banlist); $i++)
{
$ban_id = $banlist[$i]['ban_id'];
if (!empty($banlist[$i]['ban_ip']))
{
$ban_ip = str_replace('255', '*', decode_ip($banlist[$i]['ban_ip']));
$select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
$ipban_count++;
}
else if (!empty($banlist[$i]['ban_email']))
{
$ban_email = $banlist[$i]['ban_email'];
$select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
$emailban_count++;
}
}
if ($select_iplist == '')
{
$select_iplist = '<option value="-1">' . $lang['NO_BANNED_IP'] . '</option>';
}
if ($select_emaillist == '')
{
$select_emaillist = '<option value="-1">' . $lang['NO_BANNED_EMAIL'] . '</option>';
}
$select_iplist = '<select name="unban_ip[]" multiple="multiple" size="15">' . $select_iplist . '</select>';
$select_emaillist = '<select name="unban_email[]" multiple="multiple" size="10">' . $select_emaillist . '</select>';
$template->assign_vars(array(
'U_SEARCH_USER' => './../search.php?mode=searchuser',
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
'S_BAN_ACTION' => 'admin_user_ban.php',
));
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['Users']['Ban_Management'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
if ( isset($_POST['submit']) )
{
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
$user_list = array();
if (!empty($_POST['username']))
{
$this_userdata = get_userdata($_POST['username'], true);
if (!$this_userdata)
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
$user_list[] = $this_userdata['user_id'];
}
$ip_list = array();
if (isset($_POST['ban_ip']))
{
$ip_list_temp = explode(',', $_POST['ban_ip']);
for ($i = 0; $i < count($ip_list_temp); $i++)
{
if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode))
{
$ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5];
while ( $ip_1_counter <= $ip_1_end )
{
$ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
$ip_2_end = ( $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[6];
if ( $ip_2_counter == 0 && $ip_2_end == 254 )
{
$ip_2_counter = 255;
$ip_2_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.255.255.255");
}
while ( $ip_2_counter <= $ip_2_end )
{
$ip_3_counter = ( $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
$ip_3_end = ( $ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[7];
if ( $ip_3_counter == 0 && $ip_3_end == 254 )
{
$ip_3_counter = 255;
$ip_3_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.255.255");
}
while ( $ip_3_counter <= $ip_3_end )
{
$ip_4_counter = ( $ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
$ip_4_end = ( $ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end ) ? 254 : $ip_range_explode[8];
if ( $ip_4_counter == 0 && $ip_4_end == 254 )
{
$ip_4_counter = 255;
$ip_4_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255");
}
while ( $ip_4_counter <= $ip_4_end )
{
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter");
$ip_4_counter++;
}
$ip_3_counter++;
}
$ip_2_counter++;
}
$ip_1_counter++;
}
}
else if (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i])))
{
$ip = gethostbynamel(trim($ip_list_temp[$i]));
for ($j = 0; $j < count($ip); $j++)
{
if (!empty($ip[$j]))
{
$ip_list[] = encode_ip($ip[$j]);
}
}
}
else if (preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ip_list_temp[$i])))
{
$ip_list[] = encode_ip(str_replace('*', '255', trim($ip_list_temp[$i])));
}
}
}
$email_list = array();
if (isset($_POST['ban_email']))
{
$email_list_temp = explode(',', $_POST['ban_email']);
for ($i = 0; $i < count($email_list_temp); $i++)
{
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
{
$email_list[] = trim($email_list_temp[$i]);
}
}
}
$sql = "SELECT * FROM " . BB_BANLIST;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not obtain banlist information');
}
$current_banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$kill_session_sql = '';
for ($i = 0; $i < count($user_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($user_list[$i] == $current_banlist[$j]['ban_userid'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
$sql = "INSERT INTO " . BB_BANLIST . " (ban_userid) VALUES (" . $user_list[$i] . ")";
if (!DB()->sql_query($sql))
{
bb_die('Could not insert ban_userid info into database');
}
}
}
for ($i = 0; $i < count($ip_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($ip_list[$i] == $current_banlist[$j]['ban_ip'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
if (preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.')))
{
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, "."))) . "'";
}
else
{
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
}
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
$sql = "INSERT INTO " . BB_BANLIST . " (ban_ip) VALUES ('" . $ip_list[$i] . "')";
if ( !DB()->sql_query($sql) )
{
bb_die('Could not insert ban_ip info into database');
}
}
}
// Now we'll delete all entries from the session table
if ($kill_session_sql != '')
{
$sql = "DELETE FROM " . BB_SESSIONS . " WHERE $kill_session_sql";
if (!DB()->sql_query($sql))
{
bb_die('Could not delete banned sessions from database');
}
}
for ($i = 0; $i < count($email_list); $i++)
{
$in_banlist = false;
for ($j = 0; $j < count($current_banlist); $j++)
{
if ($email_list[$i] == $current_banlist[$j]['ban_email'])
{
$in_banlist = true;
}
}
if (!$in_banlist)
{
$sql = "INSERT INTO " . BB_BANLIST . " (ban_email) VALUES ('" . DB()->escape($email_list[$i]) . "')";
if (!DB()->sql_query($sql))
{
bb_die('Could not insert ban_email info into database');
}
}
}
$where_sql = '';
if (isset($_POST['unban_user']))
{
$user_list = $_POST['unban_user'];
for ($i = 0; $i < count($user_list); $i++)
{
if ($user_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);
}
}
}
if (isset($_POST['unban_ip']))
{
$ip_list = $_POST['unban_ip'];
for ($i = 0; $i < count($ip_list); $i++)
{
if ($ip_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . DB()->escape($ip_list[$i]);
}
}
}
if (isset($_POST['unban_email']))
{
$email_list = $_POST['unban_email'];
for ($i = 0; $i < count($email_list); $i++)
{
if ($email_list[$i] != -1)
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . DB()->escape($email_list[$i]);
}
}
}
if ($where_sql != '')
{
$sql = "DELETE FROM " . BB_BANLIST . " WHERE ban_id IN ($where_sql)";
if (!DB()->sql_query($sql))
{
bb_die('Could not delete ban info from database');
}
}
bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
$template->assign_vars(array(
'S_BANLIST_ACTION' => 'admin_user_ban.php',
));
$userban_count = 0;
$ipban_count = 0;
$emailban_count = 0;
$sql = "SELECT b.ban_id, u.user_id, u.username
FROM " . BB_BANLIST . " b, " . BB_USERS . " u
WHERE u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> " . GUEST_UID . "
ORDER BY u.username ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not select current user_id ban list');
}
$user_list = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_userlist = '';
for ($i = 0; $i < count($user_list); $i++)
{
$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
$userban_count++;
}
if ($select_userlist == '')
{
$select_userlist = '<option value="-1">' . $lang['NO_BANNED_USERS'] . '</option>';
}
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
$sql = "SELECT ban_id, ban_ip, ban_email FROM ". BB_BANLIST ." ORDER BY ban_ip";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not select current ip ban list');
}
$banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_iplist = '';
$select_emaillist = '';
for ($i = 0; $i < count($banlist); $i++)
{
$ban_id = $banlist[$i]['ban_id'];
if (!empty($banlist[$i]['ban_ip']))
{
$ban_ip = str_replace('255', '*', decode_ip($banlist[$i]['ban_ip']));
$select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
$ipban_count++;
}
else if (!empty($banlist[$i]['ban_email']))
{
$ban_email = $banlist[$i]['ban_email'];
$select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
$emailban_count++;
}
}
if ($select_iplist == '')
{
$select_iplist = '<option value="-1">' . $lang['NO_BANNED_IP'] . '</option>';
}
if ($select_emaillist == '')
{
$select_emaillist = '<option value="-1">' . $lang['NO_BANNED_EMAIL'] . '</option>';
}
$select_iplist = '<select name="unban_ip[]" multiple="multiple" size="15">' . $select_iplist . '</select>';
$select_emaillist = '<select name="unban_email[]" multiple="multiple" size="10">' . $select_emaillist . '</select>';
$template->assign_vars(array(
'U_SEARCH_USER' => './../search.php?mode=searchuser',
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
'S_BAN_ACTION' => 'admin_user_ban.php',
));
}
print_page('admin_user_ban.tpl', 'admin');

File diff suppressed because it is too large Load diff

View file

@ -1,159 +1,159 @@
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Word_Censor'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
if (!$bb_cfg['use_word_censor'])
{
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
}
$mode = request_var('mode', '');
$mode = htmlspecialchars($mode);
if (isset($_POST['add']))
{
$mode = 'add';
}
else if (isset($_POST['save']))
{
$mode = 'save';
}
if ($mode != '')
{
if ($mode == 'edit' || $mode == 'add')
{
$word_id = intval(request_var('id', 0));
$s_hidden_fields = $word = $replacement = '';
if ($mode == 'edit')
{
if ($word_id)
{
$sql = "SELECT * FROM " . BB_WORDS . " WHERE word_id = $word_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not query words table #1');
}
$word_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
$word = $word_info['word'];
$replacement = $word_info['replacement'];
}
else
{
bb_die($lang['NO_WORD_SELECTED']);
}
}
$template->assign_vars(array(
'TPL_ADMIN_WORDS_EDIT' => true,
'WORD' => $word,
'REPLACEMENT' => $replacement,
'S_WORDS_ACTION' => 'admin_words.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else if ($mode == 'save')
{
$word_id = intval(request_var('id', 0));
$word = trim(request_var('word', ''));
$replacement = trim(request_var('replacement', ''));
if ($word == '' || $replacement == '')
{
bb_die($lang['MUST_ENTER_WORD']);
}
if ($word_id)
{
$sql = "UPDATE " . BB_WORDS . "
SET word = '" . DB()->escape($word) . "', replacement = '" . DB()->escape($replacement) . "'
WHERE word_id = $word_id";
$message = $lang['WORD_UPDATED'];
}
else
{
$sql = "INSERT INTO " . BB_WORDS . " (word, replacement)
VALUES ('" . DB()->escape($word) . "', '" . DB()->escape($replacement) . "')";
$message = $lang['WORD_ADDED'];
}
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not insert data into words table');
}
CACHE('bb_cache')->rm('censored');
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
else if ($mode == 'delete')
{
$word_id = intval(request_var('id', 0));
if ($word_id)
{
$sql = "DELETE FROM " . BB_WORDS . " WHERE word_id = $word_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not remove data from words table');
}
CACHE('bb_cache')->rm('censored');
bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
bb_die($lang['NO_WORD_SELECTED']);
}
}
}
else
{
$sql = "SELECT * FROM " . BB_WORDS . " ORDER BY word";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not query words table #2');
}
$word_rows = DB()->sql_fetchrowset($result);
$word_count = count($word_rows);
$template->assign_vars(array(
'TPL_ADMIN_WORDS_LIST' => true,
'S_WORDS_ACTION' => 'admin_words.php',
'S_HIDDEN_FIELDS' => '',
));
for ($i = 0; $i < $word_count; $i++)
{
$word = $word_rows[$i]['word'];
$replacement = $word_rows[$i]['replacement'];
$word_id = $word_rows[$i]['word_id'];
$row_class = !($i % 2) ? 'row1' : 'row2';
$template->assign_block_vars('words', array(
'ROW_CLASS' => $row_class,
'WORD' => $word,
'REPLACEMENT' => $replacement,
'U_WORD_EDIT' => "admin_words.php?mode=edit&amp;id=$word_id",
'U_WORD_DELETE' => "admin_words.php?mode=delete&amp;id=$word_id",
));
}
}
<?php
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Word_Censor'] = basename(__FILE__);
return;
}
require('./pagestart.php');
// ACP Header - END
if (!$bb_cfg['use_word_censor'])
{
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
}
$mode = request_var('mode', '');
$mode = htmlspecialchars($mode);
if (isset($_POST['add']))
{
$mode = 'add';
}
else if (isset($_POST['save']))
{
$mode = 'save';
}
if ($mode != '')
{
if ($mode == 'edit' || $mode == 'add')
{
$word_id = intval(request_var('id', 0));
$s_hidden_fields = $word = $replacement = '';
if ($mode == 'edit')
{
if ($word_id)
{
$sql = "SELECT * FROM " . BB_WORDS . " WHERE word_id = $word_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not query words table #1');
}
$word_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
$word = $word_info['word'];
$replacement = $word_info['replacement'];
}
else
{
bb_die($lang['NO_WORD_SELECTED']);
}
}
$template->assign_vars(array(
'TPL_ADMIN_WORDS_EDIT' => true,
'WORD' => $word,
'REPLACEMENT' => $replacement,
'S_WORDS_ACTION' => 'admin_words.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
));
}
else if ($mode == 'save')
{
$word_id = intval(request_var('id', 0));
$word = trim(request_var('word', ''));
$replacement = trim(request_var('replacement', ''));
if ($word == '' || $replacement == '')
{
bb_die($lang['MUST_ENTER_WORD']);
}
if ($word_id)
{
$sql = "UPDATE " . BB_WORDS . "
SET word = '" . DB()->escape($word) . "', replacement = '" . DB()->escape($replacement) . "'
WHERE word_id = $word_id";
$message = $lang['WORD_UPDATED'];
}
else
{
$sql = "INSERT INTO " . BB_WORDS . " (word, replacement)
VALUES ('" . DB()->escape($word) . "', '" . DB()->escape($replacement) . "')";
$message = $lang['WORD_ADDED'];
}
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not insert data into words table');
}
CACHE('bb_cache')->rm('censored');
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
}
else if ($mode == 'delete')
{
$word_id = intval(request_var('id', 0));
if ($word_id)
{
$sql = "DELETE FROM " . BB_WORDS . " WHERE word_id = $word_id";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not remove data from words table');
}
CACHE('bb_cache')->rm('censored');
bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
else
{
bb_die($lang['NO_WORD_SELECTED']);
}
}
}
else
{
$sql = "SELECT * FROM " . BB_WORDS . " ORDER BY word";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not query words table #2');
}
$word_rows = DB()->sql_fetchrowset($result);
$word_count = count($word_rows);
$template->assign_vars(array(
'TPL_ADMIN_WORDS_LIST' => true,
'S_WORDS_ACTION' => 'admin_words.php',
'S_HIDDEN_FIELDS' => '',
));
for ($i = 0; $i < $word_count; $i++)
{
$word = $word_rows[$i]['word'];
$replacement = $word_rows[$i]['replacement'];
$word_id = $word_rows[$i]['word_id'];
$row_class = !($i % 2) ? 'row1' : 'row2';
$template->assign_block_vars('words', array(
'ROW_CLASS' => $row_class,
'WORD' => $word,
'REPLACEMENT' => $replacement,
'U_WORD_EDIT' => "admin_words.php?mode=edit&amp;id=$word_id",
'U_WORD_DELETE' => "admin_words.php?mode=delete&amp;id=$word_id",
));
}
}
print_page('admin_words.tpl', 'admin');

View file

@ -1,35 +1,35 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $user;
$mode = (string) $this->request['mode'];
$user_id = (int) $this->request['user_id'];
if (!$user_id OR !$u_data = get_userdata($user_id))
{
$this->ajax_die('invalid user_id');
}
if (!IS_ADMIN && $user_id != $user->id)
{
$this->ajax_die('Не админ');
}
switch ($mode)
{
case 'delete':
delete_avatar($user_id, $u_data['avatar_ext_id']);
$new_ext_id = 0;
$response = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" />';
break;
default:
$this->ajax_die('invalid mode');
}
DB()->query("UPDATE ". BB_USERS ." SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions($user_id);
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $user;
$mode = (string) $this->request['mode'];
$user_id = (int) $this->request['user_id'];
if (!$user_id OR !$u_data = get_userdata($user_id))
{
$this->ajax_die('invalid user_id');
}
if (!IS_ADMIN && $user_id != $user->id)
{
$this->ajax_die('Не админ');
}
switch ($mode)
{
case 'delete':
delete_avatar($user_id, $u_data['avatar_ext_id']);
$new_ext_id = 0;
$response = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" />';
break;
default:
$this->ajax_die('invalid mode');
}
DB()->query("UPDATE ". BB_USERS ." SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions($user_id);
$this->response['avatar_html'] = $response;

View file

@ -1,106 +1,106 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id'])) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$attach_id = (int) $this->request['attach_id'];
$mode = (string) $this->request['mode'];
if ($bb_cfg['tor_comment'])
{
$comment = (string) $this->request['comment'];
}
$tor = DB()->fetch_row("
SELECT
tor.poster_id, tor.forum_id, tor.topic_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id, t.topic_title
FROM ". BB_BT_TORRENTS ." tor
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = tor.forum_id)
INNER JOIN ". BB_TOPICS ." t ON(t.topic_id = tor.topic_id)
WHERE tor.attach_id = $attach_id
LIMIT 1
");
if (!$tor) $this->ajax_die($lang['TORRENT_FAILED']);
switch ($mode)
{
case 'status':
$new_status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$new_status])) $this->ajax_die($lang['TOR_STATUS_FAILED']);
if (!isset($this->request['status'])) $this->ajax_die($lang['TOR_DONT_CHANGE']);
if (!IS_AM) $this->ajax_die($lang['NOT_MODERATOR']);
// Тот же статус
if ($tor['tor_status'] == $new_status)
{
$this->ajax_die($lang['TOR_STATUS_DUB']);
}
// Запрет на изменение/присвоение CH-статуса модератором
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
{
$this->ajax_die($lang['TOR_DONT_CHANGE']);
}
// Права на изменение статуса
if ($tor['tor_status'] == TOR_CLOSED_CPHOLD)
{
if (!IS_ADMIN) $this->verify_mod_rights($tor['forum_id']);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_status = ". TOPIC_UNLOCKED ." WHERE topic_id = {$tor['topic_id']} LIMIT 1");
}
else
{
$this->verify_mod_rights($tor['forum_id']);
}
// Подтверждение изменения статуса, выставленного другим модератором
if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userdata['user_id'] && $tor['checked_time'] + 2*3600 > TIMENOW)
{
if (empty($this->request['confirmed']))
{
$msg = $lang['TOR_STATUS_OF'] ." {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n";
$msg .= ($username = get_username($tor['checked_user_id'])) ? $lang['TOR_STATUS_CHANGED'] . html_entity_decode($username) .", ". delta_time($tor['checked_time']) . $lang['TOR_BACK'] ."\n\n" : "";
$msg .= $lang['PROCEED'] .'?';
$this->prompt_for_confirm($msg);
}
}
change_tor_status($attach_id, $new_status);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> &middot; '. profile_url($userdata) .' &middot; <i>'. delta_time(TIMENOW) . $lang['TOR_BACK']. '</i>';
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply'])))
{
if ($tor['poster_id'] > 0)
{
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] .' '.$lang['TOR_STATUS_NAME'][$new_status]);
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
send_pm($tor['poster_id'], $subject, $message, $userdata['user_id']);
cache_rm_user_sessions($tor['poster_id']);
}
}
break;
case 'status_reply':
if (!$bb_cfg['tor_comment']) $this->ajax_die($lang['MODULE_OFF']);
$subject = sprintf($lang['TOR_AUTH_TITLE'], $tor['topic_title']);
$message = sprintf($lang['TOR_AUTH_MSG'], get_username($tor['checked_user_id']), make_url(TOPIC_URL . $tor['topic_id']), $tor['topic_title']);
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']);
cache_rm_user_sessions($tor['checked_user_id']);
break;
}
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id'])) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$attach_id = (int) $this->request['attach_id'];
$mode = (string) $this->request['mode'];
if ($bb_cfg['tor_comment'])
{
$comment = (string) $this->request['comment'];
}
$tor = DB()->fetch_row("
SELECT
tor.poster_id, tor.forum_id, tor.topic_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id, t.topic_title
FROM ". BB_BT_TORRENTS ." tor
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = tor.forum_id)
INNER JOIN ". BB_TOPICS ." t ON(t.topic_id = tor.topic_id)
WHERE tor.attach_id = $attach_id
LIMIT 1
");
if (!$tor) $this->ajax_die($lang['TORRENT_FAILED']);
switch ($mode)
{
case 'status':
$new_status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$new_status])) $this->ajax_die($lang['TOR_STATUS_FAILED']);
if (!isset($this->request['status'])) $this->ajax_die($lang['TOR_DONT_CHANGE']);
if (!IS_AM) $this->ajax_die($lang['NOT_MODERATOR']);
// Тот же статус
if ($tor['tor_status'] == $new_status)
{
$this->ajax_die($lang['TOR_STATUS_DUB']);
}
// Запрет на изменение/присвоение CH-статуса модератором
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
{
$this->ajax_die($lang['TOR_DONT_CHANGE']);
}
// Права на изменение статуса
if ($tor['tor_status'] == TOR_CLOSED_CPHOLD)
{
if (!IS_ADMIN) $this->verify_mod_rights($tor['forum_id']);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_status = ". TOPIC_UNLOCKED ." WHERE topic_id = {$tor['topic_id']} LIMIT 1");
}
else
{
$this->verify_mod_rights($tor['forum_id']);
}
// Подтверждение изменения статуса, выставленного другим модератором
if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userdata['user_id'] && $tor['checked_time'] + 2*3600 > TIMENOW)
{
if (empty($this->request['confirmed']))
{
$msg = $lang['TOR_STATUS_OF'] ." {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n";
$msg .= ($username = get_username($tor['checked_user_id'])) ? $lang['TOR_STATUS_CHANGED'] . html_entity_decode($username) .", ". delta_time($tor['checked_time']) . $lang['TOR_BACK'] ."\n\n" : "";
$msg .= $lang['PROCEED'] .'?';
$this->prompt_for_confirm($msg);
}
}
change_tor_status($attach_id, $new_status);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> &middot; '. profile_url($userdata) .' &middot; <i>'. delta_time(TIMENOW) . $lang['TOR_BACK']. '</i>';
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply'])))
{
if ($tor['poster_id'] > 0)
{
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] .' '.$lang['TOR_STATUS_NAME'][$new_status]);
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
send_pm($tor['poster_id'], $subject, $message, $userdata['user_id']);
cache_rm_user_sessions($tor['poster_id']);
}
}
break;
case 'status_reply':
if (!$bb_cfg['tor_comment']) $this->ajax_die($lang['MODULE_OFF']);
$subject = sprintf($lang['TOR_AUTH_TITLE'], $tor['topic_title']);
$message = sprintf($lang['TOR_AUTH_MSG'], get_username($tor['checked_user_id']), make_url(TOPIC_URL . $tor['topic_id']), $tor['topic_title']);
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']);
cache_rm_user_sessions($tor['checked_user_id']);
break;
}
$this->response['attach_id'] = $attach_id;

View file

@ -1,104 +1,104 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
if (!isset($this->request['type']))
{
$this->ajax_die('type');
}
$attach_id = (int) $this->request['attach_id'];
$type = (string) $this->request['type'];
$torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
". BB_ATTACHMENTS ." a,
". BB_ATTACHMENTS_DESC ." d,
". BB_POSTS ." p,
". BB_TOPICS ." t,
". BB_FORUMS ." f
WHERE
a.attach_id = $attach_id
AND d.attach_id = $attach_id
AND p.post_id = a.post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
LIMIT 1
");
if (!$torrent) $this->ajax_die($lang['INVALID_ATTACH_ID']);
if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
{
if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
{
true;
}
else
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
}
elseif (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
$title = $url = '';
switch ($type)
{
case 'set_gold';
case 'set_silver';
case 'unset_silver_gold';
if ($type == 'set_silver')
{
$tor_type = TOR_TYPE_SILVER;
}
elseif ($type == 'set_gold')
{
$tor_type = TOR_TYPE_GOLD;
}
else
{
$tor_type = 0;
}
change_tor_type($attach_id, $tor_type);
$title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'reg';
tracker_register($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'unreg';
tracker_unregister($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'del_torrent';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_TORRENT']);
delete_torrent($attach_id);
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'del_torrent_move_topic';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
delete_torrent($attach_id);
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break;
}
$this->response['url'] = $url;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
if (!isset($this->request['type']))
{
$this->ajax_die('type');
}
$attach_id = (int) $this->request['attach_id'];
$type = (string) $this->request['type'];
$torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
". BB_ATTACHMENTS ." a,
". BB_ATTACHMENTS_DESC ." d,
". BB_POSTS ." p,
". BB_TOPICS ." t,
". BB_FORUMS ." f
WHERE
a.attach_id = $attach_id
AND d.attach_id = $attach_id
AND p.post_id = a.post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
LIMIT 1
");
if (!$torrent) $this->ajax_die($lang['INVALID_ATTACH_ID']);
if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
{
if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
{
true;
}
else
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
}
elseif (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
$title = $url = '';
switch ($type)
{
case 'set_gold';
case 'set_silver';
case 'unset_silver_gold';
if ($type == 'set_silver')
{
$tor_type = TOR_TYPE_SILVER;
}
elseif ($type == 'set_gold')
{
$tor_type = TOR_TYPE_GOLD;
}
else
{
$tor_type = 0;
}
change_tor_type($attach_id, $tor_type);
$title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'reg';
tracker_register($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'unreg';
tracker_unregister($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'del_torrent';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_TORRENT']);
delete_torrent($attach_id);
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'del_torrent_move_topic';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
delete_torrent($attach_id);
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break;
}
$this->response['url'] = $url;
$this->response['title'] = $title;

View file

@ -1,33 +1,33 @@
<?php
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']);
if (!$user_id OR !$u_data = get_userdata($user_id))
{
$this->ajax_die('invalid user_id');
}
if (!is_array($new_opt))
{
$this->ajax_die('invalid new_opt');
}
foreach ($bf['user_opt'] as $opt_name => $opt_bit)
{
if (isset($new_opt[$opt_name]))
{
setbit($u_data['user_opt'], $opt_bit, !empty($new_opt[$opt_name]));
}
}
DB()->query("UPDATE ". BB_USERS ." SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
// Удаляем данные из кеша
cache_rm_user_sessions ($user_id);
<?php
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']);
if (!$user_id OR !$u_data = get_userdata($user_id))
{
$this->ajax_die('invalid user_id');
}
if (!is_array($new_opt))
{
$this->ajax_die('invalid new_opt');
}
foreach ($bf['user_opt'] as $opt_name => $opt_bit)
{
if (isset($new_opt[$opt_name]))
{
setbit($u_data['user_opt'], $opt_bit, !empty($new_opt[$opt_name]));
}
}
DB()->query("UPDATE ". BB_USERS ." SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
// Удаляем данные из кеша
cache_rm_user_sessions ($user_id);
$this->response['resp_html'] = $lang['SAVED'];

View file

@ -1,27 +1,27 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $datastore, $lang;
$ranks = $datastore->get('ranks');
$rank_id = intval($this->request['rank_id']);
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die("invalid user_id: $user_id");
}
if ($rank_id != 0 && !isset($ranks[$rank_id]))
{
$this->ajax_die("invalid rank_id: $rank_id");
}
DB()->query("UPDATE ". BB_USERS ." SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions($user_id);
$user_rank = ($rank_id) ? '<span class="'. $ranks[$rank_id]['rank_style'] .'">'. $ranks[$rank_id]['rank_title'] .'</span>' : '';
$this->response['html'] = ($rank_id) ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK'];
$this->response['rank_name'] = ($rank_id) ? $user_rank : $lang['USER'];
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $datastore, $lang;
$ranks = $datastore->get('ranks');
$rank_id = intval($this->request['rank_id']);
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die("invalid user_id: $user_id");
}
if ($rank_id != 0 && !isset($ranks[$rank_id]))
{
$this->ajax_die("invalid rank_id: $rank_id");
}
DB()->query("UPDATE ". BB_USERS ." SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions($user_id);
$user_rank = ($rank_id) ? '<span class="'. $ranks[$rank_id]['rank_style'] .'">'. $ranks[$rank_id]['rank_title'] .'</span>' : '';
$this->response['html'] = ($rank_id) ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK'];
$this->response['rank_name'] = ($rank_id) ? $user_rank : $lang['USER'];

View file

@ -1,168 +1,168 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$field = (string) $this->request['field'])
{
$this->ajax_die('invalid profile field');
}
$table = BB_USERS;
$value = $this->request['value'] = (string) (isset($this->request['value'])) ? $this->request['value'] : 0;
switch ($field)
{
case 'username':
require_once(INC_DIR .'functions_validate.php');
$value = clean_username($value);
if ($err = validate_username($value))
{
$this->ajax_die(strip_tags($err));
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_email':
require_once(INC_DIR .'functions_validate.php');
$value = htmlCHR($value);
if ($err = validate_email($value))
{
$this->ajax_die($err);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_website':
if ($value == '' || preg_match('#^https?://[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+$#iu', $value))
{
$this->response['new_value'] = htmlCHR($value);
}
else $this->ajax_die($lang['WEBSITE_ERROR']);
break;
case 'user_gender':
if (!$bb_cfg['gender']) $this->ajax_die($lang['MODULE_OFF']);
if (!isset($lang['GENDER_SELECT'][$value]))
{
$this->ajax_die($lang['ERROR']);
}
else $this->response['new_value'] = $lang['GENDER_SELECT'][$value];
break;
case 'user_birthday':
if (!$bb_cfg['birthday_enabled']) $this->ajax_die($lang['MODULE_OFF']);
$birthday_date = date_parse($value);
if (!empty($birthday_date['year']))
{
if (strtotime($value) >= TIMENOW)
{
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
}
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age'])
{
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
}
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age'])
{
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
}
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_icq':
if ($value && !preg_match('#^\d{6,15}$#', $value))
{
$this->ajax_die($lang['ICQ_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_skype':
if ($value && !preg_match("#^[a-zA-Z0-9_.\-@,]{6,32}$#", $value))
{
$this->ajax_die($lang['SKYPE_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_twitter':
if ($value && !preg_match("#^[a-zA-Z0-9_]{1,15}$#", $value))
{
$this->ajax_die($lang['TWITTER_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_from':
case 'user_occ':
case 'user_interests':
$value = htmlCHR($value);
$this->response['new_value'] = $value;
break;
case 'user_regdate':
case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] OR $value > TIMENOW)
{
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
break;
case 'u_up_total':
case 'u_down_total':
case 'u_up_release':
case 'u_up_bonus':
if (!IS_ADMIN) $this->ajax_die($lang['NOT_ADMIN']);
$table = BB_BT_USERS;
$value = (float) str_replace(',', '.', $this->request['value']);
foreach (array('KB'=>1,'MB'=>2,'GB'=>3,'TB'=>4) as $s => $m)
{
if (strpos($this->request['value'], $s) !== false)
{
$value *= pow(1024, $m);
break;
}
}
$value = sprintf('%.0f', $value);
$this->response['new_value'] = humn_size($value, null, null, ' ');
if (!$btu = get_bt_userdata($user_id))
{
require(INC_DIR .'functions_torrent.php');
generate_passkey($user_id, true);
$btu = get_bt_userdata($user_id);
}
$btu[$field] = $value;
$this->response['update_ids']['u_ratio'] = (string) get_bt_ratio($btu);
break;
case 'user_points':
$value = htmlCHR($value);
$value = (float) str_replace(',', '.', $this->request['value']);
$value = sprintf('%.2f', $value);
$this->response['new_value'] = $value;
break;
default:
$this->ajax_die("invalid profile field: $field");
}
$value_sql = DB()->escape($value, true);
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions ($user_id);
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$field = (string) $this->request['field'])
{
$this->ajax_die('invalid profile field');
}
$table = BB_USERS;
$value = $this->request['value'] = (string) (isset($this->request['value'])) ? $this->request['value'] : 0;
switch ($field)
{
case 'username':
require_once(INC_DIR .'functions_validate.php');
$value = clean_username($value);
if ($err = validate_username($value))
{
$this->ajax_die(strip_tags($err));
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_email':
require_once(INC_DIR .'functions_validate.php');
$value = htmlCHR($value);
if ($err = validate_email($value))
{
$this->ajax_die($err);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_website':
if ($value == '' || preg_match('#^https?://[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+$#iu', $value))
{
$this->response['new_value'] = htmlCHR($value);
}
else $this->ajax_die($lang['WEBSITE_ERROR']);
break;
case 'user_gender':
if (!$bb_cfg['gender']) $this->ajax_die($lang['MODULE_OFF']);
if (!isset($lang['GENDER_SELECT'][$value]))
{
$this->ajax_die($lang['ERROR']);
}
else $this->response['new_value'] = $lang['GENDER_SELECT'][$value];
break;
case 'user_birthday':
if (!$bb_cfg['birthday_enabled']) $this->ajax_die($lang['MODULE_OFF']);
$birthday_date = date_parse($value);
if (!empty($birthday_date['year']))
{
if (strtotime($value) >= TIMENOW)
{
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
}
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age'])
{
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
}
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age'])
{
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
}
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_icq':
if ($value && !preg_match('#^\d{6,15}$#', $value))
{
$this->ajax_die($lang['ICQ_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_skype':
if ($value && !preg_match("#^[a-zA-Z0-9_.\-@,]{6,32}$#", $value))
{
$this->ajax_die($lang['SKYPE_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_twitter':
if ($value && !preg_match("#^[a-zA-Z0-9_]{1,15}$#", $value))
{
$this->ajax_die($lang['TWITTER_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_from':
case 'user_occ':
case 'user_interests':
$value = htmlCHR($value);
$this->response['new_value'] = $value;
break;
case 'user_regdate':
case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] OR $value > TIMENOW)
{
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
break;
case 'u_up_total':
case 'u_down_total':
case 'u_up_release':
case 'u_up_bonus':
if (!IS_ADMIN) $this->ajax_die($lang['NOT_ADMIN']);
$table = BB_BT_USERS;
$value = (float) str_replace(',', '.', $this->request['value']);
foreach (array('KB'=>1,'MB'=>2,'GB'=>3,'TB'=>4) as $s => $m)
{
if (strpos($this->request['value'], $s) !== false)
{
$value *= pow(1024, $m);
break;
}
}
$value = sprintf('%.0f', $value);
$this->response['new_value'] = humn_size($value, null, null, ' ');
if (!$btu = get_bt_userdata($user_id))
{
require(INC_DIR .'functions_torrent.php');
generate_passkey($user_id, true);
$btu = get_bt_userdata($user_id);
}
$btu[$field] = $value;
$this->response['update_ids']['u_ratio'] = (string) get_bt_ratio($btu);
break;
case 'user_points':
$value = htmlCHR($value);
$value = (float) str_replace(',', '.', $this->request['value']);
$value = sprintf('%.2f', $value);
$this->response['new_value'] = $value;
break;
default:
$this->ajax_die("invalid profile field: $field");
}
$value_sql = DB()->escape($value, true);
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions ($user_id);
$this->response['edit_id'] = $this->request['edit_id'];

View file

@ -1,25 +1,25 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang;
$req_uid = (int) $this->request['user_id'];
if ($req_uid == $userdata['user_id'] || IS_ADMIN)
{
if (empty($this->request['confirmed']))
{
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
if (!$passkey = generate_passkey($req_uid, IS_ADMIN))
{
$this->ajax_die('Could not insert passkey');
}
tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
}
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang;
$req_uid = (int) $this->request['user_id'];
if ($req_uid == $userdata['user_id'] || IS_ADMIN)
{
if (empty($this->request['confirmed']))
{
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
if (!$passkey = generate_passkey($req_uid, IS_ADMIN))
{
$this->ajax_die('Could not insert passkey');
}
tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
}
else $this->ajax_die($lang['NOT_AUTHORISED']);

View file

@ -1,69 +1,69 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang, $user;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die("invalid user_id: $user_id");
}
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
switch ($mode)
{
case 'get_group_list':
$sql = "
SELECT ug.user_pending, g.group_id, g.group_type, g.group_name, g.group_moderator, self.user_id AS can_view
FROM ". BB_USER_GROUP ." ug
INNER JOIN ". BB_GROUPS ." g ON(g.group_id = ug.group_id AND g.group_single_user = 0)
LEFT JOIN ". BB_USER_GROUP ." self ON(self.group_id = g.group_id AND self.user_id = {$user->id} AND self.user_pending = 0)
WHERE ug.user_id = $user_id
ORDER BY g.group_name
";
$html = array();
foreach (DB()->fetch_rowset($sql) as $row)
{
$class = ($row['user_pending']) ? 'med' : 'med bold';
$class .= ($row['group_moderator'] == $user_id) ? ' colorMod' : '';
$href = "groupcp.php?g={$row['group_id']}";
if (IS_ADMIN)
{
$href .= "&amp;u=$user_id";
$link = '<a href="'. $href .'" class="'. $class .'" target="_blank">'. htmlCHR($row['group_name']) .'</a>';
$html[] = $link;
}
else
{
// скрытая группа и сам юзер не является ее членом
if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view'])
{
continue;
}
if ($row['group_moderator'] == $user->id)
{
$class .= ' selfMod';
$href .= "&amp;u=$user_id"; // сам юзер модератор этой группы
}
$link = '<a href="'. $href .'" class="'. $class .'" target="_blank">'. htmlCHR($row['group_name']) .'</a>';
$html[] = $link;
}
}
if ($html)
{
$this->response['group_list_html'] = '<ul><li>'. join('</li><li>', $html) .'</li></ul>';
}
else
{
$this->response['group_list_html'] = $lang['GROUP_LIST_HIDDEN'];
}
break;
default:
$this->ajax_die("invalid mode: $mode");
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang, $user;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
{
$this->ajax_die("invalid user_id: $user_id");
}
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
switch ($mode)
{
case 'get_group_list':
$sql = "
SELECT ug.user_pending, g.group_id, g.group_type, g.group_name, g.group_moderator, self.user_id AS can_view
FROM ". BB_USER_GROUP ." ug
INNER JOIN ". BB_GROUPS ." g ON(g.group_id = ug.group_id AND g.group_single_user = 0)
LEFT JOIN ". BB_USER_GROUP ." self ON(self.group_id = g.group_id AND self.user_id = {$user->id} AND self.user_pending = 0)
WHERE ug.user_id = $user_id
ORDER BY g.group_name
";
$html = array();
foreach (DB()->fetch_rowset($sql) as $row)
{
$class = ($row['user_pending']) ? 'med' : 'med bold';
$class .= ($row['group_moderator'] == $user_id) ? ' colorMod' : '';
$href = "groupcp.php?g={$row['group_id']}";
if (IS_ADMIN)
{
$href .= "&amp;u=$user_id";
$link = '<a href="'. $href .'" class="'. $class .'" target="_blank">'. htmlCHR($row['group_name']) .'</a>';
$html[] = $link;
}
else
{
// скрытая группа и сам юзер не является ее членом
if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view'])
{
continue;
}
if ($row['group_moderator'] == $user->id)
{
$class .= ' selfMod';
$href .= "&amp;u=$user_id"; // сам юзер модератор этой группы
}
$link = '<a href="'. $href .'" class="'. $class .'" target="_blank">'. htmlCHR($row['group_name']) .'</a>';
$html[] = $link;
}
}
if ($html)
{
$this->response['group_list_html'] = '<ul><li>'. join('</li><li>', $html) .'</li></ul>';
}
else
{
$this->response['group_list_html'] = $lang['GROUP_LIST_HIDDEN'];
}
break;
default:
$this->ajax_die("invalid mode: $mode");
}

View file

@ -1,132 +1,132 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata, $datastore;
$mode = (string) $this->request['mode'];
$html = '';
switch($mode)
{
case 'birthday_week':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_week_list'])
{
foreach($stats['birthday_week_list'] as $week)
{
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']) .')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html));
}
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
break;
case 'birthday_today':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_today_list'])
{
foreach($stats['birthday_today_list'] as $today)
{
$html[] = profile_url($today) .' <span class="small">('. birthday_age($today['user_birthday']) .')</span>';
}
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
}
else $html = $lang['NOBIRTHDAY_TODAY'];
break;
case 'get_forum_mods':
$forum_id = (int) $this->request['forum_id'];
$datastore->enqueue(array(
'moderators',
));
$moderators = array();
$mod = $datastore->get('moderators');
if (isset($mod['mod_users'][$forum_id]))
{
foreach ($mod['mod_users'][$forum_id] as $user_id)
{
$moderators[] = '<a href="'. PROFILE_URL . $user_id .'">'. $mod['name_users'][$user_id] .'</a>';
}
}
if (isset($mod['mod_groups'][$forum_id]))
{
foreach ($mod['mod_groups'][$forum_id] as $group_id)
{
$moderators[] = '<a href="'. "groupcp.php?". POST_GROUPS_URL ."=". $group_id .'">'. $mod['name_groups'][$group_id] .'</a>';
}
}
$html = ':&nbsp;';
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
unset($moderators, $mod);
$datastore->rm('moderators');
break;
case 'change_tz':
$tz = (int) $this->request['tz'];
if ($tz < -12) $tz = -12;
if ($tz > 13) $tz = 13;
if ($tz != $bb_cfg['board_timezone'])
{
// Set current user timezone
DB()->query("UPDATE ". BB_USERS ." SET user_timezone = $tz WHERE user_id = ". $userdata['user_id'] ." LIMIT 1");
$bb_cfg['board_timezone'] = $tz;
cache_rm_user_sessions ($userdata['user_id']);
}
break;
case 'get_traf_stats':
$user_id = (int) $this->request['user_id'];
$btu = get_bt_userdata($user_id);
$profiledata = get_userdata($user_id);
$speed_up = ($btu['speed_up']) ? humn_size($btu['speed_up']).'/s' : '0 KB/s';
$speed_down = ($btu['speed_down']) ? humn_size($btu['speed_down']).'/s' : '0 KB/s';
$user_ratio = ($btu['u_down_total'] > MIN_DL_FOR_RATIO) ? '<b class="gen">'. get_bt_ratio($btu) .'</b>' : $lang['IT_WILL_BE_DOWN'] .' <b>'. humn_size(MIN_DL_FOR_RATIO) .'</b>';
$html = '
<tr class="row3">
<th style="padding: 0;" class="stats-ext"></th>
<th>'. $lang['DOWNLOADED'] .'</th>
<th>'. $lang['UPLOADED'] .'</th>
<th>'. $lang['RELEASED'] .'</th>
<th>'. $lang['BONUS'] .'</th>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>'. $lang['SEED_BONUS'] .'</th>' : '';
$html .= '</tr>
<tr class="row1">
<td class="stats-ext">'. $lang['TOTAL_TRAF'] .'</td>
<td id="u_down_total"><span class="editable bold leechmed">'. humn_size($btu['u_down_total']) .'</span></td>
<td id="u_up_total"><span class="editable bold seedmed">' .humn_size($btu['u_up_total']) .'</span></td>
<td id="u_up_release"><span class="editable bold seedmed">'. humn_size($btu['u_up_release']) .'</span></td>
<td id="u_up_bonus"><span class="editable bold seedmed">'. humn_size($btu['u_up_bonus']) .'</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">'. $profiledata['user_points'] .'</b></td>' : '';
$html .= '</tr>
<tr class="row5">
<td colspan="1">'. $lang['MAX_SPEED'] .'</td>
<td colspan="2">'. $lang['DL_DL_SPEED'] .': '. $speed_down .'</span></td>
<td colspan="2">'. $lang['DL_UL_SPEED'] .': '. $speed_up .'</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
$html .= '</tr>';
$this->response['user_ratio'] = '
<th><a href="'. $bb_cfg['ratio_url_help'] .'" class="bold">'. $lang['USER_RATIO'] .'</a>:</th>
<td>'. $user_ratio .'</td>
';
break;
}
$this->response['html'] = $html;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata, $datastore;
$mode = (string) $this->request['mode'];
$html = '';
switch($mode)
{
case 'birthday_week':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_week_list'])
{
foreach($stats['birthday_week_list'] as $week)
{
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']) .')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html));
}
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
break;
case 'birthday_today':
$stats = $datastore->get('stats');
$datastore->enqueue(array(
'stats',
));
if ($stats['birthday_today_list'])
{
foreach($stats['birthday_today_list'] as $today)
{
$html[] = profile_url($today) .' <span class="small">('. birthday_age($today['user_birthday']) .')</span>';
}
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
}
else $html = $lang['NOBIRTHDAY_TODAY'];
break;
case 'get_forum_mods':
$forum_id = (int) $this->request['forum_id'];
$datastore->enqueue(array(
'moderators',
));
$moderators = array();
$mod = $datastore->get('moderators');
if (isset($mod['mod_users'][$forum_id]))
{
foreach ($mod['mod_users'][$forum_id] as $user_id)
{
$moderators[] = '<a href="'. PROFILE_URL . $user_id .'">'. $mod['name_users'][$user_id] .'</a>';
}
}
if (isset($mod['mod_groups'][$forum_id]))
{
foreach ($mod['mod_groups'][$forum_id] as $group_id)
{
$moderators[] = '<a href="'. "groupcp.php?". POST_GROUPS_URL ."=". $group_id .'">'. $mod['name_groups'][$group_id] .'</a>';
}
}
$html = ':&nbsp;';
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
unset($moderators, $mod);
$datastore->rm('moderators');
break;
case 'change_tz':
$tz = (int) $this->request['tz'];
if ($tz < -12) $tz = -12;
if ($tz > 13) $tz = 13;
if ($tz != $bb_cfg['board_timezone'])
{
// Set current user timezone
DB()->query("UPDATE ". BB_USERS ." SET user_timezone = $tz WHERE user_id = ". $userdata['user_id'] ." LIMIT 1");
$bb_cfg['board_timezone'] = $tz;
cache_rm_user_sessions ($userdata['user_id']);
}
break;
case 'get_traf_stats':
$user_id = (int) $this->request['user_id'];
$btu = get_bt_userdata($user_id);
$profiledata = get_userdata($user_id);
$speed_up = ($btu['speed_up']) ? humn_size($btu['speed_up']).'/s' : '0 KB/s';
$speed_down = ($btu['speed_down']) ? humn_size($btu['speed_down']).'/s' : '0 KB/s';
$user_ratio = ($btu['u_down_total'] > MIN_DL_FOR_RATIO) ? '<b class="gen">'. get_bt_ratio($btu) .'</b>' : $lang['IT_WILL_BE_DOWN'] .' <b>'. humn_size(MIN_DL_FOR_RATIO) .'</b>';
$html = '
<tr class="row3">
<th style="padding: 0;" class="stats-ext"></th>
<th>'. $lang['DOWNLOADED'] .'</th>
<th>'. $lang['UPLOADED'] .'</th>
<th>'. $lang['RELEASED'] .'</th>
<th>'. $lang['BONUS'] .'</th>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>'. $lang['SEED_BONUS'] .'</th>' : '';
$html .= '</tr>
<tr class="row1">
<td class="stats-ext">'. $lang['TOTAL_TRAF'] .'</td>
<td id="u_down_total"><span class="editable bold leechmed">'. humn_size($btu['u_down_total']) .'</span></td>
<td id="u_up_total"><span class="editable bold seedmed">' .humn_size($btu['u_up_total']) .'</span></td>
<td id="u_up_release"><span class="editable bold seedmed">'. humn_size($btu['u_up_release']) .'</span></td>
<td id="u_up_bonus"><span class="editable bold seedmed">'. humn_size($btu['u_up_bonus']) .'</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">'. $profiledata['user_points'] .'</b></td>' : '';
$html .= '</tr>
<tr class="row5">
<td colspan="1">'. $lang['MAX_SPEED'] .'</td>
<td colspan="2">'. $lang['DL_DL_SPEED'] .': '. $speed_down .'</span></td>
<td colspan="2">'. $lang['DL_UL_SPEED'] .': '. $speed_up .'</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
$html .= '</tr>';
$this->response['user_ratio'] = '
<th><a href="'. $bb_cfg['ratio_url_help'] .'" class="bold">'. $lang['USER_RATIO'] .'</a>:</th>
<td>'. $user_ratio .'</td>
';
break;
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;

View file

@ -1,107 +1,107 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
$mode = (string) $this->request['mode'];
switch ($mode)
{
case 'clear_cache':
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
{
if (!in_array('db_sqlite', $cache_val))
{
CACHE($cache_name)->rm();
}
}
$this->response['cache_html'] = '<span class="seed bold">'. $lang['ALL_CACHE_CLEARED'] .'</span>';
break;
case 'clear_datastore':
global $datastore;
$datastore->clean();
$this->response['datastore_html'] = '<span class="seed bold">'. $lang['DATASTORE_CLEARED'] .'</span>';
break;
case 'clear_template_cache':
global $template;
$match = 'tpl_';
$match_len = strlen($match);
$dir = $template->cachedir;
$res = @opendir($dir);
while (($file = readdir($res)) !== false)
{
if (substr($file, 0, $match_len) === $match)
{
@unlink($dir . $file);
}
}
closedir($res);
$this->response['template_cache_html'] = '<span class="seed bold">'. $lang['ALL_TEMPLATE_CLEARED'] .'</span>';
break;
case 'indexer':
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
{
file_put_contents($bb_cfg['sphinx_config_path'].".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
foreach ($result as $row)
{
file_put_contents($bb_cfg['sphinx_config_path'].".log", $row."\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
$this->response['indexer_html'] = '<span class="seed bold">'. $lang['INDEXER'] .'</span>';
break;
case 'update_user_level':
require(INC_DIR .'functions_group.php');
update_user_level('all');
$this->response['update_user_level_html'] = '<span class="seed bold">'. $lang['USER_LEVELS_UPDATED'] .'</span>';
break;
case 'sync_topics':
sync('topic', 'all');
sync_all_forums();
$this->response['sync_topics_html'] = '<span class="seed bold">'. $lang['TOPICS_DATA_SYNCHRONIZED'] .'</span>';
break;
case 'sync_user_posts':
sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '<span class="seed bold">'. $lang['USER POSTS COUNT SYNCHRONIZED'] .'</span>';
break;
}
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
$mode = (string) $this->request['mode'];
switch ($mode)
{
case 'clear_cache':
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
{
if (!in_array('db_sqlite', $cache_val))
{
CACHE($cache_name)->rm();
}
}
$this->response['cache_html'] = '<span class="seed bold">'. $lang['ALL_CACHE_CLEARED'] .'</span>';
break;
case 'clear_datastore':
global $datastore;
$datastore->clean();
$this->response['datastore_html'] = '<span class="seed bold">'. $lang['DATASTORE_CLEARED'] .'</span>';
break;
case 'clear_template_cache':
global $template;
$match = 'tpl_';
$match_len = strlen($match);
$dir = $template->cachedir;
$res = @opendir($dir);
while (($file = readdir($res)) !== false)
{
if (substr($file, 0, $match_len) === $match)
{
@unlink($dir . $file);
}
}
closedir($res);
$this->response['template_cache_html'] = '<span class="seed bold">'. $lang['ALL_TEMPLATE_CLEARED'] .'</span>';
break;
case 'indexer':
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
{
file_put_contents($bb_cfg['sphinx_config_path'].".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
foreach ($result as $row)
{
file_put_contents($bb_cfg['sphinx_config_path'].".log", $row."\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
$this->response['indexer_html'] = '<span class="seed bold">'. $lang['INDEXER'] .'</span>';
break;
case 'update_user_level':
require(INC_DIR .'functions_group.php');
update_user_level('all');
$this->response['update_user_level_html'] = '<span class="seed bold">'. $lang['USER_LEVELS_UPDATED'] .'</span>';
break;
case 'sync_topics':
sync('topic', 'all');
sync_all_forums();
$this->response['sync_topics_html'] = '<span class="seed bold">'. $lang['TOPICS_DATA_SYNCHRONIZED'] .'</span>';
break;
case 'sync_user_posts':
sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '<span class="seed bold">'. $lang['USER POSTS COUNT SYNCHRONIZED'] .'</span>';
break;
}
$this->response['mode'] = $mode;

View file

@ -1,84 +1,84 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
$mode = (string) $this->request['mode'];
$user_id = $this->request['user_id'];
switch ($mode)
{
case 'delete_profile':
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DELETE_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['USER_DELETE_CONFIRM']);
if ($user_id != BOT_UID)
{
delete_user_sessions($user_id);
user_delete($user_id);
$this->response['info'] = $lang['USER_DELETED'];
}
else $this->ajax_die($lang['USER_DELETE_CSV']);
break;
case 'delete_topics':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_ALL_POSTS_CONFIRM']);
if (IS_ADMIN)
{
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM ". BB_TOPICS ." WHERE topic_poster = $user_id", 'topic_id');
$deleted_topics = topic_delete($user_topics);
$deleted_posts = post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
}
else $this->ajax_die($lang['NOT_ADMIN']);
break;
case 'delete_message':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
if (IS_ADMIN)
{
post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
}
else $this->ajax_die($lang['NOT_ADMIN']);
break;
case 'user_activate':
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEACTIVATE_CONFIRM']);
DB()->query("UPDATE ". BB_USERS ." SET user_active = '1' WHERE user_id = ". $user_id);
$this->response['info'] = $lang['USER_ACTIVATE_ON'];
break;
case 'user_deactivate':
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DEACTIVATE_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['ACTIVATE_CONFIRM']);
DB()->query("UPDATE ". BB_USERS ." SET user_active = '0' WHERE user_id = ". $user_id);
delete_user_sessions($user_id);
$this->response['info'] = $lang['USER_ACTIVATE_OFF'];
break;
}
$this->response['mode'] = $mode;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
$mode = (string) $this->request['mode'];
$user_id = $this->request['user_id'];
switch ($mode)
{
case 'delete_profile':
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DELETE_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['USER_DELETE_CONFIRM']);
if ($user_id != BOT_UID)
{
delete_user_sessions($user_id);
user_delete($user_id);
$this->response['info'] = $lang['USER_DELETED'];
}
else $this->ajax_die($lang['USER_DELETE_CSV']);
break;
case 'delete_topics':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_ALL_POSTS_CONFIRM']);
if (IS_ADMIN)
{
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM ". BB_TOPICS ." WHERE topic_poster = $user_id", 'topic_id');
$deleted_topics = topic_delete($user_topics);
$deleted_posts = post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
}
else $this->ajax_die($lang['NOT_ADMIN']);
break;
case 'delete_message':
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
if (IS_ADMIN)
{
post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
}
else $this->ajax_die($lang['NOT_ADMIN']);
break;
case 'user_activate':
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEACTIVATE_CONFIRM']);
DB()->query("UPDATE ". BB_USERS ." SET user_active = '1' WHERE user_id = ". $user_id);
$this->response['info'] = $lang['USER_ACTIVATE_ON'];
break;
case 'user_deactivate':
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DEACTIVATE_ME']);
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['ACTIVATE_CONFIRM']);
DB()->query("UPDATE ". BB_USERS ." SET user_active = '0' WHERE user_id = ". $user_id);
delete_user_sessions($user_id);
$this->response['info'] = $lang['USER_ACTIVATE_OFF'];
break;
}
$this->response['mode'] = $mode;
$this->response['url'] = html_entity_decode(make_url('/') . PROFILE_URL . $user_id);

View file

@ -1,130 +1,130 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang, $datastore;
$mode = (string) $this->request['mode'];
switch ($mode)
{
case 'tor_status':
$topics = (string) $this->request['topic_ids'];
$status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$status]))
{
$this->ajax_die($lang['STATUS_DOES_EXIST'] . $new_status);
}
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE topic_id IN($topics)", 'attach_id');
foreach($topic_ids as $attach_id)
{
change_tor_status($attach_id, $status);
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics);
break;
case 'edit_topic_title':
$topic_id = (int) $this->request['topic_id'];
$topic_title = (string) $this->request['topic_title'];
$new_title = clean_title($topic_title);
if (!$topic_id) $this->ajax_die($lang['INVALID_TOPIC_ID']);
if ($new_title == '') $this->ajax_die($lang['DONT_MESSAGE_TITLE']);
if (!$t_data = DB()->fetch_row("SELECT forum_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{
$this->ajax_die($lang['INVALID_TOPIC_ID_DB']);
}
$this->verify_mod_rights($t_data['forum_id']);
$topic_title_sql = DB()->escape($new_title);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news'])
{
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news'])
{
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
$this->response['topic_id'] = $topic_id;
$this->response['topic_title'] = $new_title;
break;
case 'profile_ip':
$user_id = (int) $this->request['user_id'];
$profiledata = get_userdata($user_id);
if (!$user_id) $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
$reg_ip = DB()->fetch_rowset("SELECT username, user_id, user_rank FROM ". BB_USERS ."
WHERE user_reg_ip = '{$profiledata['user_reg_ip']}'
AND user_reg_ip != ''
AND user_id != {$profiledata['user_id']}
ORDER BY username ASC");
$last_ip = DB()->fetch_rowset("SELECT username, user_id, user_rank FROM " .BB_USERS ."
WHERE user_last_ip = '{$profiledata['user_last_ip']}'
AND user_last_ip != ''
AND user_id != {$profiledata['user_id']}");
$link_reg_ip = $link_last_ip = '';
if (!empty($reg_ip))
{
$link_reg_ip .= $lang['OTHER_IP'] .' ';
foreach ($reg_ip as $row)
{
$link_reg_ip .= profile_url($row) .' ';
}
}
if (!empty($last_ip))
{
$link_last_ip .= $lang['OTHER_IP'] .' ';
foreach ($last_ip as $row)
{
$link_last_ip .= profile_url($row) .' ';
}
}
if ($profiledata['user_level'] == ADMIN && !IS_ADMIN) $reg_ip = $last_ip = $lang['HIDDEN'];
elseif ($profiledata['user_level'] == MOD && IS_MOD) $reg_ip = $last_ip = $lang['HIDDEN'];
else
{
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
$user_last_ip = decode_ip($profiledata['user_last_ip']);
$reg_ip = '<a href="'. $bb_cfg['whois_info'] . $user_reg_ip .'" class="gen" target="_blank">'. $user_reg_ip .'</a>';
$last_ip = '<a href="'. $bb_cfg['whois_info'] . $user_last_ip .'" class="gen" target="_blank">'. $user_last_ip .'</a>';
}
$this->response['ip_list_html'] = '
<br /><table class="mod_ip bCenter borderless" cellspacing="1">
<tr class="row5" >
<td>'. $lang['REG_IP'] .'</td>
<td class="tCenter">'. $reg_ip .'</td>
<td><div>'. $link_reg_ip .'</div></td>
</tr>
<tr class="row4">
<td>'. $lang['LAST_IP'] .'</td>
<td class="tCenter">'. $last_ip .'</td>
<td><div>'. $link_last_ip .'</div></td>
</tr>
</table><br />
';
break;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang, $datastore;
$mode = (string) $this->request['mode'];
switch ($mode)
{
case 'tor_status':
$topics = (string) $this->request['topic_ids'];
$status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$status]))
{
$this->ajax_die($lang['STATUS_DOES_EXIST'] . $new_status);
}
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE topic_id IN($topics)", 'attach_id');
foreach($topic_ids as $attach_id)
{
change_tor_status($attach_id, $status);
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics);
break;
case 'edit_topic_title':
$topic_id = (int) $this->request['topic_id'];
$topic_title = (string) $this->request['topic_title'];
$new_title = clean_title($topic_title);
if (!$topic_id) $this->ajax_die($lang['INVALID_TOPIC_ID']);
if ($new_title == '') $this->ajax_die($lang['DONT_MESSAGE_TITLE']);
if (!$t_data = DB()->fetch_row("SELECT forum_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{
$this->ajax_die($lang['INVALID_TOPIC_ID_DB']);
}
$this->verify_mod_rights($t_data['forum_id']);
$topic_title_sql = DB()->escape($new_title);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news'])
{
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news'])
{
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
$this->response['topic_id'] = $topic_id;
$this->response['topic_title'] = $new_title;
break;
case 'profile_ip':
$user_id = (int) $this->request['user_id'];
$profiledata = get_userdata($user_id);
if (!$user_id) $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
$reg_ip = DB()->fetch_rowset("SELECT username, user_id, user_rank FROM ". BB_USERS ."
WHERE user_reg_ip = '{$profiledata['user_reg_ip']}'
AND user_reg_ip != ''
AND user_id != {$profiledata['user_id']}
ORDER BY username ASC");
$last_ip = DB()->fetch_rowset("SELECT username, user_id, user_rank FROM " .BB_USERS ."
WHERE user_last_ip = '{$profiledata['user_last_ip']}'
AND user_last_ip != ''
AND user_id != {$profiledata['user_id']}");
$link_reg_ip = $link_last_ip = '';
if (!empty($reg_ip))
{
$link_reg_ip .= $lang['OTHER_IP'] .' ';
foreach ($reg_ip as $row)
{
$link_reg_ip .= profile_url($row) .' ';
}
}
if (!empty($last_ip))
{
$link_last_ip .= $lang['OTHER_IP'] .' ';
foreach ($last_ip as $row)
{
$link_last_ip .= profile_url($row) .' ';
}
}
if ($profiledata['user_level'] == ADMIN && !IS_ADMIN) $reg_ip = $last_ip = $lang['HIDDEN'];
elseif ($profiledata['user_level'] == MOD && IS_MOD) $reg_ip = $last_ip = $lang['HIDDEN'];
else
{
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
$user_last_ip = decode_ip($profiledata['user_last_ip']);
$reg_ip = '<a href="'. $bb_cfg['whois_info'] . $user_reg_ip .'" class="gen" target="_blank">'. $user_reg_ip .'</a>';
$last_ip = '<a href="'. $bb_cfg['whois_info'] . $user_last_ip .'" class="gen" target="_blank">'. $user_last_ip .'</a>';
}
$this->response['ip_list_html'] = '
<br /><table class="mod_ip bCenter borderless" cellspacing="1">
<tr class="row5" >
<td>'. $lang['REG_IP'] .'</td>
<td class="tCenter">'. $reg_ip .'</td>
<td><div>'. $link_reg_ip .'</div></td>
</tr>
<tr class="row4">
<td>'. $lang['LAST_IP'] .'</td>
<td class="tCenter">'. $last_ip .'</td>
<td><div>'. $link_last_ip .'</div></td>
</tr>
</table><br />
';
break;
}

View file

@ -1,60 +1,60 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang, $userdata;
$post_id = (int) $this->request['post_id'];
$mc_type = (int) $this->request['mc_type'];
$mc_text = (string) $this->request['mc_text'];
if (!$mc_text = prepare_message($mc_text)) $this->ajax_die($lang['EMPTY_MESSAGE']);
$post = DB()->fetch_row("
SELECT
p.post_id, p.poster_id
FROM ". BB_POSTS ." p
WHERE p.post_id = $post_id
");
if (!$post) $this->ajax_die('not post');
$data = array(
'mc_comment' => ($mc_type) ? $mc_text : '',
'mc_type' => $mc_type,
'mc_user_id' => ($mc_type) ? $userdata['user_id'] : 0,
);
$sql_args = DB()->build_array('UPDATE', $data);
DB()->query("UPDATE ". BB_POSTS ." SET $sql_args WHERE post_id = $post_id");
if ($mc_type && $post['poster_id'] != $userdata['user_id'])
{
$subject = sprintf($lang['MC_COMMENT_PM_SUBJECT'], $lang['MC_COMMENT'][$mc_type]['type']);
$message = sprintf($lang['MC_COMMENT_PM_MSG'], get_username($post['poster_id']), make_url(POST_URL ."$post_id#$post_id"), $lang['MC_COMMENT'][$mc_type]['type'], $mc_text);
send_pm($post['poster_id'], $subject, $message);
cache_rm_user_sessions($post['poster_id']);
}
switch($mc_type)
{
case 1: // Комментарий
$mc_class = 'success';
break;
case 2: // Информация
$mc_class = 'info';
break;
case 3: // Предупреждение
$mc_class = 'warning';
break;
case 4: // Нарушение
$mc_class = 'danger';
break;
default:
$mc_class = '';
break;
}
$this->response['mc_type'] = $mc_type;
$this->response['post_id'] = $post_id;
$this->response['mc_title'] = sprintf($lang['MC_COMMENT'][$mc_type]['title'], profile_url($userdata));
$this->response['mc_text'] = bbcode2html($mc_text);
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang, $userdata;
$post_id = (int) $this->request['post_id'];
$mc_type = (int) $this->request['mc_type'];
$mc_text = (string) $this->request['mc_text'];
if (!$mc_text = prepare_message($mc_text)) $this->ajax_die($lang['EMPTY_MESSAGE']);
$post = DB()->fetch_row("
SELECT
p.post_id, p.poster_id
FROM ". BB_POSTS ." p
WHERE p.post_id = $post_id
");
if (!$post) $this->ajax_die('not post');
$data = array(
'mc_comment' => ($mc_type) ? $mc_text : '',
'mc_type' => $mc_type,
'mc_user_id' => ($mc_type) ? $userdata['user_id'] : 0,
);
$sql_args = DB()->build_array('UPDATE', $data);
DB()->query("UPDATE ". BB_POSTS ." SET $sql_args WHERE post_id = $post_id");
if ($mc_type && $post['poster_id'] != $userdata['user_id'])
{
$subject = sprintf($lang['MC_COMMENT_PM_SUBJECT'], $lang['MC_COMMENT'][$mc_type]['type']);
$message = sprintf($lang['MC_COMMENT_PM_MSG'], get_username($post['poster_id']), make_url(POST_URL ."$post_id#$post_id"), $lang['MC_COMMENT'][$mc_type]['type'], $mc_text);
send_pm($post['poster_id'], $subject, $message);
cache_rm_user_sessions($post['poster_id']);
}
switch($mc_type)
{
case 1: // Комментарий
$mc_class = 'success';
break;
case 2: // Информация
$mc_class = 'info';
break;
case 3: // Предупреждение
$mc_class = 'warning';
break;
case 4: // Нарушение
$mc_class = 'danger';
break;
default:
$mc_class = '';
break;
}
$this->response['mc_type'] = $mc_type;
$this->response['post_id'] = $post_id;
$this->response['mc_title'] = sprintf($lang['MC_COMMENT'][$mc_type]['title'], profile_url($userdata));
$this->response['mc_text'] = bbcode2html($mc_text);
$this->response['mc_class'] = $mc_class;

View file

@ -1,172 +1,172 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata;
if (!IS_SUPER_ADMIN) $this->ajax_die('not auth');
array_deep($this->request, 'trim');
$mode = (string) $this->request['mode'];
$sql_error = false;
// установка / начальная валидация значений
switch ($mode)
{
case 'load':
case 'save':
if (!$tpl_id = (int) $this->request['tpl_id'])
{
$this->ajax_die('Выбранный шаблон не найден, создайте новый (empty tpl_id)');
}
if (!$tpl_data = DB()->fetch_row("SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = $tpl_id LIMIT 1"))
{
$this->ajax_die("Шаблон [id: $tpl_id] не найден в БД");
}
break;
}
switch ($mode)
{
case 'save':
case 'new':
if (!$tpl_name = htmlCHR(str_compact($this->request['tpl_name'])))
{
$this->ajax_die('не заполнено название шаблона');
}
$tpl_name = substr($tpl_name, 0, 60);
if (!$tpl_src_form = htmlCHR($this->request['tpl_src_form']))
{
$this->ajax_die('не заполнен скрипт формы шаблона');
}
if (!$tpl_src_title = htmlCHR($this->request['tpl_src_title']))
{
$this->ajax_die('не заполнен формат названия темы');
}
$tpl_src_title = str_compact($tpl_src_title);
if (!$tpl_src_msg = htmlCHR($this->request['tpl_src_msg']))
{
$this->ajax_die('не заполнен формат создания сообщения');
}
$tpl_comment = htmlCHR($this->request['tpl_comment']);
preg_match('#\d+#', (string) $this->request['tpl_rules'], $m);
$tpl_rules_post_id = isset($m[0]) ? (int) $m[0] : 0;
$sql_args = array(
'tpl_name' => (string) $tpl_name,
'tpl_src_form' => (string) $tpl_src_form,
'tpl_src_title' => (string) $tpl_src_title,
'tpl_src_msg' => (string) $tpl_src_msg,
'tpl_comment' => (string) $tpl_comment,
'tpl_rules_post_id' => (int) $tpl_rules_post_id,
'tpl_last_edit_tm' => (int) TIMENOW,
'tpl_last_edit_by' => (int) $userdata['user_id'],
);
break;
}
// выполнение
switch ($mode)
{
// загрузка шаблона
case 'load':
$this->response['val']['tpl-name-save'] = $tpl_data['tpl_name'];
$this->response['val']['tpl-src-form'] = $tpl_data['tpl_src_form'];
$this->response['val']['tpl-src-title'] = $tpl_data['tpl_src_title'];
$this->response['val']['tpl-src-msg'] = $tpl_data['tpl_src_msg'];
$this->response['val']['tpl-comment-save'] = $tpl_data['tpl_comment'];
$this->response['val']['tpl-rules-save'] = $tpl_data['tpl_rules_post_id'];
array_deep($this->response['val'], 'html_ent_decode');
$this->response['val']['tpl-id-save'] = $tpl_id;
$this->response['val']['tpl-last-edit-tst'] = $tpl_data['tpl_last_edit_tm'];
$this->response['html']['tpl-name-old-save'] = $tpl_data['tpl_name'];
$this->response['html']['tpl-last-edit-time'] = bb_date($tpl_data['tpl_last_edit_tm'], 'd-M-y H:i');
$this->response['html']['tpl-last-edit-by'] = get_username(intval($tpl_data['tpl_last_edit_by']));
$this->response['tpl_rules_href'] = POST_URL . $tpl_data['tpl_rules_post_id'] .'#'. $tpl_data['tpl_rules_post_id'];
break;
// включение / отключение шаблона в форуме
case 'assign':
if (!$tpl_id = (int) $this->request['tpl_id'])
{
$this->ajax_die('Выбранный шаблон не найден, создайте новый (empty tpl_id)');
}
if (!$forum_id = (int) $this->request['forum_id'])
{
$this->ajax_die('empty forum_id');
}
if (!forum_exists($forum_id))
{
$this->ajax_die("нет такого форума [id: $forum_id]");
}
// отключение
if ($tpl_id == -1)
{
$new_tpl_id = 0;
$this->response['msg'] = 'Шаблоны в этом форуме отключены';
}
// включение
else
{
if (!$tpl_name = DB()->fetch_row("SELECT tpl_name FROM ". BB_TOPIC_TPL ." WHERE tpl_id = $tpl_id LIMIT 1", 'tpl_name'))
{
$this->ajax_die("Шаблон [id: $tpl_id] не найден в БД");
}
$new_tpl_id = $tpl_id;
$this->response['msg'] = "Включен шаблон $tpl_name";
}
DB()->query("UPDATE ". BB_FORUMS ." SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id LIMIT 1");
break;
// сохранение изменений
case 'save':
if ($tpl_data['tpl_last_edit_tm'] > $this->request['tpl_l_ed_tst'] && $tpl_data['tpl_last_edit_by'] != $userdata['user_id'])
{
$last_edit_by_username = get_username(intval($tpl_data['tpl_last_edit_by']));
$msg = "Изменения не были сохранены!\n\n";
$msg .= 'Шаблон был отредактирован: '. html_entity_decode($last_edit_by_username) .', '. delta_time($tpl_data['tpl_last_edit_tm']) ." назад\n\n";
$this->ajax_die($msg);
}
$sql = "UPDATE ". BB_TOPIC_TPL ." SET ". DB()->build_array('UPDATE', $sql_args) ." WHERE tpl_id = $tpl_id LIMIT 1";
if (!@DB()->query($sql))
{
$sql_error = DB()->sql_error();
}
$this->response['tpl_id'] = $tpl_id;
$this->response['tpl_name'] = $tpl_name;
$this->response['html']['tpl-last-edit-time'] = bb_date(TIMENOW, 'd-M-y H:i');
$this->response['html']['tpl-last-edit-by'] = $userdata['username'];
break;
// создание нового шаблона
case 'new':
$sql = "INSERT INTO ". BB_TOPIC_TPL . DB()->build_array('INSERT', $sql_args);
if (!@DB()->query($sql))
{
$sql_error = DB()->sql_error();
}
break;
// ошибочный $mode
default:
$this->ajax_die("invalid mode: $mode");
}
// возможный дубль названия шаблона
if ($sql_error)
{
if ($sql_error['code'] == 1062) // Duplicate entry
{
$this->ajax_die('Шаблон с таким названием уже существует, выберите другое название');
}
$this->ajax_die("db error {$sql_error['code']}: {$sql_error['message']}");
}
// выход
$this->response['mode'] = $mode;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata;
if (!IS_SUPER_ADMIN) $this->ajax_die('not auth');
array_deep($this->request, 'trim');
$mode = (string) $this->request['mode'];
$sql_error = false;
// установка / начальная валидация значений
switch ($mode)
{
case 'load':
case 'save':
if (!$tpl_id = (int) $this->request['tpl_id'])
{
$this->ajax_die('Выбранный шаблон не найден, создайте новый (empty tpl_id)');
}
if (!$tpl_data = DB()->fetch_row("SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = $tpl_id LIMIT 1"))
{
$this->ajax_die("Шаблон [id: $tpl_id] не найден в БД");
}
break;
}
switch ($mode)
{
case 'save':
case 'new':
if (!$tpl_name = htmlCHR(str_compact($this->request['tpl_name'])))
{
$this->ajax_die('не заполнено название шаблона');
}
$tpl_name = substr($tpl_name, 0, 60);
if (!$tpl_src_form = htmlCHR($this->request['tpl_src_form']))
{
$this->ajax_die('не заполнен скрипт формы шаблона');
}
if (!$tpl_src_title = htmlCHR($this->request['tpl_src_title']))
{
$this->ajax_die('не заполнен формат названия темы');
}
$tpl_src_title = str_compact($tpl_src_title);
if (!$tpl_src_msg = htmlCHR($this->request['tpl_src_msg']))
{
$this->ajax_die('не заполнен формат создания сообщения');
}
$tpl_comment = htmlCHR($this->request['tpl_comment']);
preg_match('#\d+#', (string) $this->request['tpl_rules'], $m);
$tpl_rules_post_id = isset($m[0]) ? (int) $m[0] : 0;
$sql_args = array(
'tpl_name' => (string) $tpl_name,
'tpl_src_form' => (string) $tpl_src_form,
'tpl_src_title' => (string) $tpl_src_title,
'tpl_src_msg' => (string) $tpl_src_msg,
'tpl_comment' => (string) $tpl_comment,
'tpl_rules_post_id' => (int) $tpl_rules_post_id,
'tpl_last_edit_tm' => (int) TIMENOW,
'tpl_last_edit_by' => (int) $userdata['user_id'],
);
break;
}
// выполнение
switch ($mode)
{
// загрузка шаблона
case 'load':
$this->response['val']['tpl-name-save'] = $tpl_data['tpl_name'];
$this->response['val']['tpl-src-form'] = $tpl_data['tpl_src_form'];
$this->response['val']['tpl-src-title'] = $tpl_data['tpl_src_title'];
$this->response['val']['tpl-src-msg'] = $tpl_data['tpl_src_msg'];
$this->response['val']['tpl-comment-save'] = $tpl_data['tpl_comment'];
$this->response['val']['tpl-rules-save'] = $tpl_data['tpl_rules_post_id'];
array_deep($this->response['val'], 'html_ent_decode');
$this->response['val']['tpl-id-save'] = $tpl_id;
$this->response['val']['tpl-last-edit-tst'] = $tpl_data['tpl_last_edit_tm'];
$this->response['html']['tpl-name-old-save'] = $tpl_data['tpl_name'];
$this->response['html']['tpl-last-edit-time'] = bb_date($tpl_data['tpl_last_edit_tm'], 'd-M-y H:i');
$this->response['html']['tpl-last-edit-by'] = get_username(intval($tpl_data['tpl_last_edit_by']));
$this->response['tpl_rules_href'] = POST_URL . $tpl_data['tpl_rules_post_id'] .'#'. $tpl_data['tpl_rules_post_id'];
break;
// включение / отключение шаблона в форуме
case 'assign':
if (!$tpl_id = (int) $this->request['tpl_id'])
{
$this->ajax_die('Выбранный шаблон не найден, создайте новый (empty tpl_id)');
}
if (!$forum_id = (int) $this->request['forum_id'])
{
$this->ajax_die('empty forum_id');
}
if (!forum_exists($forum_id))
{
$this->ajax_die("нет такого форума [id: $forum_id]");
}
// отключение
if ($tpl_id == -1)
{
$new_tpl_id = 0;
$this->response['msg'] = 'Шаблоны в этом форуме отключены';
}
// включение
else
{
if (!$tpl_name = DB()->fetch_row("SELECT tpl_name FROM ". BB_TOPIC_TPL ." WHERE tpl_id = $tpl_id LIMIT 1", 'tpl_name'))
{
$this->ajax_die("Шаблон [id: $tpl_id] не найден в БД");
}
$new_tpl_id = $tpl_id;
$this->response['msg'] = "Включен шаблон $tpl_name";
}
DB()->query("UPDATE ". BB_FORUMS ." SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id LIMIT 1");
break;
// сохранение изменений
case 'save':
if ($tpl_data['tpl_last_edit_tm'] > $this->request['tpl_l_ed_tst'] && $tpl_data['tpl_last_edit_by'] != $userdata['user_id'])
{
$last_edit_by_username = get_username(intval($tpl_data['tpl_last_edit_by']));
$msg = "Изменения не были сохранены!\n\n";
$msg .= 'Шаблон был отредактирован: '. html_entity_decode($last_edit_by_username) .', '. delta_time($tpl_data['tpl_last_edit_tm']) ." назад\n\n";
$this->ajax_die($msg);
}
$sql = "UPDATE ". BB_TOPIC_TPL ." SET ". DB()->build_array('UPDATE', $sql_args) ." WHERE tpl_id = $tpl_id LIMIT 1";
if (!@DB()->query($sql))
{
$sql_error = DB()->sql_error();
}
$this->response['tpl_id'] = $tpl_id;
$this->response['tpl_name'] = $tpl_name;
$this->response['html']['tpl-last-edit-time'] = bb_date(TIMENOW, 'd-M-y H:i');
$this->response['html']['tpl-last-edit-by'] = $userdata['username'];
break;
// создание нового шаблона
case 'new':
$sql = "INSERT INTO ". BB_TOPIC_TPL . DB()->build_array('INSERT', $sql_args);
if (!@DB()->query($sql))
{
$sql_error = DB()->sql_error();
}
break;
// ошибочный $mode
default:
$this->ajax_die("invalid mode: $mode");
}
// возможный дубль названия шаблона
if ($sql_error)
{
if ($sql_error['code'] == 1062) // Duplicate entry
{
$this->ajax_die('Шаблон с таким названием уже существует, выберите другое название');
}
$this->ajax_die("db error {$sql_error['code']}: {$sql_error['message']}");
}
// выход
$this->response['mode'] = $mode;
$this->response['timestamp'] = TIMENOW;

View file

@ -1,76 +1,76 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata;
$mode = (string) $this->request['mode'];
$html = '<img src="./images/good.gif">';
switch($mode)
{
case 'check_name':
$username = clean_username($this->request['username']);
if (empty($username))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_A_NAME'] .'</span>';
}
elseif($err = validate_username($username))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
}
break;
case 'check_email':
$email = (string) $this->request['email'];
if (empty($email))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_E_MAIL'] .'</span>';
}
elseif($err = validate_email($email))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
}
break;
case 'check_pass':
$pass = (string) $this->request['pass'];
$pass_confirm = (string) $this->request['pass_confirm'];
if (empty($pass) || empty($pass_confirm))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_PASS'] .'</span>';
}
else
{
if ($pass != $pass_confirm)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_PASS_ERR'] .'</span>';
}
else
{
if (mb_strlen($pass, 'UTF-8') > 20)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. sprintf($lang['CHOOSE_PASS_ERR_MAX'], 20) .'</span>';
}
elseif (mb_strlen($pass, 'UTF-8') < 5)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. sprintf($lang['CHOOSE_PASS_ERR_MIN'], 5) .'</span>';
}
else
{
$text = (IS_GUEST) ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
$html = '<img src="./images/good.gif"> <span class="seedmed bold">'. $text .'</span>';
}
}
}
break;
case 'refresh_captcha';
$html = CAPTCHA()->get_html();
break;
}
$this->response['html'] = $html;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata;
$mode = (string) $this->request['mode'];
$html = '<img src="./images/good.gif">';
switch($mode)
{
case 'check_name':
$username = clean_username($this->request['username']);
if (empty($username))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_A_NAME'] .'</span>';
}
elseif($err = validate_username($username))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
}
break;
case 'check_email':
$email = (string) $this->request['email'];
if (empty($email))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_E_MAIL'] .'</span>';
}
elseif($err = validate_email($email))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
}
break;
case 'check_pass':
$pass = (string) $this->request['pass'];
$pass_confirm = (string) $this->request['pass_confirm'];
if (empty($pass) || empty($pass_confirm))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_PASS'] .'</span>';
}
else
{
if ($pass != $pass_confirm)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_PASS_ERR'] .'</span>';
}
else
{
if (mb_strlen($pass, 'UTF-8') > 20)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. sprintf($lang['CHOOSE_PASS_ERR_MAX'], 20) .'</span>';
}
elseif (mb_strlen($pass, 'UTF-8') < 5)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. sprintf($lang['CHOOSE_PASS_ERR_MIN'], 5) .'</span>';
}
else
{
$text = (IS_GUEST) ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
$html = '<img src="./images/good.gif"> <span class="seedmed bold">'. $text .'</span>';
}
}
}
break;
case 'refresh_captcha';
$html = CAPTCHA()->get_html();
break;
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;

View file

@ -1,53 +1,53 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $user, $lang;
$post_id = (int) @$this->request['post_id'];
$topic_id = (int) @$this->request['topic_id'];
if (!$post_id)
{
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id", 'topic_first_post_id');
}
$sql = "
SELECT
p.*,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
f.auth_read
FROM ". BB_POSTS ." p
INNER JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = pt.post_id)
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = p.forum_id)
WHERE
p.post_id = $post_id
LIMIT 1
";
if (!$post_data = DB()->fetch_row($sql))
{
$this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
}
// Auth check
if ($post_data['auth_read'] == AUTH_REG)
{
if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
}
elseif ($post_data['auth_read'] != AUTH_ALL)
{
$is_auth = auth(AUTH_READ, $post_data['forum_id'], $user->data, $post_data);
if (!$is_auth['auth_read'])
{
$this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
}
}
$this->response['post_id'] = $post_id;
$this->response['topic_id'] = $topic_id;
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $user, $lang;
$post_id = (int) @$this->request['post_id'];
$topic_id = (int) @$this->request['topic_id'];
if (!$post_id)
{
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id", 'topic_first_post_id');
}
$sql = "
SELECT
p.*,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
f.auth_read
FROM ". BB_POSTS ." p
INNER JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = pt.post_id)
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = p.forum_id)
WHERE
p.post_id = $post_id
LIMIT 1
";
if (!$post_data = DB()->fetch_row($sql))
{
$this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
}
// Auth check
if ($post_data['auth_read'] == AUTH_REG)
{
if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
}
elseif ($post_data['auth_read'] != AUTH_ALL)
{
$is_auth = auth(AUTH_READ, $post_data['forum_id'], $user->data, $post_data);
if (!$is_auth['auth_read'])
{
$this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
}
}
$this->response['post_id'] = $post_id;
$this->response['topic_id'] = $topic_id;
$this->response['post_html'] = get_parsed_post($post_data);

View file

@ -1,172 +1,172 @@
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
$attach_id = (int) $this->request['attach_id'];
$torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB_ATTACHMENTS_DESC ." at WHERE at.attach_id = $attach_id LIMIT 1");
if (!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
if (($file_contents = @file_get_contents($filename)) === false)
{
if (IS_AM)
{
$this->ajax_die($lang['ERROR_NO_ATTACHMENT'] ."\n\n". htmlCHR($filename));
}
else
{
$this->ajax_die($lang['ERROR_NO_ATTACHMENT']);
}
}
// Построение списка
$tor_filelist = build_tor_filelist($file_contents);
function build_tor_filelist ($file_contents)
{
global $lang;
if (!$tor = bdecode($file_contents))
{
return $lang['TORFILE_INVALID'];
}
$torrent = new torrent($tor);
return $torrent->get_filelist();
}
class torrent
{
var $tor_decoded = array();
var $files_ary = array('/' => '');
var $multiple = null;
var $root_dir = '';
var $files_html = '';
function torrent ($decoded_file_contents)
{
$this->tor_decoded = $decoded_file_contents;
}
function get_filelist ()
{
$this->build_filelist_array();
if ($this->multiple)
{
if ($this->files_ary['/'] !== '')
{
$this->files_ary = array_merge($this->files_ary, $this->files_ary['/']);
unset($this->files_ary['/']);
}
$filelist = $this->build_filelist_html();
return "<div class=\"tor-root-dir\">{$this->root_dir}</div>$filelist";
}
else
{
return join('', $this->files_ary['/']);
}
}
function build_filelist_array ()
{
global $lang;
$info = $this->tor_decoded['info'];
if (isset($info['name.utf-8']))
{
$info['name'] =& $info['name.utf-8'];
}
if (isset($info['files']) && is_array($info['files']))
{
$this->root_dir = isset($info['name']) ? '../'. clean_tor_dirname($info['name']) : '...';
$this->multiple = true;
foreach ($info['files'] as $f)
{
if (isset($f['path.utf-8']))
{
$f['path'] =& $f['path.utf-8'];
}
if (!isset($f['path']) || !is_array($f['path']))
{
continue;
}
array_deep($f['path'], 'clean_tor_dirname');
$length = isset($f['length']) ? (float) $f['length'] : 0;
$subdir_count = count($f['path']) - 1;
if ($subdir_count > 0)
{
$name = array_pop($f['path']);
$cur_files_ary =& $this->files_ary;
for ($i=0,$j=1; $i < $subdir_count; $i++,$j++)
{
$subdir = $f['path'][$i];
if (!isset($cur_files_ary[$subdir]))
{
$cur_files_ary[$subdir] = array();
}
$cur_files_ary =& $cur_files_ary[$subdir];
if ($j == $subdir_count)
{
if (is_string($cur_files_ary))
{
bb_die($lang['ERROR_BUILD']);
}
$cur_files_ary[] = $this->build_file_item($name, $length);
}
}
@natsort($cur_files_ary);
}
else
{
$name = $f['path'][0];
$this->files_ary['/'][] = $this->build_file_item($name, $length);
natsort($this->files_ary['/']);
}
}
}
else
{
$this->multiple = false;
$name = isset($info['name']) ? clean_tor_dirname($info['name']) : '';
$length = isset($info['length']) ? (int) $info['length'] : 0;
$this->files_ary['/'][] = $this->build_file_item($name, $length);
natsort($this->files_ary['/']);
}
}
function build_file_item ($name, $length)
{
return "$name <i>$length</i>";
}
function build_filelist_html ()
{
global $html;
return $html->array2html($this->files_ary);
}
}
function clean_tor_dirname ($dirname)
{
return str_replace(array('[', ']', '<', '>', "'"), array('&#91;', '&#93;', '&lt;', '&gt;', '&#039;'), $dirname);
}
<?php
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
$attach_id = (int) $this->request['attach_id'];
$torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB_ATTACHMENTS_DESC ." at WHERE at.attach_id = $attach_id LIMIT 1");
if (!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
if (($file_contents = @file_get_contents($filename)) === false)
{
if (IS_AM)
{
$this->ajax_die($lang['ERROR_NO_ATTACHMENT'] ."\n\n". htmlCHR($filename));
}
else
{
$this->ajax_die($lang['ERROR_NO_ATTACHMENT']);
}
}
// Построение списка
$tor_filelist = build_tor_filelist($file_contents);
function build_tor_filelist ($file_contents)
{
global $lang;
if (!$tor = bdecode($file_contents))
{
return $lang['TORFILE_INVALID'];
}
$torrent = new torrent($tor);
return $torrent->get_filelist();
}
class torrent
{
var $tor_decoded = array();
var $files_ary = array('/' => '');
var $multiple = null;
var $root_dir = '';
var $files_html = '';
function torrent ($decoded_file_contents)
{
$this->tor_decoded = $decoded_file_contents;
}
function get_filelist ()
{
$this->build_filelist_array();
if ($this->multiple)
{
if ($this->files_ary['/'] !== '')
{
$this->files_ary = array_merge($this->files_ary, $this->files_ary['/']);
unset($this->files_ary['/']);
}
$filelist = $this->build_filelist_html();
return "<div class=\"tor-root-dir\">{$this->root_dir}</div>$filelist";
}
else
{
return join('', $this->files_ary['/']);
}
}
function build_filelist_array ()
{
global $lang;
$info = $this->tor_decoded['info'];
if (isset($info['name.utf-8']))
{
$info['name'] =& $info['name.utf-8'];
}
if (isset($info['files']) && is_array($info['files']))
{
$this->root_dir = isset($info['name']) ? '../'. clean_tor_dirname($info['name']) : '...';
$this->multiple = true;
foreach ($info['files'] as $f)
{
if (isset($f['path.utf-8']))
{
$f['path'] =& $f['path.utf-8'];
}
if (!isset($f['path']) || !is_array($f['path']))
{
continue;
}
array_deep($f['path'], 'clean_tor_dirname');
$length = isset($f['length']) ? (float) $f['length'] : 0;
$subdir_count = count($f['path']) - 1;
if ($subdir_count > 0)
{
$name = array_pop($f['path']);
$cur_files_ary =& $this->files_ary;
for ($i=0,$j=1; $i < $subdir_count; $i++,$j++)
{
$subdir = $f['path'][$i];
if (!isset($cur_files_ary[$subdir]))
{
$cur_files_ary[$subdir] = array();
}
$cur_files_ary =& $cur_files_ary[$subdir];
if ($j == $subdir_count)
{
if (is_string($cur_files_ary))
{
bb_die($lang['ERROR_BUILD']);
}
$cur_files_ary[] = $this->build_file_item($name, $length);
}
}
@natsort($cur_files_ary);
}
else
{
$name = $f['path'][0];
$this->files_ary['/'][] = $this->build_file_item($name, $length);
natsort($this->files_ary['/']);
}
}
}
else
{
$this->multiple = false;
$name = isset($info['name']) ? clean_tor_dirname($info['name']) : '';
$length = isset($info['length']) ? (int) $info['length'] : 0;
$this->files_ary['/'][] = $this->build_file_item($name, $length);
natsort($this->files_ary['/']);
}
}
function build_file_item ($name, $length)
{
return "$name <i>$length</i>";
}
function build_filelist_html ()
{
global $html;
return $html->array2html($this->files_ary);
}
}
function clean_tor_dirname ($dirname)
{
return str_replace(array('[', ']', '<', '>', "'"), array('&#91;', '&#93;', '&lt;', '&gt;', '&#039;'), $dirname);
}
$this->response['html'] = $tor_filelist;

View file

@ -1,220 +1,220 @@
<?php
/**
* Setup Basic Authentication
*/
// moved to auth
/**
* Setup Forum Authentication (admin/admin_forumauth.php)
*/
//admin/admin_forumauth.php
/**
* Setup Usergroup Authentication
*/
//admin/admin_ug_auth.php
/**
* Setup s_auth_can in viewforum and viewtopic (viewtopic.php/viewforum.php)
*/
function attach_build_auth_levels($is_auth, &$s_auth_can)
{
global $lang, $attach_config;
if (intval($attach_config['disable_mod']))
{
return;
}
// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'] ) . '<br />';
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'] ) . '<br />';
}
/**
* Called from admin_users.php and admin_groups.php in order to process Quota Settings (admin/admin_users.php:admin/admin_groups.php)
*/
function attachment_quota_settings($admin_mode, $submit = false, $mode)
{
global $template, $lang, $attach_config;
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
{
$upload_dir = $attach_config['upload_dir'];
}
else
{
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
}
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
if (!function_exists("process_quota_settings"))
include(BB_ROOT . 'attach_mod/includes/functions_admin.php');
$user_id = 0;
if ($admin_mode == 'user')
{
// We overwrite submit here... to be sure
$submit = (isset($_POST['submit'])) ? true : false;
if (!$submit && $mode != 'save')
{
$user_id = get_var(POST_USERS_URL, 0);
$u_name = get_var('username', '');
if (!$user_id && !$u_name)
{
bb_die($lang['NO_USER_ID_SPECIFIED'] );
}
if ($user_id)
{
$this_userdata['user_id'] = $user_id;
}
else
{
// Get userdata is handling the sanitizing of username
$this_userdata = get_userdata($_POST['username'], true);
}
$user_id = (int) $this_userdata['user_id'];
}
else
{
$user_id = get_var('id', 0);
if (!$user_id)
{
bb_die($lang['NO_USER_ID_SPECIFIED'] );
}
}
}
if ($admin_mode == 'user' && !$submit && $mode != 'save')
{
// Show the contents
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE user_id = ' . (int) $user_id;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Unable to get quota settings #1');
}
$pm_quota = $upload_quota = 0;
if ($row = DB()->sql_fetchrow($result))
{
do
{
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
{
$upload_quota = $row['quota_limit_id'];
}
else if ($row['quota_type'] == QUOTA_PM_LIMIT)
{
$pm_quota = $row['quota_limit_id'];
}
}
while ($row = DB()->sql_fetchrow($result));
}
else
{
// Set Default Quota Limit
$upload_quota = $attach_config['default_upload_quota'];
$pm_quota = $attach_config['default_pm_quota'];
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
));
}
if ($admin_mode == 'user' && $submit && @$_POST['delete_user'])
{
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, 0);
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, 0);
}
else if ($admin_mode == 'user' && $submit && $mode == 'save')
{
// Get the contents
$upload_quota = get_var('user_upload_quota', 0);
$pm_quota = get_var('user_pm_quota', 0);
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, $pm_quota);
}
if ($admin_mode == 'group' && $mode == 'newgroup')
{
return;
}
if ($admin_mode == 'group' && !$submit && isset($_POST['edit']))
{
// Get group id again
$group_id = get_var(POST_GROUPS_URL, 0);
// Show the contents
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE group_id = ' . (int) $group_id;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Unable to get quota settings #2');
}
$pm_quota = $upload_quota = 0;
if ($row = DB()->sql_fetchrow($result))
{
do
{
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
{
$upload_quota = $row['quota_limit_id'];
}
else if ($row['quota_type'] == QUOTA_PM_LIMIT)
{
$pm_quota = $row['quota_limit_id'];
}
}
while ($row = DB()->sql_fetchrow($result));
}
else
{
// Set Default Quota Limit
$upload_quota = $attach_config['default_upload_quota'];
$pm_quota = $attach_config['default_pm_quota'];
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
));
}
if ($admin_mode == 'group' && $submit && isset($_POST['group_delete']))
{
$group_id = get_var(POST_GROUPS_URL, 0);
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, 0);
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, 0);
}
else if ($admin_mode == 'group' && $submit)
{
$group_id = get_var(POST_GROUPS_URL, 0);
// Get the contents
$upload_quota = get_var('group_upload_quota', 0);
$pm_quota = get_var('group_pm_quota', 0);
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
}
<?php
/**
* Setup Basic Authentication
*/
// moved to auth
/**
* Setup Forum Authentication (admin/admin_forumauth.php)
*/
//admin/admin_forumauth.php
/**
* Setup Usergroup Authentication
*/
//admin/admin_ug_auth.php
/**
* Setup s_auth_can in viewforum and viewtopic (viewtopic.php/viewforum.php)
*/
function attach_build_auth_levels($is_auth, &$s_auth_can)
{
global $lang, $attach_config;
if (intval($attach_config['disable_mod']))
{
return;
}
// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'] ) . '<br />';
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'] ) . '<br />';
}
/**
* Called from admin_users.php and admin_groups.php in order to process Quota Settings (admin/admin_users.php:admin/admin_groups.php)
*/
function attachment_quota_settings($admin_mode, $submit = false, $mode)
{
global $template, $lang, $attach_config;
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
{
$upload_dir = $attach_config['upload_dir'];
}
else
{
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
}
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
if (!function_exists("process_quota_settings"))
include(BB_ROOT . 'attach_mod/includes/functions_admin.php');
$user_id = 0;
if ($admin_mode == 'user')
{
// We overwrite submit here... to be sure
$submit = (isset($_POST['submit'])) ? true : false;
if (!$submit && $mode != 'save')
{
$user_id = get_var(POST_USERS_URL, 0);
$u_name = get_var('username', '');
if (!$user_id && !$u_name)
{
bb_die($lang['NO_USER_ID_SPECIFIED'] );
}
if ($user_id)
{
$this_userdata['user_id'] = $user_id;
}
else
{
// Get userdata is handling the sanitizing of username
$this_userdata = get_userdata($_POST['username'], true);
}
$user_id = (int) $this_userdata['user_id'];
}
else
{
$user_id = get_var('id', 0);
if (!$user_id)
{
bb_die($lang['NO_USER_ID_SPECIFIED'] );
}
}
}
if ($admin_mode == 'user' && !$submit && $mode != 'save')
{
// Show the contents
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE user_id = ' . (int) $user_id;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Unable to get quota settings #1');
}
$pm_quota = $upload_quota = 0;
if ($row = DB()->sql_fetchrow($result))
{
do
{
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
{
$upload_quota = $row['quota_limit_id'];
}
else if ($row['quota_type'] == QUOTA_PM_LIMIT)
{
$pm_quota = $row['quota_limit_id'];
}
}
while ($row = DB()->sql_fetchrow($result));
}
else
{
// Set Default Quota Limit
$upload_quota = $attach_config['default_upload_quota'];
$pm_quota = $attach_config['default_pm_quota'];
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
));
}
if ($admin_mode == 'user' && $submit && @$_POST['delete_user'])
{
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, 0);
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, 0);
}
else if ($admin_mode == 'user' && $submit && $mode == 'save')
{
// Get the contents
$upload_quota = get_var('user_upload_quota', 0);
$pm_quota = get_var('user_pm_quota', 0);
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, $pm_quota);
}
if ($admin_mode == 'group' && $mode == 'newgroup')
{
return;
}
if ($admin_mode == 'group' && !$submit && isset($_POST['edit']))
{
// Get group id again
$group_id = get_var(POST_GROUPS_URL, 0);
// Show the contents
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE group_id = ' . (int) $group_id;
if (!($result = DB()->sql_query($sql)))
{
bb_die('Unable to get quota settings #2');
}
$pm_quota = $upload_quota = 0;
if ($row = DB()->sql_fetchrow($result))
{
do
{
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
{
$upload_quota = $row['quota_limit_id'];
}
else if ($row['quota_type'] == QUOTA_PM_LIMIT)
{
$pm_quota = $row['quota_limit_id'];
}
}
while ($row = DB()->sql_fetchrow($result));
}
else
{
// Set Default Quota Limit
$upload_quota = $attach_config['default_upload_quota'];
$pm_quota = $attach_config['default_pm_quota'];
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
));
}
if ($admin_mode == 'group' && $submit && isset($_POST['group_delete']))
{
$group_id = get_var(POST_GROUPS_URL, 0);
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, 0);
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, 0);
}
else if ($admin_mode == 'group' && $submit)
{
$group_id = get_var(POST_GROUPS_URL, 0);
// Get the contents
$upload_quota = get_var('group_upload_quota', 0);
$pm_quota = get_var('group_pm_quota', 0);
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
}
}

View file

@ -1,2 +1,2 @@
order allow,deny
order allow,deny
deny from all

View file

@ -1,94 +1,94 @@
<?php
define('IN_FORUM', true);
define('BB_SCRIPT', 'callseed');
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
// Init userdata
$user->session_start(array('req_login' => true));
$topic_id = (int) request_var('t', 0);
$t_data = topic_info($topic_id);
$forum_id = $t_data['forum_id'];
set_die_append_msg($forum_id, $topic_id);
if ($t_data['seeders'] > 2)
{
bb_die(sprintf($lang['CALLSEED_HAVE_SEED'], $t_data['seeders']));
}
elseif ($t_data['call_seed_time'] > (TIMENOW - 86400))
{
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
bb_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
}
$ban_user_id = array();
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
$ban_user_id[] = ','. $row['ban_userid'];
}
$ban_user_id = join('', $ban_user_id);
$user_list = DB()->fetch_rowset("
SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl
FROM ". BB_BT_DLSTATUS ." dl
LEFT JOIN ". BB_USERS ." u ON(u.user_id = dl.user_id)
LEFT JOIN ". BB_BT_TRACKER ." tr ON(tr.user_id = dl.user_id)
WHERE dl.topic_id = $topic_id
AND dl.user_status IN (". DL_STATUS_COMPLETE.", ". DL_STATUS_DOWN.")
AND dl.user_id NOT IN ({$userdata['user_id']}, ". EXCLUDED_USERS_CSV . $ban_user_id .")
AND u.user_active = 1
GROUP BY dl.user_id
");
$subject = sprintf($lang['CALLSEED_SUBJECT'], $t_data['topic_title']);
$message = sprintf($lang['CALLSEED_TEXT'], make_url(TOPIC_URL . $topic_id), $t_data['topic_title'], make_url(DOWNLOAD_URL . $t_data['attach_id']));
if ($user_list)
{
foreach ($user_list as $row)
{
if (!empty($row['active_dl'])) continue;
if (bf($row['user_opt'], 'user_opt', 'user_callseed'))
{
send_pm($row['user_id'], $subject, $message, BOT_UID);
}
}
}
else
{
send_pm($t_data['poster_id'], $subject, $message, BOT_UID);
}
DB()->query("UPDATE ". BB_BT_TORRENTS ." SET call_seed_time = ". TIMENOW ." WHERE topic_id = $topic_id LIMIT 1");
meta_refresh(TOPIC_URL . $topic_id);
bb_die($lang['CALLSEED_MSG_OK']);
function topic_info ($topic_id)
{
global $lang;
$sql = "
SELECT
tor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time,
t.topic_title, sn.seeders
FROM ". BB_BT_TORRENTS ." tor
LEFT JOIN ". BB_TOPICS ." t USING(topic_id)
LEFT JOIN ". BB_BT_TRACKER_SNAP ." sn USING(topic_id)
WHERE tor.topic_id = $topic_id
";
if (!$torrent = DB()->fetch_row($sql))
{
bb_die($lang['TOPIC_POST_NOT_EXIST']);
}
return $torrent;
}
<?php
define('IN_FORUM', true);
define('BB_SCRIPT', 'callseed');
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
// Init userdata
$user->session_start(array('req_login' => true));
$topic_id = (int) request_var('t', 0);
$t_data = topic_info($topic_id);
$forum_id = $t_data['forum_id'];
set_die_append_msg($forum_id, $topic_id);
if ($t_data['seeders'] > 2)
{
bb_die(sprintf($lang['CALLSEED_HAVE_SEED'], $t_data['seeders']));
}
elseif ($t_data['call_seed_time'] > (TIMENOW - 86400))
{
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
bb_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
}
$ban_user_id = array();
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
$ban_user_id[] = ','. $row['ban_userid'];
}
$ban_user_id = join('', $ban_user_id);
$user_list = DB()->fetch_rowset("
SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl
FROM ". BB_BT_DLSTATUS ." dl
LEFT JOIN ". BB_USERS ." u ON(u.user_id = dl.user_id)
LEFT JOIN ". BB_BT_TRACKER ." tr ON(tr.user_id = dl.user_id)
WHERE dl.topic_id = $topic_id
AND dl.user_status IN (". DL_STATUS_COMPLETE.", ". DL_STATUS_DOWN.")
AND dl.user_id NOT IN ({$userdata['user_id']}, ". EXCLUDED_USERS_CSV . $ban_user_id .")
AND u.user_active = 1
GROUP BY dl.user_id
");
$subject = sprintf($lang['CALLSEED_SUBJECT'], $t_data['topic_title']);
$message = sprintf($lang['CALLSEED_TEXT'], make_url(TOPIC_URL . $topic_id), $t_data['topic_title'], make_url(DOWNLOAD_URL . $t_data['attach_id']));
if ($user_list)
{
foreach ($user_list as $row)
{
if (!empty($row['active_dl'])) continue;
if (bf($row['user_opt'], 'user_opt', 'user_callseed'))
{
send_pm($row['user_id'], $subject, $message, BOT_UID);
}
}
}
else
{
send_pm($t_data['poster_id'], $subject, $message, BOT_UID);
}
DB()->query("UPDATE ". BB_BT_TORRENTS ." SET call_seed_time = ". TIMENOW ." WHERE topic_id = $topic_id LIMIT 1");
meta_refresh(TOPIC_URL . $topic_id);
bb_die($lang['CALLSEED_MSG_OK']);
function topic_info ($topic_id)
{
global $lang;
$sql = "
SELECT
tor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time,
t.topic_title, sn.seeders
FROM ". BB_BT_TORRENTS ." tor
LEFT JOIN ". BB_TOPICS ." t USING(topic_id)
LEFT JOIN ". BB_BT_TRACKER_SNAP ." sn USING(topic_id)
WHERE tor.topic_id = $topic_id
";
if (!$torrent = DB()->fetch_row($sql))
{
bb_die($lang['TOPIC_POST_NOT_EXIST']);
}
return $torrent;
}

View file

@ -1,6 +1,6 @@
<?php
define('START_CRON', true);
define('BB_ROOT', dirname ( __FILE__ ) . '/');
<?php
define('START_CRON', true);
define('BB_ROOT', dirname ( __FILE__ ) . '/');
require(BB_ROOT. 'common.php');

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" secure="false" />
<site-control permitted-cross-domain-policies="master-only" />
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" secure="false" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>

View file

@ -1,3 +1,3 @@
php_flag engine off
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
php_flag engine off
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
AddType text/plain .php .php .htm .html .phtml .pl .asp

View file

@ -1,3 +1,3 @@
php_flag engine off
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
php_flag engine off
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
AddType text/plain .php .php .htm .html .phtml .pl .asp

File diff suppressed because it is too large Load diff

View file

@ -1,400 +1,400 @@
<?php
/**
* 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(0, 0, 0);
//$background_color = array(220, 230, 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. To remove, see configuration file
$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);
# imagegif($img2, $img_path);
# imagepng($img2, $img_path);
imagedestroy($img2);
return $this->keystring;
}
<?php
/**
* 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(0, 0, 0);
//$background_color = array(220, 230, 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. To remove, see configuration file
$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);
# imagegif($img2, $img_path);
# imagepng($img2, $img_path);
imagedestroy($img2);
return $this->keystring;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,183 +1,183 @@
<?php
/**
* A class for validating method parameters to allowed types via reflection.
*
* Purpose
* Used as a more convenient multiple assert(), standing after the declaration of the methods.
*
* Features and advantage
* * Very easy to use
* * Ability to turn off on the production server
*
* WARNING
* On a production server, it is important to disable assert, that would save server resources.
* For this, use the assert_options(ASSERT_ACTIVE, false) or INI setting "assert.active 0".
* In this case ReflectionTypeHint::isValid() always returns TRUE!
*
* Useful links
* http://www.ilia.ws/archives/205-Type-hinting-for-PHP-5.3.html
* http://php.net/manual/en/language.oop5.typehinting.php
*
* @example ReflectionTypeHint_example.php
* @link http://code.google.com/p/php5-reflection-type-hint/
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @author Nasibullin Rinat
* @version 1.1.0
*/
class ReflectionTypeHint
{
protected static $hints = array(
'int' => 'is_int',
'integer' => 'is_int',
'digit' => 'ctype_digit',
'number' => 'ctype_digit',
'float' => 'is_float',
'double' => 'is_float',
'real' => 'is_float',
'numeric' => 'is_numeric',
'str' => 'is_string',
'string' => 'is_string',
'char' => 'is_string',
'bool' => 'is_bool',
'boolean' => 'is_bool',
'null' => 'is_null',
'array' => 'is_array',
'obj' => 'is_object',
'object' => 'is_object',
'res' => 'is_resource',
'resource' => 'is_resource',
'scalar' => 'is_scalar', #integer, float, string or boolean
'cb' => 'is_callable',
'callback' => 'is_callable',
);
#calling the methods of this class only statically!
private function __construct() {}
public static function isValid()
{
if (! assert_options(ASSERT_ACTIVE)) return true;
$bt = self::debugBacktrace(null, 1);
extract($bt); //to $file, $line, $function, $class, $object, $type, $args
if (! $args) return true; #speed improve
$r = new ReflectionMethod($class, $function);
$doc = $r->getDocComment();
$cache_id = $class. $type. $function;
preg_match_all('~ [\r\n]++ [\x20\t]++ \* [\x20\t]++
@param
[\x20\t]++
\K #memory reduce
( [_a-z]++[_a-z\d]*+
(?>[|/,][_a-z]+[_a-z\d]*)*+
) #1 types
[\x20\t]++
&?+\$([_a-z]++[_a-z\d]*+) #2 name
~sixSX', $doc, $params, PREG_SET_ORDER);
$parameters = $r->getParameters();
//d($args, $params, $parameters);
if (count($parameters) > count($params))
{
$message = 'phpDoc %d piece(s) @param description expected in %s%s%s(), %s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, count($parameters), $class, $type, $function, count($params), $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_NOTICE);
}
foreach ($args as $i => $value)
{
if (! isset($params[$i])) return true;
if ($parameters[$i]->name !== $params[$i][2])
{
$param_num = $i + 1;
$message = 'phpDoc @param %d in %s%s%s() must be named as $%s, $%s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, $param_num, $class, $type, $function, $parameters[$i]->name, $params[$i][2], $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_NOTICE);
}
$hints = preg_split('~[|/,]~sSX', $params[$i][1]);
if (! self::checkValueTypes($hints, $value))
{
$param_num = $i + 1;
$message = 'Argument %d passed to %s%s%s() must be an %s, %s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, $param_num, $class, $type, $function, implode('|', $hints), (is_object($value) ? get_class($value) . ' ' : '') . gettype($value), $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_WARNING);
return false;
}
}
return true;
}
/**
* Return stacktrace. Correctly work with call_user_func*()
* (totally skip them correcting caller references).
* If $return_frame is present, return only $return_frame matched caller, not all stacktrace.
*
* @param string|null $re_ignore example: '~^' . preg_quote(__CLASS__, '~') . '(?![a-zA-Z\d])~sSX'
* @param int|null $return_frame
* @return array
*/
public static function debugBacktrace($re_ignore = null, $return_frame = null)
{
$trace = debug_backtrace();
$a = array();
$frames = 0;
for ($i = 0, $n = count($trace); $i < $n; $i++)
{
$t = $trace[$i];
if (! $t) continue;
// Next frame.
$next = isset($trace[$i+1])? $trace[$i+1] : null;
// Dummy frame before call_user_func*() frames.
if (! isset($t['file']) && $next)
{
$t['over_function'] = $trace[$i+1]['function'];
$t = $t + $trace[$i+1];
$trace[$i+1] = null; // skip call_user_func on next iteration
}
// Skip myself frame.
if (++$frames < 2) continue;
// 'class' and 'function' field of next frame define where this frame function situated.
// Skip frames for functions situated in ignored places.
if ($re_ignore && $next)
{
// Name of function "inside which" frame was generated.
$frame_caller = (isset($next['class']) ? $next['class'] . $next['type'] : '')
. (isset($next['function']) ? $next['function'] : '');
if (preg_match($re_ignore, $frame_caller)) continue;
}
// On each iteration we consider ability to add PREVIOUS frame to $a stack.
if (count($a) === $return_frame) return $t;
$a[] = $t;
}
return $a;
}
/**
* Checks a value to the allowed types
*
* @param array $types
* @param mixed $value
* @return bool
*/
public static function checkValueTypes(array $types, $value)
{
foreach ($types as $type)
{
$type = strtolower($type);
if (array_key_exists($type, self::$hints) && call_user_func(self::$hints[$type], $value)) return true;
if (is_object($value) && @is_a($value, $type)) return true;
if ($type === 'mixed') return true;
}
return false;
}
<?php
/**
* A class for validating method parameters to allowed types via reflection.
*
* Purpose
* Used as a more convenient multiple assert(), standing after the declaration of the methods.
*
* Features and advantage
* * Very easy to use
* * Ability to turn off on the production server
*
* WARNING
* On a production server, it is important to disable assert, that would save server resources.
* For this, use the assert_options(ASSERT_ACTIVE, false) or INI setting "assert.active 0".
* In this case ReflectionTypeHint::isValid() always returns TRUE!
*
* Useful links
* http://www.ilia.ws/archives/205-Type-hinting-for-PHP-5.3.html
* http://php.net/manual/en/language.oop5.typehinting.php
*
* @example ReflectionTypeHint_example.php
* @link http://code.google.com/p/php5-reflection-type-hint/
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @author Nasibullin Rinat
* @version 1.1.0
*/
class ReflectionTypeHint
{
protected static $hints = array(
'int' => 'is_int',
'integer' => 'is_int',
'digit' => 'ctype_digit',
'number' => 'ctype_digit',
'float' => 'is_float',
'double' => 'is_float',
'real' => 'is_float',
'numeric' => 'is_numeric',
'str' => 'is_string',
'string' => 'is_string',
'char' => 'is_string',
'bool' => 'is_bool',
'boolean' => 'is_bool',
'null' => 'is_null',
'array' => 'is_array',
'obj' => 'is_object',
'object' => 'is_object',
'res' => 'is_resource',
'resource' => 'is_resource',
'scalar' => 'is_scalar', #integer, float, string or boolean
'cb' => 'is_callable',
'callback' => 'is_callable',
);
#calling the methods of this class only statically!
private function __construct() {}
public static function isValid()
{
if (! assert_options(ASSERT_ACTIVE)) return true;
$bt = self::debugBacktrace(null, 1);
extract($bt); //to $file, $line, $function, $class, $object, $type, $args
if (! $args) return true; #speed improve
$r = new ReflectionMethod($class, $function);
$doc = $r->getDocComment();
$cache_id = $class. $type. $function;
preg_match_all('~ [\r\n]++ [\x20\t]++ \* [\x20\t]++
@param
[\x20\t]++
\K #memory reduce
( [_a-z]++[_a-z\d]*+
(?>[|/,][_a-z]+[_a-z\d]*)*+
) #1 types
[\x20\t]++
&?+\$([_a-z]++[_a-z\d]*+) #2 name
~sixSX', $doc, $params, PREG_SET_ORDER);
$parameters = $r->getParameters();
//d($args, $params, $parameters);
if (count($parameters) > count($params))
{
$message = 'phpDoc %d piece(s) @param description expected in %s%s%s(), %s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, count($parameters), $class, $type, $function, count($params), $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_NOTICE);
}
foreach ($args as $i => $value)
{
if (! isset($params[$i])) return true;
if ($parameters[$i]->name !== $params[$i][2])
{
$param_num = $i + 1;
$message = 'phpDoc @param %d in %s%s%s() must be named as $%s, $%s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, $param_num, $class, $type, $function, $parameters[$i]->name, $params[$i][2], $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_NOTICE);
}
$hints = preg_split('~[|/,]~sSX', $params[$i][1]);
if (! self::checkValueTypes($hints, $value))
{
$param_num = $i + 1;
$message = 'Argument %d passed to %s%s%s() must be an %s, %s given, ' . PHP_EOL
. 'called in %s on line %d ' . PHP_EOL
. 'and defined in %s on line %d';
$message = sprintf($message, $param_num, $class, $type, $function, implode('|', $hints), (is_object($value) ? get_class($value) . ' ' : '') . gettype($value), $file, $line, $r->getFileName(), $r->getStartLine());
trigger_error($message, E_USER_WARNING);
return false;
}
}
return true;
}
/**
* Return stacktrace. Correctly work with call_user_func*()
* (totally skip them correcting caller references).
* If $return_frame is present, return only $return_frame matched caller, not all stacktrace.
*
* @param string|null $re_ignore example: '~^' . preg_quote(__CLASS__, '~') . '(?![a-zA-Z\d])~sSX'
* @param int|null $return_frame
* @return array
*/
public static function debugBacktrace($re_ignore = null, $return_frame = null)
{
$trace = debug_backtrace();
$a = array();
$frames = 0;
for ($i = 0, $n = count($trace); $i < $n; $i++)
{
$t = $trace[$i];
if (! $t) continue;
// Next frame.
$next = isset($trace[$i+1])? $trace[$i+1] : null;
// Dummy frame before call_user_func*() frames.
if (! isset($t['file']) && $next)
{
$t['over_function'] = $trace[$i+1]['function'];
$t = $t + $trace[$i+1];
$trace[$i+1] = null; // skip call_user_func on next iteration
}
// Skip myself frame.
if (++$frames < 2) continue;
// 'class' and 'function' field of next frame define where this frame function situated.
// Skip frames for functions situated in ignored places.
if ($re_ignore && $next)
{
// Name of function "inside which" frame was generated.
$frame_caller = (isset($next['class']) ? $next['class'] . $next['type'] : '')
. (isset($next['function']) ? $next['function'] : '');
if (preg_match($re_ignore, $frame_caller)) continue;
}
// On each iteration we consider ability to add PREVIOUS frame to $a stack.
if (count($a) === $return_frame) return $t;
$a[] = $t;
}
return $a;
}
/**
* Checks a value to the allowed types
*
* @param array $types
* @param mixed $value
* @return bool
*/
public static function checkValueTypes(array $types, $value)
{
foreach ($types as $type)
{
$type = strtolower($type);
if (array_key_exists($type, self::$hints) && call_user_func(self::$hints[$type], $value)) return true;
if (is_object($value) && @is_a($value, $type)) return true;
if ($type === 'mixed') return true;
}
return false;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,14 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
global $cron_runtime_log;
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
{
if (method_exists(CACHE($cache_name), 'gc'))
{
$changes = CACHE($cache_name)->gc();
$cron_runtime_log = date('Y-m-d H:i:s') ." -- ". str_pad("$cache_name ", 25, '-', STR_PAD_RIGHT) ." del: $changes\n";
}
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
global $cron_runtime_log;
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
{
if (method_exists(CACHE($cache_name), 'gc'))
{
$changes = CACHE($cache_name)->gc();
$cron_runtime_log = date('Y-m-d H:i:s') ." -- ". str_pad("$cache_name ", 25, '-', STR_PAD_RIGHT) ." del: $changes\n";
}
}

View file

@ -1,61 +1,61 @@
<?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");
<?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");
}

View file

@ -1,37 +1,37 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
sleep(15);
$exec_output = array();
$exec_return_status = 0;
if ($bb_cfg['db_backup_shell_cmd'])
{
exec($bb_cfg['db_backup_shell_cmd'], $exec_output, $exec_return_status);
$cron_runtime_log = join(LOG_LF, $exec_output) . LOG_LF;
}
if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_email'])
{
require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']);
$emailer->set_subject("DB Backup failed [{$bb_cfg['server_name']}]");
$emailer->assign_vars(array(
'MESSAGE' => $cron_runtime_log,
));
$emailer->send();
$emailer->reset();
}
sleep(10);
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
sleep(15);
$exec_output = array();
$exec_return_status = 0;
if ($bb_cfg['db_backup_shell_cmd'])
{
exec($bb_cfg['db_backup_shell_cmd'], $exec_output, $exec_return_status);
$cron_runtime_log = join(LOG_LF, $exec_output) . LOG_LF;
}
if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_email'])
{
require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']);
$emailer->set_subject("DB Backup failed [{$bb_cfg['server_name']}]");
$emailer->assign_vars(array(
'MESSAGE' => $cron_runtime_log,
));
$emailer->send();
$emailer->reset();
}
sleep(10);
DB()->expect_slow_query(16*60, 100);

View file

@ -1,33 +1,33 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
$exec_output = array();
$exec_return_status = 0;
if ($bb_cfg['site_backup_shell_cmd'])
{
exec($bb_cfg['site_backup_shell_cmd'], $exec_output, $exec_return_status);
$cron_runtime_log = join(LOG_LF, $exec_output) . LOG_LF;
}
if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_email'])
{
require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']);
$emailer->set_subject("Site Backup failed [{$bb_cfg['server_name']}]");
$emailer->assign_vars(array(
'MESSAGE' => $cron_runtime_log,
));
$emailer->send();
$emailer->reset();
}
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
$exec_output = array();
$exec_return_status = 0;
if ($bb_cfg['site_backup_shell_cmd'])
{
exec($bb_cfg['site_backup_shell_cmd'], $exec_output, $exec_return_status);
$cron_runtime_log = join(LOG_LF, $exec_output) . LOG_LF;
}
if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_email'])
{
require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']);
$emailer->set_subject("Site Backup failed [{$bb_cfg['server_name']}]");
$emailer->assign_vars(array(
'MESSAGE' => $cron_runtime_log,
));
$emailer->send();
$emailer->reset();
}
sleep(10);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,157 +1,157 @@
<?php
function run_jobs($jobs)
{
global $bb_cfg, $tr_cfg, $datastore;
define('IN_CRON', true);
$sql = "SELECT cron_script FROM " . BB_CRON ." WHERE cron_id IN ($jobs)";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain cron script');
}
while ($row = DB()->sql_fetchrow($result))
{
$job = $row['cron_script'];
$job_script = INC_DIR . 'cron/jobs/' . $job;
require($job_script);
}
DB()->query("
UPDATE ". BB_CRON ." SET
last_run = NOW(),
run_counter = run_counter + 1,
next_run =
CASE
WHEN schedule = 'hourly' THEN
DATE_ADD(NOW(), INTERVAL 1 HOUR)
WHEN schedule = 'daily' THEN
DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL TIME_TO_SEC(run_time) SECOND)
WHEN schedule = 'weekly' THEN
DATE_ADD(
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(NOW()) DAY), INTERVAL 7 DAY),
INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
WHEN schedule = 'monthly' THEN
DATE_ADD(
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL DAYOFMONTH(NOW())-1 DAY), INTERVAL 1 MONTH),
INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
ELSE
DATE_ADD(NOW(), INTERVAL TIME_TO_SEC(run_interval) SECOND)
END
WHERE cron_id IN ($jobs)
");
sleep(3);
return;
}
function delete_jobs($jobs)
{
DB()->query("DELETE FROM " . BB_CRON . " WHERE cron_id IN ($jobs)");
return;
}
function toggle_active($jobs, $cron_action)
{
$active = ($cron_action == 'disable') ? 0 : 1;
DB()->query("UPDATE " . BB_CRON . " SET cron_active = $active WHERE cron_id IN ($jobs)");
return;
}
function validate_cron_post($cron_arr) {
$errors = 'Errors in: ';
$errnum = 0;
if (!$cron_arr['cron_title']){
$errors .= 'cron title (empty value), ';
$errnum++;
}
if (!$cron_arr['cron_script']){
$errors .= 'cron script (empty value), ';
$errnum++;
}
if ($errnum > 0){
$result = $errors . ' total ' . $errnum . ' errors <br/> <a href="javascript:history.back(-1)">Back</a>';
}
else {
$result = 1;
}
return $result;
}
function insert_cron_job($cron_arr)
{
$row = DB()->fetch_row("SELECT cron_title, cron_script FROM ". BB_CRON ." WHERE cron_title = '". $_POST['cron_title'] ."' or cron_script = '". $_POST['cron_script'] ."' ");
if ($row)
{
global $lang;
if ($_POST['cron_script'] == $row['cron_script'])
{
$langmode = $lang['SCRIPT_DUPLICATE'];
}
else $langmode = $lang['TITLE_DUPLICATE'];
$message = $langmode . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "<a href=\"javascript:history.back(-1)\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS'], "<a href=\"admin_cron.php?mode=list\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"index.php?pane=right\">", "</a>");
bb_die($message);
}
$cron_active = $cron_arr['cron_active'];
$cron_title = $cron_arr['cron_title'];
$cron_script = $cron_arr['cron_script'];
$schedule = $cron_arr['schedule'];
$run_day = $cron_arr['run_day'];
$run_time = $cron_arr['run_time'];
$run_order = $cron_arr['run_order'];
$last_run = $cron_arr['last_run'];
$next_run = $cron_arr['next_run'];
$run_interval = $cron_arr['run_interval'];
$log_enabled = $cron_arr['log_enabled'];
$log_file = $cron_arr['log_file'];
$log_sql_queries = $cron_arr['log_sql_queries'];
$disable_board = $cron_arr['disable_board'];
$run_counter = $cron_arr['run_counter'];
DB()->query("INSERT INTO ". BB_CRON ." (cron_active, cron_title, cron_script, schedule, run_day, run_time, run_order, last_run, next_run, run_interval, log_enabled, log_file, log_sql_queries, disable_board, run_counter) VALUES (
$cron_active, '$cron_title', '$cron_script', '$schedule', '$run_day', '$run_time', '$run_order', '$last_run', '$next_run', '$run_interval', $log_enabled, '$log_file', $log_sql_queries, $disable_board, '$run_counter')");
}
function update_cron_job($cron_arr)
{
$cron_id = $cron_arr['cron_id'];
$cron_active = $cron_arr['cron_active'];
$cron_title = DB()->escape($cron_arr['cron_title']);
$cron_script = DB()->escape($cron_arr['cron_script']);
$schedule = $cron_arr['schedule'];
$run_day = $cron_arr['run_day'];
$run_time = $cron_arr['run_time'];
$run_order = $cron_arr['run_order'];
$last_run = $cron_arr['last_run'];
$next_run = $cron_arr['next_run'];
$run_interval = $cron_arr['run_interval'];
$log_enabled = $cron_arr['log_enabled'];
$log_file = DB()->escape($cron_arr['log_file']);
$log_sql_queries = $cron_arr['log_sql_queries'];
$disable_board = $cron_arr['disable_board'];
$run_counter = $cron_arr['run_counter'];
DB()->query("UPDATE " . BB_CRON . " SET
cron_active = '$cron_active',
cron_title = '$cron_title',
cron_script = '$cron_script',
schedule = '$schedule',
run_day = '$run_day',
run_time = '$run_time',
run_order = '$run_order',
last_run = '$last_run',
next_run = '$next_run',
run_interval = '$run_interval',
log_enabled = '$log_enabled',
log_file = '$log_file',
log_sql_queries = '$log_sql_queries',
disable_board = '$disable_board',
run_counter = '$run_counter'
WHERE cron_id = $cron_id
");
<?php
function run_jobs($jobs)
{
global $bb_cfg, $tr_cfg, $datastore;
define('IN_CRON', true);
$sql = "SELECT cron_script FROM " . BB_CRON ." WHERE cron_id IN ($jobs)";
if (!$result = DB()->sql_query($sql))
{
bb_die('Could not obtain cron script');
}
while ($row = DB()->sql_fetchrow($result))
{
$job = $row['cron_script'];
$job_script = INC_DIR . 'cron/jobs/' . $job;
require($job_script);
}
DB()->query("
UPDATE ". BB_CRON ." SET
last_run = NOW(),
run_counter = run_counter + 1,
next_run =
CASE
WHEN schedule = 'hourly' THEN
DATE_ADD(NOW(), INTERVAL 1 HOUR)
WHEN schedule = 'daily' THEN
DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL TIME_TO_SEC(run_time) SECOND)
WHEN schedule = 'weekly' THEN
DATE_ADD(
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(NOW()) DAY), INTERVAL 7 DAY),
INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
WHEN schedule = 'monthly' THEN
DATE_ADD(
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL DAYOFMONTH(NOW())-1 DAY), INTERVAL 1 MONTH),
INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
ELSE
DATE_ADD(NOW(), INTERVAL TIME_TO_SEC(run_interval) SECOND)
END
WHERE cron_id IN ($jobs)
");
sleep(3);
return;
}
function delete_jobs($jobs)
{
DB()->query("DELETE FROM " . BB_CRON . " WHERE cron_id IN ($jobs)");
return;
}
function toggle_active($jobs, $cron_action)
{
$active = ($cron_action == 'disable') ? 0 : 1;
DB()->query("UPDATE " . BB_CRON . " SET cron_active = $active WHERE cron_id IN ($jobs)");
return;
}
function validate_cron_post($cron_arr) {
$errors = 'Errors in: ';
$errnum = 0;
if (!$cron_arr['cron_title']){
$errors .= 'cron title (empty value), ';
$errnum++;
}
if (!$cron_arr['cron_script']){
$errors .= 'cron script (empty value), ';
$errnum++;
}
if ($errnum > 0){
$result = $errors . ' total ' . $errnum . ' errors <br/> <a href="javascript:history.back(-1)">Back</a>';
}
else {
$result = 1;
}
return $result;
}
function insert_cron_job($cron_arr)
{
$row = DB()->fetch_row("SELECT cron_title, cron_script FROM ". BB_CRON ." WHERE cron_title = '". $_POST['cron_title'] ."' or cron_script = '". $_POST['cron_script'] ."' ");
if ($row)
{
global $lang;
if ($_POST['cron_script'] == $row['cron_script'])
{
$langmode = $lang['SCRIPT_DUPLICATE'];
}
else $langmode = $lang['TITLE_DUPLICATE'];
$message = $langmode . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "<a href=\"javascript:history.back(-1)\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS'], "<a href=\"admin_cron.php?mode=list\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"index.php?pane=right\">", "</a>");
bb_die($message);
}
$cron_active = $cron_arr['cron_active'];
$cron_title = $cron_arr['cron_title'];
$cron_script = $cron_arr['cron_script'];
$schedule = $cron_arr['schedule'];
$run_day = $cron_arr['run_day'];
$run_time = $cron_arr['run_time'];
$run_order = $cron_arr['run_order'];
$last_run = $cron_arr['last_run'];
$next_run = $cron_arr['next_run'];
$run_interval = $cron_arr['run_interval'];
$log_enabled = $cron_arr['log_enabled'];
$log_file = $cron_arr['log_file'];
$log_sql_queries = $cron_arr['log_sql_queries'];
$disable_board = $cron_arr['disable_board'];
$run_counter = $cron_arr['run_counter'];
DB()->query("INSERT INTO ". BB_CRON ." (cron_active, cron_title, cron_script, schedule, run_day, run_time, run_order, last_run, next_run, run_interval, log_enabled, log_file, log_sql_queries, disable_board, run_counter) VALUES (
$cron_active, '$cron_title', '$cron_script', '$schedule', '$run_day', '$run_time', '$run_order', '$last_run', '$next_run', '$run_interval', $log_enabled, '$log_file', $log_sql_queries, $disable_board, '$run_counter')");
}
function update_cron_job($cron_arr)
{
$cron_id = $cron_arr['cron_id'];
$cron_active = $cron_arr['cron_active'];
$cron_title = DB()->escape($cron_arr['cron_title']);
$cron_script = DB()->escape($cron_arr['cron_script']);
$schedule = $cron_arr['schedule'];
$run_day = $cron_arr['run_day'];
$run_time = $cron_arr['run_time'];
$run_order = $cron_arr['run_order'];
$last_run = $cron_arr['last_run'];
$next_run = $cron_arr['next_run'];
$run_interval = $cron_arr['run_interval'];
$log_enabled = $cron_arr['log_enabled'];
$log_file = DB()->escape($cron_arr['log_file']);
$log_sql_queries = $cron_arr['log_sql_queries'];
$disable_board = $cron_arr['disable_board'];
$run_counter = $cron_arr['run_counter'];
DB()->query("UPDATE " . BB_CRON . " SET
cron_active = '$cron_active',
cron_title = '$cron_title',
cron_script = '$cron_script',
schedule = '$schedule',
run_day = '$run_day',
run_time = '$run_time',
run_order = '$run_order',
last_run = '$last_run',
next_run = '$next_run',
run_interval = '$run_interval',
log_enabled = '$log_enabled',
log_file = '$log_file',
log_sql_queries = '$log_sql_queries',
disable_board = '$disable_board',
run_counter = '$run_counter'
WHERE cron_id = $cron_id
");
}

File diff suppressed because it is too large Load diff

View file

@ -1,166 +1,166 @@
<?php
class upload_common
{
var $cfg = array(
'max_size' => 0,
'max_width' => 0,
'max_height' => 0,
'allowed_ext' => array(),
'upload_path' => '',
);
var $file = array(
'name' => '',
'type' => '',
'size' => 0,
'tmp_name' => '',
'error' => UPLOAD_ERR_NO_FILE,
);
var $orig_name = '';
var $file_path = ''; // Stored file path
var $file_ext = '';
var $file_ext_id = '';
var $file_size = '';
var $ext_ids = array(); // array_flip($bb_cfg['file_id_ext'])
var $errors = array();
var $img_types = array(1=>'gif', 2=>'jpg', 3=>'png', 6=>'bmp', 7=>'tiff', 8=>'tiff');
function init ($cfg = array(), $post_params = array(), $uploaded_only = true)
{
global $bb_cfg, $lang;
$lang['upload_error_common'] = 'Ошибка загрузки файла';
$lang['upload_errors'] = array(
UPLOAD_ERR_INI_SIZE => 'превышен максимальный размер файлов для сервера',
UPLOAD_ERR_FORM_SIZE => 'превышен максимальный размер загружаемого файла',
UPLOAD_ERR_PARTIAL => 'файл был загружен частично',
UPLOAD_ERR_NO_FILE => 'файл не был загружен',
UPLOAD_ERR_NO_TMP_DIR => 'временная директория не найдена',
UPLOAD_ERR_CANT_WRITE => 'ошибка записи',
UPLOAD_ERR_EXTENSION => 'загрузка остановлена из-за расширения',
);
$this->cfg = array_merge($this->cfg, $cfg);
$this->file = $post_params;
// upload errors from $_FILES
if ($this->file['error'])
{
$msg = $lang['upload_error_common'];
$msg .= ($err_desc =& $lang['upload_errors'][$this->file['error']]) ? " ($err_desc)" : '';
$this->errors[] = $msg;
return false;
}
// file_exists
if (!file_exists($this->file['tmp_name']))
{
$this->errors[] = "uploaded file not exists: {$this->file['tmp_name']}";
return false;
}
// size
if (!$this->file_size = filesize($this->file['tmp_name']))
{
$this->errors[] = "uploaded file is empty: {$this->file['tmp_name']}";
return false;
}
if ($this->cfg['max_size'] && $this->file_size > $this->cfg['max_size'])
{
$this->errors[] = 'Загруженный файл превышает максимальный размер '. humn_size($this->cfg['max_size']);
return false;
}
// is_uploaded_file
if ($uploaded_only && !is_uploaded_file($this->file['tmp_name']))
{
$this->errors[] = "not uploaded file: {$this->file['tmp_name']}";
return false;
}
// get ext
$this->ext_ids = array_flip($bb_cfg['file_id_ext']);
$file_name_ary = explode('.', $this->file['name']);
$this->file_ext = strtolower(end($file_name_ary));
// img
if ($this->cfg['max_width'] || $this->cfg['max_height'])
{
if ($img_info = getimagesize($this->file['tmp_name']))
{
list($width, $height, $type, $attr) = $img_info;
// redefine ext
if (!$width || !$height || !$type || !isset($this->img_types[$type]))
{
$this->errors[] = 'Недопустимый тип файла изображения';
return false;
}
$this->file_ext = $this->img_types[$type];
// width & height
if (($this->cfg['max_width'] && $width > $this->cfg['max_width']) || ($this->cfg['max_height'] && $height > $this->cfg['max_height']))
{
$this->errors[] = "Размеры изображения превышают максимально допустимые {$this->cfg['max_width']}x{$this->cfg['max_height']} px";
return false;
}
}
else
{
$this->errors[] = 'Загруженный файл не является изображением';
return false;
}
}
// check ext
if (!isset($this->ext_ids[$this->file_ext]) || !in_array($this->file_ext, $this->cfg['allowed_ext'], true))
{
$this->errors[] = 'Расширение '. htmlCHR($this->file_ext) .' для загружаемых файлов не разрешено';
return false;
}
$this->file_ext_id = $this->ext_ids[$this->file_ext];
return true;
}
function store ($mode = '', $params = array())
{
global $bb_cfg;
if ($mode == 'avatar')
{
delete_avatar($params['user_id'], $params['avatar_ext_id']);
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id, $bb_cfg['avatars']['upload_path']);
return $this->_move($file_path);
}
else if ($mode == 'attach')
{
$file_path = get_attach_path($params['topic_id']);
return $this->_move($file_path);
}
else
{
trigger_error("invalid upload mode: $mode", E_USER_ERROR);
}
}
function _move ($file_path)
{
$dir = dirname($file_path);
if (!file_exists($dir))
{
if (!bb_mkdir($dir))
{
$this->errors[] = "Cannot create dir: $dir";
return false;
}
}
if (!@rename($this->file['tmp_name'], $file_path))
{
if (!@copy($this->file['tmp_name'], $file_path))
{
$this->errors[] = 'Cannot copy tmp file';
return false;
}
@unlink($this->file['tmp_name']);
}
@chmod($file_path, 0664);
return file_exists($file_path);
}
<?php
class upload_common
{
var $cfg = array(
'max_size' => 0,
'max_width' => 0,
'max_height' => 0,
'allowed_ext' => array(),
'upload_path' => '',
);
var $file = array(
'name' => '',
'type' => '',
'size' => 0,
'tmp_name' => '',
'error' => UPLOAD_ERR_NO_FILE,
);
var $orig_name = '';
var $file_path = ''; // Stored file path
var $file_ext = '';
var $file_ext_id = '';
var $file_size = '';
var $ext_ids = array(); // array_flip($bb_cfg['file_id_ext'])
var $errors = array();
var $img_types = array(1=>'gif', 2=>'jpg', 3=>'png', 6=>'bmp', 7=>'tiff', 8=>'tiff');
function init ($cfg = array(), $post_params = array(), $uploaded_only = true)
{
global $bb_cfg, $lang;
$lang['upload_error_common'] = 'Ошибка загрузки файла';
$lang['upload_errors'] = array(
UPLOAD_ERR_INI_SIZE => 'превышен максимальный размер файлов для сервера',
UPLOAD_ERR_FORM_SIZE => 'превышен максимальный размер загружаемого файла',
UPLOAD_ERR_PARTIAL => 'файл был загружен частично',
UPLOAD_ERR_NO_FILE => 'файл не был загружен',
UPLOAD_ERR_NO_TMP_DIR => 'временная директория не найдена',
UPLOAD_ERR_CANT_WRITE => 'ошибка записи',
UPLOAD_ERR_EXTENSION => 'загрузка остановлена из-за расширения',
);
$this->cfg = array_merge($this->cfg, $cfg);
$this->file = $post_params;
// upload errors from $_FILES
if ($this->file['error'])
{
$msg = $lang['upload_error_common'];
$msg .= ($err_desc =& $lang['upload_errors'][$this->file['error']]) ? " ($err_desc)" : '';
$this->errors[] = $msg;
return false;
}
// file_exists
if (!file_exists($this->file['tmp_name']))
{
$this->errors[] = "uploaded file not exists: {$this->file['tmp_name']}";
return false;
}
// size
if (!$this->file_size = filesize($this->file['tmp_name']))
{
$this->errors[] = "uploaded file is empty: {$this->file['tmp_name']}";
return false;
}
if ($this->cfg['max_size'] && $this->file_size > $this->cfg['max_size'])
{
$this->errors[] = 'Загруженный файл превышает максимальный размер '. humn_size($this->cfg['max_size']);
return false;
}
// is_uploaded_file
if ($uploaded_only && !is_uploaded_file($this->file['tmp_name']))
{
$this->errors[] = "not uploaded file: {$this->file['tmp_name']}";
return false;
}
// get ext
$this->ext_ids = array_flip($bb_cfg['file_id_ext']);
$file_name_ary = explode('.', $this->file['name']);
$this->file_ext = strtolower(end($file_name_ary));
// img
if ($this->cfg['max_width'] || $this->cfg['max_height'])
{
if ($img_info = getimagesize($this->file['tmp_name']))
{
list($width, $height, $type, $attr) = $img_info;
// redefine ext
if (!$width || !$height || !$type || !isset($this->img_types[$type]))
{
$this->errors[] = 'Недопустимый тип файла изображения';
return false;
}
$this->file_ext = $this->img_types[$type];
// width & height
if (($this->cfg['max_width'] && $width > $this->cfg['max_width']) || ($this->cfg['max_height'] && $height > $this->cfg['max_height']))
{
$this->errors[] = "Размеры изображения превышают максимально допустимые {$this->cfg['max_width']}x{$this->cfg['max_height']} px";
return false;
}
}
else
{
$this->errors[] = 'Загруженный файл не является изображением';
return false;
}
}
// check ext
if (!isset($this->ext_ids[$this->file_ext]) || !in_array($this->file_ext, $this->cfg['allowed_ext'], true))
{
$this->errors[] = 'Расширение '. htmlCHR($this->file_ext) .' для загружаемых файлов не разрешено';
return false;
}
$this->file_ext_id = $this->ext_ids[$this->file_ext];
return true;
}
function store ($mode = '', $params = array())
{
global $bb_cfg;
if ($mode == 'avatar')
{
delete_avatar($params['user_id'], $params['avatar_ext_id']);
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id, $bb_cfg['avatars']['upload_path']);
return $this->_move($file_path);
}
else if ($mode == 'attach')
{
$file_path = get_attach_path($params['topic_id']);
return $this->_move($file_path);
}
else
{
trigger_error("invalid upload mode: $mode", E_USER_ERROR);
}
}
function _move ($file_path)
{
$dir = dirname($file_path);
if (!file_exists($dir))
{
if (!bb_mkdir($dir))
{
$this->errors[] = "Cannot create dir: $dir";
return false;
}
}
if (!@rename($this->file['tmp_name'], $file_path))
{
if (!@copy($this->file['tmp_name'], $file_path))
{
$this->errors[] = 'Cannot copy tmp file';
return false;
}
@unlink($this->file['tmp_name']);
}
@chmod($file_path, 0664);
return file_exists($file_path);
}
}

View file

@ -1,102 +1,102 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
?>
<style type="text/css">
.sqlLog {
clear: both;
font-family: Courier, monospace;
font-size: 12px;
white-space: nowrap;
background: #F5F5F5;
border: 1px solid #BBC0C8;
overflow: auto;
width: 98%;
margin: 0 auto;
padding: 2px 4px;
}
.sqlLogTitle {
font-weight: bold;
color: #444444;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
padding-bottom: 2px;
}
.sqlLogRow {
background-color: #F5F5F5;
padding-bottom: 1px;
border: solid #F5F5F5;
border-width: 0 0 1px 0;
cursor: pointer;
}
.sqlLogHead {
text-align: right;
float: right;
width: 100%;
}
.sqlLogHead fieldset {
float: right;
margin-right: 4px;
}
.sqlLogWrapped {
white-space: normal;
overflow: visible;
}
.sqlExplain {
color: #B50000;
font-size: 13px;
cursor: default;
}
.sqlHover {
border-color: #8B0000;
}
.sqlHighlight {
background: #FFE4E1;
}
</style>
<?php
if (!empty($_COOKIE['explain']))
{
foreach ($DBS->srv as $srv_name => $db_obj)
{
if (!empty($db_obj->do_explain))
{
$db_obj->explain('display');
}
}
}
$sql_log = !empty($_COOKIE['sql_log']) ? get_sql_log() : '';
echo '
<script type="text/javascript">
function fixSqlLog() {
if ($("#sqlLog").height() > 400) {
$("#sqlLog").height(400);
}
$("#sqlLog div.sqlLogRow")
.hover(
function(){ $(this).addClass("sqlHover"); },
function(){ $(this).removeClass("sqlHover"); }
)
.click(
function(){ $(this).toggleClass("sqlHighlight"); }
)
;
}
</script>
<div class="sqlLogHead">
';
echo '</div><!-- / sqlLogHead -->';
if ($sql_log)
{
echo '<div class="sqlLog" id="sqlLog">'. ($sql_log ? $sql_log : '') .'</div><!-- / sqlLog --><br clear="all" />';
}
?>
<script type="text/javascript">
$(document).ready(fixSqlLog);
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
?>
<style type="text/css">
.sqlLog {
clear: both;
font-family: Courier, monospace;
font-size: 12px;
white-space: nowrap;
background: #F5F5F5;
border: 1px solid #BBC0C8;
overflow: auto;
width: 98%;
margin: 0 auto;
padding: 2px 4px;
}
.sqlLogTitle {
font-weight: bold;
color: #444444;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
padding-bottom: 2px;
}
.sqlLogRow {
background-color: #F5F5F5;
padding-bottom: 1px;
border: solid #F5F5F5;
border-width: 0 0 1px 0;
cursor: pointer;
}
.sqlLogHead {
text-align: right;
float: right;
width: 100%;
}
.sqlLogHead fieldset {
float: right;
margin-right: 4px;
}
.sqlLogWrapped {
white-space: normal;
overflow: visible;
}
.sqlExplain {
color: #B50000;
font-size: 13px;
cursor: default;
}
.sqlHover {
border-color: #8B0000;
}
.sqlHighlight {
background: #FFE4E1;
}
</style>
<?php
if (!empty($_COOKIE['explain']))
{
foreach ($DBS->srv as $srv_name => $db_obj)
{
if (!empty($db_obj->do_explain))
{
$db_obj->explain('display');
}
}
}
$sql_log = !empty($_COOKIE['sql_log']) ? get_sql_log() : '';
echo '
<script type="text/javascript">
function fixSqlLog() {
if ($("#sqlLog").height() > 400) {
$("#sqlLog").height(400);
}
$("#sqlLog div.sqlLogRow")
.hover(
function(){ $(this).addClass("sqlHover"); },
function(){ $(this).removeClass("sqlHover"); }
)
.click(
function(){ $(this).toggleClass("sqlHighlight"); }
)
;
}
</script>
<div class="sqlLogHead">
';
echo '</div><!-- / sqlLogHead -->';
if ($sql_log)
{
echo '<div class="sqlLog" id="sqlLog">'. ($sql_log ? $sql_log : '') .'</div><!-- / sqlLog --><br clear="all" />';
}
?>
<script type="text/javascript">
$(document).ready(fixSqlLog);
</script>

View file

@ -1,82 +1,82 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
$can_edit_tpl = IS_SUPER_ADMIN;
$edit_tpl_mode = ($can_edit_tpl && !empty($_REQUEST['edit_tpl']));
// forum_data
$sql = "SELECT forum_name, allow_reg_tracker, forum_tpl_id FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
if (!$forum_id OR !$f_data = DB()->fetch_row($sql))
{
bb_die('Форум не найден');
}
// tpl_data
$tpl_data = array();
$sql = "SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1";
if (!$f_data['forum_tpl_id'] OR !$tpl_data = DB()->fetch_row($sql))
{
if (!$edit_tpl_mode)
{
redirect(POSTING_URL . "?mode=newtopic&f=$forum_id");
}
}
$template->assign_vars(array(
'PAGE_TITLE' => 'Новый релиз',
'FORUM_NAME' => $f_data['forum_name'],
'FORUM_ID' => $forum_id,
'TPL_FORM_ACTION' => POSTING_URL . "?mode=newtopic&amp;f=$forum_id",
'REGULAR_TOPIC_HREF' => POSTING_URL . "?mode=newtopic&amp;f=$forum_id",
'TOR_REQUIRED' => $f_data['allow_reg_tracker'],
'EDIT_TPL' => $edit_tpl_mode,
'CAN_EDIT_TPL' => $can_edit_tpl,
'EDIT_TPL_URL' => POSTING_URL . "?mode=new_rel&amp;f=$forum_id&amp;edit_tpl=1",
));
if ($tpl_data)
{
// tpl_rules_html
$tpl_rules_html = '';
if ($tpl_data['tpl_rules_post_id'])
{
if (!$tpl_rules_html = bbcode2html(DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = ". $tpl_data['tpl_rules_post_id'], 'post_text')))
{
$tpl_data['tpl_rules_post_id'] = 0;
DB()->query("UPDATE ". BB_TOPIC_TPL ." SET tpl_rules_post_id = 0 WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1");
}
}
$template->assign_vars(array(
'TPL_ID' => $tpl_data['tpl_id'],
'TPL_NAME' => $tpl_data['tpl_name'],
'TPL_SRC_FORM_VAL' => $tpl_data['tpl_src_form'],
'TPL_SRC_TITLE_VAL' => $tpl_data['tpl_src_title'],
'TPL_SRC_MSG_VAL' => $tpl_data['tpl_src_msg'],
'TPL_RULES_HTML' => $tpl_rules_html,
));
}
if ($edit_tpl_mode)
{
$template->assign_vars(array(
'NO_TPL_ASSIGNED' => !($f_data['forum_tpl_id']),
'TPL_SELECT' => get_select('forum_tpl', $f_data['forum_tpl_id']),
));
if ($tpl_data)
{
$template->assign_vars(array(
'TPL_COMMENT' => $tpl_data['tpl_comment'],
'TPL_RULES_POST_ID' => $tpl_data['tpl_rules_post_id'],
'TPL_LAST_EDIT_TIME' => bb_date($tpl_data['tpl_last_edit_tm'], 'd-M-y H:i'),
'TPL_LAST_EDIT_USER' => get_username(intval($tpl_data['tpl_last_edit_by'])),
'TPL_LAST_EDIT_TIMESTAMP' => $tpl_data['tpl_last_edit_tm'],
));
}
}
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
$can_edit_tpl = IS_SUPER_ADMIN;
$edit_tpl_mode = ($can_edit_tpl && !empty($_REQUEST['edit_tpl']));
// forum_data
$sql = "SELECT forum_name, allow_reg_tracker, forum_tpl_id FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
if (!$forum_id OR !$f_data = DB()->fetch_row($sql))
{
bb_die('Форум не найден');
}
// tpl_data
$tpl_data = array();
$sql = "SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1";
if (!$f_data['forum_tpl_id'] OR !$tpl_data = DB()->fetch_row($sql))
{
if (!$edit_tpl_mode)
{
redirect(POSTING_URL . "?mode=newtopic&f=$forum_id");
}
}
$template->assign_vars(array(
'PAGE_TITLE' => 'Новый релиз',
'FORUM_NAME' => $f_data['forum_name'],
'FORUM_ID' => $forum_id,
'TPL_FORM_ACTION' => POSTING_URL . "?mode=newtopic&amp;f=$forum_id",
'REGULAR_TOPIC_HREF' => POSTING_URL . "?mode=newtopic&amp;f=$forum_id",
'TOR_REQUIRED' => $f_data['allow_reg_tracker'],
'EDIT_TPL' => $edit_tpl_mode,
'CAN_EDIT_TPL' => $can_edit_tpl,
'EDIT_TPL_URL' => POSTING_URL . "?mode=new_rel&amp;f=$forum_id&amp;edit_tpl=1",
));
if ($tpl_data)
{
// tpl_rules_html
$tpl_rules_html = '';
if ($tpl_data['tpl_rules_post_id'])
{
if (!$tpl_rules_html = bbcode2html(DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = ". $tpl_data['tpl_rules_post_id'], 'post_text')))
{
$tpl_data['tpl_rules_post_id'] = 0;
DB()->query("UPDATE ". BB_TOPIC_TPL ." SET tpl_rules_post_id = 0 WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1");
}
}
$template->assign_vars(array(
'TPL_ID' => $tpl_data['tpl_id'],
'TPL_NAME' => $tpl_data['tpl_name'],
'TPL_SRC_FORM_VAL' => $tpl_data['tpl_src_form'],
'TPL_SRC_TITLE_VAL' => $tpl_data['tpl_src_title'],
'TPL_SRC_MSG_VAL' => $tpl_data['tpl_src_msg'],
'TPL_RULES_HTML' => $tpl_rules_html,
));
}
if ($edit_tpl_mode)
{
$template->assign_vars(array(
'NO_TPL_ASSIGNED' => !($f_data['forum_tpl_id']),
'TPL_SELECT' => get_select('forum_tpl', $f_data['forum_tpl_id']),
));
if ($tpl_data)
{
$template->assign_vars(array(
'TPL_COMMENT' => $tpl_data['tpl_comment'],
'TPL_RULES_POST_ID' => $tpl_data['tpl_rules_post_id'],
'TPL_LAST_EDIT_TIME' => bb_date($tpl_data['tpl_last_edit_tm'], 'd-M-y H:i'),
'TPL_LAST_EDIT_USER' => get_username(intval($tpl_data['tpl_last_edit_by'])),
'TPL_LAST_EDIT_TIMESTAMP' => $tpl_data['tpl_last_edit_tm'],
));
}
}
print_page('posting_tpl.tpl');

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,100 +1,100 @@
<?php
if (empty($bb_cfg['topic_notify_enabled']))
{
bb_die($lang['DISABLED']);
}
$page_cfg['use_tablesorter'] = true;
$page_cfg['include_bbcode_js'] = true;
$tracking_topics = get_tracks('topic');
$user_id = $userdata['user_id'];
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
$per_page = $bb_cfg['topics_per_page'];
if (isset($_POST['topic_id_list']))
{
$topic_ids = implode(",", $_POST['topic_id_list']);
$sql = "DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id IN(". $topic_ids .") AND user_id = $user_id";
if (!($result = DB() ->sql_query($sql)))
{
bb_die('Could not delete topic watch information #1');
}
}
$template->assign_vars(array(
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
'S_FORM_ACTION' => BB_ROOT .'profile.php?mode=watch',
));
$sql = "SELECT COUNT(topic_id) as watch_count FROM ". BB_TOPICS_WATCH ." WHERE user_id = $user_id";
if ( !($result = DB() ->sql_query($sql)) )
{
bb_die('Could not obtain watch topic information #2');
}
$row = DB() ->sql_fetchrow($result);
$watch_count = ( $row['watch_count'] ) ? $row['watch_count'] : 0;
DB() ->sql_freeresult($result);
if ($watch_count > 0)
{
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
u2.user_level as last_user_level, u2.user_rank as last_user_rank
FROM ". BB_TOPICS_WATCH ." w, ". BB_TOPICS ." t, ". BB_USERS ." u, ". BB_FORUMS ." f, ". BB_POSTS ." p, " . BB_USERS . " u2
WHERE w.topic_id = t.topic_id
AND t.forum_id = f.forum_id
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id
AND t.topic_poster = u.user_id
AND w.user_id = $user_id
GROUP BY t.topic_last_post_time DESC
LIMIT $start, $per_page";
if (!($result = DB() ->sql_query($sql)))
{
bb_die('Could not obtain watch topic information #3');
}
$watch = DB() ->sql_fetchrowset($result);
if ($watch)
{
for ( $i = 0; $i < count($watch); $i++ )
{
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
$template->assign_block_vars('watch', array(
'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
'POST_ID' => $watch[$i]['topic_first_post_id'],
'TOPIC_ID' => $watch[$i]['topic_id'],
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
'REPLIES' => $watch[$i]['topic_replies'],
'AUTHOR' => profile_url($watch[$i]),
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) .'<br />'. profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
));
}
$template->assign_vars(array(
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
'PAGINATION' => generate_pagination(BB_ROOT .'profile.php?mode=watch', $watch_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $per_page ) + 1 ), ceil( $watch_count / $per_page )),
'U_PER_PAGE' => BB_ROOT .'profile.php?mode=watch',
'PER_PAGE' => $per_page,
));
}
DB() ->sql_freeresult($result);
}
else
{
meta_refresh(BB_ROOT, '3');
bb_die($lang['NO_WATCHED_TOPICS']);
}
<?php
if (empty($bb_cfg['topic_notify_enabled']))
{
bb_die($lang['DISABLED']);
}
$page_cfg['use_tablesorter'] = true;
$page_cfg['include_bbcode_js'] = true;
$tracking_topics = get_tracks('topic');
$user_id = $userdata['user_id'];
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
$per_page = $bb_cfg['topics_per_page'];
if (isset($_POST['topic_id_list']))
{
$topic_ids = implode(",", $_POST['topic_id_list']);
$sql = "DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id IN(". $topic_ids .") AND user_id = $user_id";
if (!($result = DB() ->sql_query($sql)))
{
bb_die('Could not delete topic watch information #1');
}
}
$template->assign_vars(array(
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
'S_FORM_ACTION' => BB_ROOT .'profile.php?mode=watch',
));
$sql = "SELECT COUNT(topic_id) as watch_count FROM ". BB_TOPICS_WATCH ." WHERE user_id = $user_id";
if ( !($result = DB() ->sql_query($sql)) )
{
bb_die('Could not obtain watch topic information #2');
}
$row = DB() ->sql_fetchrow($result);
$watch_count = ( $row['watch_count'] ) ? $row['watch_count'] : 0;
DB() ->sql_freeresult($result);
if ($watch_count > 0)
{
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
u2.user_level as last_user_level, u2.user_rank as last_user_rank
FROM ". BB_TOPICS_WATCH ." w, ". BB_TOPICS ." t, ". BB_USERS ." u, ". BB_FORUMS ." f, ". BB_POSTS ." p, " . BB_USERS . " u2
WHERE w.topic_id = t.topic_id
AND t.forum_id = f.forum_id
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id
AND t.topic_poster = u.user_id
AND w.user_id = $user_id
GROUP BY t.topic_last_post_time DESC
LIMIT $start, $per_page";
if (!($result = DB() ->sql_query($sql)))
{
bb_die('Could not obtain watch topic information #3');
}
$watch = DB() ->sql_fetchrowset($result);
if ($watch)
{
for ( $i = 0; $i < count($watch); $i++ )
{
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
$template->assign_block_vars('watch', array(
'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
'POST_ID' => $watch[$i]['topic_first_post_id'],
'TOPIC_ID' => $watch[$i]['topic_id'],
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
'REPLIES' => $watch[$i]['topic_replies'],
'AUTHOR' => profile_url($watch[$i]),
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) .'<br />'. profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
));
}
$template->assign_vars(array(
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
'PAGINATION' => generate_pagination(BB_ROOT .'profile.php?mode=watch', $watch_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $per_page ) + 1 ), ceil( $watch_count / $per_page )),
'U_PER_PAGE' => BB_ROOT .'profile.php?mode=watch',
'PER_PAGE' => $per_page,
));
}
DB() ->sql_freeresult($result);
}
else
{
meta_refresh(BB_ROOT, '3');
bb_die($lang['NO_WATCHED_TOPICS']);
}
print_page('usercp_topic_watch.tpl');

View file

@ -1,240 +1,240 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
require(INC_DIR .'bbcode.php');
$datastore->enqueue(array(
'ranks',
));
if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID)
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$profiledata = get_userdata($_GET[POST_USERS_URL]))
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$userdata['session_logged_in'])
{
redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
}
if (!$ranks = $datastore->get('ranks'))
{
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
$poster_rank = $rank_image= $rank_style = $rank_select = '';
if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
{
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
$poster_rank = $ranks[$user_rank]['rank_title'];
$rank_style = $ranks[$user_rank]['rank_style'];
}
if (IS_ADMIN)
{
$rank_select = array($lang['NONE'] => 0);
foreach ($ranks as $row)
{
$rank_select[$row['rank_title']] = $row['rank_id'];
}
$rank_select = build_select('rank-sel', $rank_select, $user_rank);
}
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM)
{
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&amp;'. POST_USERS_URL .'='. $profiledata['user_id'] : 'mailto:'. $profiledata['user_email'];
$email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
}
else
{
$email = '';
}
// Report
//
// Get report user module and create report link
//
include(INC_DIR ."functions_report.php");
$report_user = report_modules('name', 'report_user');
if ($report_user && $report_user->auth_check('auth_write'))
{
$template->assign_block_vars('switch_report_user', array());
$template->assign_vars(array(
'U_REPORT_USER' => 'report.php?mode='. $report_user->mode .'&amp;id='. $profiledata['user_id'],
'L_REPORT_USER' => $report_user->lang['WRITE_REPORT'])
);
}
// Report [END]
//
// Generate page
//
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
if(bf($profiledata['user_opt'], 'user_opt', 'dis_sig'))
{
if($profile_user_id)
{
$signature = $lang['SIGNATURE_DISABLE'];
}
else
{
$signature = '';
}
}
else if ($signature)
{
$signature = bbcode2html($signature);
}
$template->assign_vars(array(
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'USERNAME' => $profiledata['username'],
'PROFILE_USER_ID' => $profiledata['user_id'],
'PROFILE_USER' => $profile_user_id,
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">". $poster_rank ."</span>" : $lang['USER'],
'RANK_IMAGE' => $rank_image,
'RANK_SELECT' => $rank_select,
'POSTS' => $profiledata['user_posts'],
'PM' => '<a href="' . PM_URL . '?mode=post&amp;'. POST_USERS_URL .'='. $profiledata['user_id'] .'">'. $lang['SEND_PRIVATE_MESSAGE'] .'</a>',
'EMAIL' => $email,
'WWW' => $profiledata['user_website'],
'ICQ' => $profiledata['user_icq'],
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'],
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'],
'USER_ACTIVE' => $profiledata['user_active'],
'LOCATION' => $profiledata['user_from'],
'OCCUPATION' => $profiledata['user_occ'],
'INTERESTS' => $profiledata['user_interests'],
'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender'] && $profiledata['user_gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
'U_SEARCH_USER' => "search.php?search_author=1&amp;uid={$profiledata['user_id']}",
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&amp;myt=1",
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')),
'SIGNATURE' => $signature,
'SHOW_PASSKEY' => (IS_ADMIN || $profile_user_id),
'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']),
'GROUP_MEMBERSHIP' => false,
'TRAF_STATS' => !(IS_AM || $profile_user_id),
));
if (IS_ADMIN)
{
$group_membership = array();
$sql = "
SELECT COUNT(g.group_id) AS groups_cnt, g.group_single_user, ug.user_pending
FROM ". BB_USER_GROUP ." ug
LEFT JOIN ". BB_GROUPS ." g USING(group_id)
WHERE ug.user_id = {$profiledata['user_id']}
GROUP BY ug.user_id, g.group_single_user, ug.user_pending
ORDER BY NULL
";
if ($rowset = DB()->fetch_rowset($sql))
{
$member = $pending = $single = 0;
foreach ($rowset as $row)
{
if (!$row['group_single_user'] && !$row['user_pending'])
{
$member = $row['groups_cnt'];
}
else if (!$row['group_single_user'] && $row['user_pending'])
{
$pending = $row['groups_cnt'];
}
else if ($row['group_single_user'])
{
$single = $row['groups_cnt'];
}
}
if ($member) $group_membership[] = $lang['PARTY'] ." <b>$member</b>";
if ($pending) $group_membership[] = $lang['CANDIDATE'] ." <b>$pending</b>";
if ($single) $group_membership[] = $lang['INDIVIDUAL'];
$group_membership = join(', ', $group_membership);
}
$template->assign_vars(array(
'GROUP_MEMBERSHIP' => (bool) $group_membership,
'GROUP_MEMBERSHIP_TXT' => $group_membership,
));
}
else if (IS_MOD)
{
$template->assign_vars(array(
'SHOW_GROUP_MEMBERSHIP' => ($profiledata['user_level'] != USER),
));
}
// Show users torrent-profile
if (IS_AM || $profile_user_id || !bf($profiledata['user_opt'], 'user_opt', 'user_dls'))
{
require(INC_DIR .'ucp/viewtorrent.php');
}
// Ajax bt_userdata
if (IS_AM || $profile_user_id)
{
show_bt_userdata($profiledata['user_id']);
}
else
{
$template->assign_vars(array(
'DOWN_TOTAL_BYTES' => false,
'MIN_DL_BYTES' => false,
));
}
if (IS_ADMIN)
{
$ajax_user_opt = bb_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'),
'dis_pm' => bf($profiledata['user_opt'], 'user_opt', 'dis_pm'),
'dis_post' => bf($profiledata['user_opt'], 'user_opt', 'dis_post'),
'dis_post_edit' => bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit'),
'dis_topic' => bf($profiledata['user_opt'], 'user_opt', 'dis_topic'),
));
$template->assign_vars(array(
'EDITABLE_TPLS' => true,
'AJAX_USER_OPT' => $ajax_user_opt,
'U_MANAGE' => "profile.php?mode=editprofile&amp;u={$profiledata['user_id']}",
'U_PERMISSIONS' => "admin/admin_ug_auth.php?mode=user&amp;u={$profiledata['user_id']}",
));
}
$user_restrictions = array();
if (bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')) $user_restrictions[] = $lang['HIDE_AVATARS'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) $user_restrictions[] = $lang['SHOW_CAPTION'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_passkey')) $user_restrictions[] = $lang['DOWNLOAD_TORRENT'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_pm')) $user_restrictions[] = $lang['SEND_PM'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post')) $user_restrictions[] = $lang['SEND_MESSAGE'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit')) $user_restrictions[] = $lang['EDIT_POST'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) $user_restrictions[] = $lang['NEW_THREADS'];
$template->assign_var('USER_RESTRICTIONS', join('</li><li>', $user_restrictions));
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
require(INC_DIR .'bbcode.php');
$datastore->enqueue(array(
'ranks',
));
if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID)
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$profiledata = get_userdata($_GET[POST_USERS_URL]))
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$userdata['session_logged_in'])
{
redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
}
if (!$ranks = $datastore->get('ranks'))
{
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
$poster_rank = $rank_image= $rank_style = $rank_select = '';
if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
{
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
$poster_rank = $ranks[$user_rank]['rank_title'];
$rank_style = $ranks[$user_rank]['rank_style'];
}
if (IS_ADMIN)
{
$rank_select = array($lang['NONE'] => 0);
foreach ($ranks as $row)
{
$rank_select[$row['rank_title']] = $row['rank_id'];
}
$rank_select = build_select('rank-sel', $rank_select, $user_rank);
}
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM)
{
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&amp;'. POST_USERS_URL .'='. $profiledata['user_id'] : 'mailto:'. $profiledata['user_email'];
$email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
}
else
{
$email = '';
}
// Report
//
// Get report user module and create report link
//
include(INC_DIR ."functions_report.php");
$report_user = report_modules('name', 'report_user');
if ($report_user && $report_user->auth_check('auth_write'))
{
$template->assign_block_vars('switch_report_user', array());
$template->assign_vars(array(
'U_REPORT_USER' => 'report.php?mode='. $report_user->mode .'&amp;id='. $profiledata['user_id'],
'L_REPORT_USER' => $report_user->lang['WRITE_REPORT'])
);
}
// Report [END]
//
// Generate page
//
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
if(bf($profiledata['user_opt'], 'user_opt', 'dis_sig'))
{
if($profile_user_id)
{
$signature = $lang['SIGNATURE_DISABLE'];
}
else
{
$signature = '';
}
}
else if ($signature)
{
$signature = bbcode2html($signature);
}
$template->assign_vars(array(
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'USERNAME' => $profiledata['username'],
'PROFILE_USER_ID' => $profiledata['user_id'],
'PROFILE_USER' => $profile_user_id,
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">". $poster_rank ."</span>" : $lang['USER'],
'RANK_IMAGE' => $rank_image,
'RANK_SELECT' => $rank_select,
'POSTS' => $profiledata['user_posts'],
'PM' => '<a href="' . PM_URL . '?mode=post&amp;'. POST_USERS_URL .'='. $profiledata['user_id'] .'">'. $lang['SEND_PRIVATE_MESSAGE'] .'</a>',
'EMAIL' => $email,
'WWW' => $profiledata['user_website'],
'ICQ' => $profiledata['user_icq'],
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'],
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'],
'USER_ACTIVE' => $profiledata['user_active'],
'LOCATION' => $profiledata['user_from'],
'OCCUPATION' => $profiledata['user_occ'],
'INTERESTS' => $profiledata['user_interests'],
'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender'] && $profiledata['user_gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
'U_SEARCH_USER' => "search.php?search_author=1&amp;uid={$profiledata['user_id']}",
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&amp;myt=1",
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')),
'SIGNATURE' => $signature,
'SHOW_PASSKEY' => (IS_ADMIN || $profile_user_id),
'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']),
'GROUP_MEMBERSHIP' => false,
'TRAF_STATS' => !(IS_AM || $profile_user_id),
));
if (IS_ADMIN)
{
$group_membership = array();
$sql = "
SELECT COUNT(g.group_id) AS groups_cnt, g.group_single_user, ug.user_pending
FROM ". BB_USER_GROUP ." ug
LEFT JOIN ". BB_GROUPS ." g USING(group_id)
WHERE ug.user_id = {$profiledata['user_id']}
GROUP BY ug.user_id, g.group_single_user, ug.user_pending
ORDER BY NULL
";
if ($rowset = DB()->fetch_rowset($sql))
{
$member = $pending = $single = 0;
foreach ($rowset as $row)
{
if (!$row['group_single_user'] && !$row['user_pending'])
{
$member = $row['groups_cnt'];
}
else if (!$row['group_single_user'] && $row['user_pending'])
{
$pending = $row['groups_cnt'];
}
else if ($row['group_single_user'])
{
$single = $row['groups_cnt'];
}
}
if ($member) $group_membership[] = $lang['PARTY'] ." <b>$member</b>";
if ($pending) $group_membership[] = $lang['CANDIDATE'] ." <b>$pending</b>";
if ($single) $group_membership[] = $lang['INDIVIDUAL'];
$group_membership = join(', ', $group_membership);
}
$template->assign_vars(array(
'GROUP_MEMBERSHIP' => (bool) $group_membership,
'GROUP_MEMBERSHIP_TXT' => $group_membership,
));
}
else if (IS_MOD)
{
$template->assign_vars(array(
'SHOW_GROUP_MEMBERSHIP' => ($profiledata['user_level'] != USER),
));
}
// Show users torrent-profile
if (IS_AM || $profile_user_id || !bf($profiledata['user_opt'], 'user_opt', 'user_dls'))
{
require(INC_DIR .'ucp/viewtorrent.php');
}
// Ajax bt_userdata
if (IS_AM || $profile_user_id)
{
show_bt_userdata($profiledata['user_id']);
}
else
{
$template->assign_vars(array(
'DOWN_TOTAL_BYTES' => false,
'MIN_DL_BYTES' => false,
));
}
if (IS_ADMIN)
{
$ajax_user_opt = bb_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'),
'dis_pm' => bf($profiledata['user_opt'], 'user_opt', 'dis_pm'),
'dis_post' => bf($profiledata['user_opt'], 'user_opt', 'dis_post'),
'dis_post_edit' => bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit'),
'dis_topic' => bf($profiledata['user_opt'], 'user_opt', 'dis_topic'),
));
$template->assign_vars(array(
'EDITABLE_TPLS' => true,
'AJAX_USER_OPT' => $ajax_user_opt,
'U_MANAGE' => "profile.php?mode=editprofile&amp;u={$profiledata['user_id']}",
'U_PERMISSIONS' => "admin/admin_ug_auth.php?mode=user&amp;u={$profiledata['user_id']}",
));
}
$user_restrictions = array();
if (bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')) $user_restrictions[] = $lang['HIDE_AVATARS'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) $user_restrictions[] = $lang['SHOW_CAPTION'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_passkey')) $user_restrictions[] = $lang['DOWNLOAD_TORRENT'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_pm')) $user_restrictions[] = $lang['SEND_PM'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post')) $user_restrictions[] = $lang['SEND_MESSAGE'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit')) $user_restrictions[] = $lang['EDIT_POST'];
if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) $user_restrictions[] = $lang['NEW_THREADS'];
$template->assign_var('USER_RESTRICTIONS', join('</li><li>', $user_restrictions));
print_page('usercp_viewprofile.tpl');

View file

@ -1,17 +1,17 @@
<title>ADVERTISING ON THE SITE</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">ADVERTISING ON THE SITE</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Advertising on <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>For advertising please contact: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Close ]</a></p>
<title>ADVERTISING ON THE SITE</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">ADVERTISING ON THE SITE</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Advertising on <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>For advertising please contact: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Close ]</a></p>
</div><!--/infobox-wrap-->

View file

@ -1,23 +1,23 @@
<div>
<h3>BitTorrent clients</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(recommended: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(recommended: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(recommended: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Terms of use resource</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ for beginners</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Where is ask a question?</a></li>
</ul>
</div>
</br>
<div>
<h3>BitTorrent clients</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(recommended: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(recommended: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(recommended: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Terms of use resource</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ for beginners</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Where is ask a question?</a></li>
</ul>
</div>
</br>
<img width="210" class="spacer" src="./images/spacer.gif" alt="" />

View file

@ -1,18 +1,18 @@
<div>
<h3>Sidebar 2</h3>
To add content into this sidebar, edit the following files:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
To disable this sidebar, set the variable $page_cfg['show_sidebar2'] in file config.php to false.
</div>
</br>
<div>
<h3>Partners</h3>
We are grateful to all people who have made material assistance to the development of TorrentPier II, specified in the file contributors.txt.
<div>
<h3>Sidebar 2</h3>
To add content into this sidebar, edit the following files:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
To disable this sidebar, set the variable $page_cfg['show_sidebar2'] in file config.php to false.
</div>
</br>
<div>
<h3>Partners</h3>
We are grateful to all people who have made material assistance to the development of TorrentPier II, specified in the file contributors.txt.
</div>

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,17 @@
<title>РЕКЛАМА НА САЙТЕ</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">РЕКЛАМА НА САЙТЕ</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Размещение рекламы на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>По вопросам размещения рекламы обращайтесь по адресу: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Закрыть ]</a></p>
<title>РЕКЛАМА НА САЙТЕ</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">РЕКЛАМА НА САЙТЕ</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Размещение рекламы на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>По вопросам размещения рекламы обращайтесь по адресу: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Закрыть ]</a></p>
</div><!--/infobox-wrap-->

View file

@ -1,23 +1,23 @@
<div>
<h3>BitTorrent клиенты</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(рекомендуемый: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(рекомендуемый: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(рекомендуемый: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Правила пользования данным ресурсом</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ для новичков</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Где задать вопрос?</a></li>
</ul>
</div>
</br>
<div>
<h3>BitTorrent клиенты</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(рекомендуемый: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(рекомендуемый: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(рекомендуемый: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Правила пользования данным ресурсом</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ для новичков</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Где задать вопрос?</a></li>
</ul>
</div>
</br>
<img width="210" class="spacer" src="./images/spacer.gif" alt="" />

View file

@ -1,18 +1,18 @@
<div>
<h3>Боковая панель 2</h3>
Для добавления контента в данную боковую панель, отредактируйте указанные файлы:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
Для отключения данной боковой панели, установите значение переменной $page_cfg['show_sidebar2'] в файле config.php в положение false.
</div>
</br>
<div>
<h3>Партнеры</h3>
Выражаем благодарность всем людям, внесшим материальную помощь в развитие TorrentPier II, указанным в файле contributors.txt.
<div>
<h3>Боковая панель 2</h3>
Для добавления контента в данную боковую панель, отредактируйте указанные файлы:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
Для отключения данной боковой панели, установите значение переменной $page_cfg['show_sidebar2'] в файле config.php в положение false.
</div>
</br>
<div>
<h3>Партнеры</h3>
Выражаем благодарность всем людям, внесшим материальную помощь в развитие TorrentPier II, указанным в файле contributors.txt.
</div>

File diff suppressed because it is too large Load diff

View file

@ -1,469 +1,469 @@
автор
алло
ало
английский
аннотация
аудио
аудиокнига
аудиоспектакль
без
битрейт
близко
более
больше
будем
будет
будете
будешь
будит
будто
буду
будут
будь
буедт
буит
бывает
был
была
были
было
быть
важная
важное
важные
важный
вам
вами
вас
ваш
ваша
ваше
ваши
вверх
вдали
вдруг
ведь
везде
версия
весь
видео
вниз
внизу
вокруг
вон
восемь
восьмой
вот
впрочем
времени
время
всё
все
всегда
всего
всем
всеми
всему
всех
всею
всю
всюду
вся
второй
выпуска
где
гоблинa
говорил
говорит
год
года
году
давай
давно
даже
дал
далеко
дальше
даром
два
двадцать
две
двенадцать
двух
двухголосый
девять
действительно
день
десять
для
дни
днями
довольно
долго
должно
доп
другая
другие
других
другова
другого
другое
другой
дублирование
дык
его
ему
если
есть
ещё
еще
жанр
закадровый
занят
занята
занято
заняты
затем
зато
зачем
здесь
зип
значит
ибо
издатель
издательство
изначально
или
именно
иметь
ими
имхо
имя
иногда
интерфейса
информация
исполнитель
кадра
каждая
каждое
каждые
каждый
кажется
как
какая
какже
какой
качество
кем
когда
кого
кодек
ком
компьютерное
кому
конечно
коотрый
которая
которого
которой
которые
который
которых
кроме
кругом
кто
куда
лет
либо
лишь
лол
лучше
любительский
люди
мало
мегалол
между
менее
меньше
меня
миллионов
мимо
минут
мля
мне
много
многоголосый
мной
мною
моё
мог
могли
могу
могут
модель
мое
может
можно
мои
мой
мочь
моя
наверху
над
надо
назад
название
наиболее
наконец
нам
нами
нас
нах
наш
наша
наше
наши
неё
него
недавно
недалеко
нее
ней
нельзя
нем
немного
нему
нередко
несжатый
несколько
нет
нею
нибудь
ниже
низко
никогда
никуда
ними
них
ничего
нужно
оба
обложка
обычно
обычный
один
однажды
однако
одного
одноголосый
одной
около
она
они
оно
операционные
описание
опять
оригинальное
особенно
особено
ответ
отовсюду
отсканированные
отсутствует
отсюда
очень
ошибками
ошибок
первый
перевод
перед
песен
платформа
под
пожалуйста
позже
пока
полное
пор
пора
после
посреди
постер
потом
потому
почему
почти
прекрасно
при
присутствует
про
продолжительность
просто
против
профессиональный
процент
процентов
прочем
пятый
пять
раз
разве
размер
разработчик
разработчика
рано
раньше
рар
режиссер
ролях
рус
русский
рядом
сайт
сам
сама
самаво
сами
самим
самими
самих
само
самого
самой
самом
самому
саму
сборки
своё
свое
своего
своей
свои
своих
свой
свою
своя
себе
себя
сегодня
седня
седьмой
сейчас
семь
сжатый
системные
системы
сих
сказал
сказала
сказать
сколько
скриншот
слишком
сначала
снова
собой
собою
совсем
спасибо
список
стал
страна
страницы
субтитры
суть
таб
таблэтка
тагда
так
такая
также
такие
такйо
такое
такой
там
тама
твоё
твой
твоя
тебе
тебя
текст
тем
теми
теперь
тех
тип
тобой
тобою
тогда
того
тоже
той
только
том
тому
топик
топика
торент
торрент
тот
точек
тоьлко
тою
транслит
требования
требуется
третий
три
трэклист
туда
тут
тысяч
тысяча
уже
уметь
упс
формат
форум
форума
хороше
хорошо
хотеть
хоть
хотя
хочешь
часто
чаще
чего
чей
человек
чем
чему
через
четвертый
четыре
что
чтоб
чтобы
чуть
чье
чья
шестой
шесть
щас
эта
эти
этим
этими
этих
это
этого
этой
этом
этому
этот
эту
язык
автор
алло
ало
английский
аннотация
аудио
аудиокнига
аудиоспектакль
без
битрейт
близко
более
больше
будем
будет
будете
будешь
будит
будто
буду
будут
будь
буедт
буит
бывает
был
была
были
было
быть
важная
важное
важные
важный
вам
вами
вас
ваш
ваша
ваше
ваши
вверх
вдали
вдруг
ведь
везде
версия
весь
видео
вниз
внизу
вокруг
вон
восемь
восьмой
вот
впрочем
времени
время
всё
все
всегда
всего
всем
всеми
всему
всех
всею
всю
всюду
вся
второй
выпуска
где
гоблинa
говорил
говорит
год
года
году
давай
давно
даже
дал
далеко
дальше
даром
два
двадцать
две
двенадцать
двух
двухголосый
девять
действительно
день
десять
для
дни
днями
довольно
долго
должно
доп
другая
другие
других
другова
другого
другое
другой
дублирование
дык
его
ему
если
есть
ещё
еще
жанр
закадровый
занят
занята
занято
заняты
затем
зато
зачем
здесь
зип
значит
ибо
издатель
издательство
изначально
или
именно
иметь
ими
имхо
имя
иногда
интерфейса
информация
исполнитель
кадра
каждая
каждое
каждые
каждый
кажется
как
какая
какже
какой
качество
кем
когда
кого
кодек
ком
компьютерное
кому
конечно
коотрый
которая
которого
которой
которые
который
которых
кроме
кругом
кто
куда
лет
либо
лишь
лол
лучше
любительский
люди
мало
мегалол
между
менее
меньше
меня
миллионов
мимо
минут
мля
мне
много
многоголосый
мной
мною
моё
мог
могли
могу
могут
модель
мое
может
можно
мои
мой
мочь
моя
наверху
над
надо
назад
название
наиболее
наконец
нам
нами
нас
нах
наш
наша
наше
наши
неё
него
недавно
недалеко
нее
ней
нельзя
нем
немного
нему
нередко
несжатый
несколько
нет
нею
нибудь
ниже
низко
никогда
никуда
ними
них
ничего
нужно
оба
обложка
обычно
обычный
один
однажды
однако
одного
одноголосый
одной
около
она
они
оно
операционные
описание
опять
оригинальное
особенно
особено
ответ
отовсюду
отсканированные
отсутствует
отсюда
очень
ошибками
ошибок
первый
перевод
перед
песен
платформа
под
пожалуйста
позже
пока
полное
пор
пора
после
посреди
постер
потом
потому
почему
почти
прекрасно
при
присутствует
про
продолжительность
просто
против
профессиональный
процент
процентов
прочем
пятый
пять
раз
разве
размер
разработчик
разработчика
рано
раньше
рар
режиссер
ролях
рус
русский
рядом
сайт
сам
сама
самаво
сами
самим
самими
самих
само
самого
самой
самом
самому
саму
сборки
своё
свое
своего
своей
свои
своих
свой
свою
своя
себе
себя
сегодня
седня
седьмой
сейчас
семь
сжатый
системные
системы
сих
сказал
сказала
сказать
сколько
скриншот
слишком
сначала
снова
собой
собою
совсем
спасибо
список
стал
страна
страницы
субтитры
суть
таб
таблэтка
тагда
так
такая
также
такие
такйо
такое
такой
там
тама
твоё
твой
твоя
тебе
тебя
текст
тем
теми
теперь
тех
тип
тобой
тобою
тогда
того
тоже
той
только
том
тому
топик
топика
торент
торрент
тот
точек
тоьлко
тою
транслит
требования
требуется
третий
три
трэклист
туда
тут
тысяч
тысяча
уже
уметь
упс
формат
форум
форума
хороше
хорошо
хотеть
хоть
хотя
хочешь
часто
чаще
чего
чей
человек
чем
чему
через
четвертый
четыре
что
чтоб
чтобы
чуть
чье
чья
шестой
шесть
щас
эта
эти
этим
этими
этих
это
этого
этой
этом
этому
этот
эту
язык

View file

@ -1,75 +1,75 @@
аббревиатура абревиатура
абонент абанент
агрессивный агресивный
агрессия агресия
агрессор агресор
аккумулятор акамулятор
аккумулятор акумулятор
аккуратно акуратно
аккуратный акуратный
апелляция апеляция
аппарат апарат
аппаратура апаратура
ассистент асистент
баррикада барикада
больше больеш
брэнд бренд
будущее будующее
будущем будующеем
будущем будующем
будущий будующий
видеть видить
всегда всигда
всегда свегда
всякий свякий
гауптвахта гаупвахта
грамотный граммотный
гуманизм гумманизм
делать деалть
дилер диллер
жизнь жизьнь
жизнь жызнь
зачет зачот
идти итти
именно миенно
инженер инжинер
интерес антирес
интерес интирес
инцидент инцедент
инцидент инциндент
легко лекго
легко лехко
машина машына
машина мошина
мощность мощьность
наконец наканец
например напирмер
ничего ничево
ничто ништо
новый нвоый
опечатка очепятка
офис оффис
перспектива переспектива
последний полседний
потом патом
потом поотм
программа софтинка
программист програмист
программу софтинку
просто рпосто
против проитв
раса расса
реклама рекламма
рекламу рекламму
свои сови
сказать сакзать
сколько сколко
случай случяй
смотреть смортеть
твой товй
теперь теепрь
функцыя функцыя
хороший хароший
черный чорный
черным чорным
аббревиатура абревиатура
абонент абанент
агрессивный агресивный
агрессия агресия
агрессор агресор
аккумулятор акамулятор
аккумулятор акумулятор
аккуратно акуратно
аккуратный акуратный
апелляция апеляция
аппарат апарат
аппаратура апаратура
ассистент асистент
баррикада барикада
больше больеш
брэнд бренд
будущее будующее
будущем будующеем
будущем будующем
будущий будующий
видеть видить
всегда всигда
всегда свегда
всякий свякий
гауптвахта гаупвахта
грамотный граммотный
гуманизм гумманизм
делать деалть
дилер диллер
жизнь жизьнь
жизнь жызнь
зачет зачот
идти итти
именно миенно
инженер инжинер
интерес антирес
интерес интирес
инцидент инцедент
инцидент инциндент
легко лекго
легко лехко
машина машына
машина мошина
мощность мощьность
наконец наканец
например напирмер
ничего ничево
ничто ништо
новый нвоый
опечатка очепятка
офис оффис
перспектива переспектива
последний полседний
потом патом
потом поотм
программа софтинка
программист програмист
программу софтинку
просто рпосто
против проитв
раса расса
реклама рекламма
рекламу рекламму
свои сови
сказать сакзать
сколько сколко
случай случяй
смотреть смортеть
твой товй
теперь теепрь
функцыя функцыя
хороший хароший
черный чорный
черным чорным
эффект эфект

View file

@ -1,17 +1,17 @@
<title>РЕКЛАМА НА САЙТІ</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">РЕКЛАМА НА САЙТІ</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Розміщення реклами на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>З питань розміщення реклами звертайтесь за адресою: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Закрити ]</a></p>
<title>РЕКЛАМА НА САЙТІ</title>
<div id="infobox-wrap" class="bCenter row1">
<fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1">РЕКЛАМА НА САЙТІ</legend>
<div class="bCenter">
<style type="text/css">
#infobox-body p { margin-top: 1em; margin-bottom: 1em; }
</style>
<div id="infobox-body">
<h2 class="bold">Розміщення реклами на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
<p>З питань розміщення реклами звертайтесь за адресою: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
</div><!--/infobox-body-->
</div>
</fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ Закрити ]</a></p>
</div><!--/infobox-wrap-->

View file

@ -1,23 +1,23 @@
<div>
<h3>BitTorrent клієнти</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/intl/ru/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(рекомендований: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/intl/ru/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(рекомендований: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(рекомендований: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Правила користування цим ресурсом</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ для новачків</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Де поставити питання?</a></li>
</ul>
</div>
</br>
<div>
<h3>BitTorrent клієнти</h3>
<ul>
<li><a rel="nofollow" href="http://www.utorrent.com/intl/ru/" class="med"><b>uTorrent</b></a> <span class="med nowrap">(рекомендований: <b>3.4</b>)</span></li>
<li><a rel="nofollow" href="http://www.bittorrent.com/intl/ru/" class="med"><b>BitTorrent</b></a> <span class="med nowrap">(рекомендований: <b>7.9</b>)</span></li>
<li><a rel="nofollow" href="http://www.transmissionbt.com/" class="med"><b>Transmission</b></a> <span class="med nowrap">(рекомендований: <b>2.82</b>)</span></li>
</ul>
</div>
</br>
<div>
<h3>FAQ</h3>
<ul class="med">
<li><a href="misc.php?do=info&show=user_agreement" class="med" onclick="window.open(this.href, '', InfoWinParams); return false;"><b>Правила користування цим ресурсом</b></a></li>
<li><a href="http://torrentpier.me/threads/faq-для-новичков.260" class="med">FAQ для новачків</a></li>
<li><a href="http://torrentpier.me/forums/Основные-вопросы-по-torrentpier-ii.10" class="med">Де поставити питання?</a></li>
</ul>
</div>
</br>
<img width="210" class="spacer" src="./images/spacer.gif" alt="" />

View file

@ -1,18 +1,18 @@
<div>
<h3>Бічна панель 2</h3>
Для додавання контенту в дану бічну панель, треба редагувати вказані файли:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
Для відключення даної бічній панелі, встановіть значення змінної $page_cfg['show_sidebar2'] у файлі config.php в положення false.
</div>
</br>
<div>
<h3>Партнери</h3>
Висловлюємо подяку всім людям, які зробили матеріальну допомогу в розвиток TorrentPier II, вказаним у файлі contributors.txt.
<div>
<h3>Бічна панель 2</h3>
Для додавання контенту в дану бічну панель, треба редагувати вказані файли:
</br></br>
<ul class="med">
<li>language/*/html/sidebar2.html</li>
<li>/templates/default/page_footer.tpl</li>
</ul>
</br>
Для відключення даної бічній панелі, встановіть значення змінної $page_cfg['show_sidebar2'] у файлі config.php в положення false.
</div>
</br>
<div>
<h3>Партнери</h3>
Висловлюємо подяку всім людям, які зробили матеріальну допомогу в розвиток TorrentPier II, вказаним у файлі contributors.txt.
</div>

View file

@ -1,469 +1,469 @@
автор
алло
ало
английский
аннотация
аудио
аудиокнига
аудиоспектакль
без
битрейт
близко
более
больше
будем
будет
будете
будешь
будит
будто
буду
будут
будь
буедт
буит
бывает
был
была
были
было
быть
важная
важное
важные
важный
вам
вами
вас
ваш
ваша
ваше
ваши
вверх
вдали
вдруг
ведь
везде
версия
весь
видео
вниз
внизу
вокруг
вон
восемь
восьмой
вот
впрочем
времени
время
всё
все
всегда
всего
всем
всеми
всему
всех
всею
всю
всюду
вся
второй
выпуска
где
гоблинa
говорил
говорит
год
года
году
давай
давно
даже
дал
далеко
дальше
даром
два
двадцать
две
двенадцать
двух
двухголосый
девять
действительно
день
десять
для
дни
днями
довольно
долго
должно
доп
другая
другие
других
другова
другого
другое
другой
дублирование
дык
его
ему
если
есть
ещё
еще
жанр
закадровый
занят
занята
занято
заняты
затем
зато
зачем
здесь
зип
значит
ибо
издатель
издательство
изначально
или
именно
иметь
ими
имхо
имя
иногда
интерфейса
информация
исполнитель
кадра
каждая
каждое
каждые
каждый
кажется
как
какая
какже
какой
качество
кем
когда
кого
кодек
ком
компьютерное
кому
конечно
коотрый
которая
которого
которой
которые
который
которых
кроме
кругом
кто
куда
лет
либо
лишь
лол
лучше
любительский
люди
мало
мегалол
между
менее
меньше
меня
миллионов
мимо
минут
мля
мне
много
многоголосый
мной
мною
моё
мог
могли
могу
могут
модель
мое
может
можно
мои
мой
мочь
моя
наверху
над
надо
назад
название
наиболее
наконец
нам
нами
нас
нах
наш
наша
наше
наши
неё
него
недавно
недалеко
нее
ней
нельзя
нем
немного
нему
нередко
несжатый
несколько
нет
нею
нибудь
ниже
низко
никогда
никуда
ними
них
ничего
нужно
оба
обложка
обычно
обычный
один
однажды
однако
одного
одноголосый
одной
около
она
они
оно
операционные
описание
опять
оригинальное
особенно
особено
ответ
отовсюду
отсканированные
отсутствует
отсюда
очень
ошибками
ошибок
первый
перевод
перед
песен
платформа
под
пожалуйста
позже
пока
полное
пор
пора
после
посреди
постер
потом
потому
почему
почти
прекрасно
при
присутствует
про
продолжительность
просто
против
профессиональный
процент
процентов
прочем
пятый
пять
раз
разве
размер
разработчик
разработчика
рано
раньше
рар
режиссер
ролях
рус
русский
рядом
сайт
сам
сама
самаво
сами
самим
самими
самих
само
самого
самой
самом
самому
саму
сборки
своё
свое
своего
своей
свои
своих
свой
свою
своя
себе
себя
сегодня
седня
седьмой
сейчас
семь
сжатый
системные
системы
сих
сказал
сказала
сказать
сколько
скриншот
слишком
сначала
снова
собой
собою
совсем
спасибо
список
стал
страна
страницы
субтитры
суть
таб
таблэтка
тагда
так
такая
также
такие
такйо
такое
такой
там
тама
твоё
твой
твоя
тебе
тебя
текст
тем
теми
теперь
тех
тип
тобой
тобою
тогда
того
тоже
той
только
том
тому
топик
топика
торент
торрент
тот
точек
тоьлко
тою
транслит
требования
требуется
третий
три
трэклист
туда
тут
тысяч
тысяча
уже
уметь
упс
формат
форум
форума
хороше
хорошо
хотеть
хоть
хотя
хочешь
часто
чаще
чего
чей
человек
чем
чему
через
четвертый
четыре
что
чтоб
чтобы
чуть
чье
чья
шестой
шесть
щас
эта
эти
этим
этими
этих
это
этого
этой
этом
этому
этот
эту
язык
автор
алло
ало
английский
аннотация
аудио
аудиокнига
аудиоспектакль
без
битрейт
близко
более
больше
будем
будет
будете
будешь
будит
будто
буду
будут
будь
буедт
буит
бывает
был
была
были
было
быть
важная
важное
важные
важный
вам
вами
вас
ваш
ваша
ваше
ваши
вверх
вдали
вдруг
ведь
везде
версия
весь
видео
вниз
внизу
вокруг
вон
восемь
восьмой
вот
впрочем
времени
время
всё
все
всегда
всего
всем
всеми
всему
всех
всею
всю
всюду
вся
второй
выпуска
где
гоблинa
говорил
говорит
год
года
году
давай
давно
даже
дал
далеко
дальше
даром
два
двадцать
две
двенадцать
двух
двухголосый
девять
действительно
день
десять
для
дни
днями
довольно
долго
должно
доп
другая
другие
других
другова
другого
другое
другой
дублирование
дык
его
ему
если
есть
ещё
еще
жанр
закадровый
занят
занята
занято
заняты
затем
зато
зачем
здесь
зип
значит
ибо
издатель
издательство
изначально
или
именно
иметь
ими
имхо
имя
иногда
интерфейса
информация
исполнитель
кадра
каждая
каждое
каждые
каждый
кажется
как
какая
какже
какой
качество
кем
когда
кого
кодек
ком
компьютерное
кому
конечно
коотрый
которая
которого
которой
которые
который
которых
кроме
кругом
кто
куда
лет
либо
лишь
лол
лучше
любительский
люди
мало
мегалол
между
менее
меньше
меня
миллионов
мимо
минут
мля
мне
много
многоголосый
мной
мною
моё
мог
могли
могу
могут
модель
мое
может
можно
мои
мой
мочь
моя
наверху
над
надо
назад
название
наиболее
наконец
нам
нами
нас
нах
наш
наша
наше
наши
неё
него
недавно
недалеко
нее
ней
нельзя
нем
немного
нему
нередко
несжатый
несколько
нет
нею
нибудь
ниже
низко
никогда
никуда
ними
них
ничего
нужно
оба
обложка
обычно
обычный
один
однажды
однако
одного
одноголосый
одной
около
она
они
оно
операционные
описание
опять
оригинальное
особенно
особено
ответ
отовсюду
отсканированные
отсутствует
отсюда
очень
ошибками
ошибок
первый
перевод
перед
песен
платформа
под
пожалуйста
позже
пока
полное
пор
пора
после
посреди
постер
потом
потому
почему
почти
прекрасно
при
присутствует
про
продолжительность
просто
против
профессиональный
процент
процентов
прочем
пятый
пять
раз
разве
размер
разработчик
разработчика
рано
раньше
рар
режиссер
ролях
рус
русский
рядом
сайт
сам
сама
самаво
сами
самим
самими
самих
само
самого
самой
самом
самому
саму
сборки
своё
свое
своего
своей
свои
своих
свой
свою
своя
себе
себя
сегодня
седня
седьмой
сейчас
семь
сжатый
системные
системы
сих
сказал
сказала
сказать
сколько
скриншот
слишком
сначала
снова
собой
собою
совсем
спасибо
список
стал
страна
страницы
субтитры
суть
таб
таблэтка
тагда
так
такая
также
такие
такйо
такое
такой
там
тама
твоё
твой
твоя
тебе
тебя
текст
тем
теми
теперь
тех
тип
тобой
тобою
тогда
того
тоже
той
только
том
тому
топик
топика
торент
торрент
тот
точек
тоьлко
тою
транслит
требования
требуется
третий
три
трэклист
туда
тут
тысяч
тысяча
уже
уметь
упс
формат
форум
форума
хороше
хорошо
хотеть
хоть
хотя
хочешь
часто
чаще
чего
чей
человек
чем
чему
через
четвертый
четыре
что
чтоб
чтобы
чуть
чье
чья
шестой
шесть
щас
эта
эти
этим
этими
этих
это
этого
этой
этом
этому
этот
эту
язык

View file

@ -1,75 +1,75 @@
аббревиатура абревиатура
абонент абанент
агрессивный агресивный
агрессия агресия
агрессор агресор
аккумулятор акамулятор
аккумулятор акумулятор
аккуратно акуратно
аккуратный акуратный
апелляция апеляция
аппарат апарат
аппаратура апаратура
ассистент асистент
баррикада барикада
больше больеш
брэнд бренд
будущее будующее
будущем будующеем
будущем будующем
будущий будующий
видеть видить
всегда всигда
всегда свегда
всякий свякий
гауптвахта гаупвахта
грамотный граммотный
гуманизм гумманизм
делать деалть
дилер диллер
жизнь жизьнь
жизнь жызнь
зачет зачот
идти итти
именно миенно
инженер инжинер
интерес антирес
интерес интирес
инцидент инцедент
инцидент инциндент
легко лекго
легко лехко
машина машына
машина мошина
мощность мощьность
наконец наканец
например напирмер
ничего ничево
ничто ништо
новый нвоый
опечатка очепятка
офис оффис
перспектива переспектива
последний полседний
потом патом
потом поотм
программа софтинка
программист програмист
программу софтинку
просто рпосто
против проитв
раса расса
реклама рекламма
рекламу рекламму
свои сови
сказать сакзать
сколько сколко
случай случяй
смотреть смортеть
твой товй
теперь теепрь
функцыя функцыя
хороший хароший
черный чорный
черным чорным
аббревиатура абревиатура
абонент абанент
агрессивный агресивный
агрессия агресия
агрессор агресор
аккумулятор акамулятор
аккумулятор акумулятор
аккуратно акуратно
аккуратный акуратный
апелляция апеляция
аппарат апарат
аппаратура апаратура
ассистент асистент
баррикада барикада
больше больеш
брэнд бренд
будущее будующее
будущем будующеем
будущем будующем
будущий будующий
видеть видить
всегда всигда
всегда свегда
всякий свякий
гауптвахта гаупвахта
грамотный граммотный
гуманизм гумманизм
делать деалть
дилер диллер
жизнь жизьнь
жизнь жызнь
зачет зачот
идти итти
именно миенно
инженер инжинер
интерес антирес
интерес интирес
инцидент инцедент
инцидент инциндент
легко лекго
легко лехко
машина машына
машина мошина
мощность мощьность
наконец наканец
например напирмер
ничего ничево
ничто ништо
новый нвоый
опечатка очепятка
офис оффис
перспектива переспектива
последний полседний
потом патом
потом поотм
программа софтинка
программист програмист
программу софтинку
просто рпосто
против проитв
раса расса
реклама рекламма
рекламу рекламму
свои сови
сказать сакзать
сколько сколко
случай случяй
смотреть смортеть
твой товй
теперь теепрь
функцыя функцыя
хороший хароший
черный чорный
черным чорным
эффект эфект

View file

@ -1,144 +1,144 @@
<?php
define('IN_FORUM', true);
define('BB_SCRIPT', 'misc');
define('BB_ROOT', './');
require(BB_ROOT .'common.php');
// Start Session Management
$user->session_start();
$do = request_var('do', '');
if ($do == 'attach_rules')
{
if (!$forum_id = @intval(request_var('f', '')) OR !forum_exists($forum_id))
{
bb_die('invalid forum_id');
}
require(BB_ROOT .'attach_mod/attachment_mod.php');
// Display the allowed Extension Groups and Upload Size
$auth = auth(AUTH_ALL, $forum_id, $userdata);
$_max_filesize = $attach_config['max_filesize'];
if (!$auth['auth_attachments'] || !$auth['auth_view'])
{
bb_die('You are not allowed to call this file');
}
$sql = 'SELECT group_id, group_name, max_filesize, forum_permissions
FROM ' . BB_EXTENSION_GROUPS . '
WHERE allow_group = 1
ORDER BY group_name ASC';
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query extension groups');
}
$allowed_filesize = array();
$rows = DB()->sql_fetchrowset($result);
$num_rows = DB()->num_rows($result);
DB()->sql_freeresult($result);
// Ok, only process those Groups allowed within this forum
$nothing = true;
for ($i = 0; $i < $num_rows; $i++)
{
$auth_cache = trim($rows[$i]['forum_permissions']);
$permit = ((is_forum_authed($auth_cache, $forum_id)) || trim($rows[$i]['forum_permissions']) == '');
if ($permit)
{
$nothing = false;
$group_name = $rows[$i]['group_name'];
$f_size = intval(trim($rows[$i]['max_filesize']));
$det_filesize = (!$f_size) ? $_max_filesize : $f_size;
$max_filesize = (!$det_filesize) ? $lang['UNLIMITED'] : humn_size($det_filesize);
$template->assign_block_vars('group_row', array(
'GROUP_RULE_HEADER' => sprintf($lang['GROUP_RULE_HEADER'], $group_name, $max_filesize),
));
$sql = 'SELECT extension
FROM ' . BB_EXTENSIONS . "
WHERE group_id = " . (int) $rows[$i]['group_id'] . "
ORDER BY extension ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query extensions');
}
$e_rows = DB()->sql_fetchrowset($result);
$e_num_rows = DB()->num_rows($result);
DB()->sql_freeresult($result);
for ($j = 0; $j < $e_num_rows; $j++)
{
$template->assign_block_vars('group_row.extension_row', array(
'EXTENSION' => $e_rows[$j]['extension'],
));
}
}
}
$template->assign_vars(array(
'PAGE_TITLE' => $lang['ATTACH_RULES_TITLE'],
));
if ($nothing)
{
$template->assign_block_vars('switch_nothing', array());
}
print_page('attach_rules.tpl', 'simple');
}
elseif ($do == 'info')
{
$req_mode = (string) request_var('show', 'not_found');
if(preg_match('/\//i', $req_mode))
{
die('Include detected!');
}
if(preg_match('/</i', $req_mode))
{
die('XSS detected!');
}
$req_mode = clean_filename(basename($req_mode));
$html_dir = LANG_DIR . 'html/';
$require = file_exists($html_dir . $req_mode .'.html') ? $html_dir . $req_mode .'.html' : $html_dir . 'not_found.html';
$in_info = true;
?><!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" href="./templates/default/css/main.css" type="text/css">
</head>
<body>
<style type="text/css">
#infobox-wrap { width: 760px; }
#infobox-body {
background: #FFFFFF; color: #000000; padding: 1em;
height: 400px; overflow: auto; border: 1px inset #000000;
}
</style>
<br />
<?php require($require) ?>
</body>
</html>
<?php
}
else
{
bb_die('Invalid mode');
<?php
define('IN_FORUM', true);
define('BB_SCRIPT', 'misc');
define('BB_ROOT', './');
require(BB_ROOT .'common.php');
// Start Session Management
$user->session_start();
$do = request_var('do', '');
if ($do == 'attach_rules')
{
if (!$forum_id = @intval(request_var('f', '')) OR !forum_exists($forum_id))
{
bb_die('invalid forum_id');
}
require(BB_ROOT .'attach_mod/attachment_mod.php');
// Display the allowed Extension Groups and Upload Size
$auth = auth(AUTH_ALL, $forum_id, $userdata);
$_max_filesize = $attach_config['max_filesize'];
if (!$auth['auth_attachments'] || !$auth['auth_view'])
{
bb_die('You are not allowed to call this file');
}
$sql = 'SELECT group_id, group_name, max_filesize, forum_permissions
FROM ' . BB_EXTENSION_GROUPS . '
WHERE allow_group = 1
ORDER BY group_name ASC';
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query extension groups');
}
$allowed_filesize = array();
$rows = DB()->sql_fetchrowset($result);
$num_rows = DB()->num_rows($result);
DB()->sql_freeresult($result);
// Ok, only process those Groups allowed within this forum
$nothing = true;
for ($i = 0; $i < $num_rows; $i++)
{
$auth_cache = trim($rows[$i]['forum_permissions']);
$permit = ((is_forum_authed($auth_cache, $forum_id)) || trim($rows[$i]['forum_permissions']) == '');
if ($permit)
{
$nothing = false;
$group_name = $rows[$i]['group_name'];
$f_size = intval(trim($rows[$i]['max_filesize']));
$det_filesize = (!$f_size) ? $_max_filesize : $f_size;
$max_filesize = (!$det_filesize) ? $lang['UNLIMITED'] : humn_size($det_filesize);
$template->assign_block_vars('group_row', array(
'GROUP_RULE_HEADER' => sprintf($lang['GROUP_RULE_HEADER'], $group_name, $max_filesize),
));
$sql = 'SELECT extension
FROM ' . BB_EXTENSIONS . "
WHERE group_id = " . (int) $rows[$i]['group_id'] . "
ORDER BY extension ASC";
if (!($result = DB()->sql_query($sql)))
{
bb_die('Could not query extensions');
}
$e_rows = DB()->sql_fetchrowset($result);
$e_num_rows = DB()->num_rows($result);
DB()->sql_freeresult($result);
for ($j = 0; $j < $e_num_rows; $j++)
{
$template->assign_block_vars('group_row.extension_row', array(
'EXTENSION' => $e_rows[$j]['extension'],
));
}
}
}
$template->assign_vars(array(
'PAGE_TITLE' => $lang['ATTACH_RULES_TITLE'],
));
if ($nothing)
{
$template->assign_block_vars('switch_nothing', array());
}
print_page('attach_rules.tpl', 'simple');
}
elseif ($do == 'info')
{
$req_mode = (string) request_var('show', 'not_found');
if(preg_match('/\//i', $req_mode))
{
die('Include detected!');
}
if(preg_match('/</i', $req_mode))
{
die('XSS detected!');
}
$req_mode = clean_filename(basename($req_mode));
$html_dir = LANG_DIR . 'html/';
$require = file_exists($html_dir . $req_mode .'.html') ? $html_dir . $req_mode .'.html' : $html_dir . 'not_found.html';
$in_info = true;
?><!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" href="./templates/default/css/main.css" type="text/css">
</head>
<body>
<style type="text/css">
#infobox-wrap { width: 760px; }
#infobox-body {
background: #FFFFFF; color: #000000; padding: 1em;
height: 400px; overflow: auto; border: 1px inset #000000;
}
</style>
<br />
<?php require($require) ?>
</body>
</html>
<?php
}
else
{
bb_die('Invalid mode');
}

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>TorrentPier (Forum)</ShortName>
<Description>TorrentPier (Forum)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" width="16" type="image/x-icon">http://torrentpier.me/favicon.ico</Image>
<Url type="text/html" template="http://torrentpier.me/search.php?mode=results&amp;show_results=topics&amp;search_keywords={searchTerms}"/>
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>TorrentPier (Forum)</ShortName>
<Description>TorrentPier (Forum)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" width="16" type="image/x-icon">http://torrentpier.me/favicon.ico</Image>
<Url type="text/html" template="http://torrentpier.me/search.php?mode=results&amp;show_results=topics&amp;search_keywords={searchTerms}"/>
</OpenSearchDescription>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>TorrentPier (Tracker)</ShortName>
<Description>TorrentPier (Tracker)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" width="16" type="image/x-icon">http://torrentpier.me/favicon.ico</Image>
<Url type="text/html" template="http://torrentpier.me/tracker.php?submit=1&amp;o=13&amp;nm={searchTerms}"/>
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>TorrentPier (Tracker)</ShortName>
<Description>TorrentPier (Tracker)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" width="16" type="image/x-icon">http://torrentpier.me/favicon.ico</Image>
<Url type="text/html" template="http://torrentpier.me/tracker.php?submit=1&amp;o=13&amp;nm={searchTerms}"/>
</OpenSearchDescription>

View file

@ -1,239 +1,239 @@
<?php
define('BB_SCRIPT', 'vote');
require('./common.php');
$user->session_start(array('req_login' => true));
$mode = (string) @$_POST['mode'];
$topic_id = (int) @$_POST['topic_id'];
$forum_id = (int) @$_POST['forum_id'];
$vote_id = (int) @$_POST['vote_id'];
$return_topic_url = TOPIC_URL . $topic_id;
$return_topic_url .= !empty($_POST['start']) ? "&amp;start=". intval($_POST['start']) : '';
set_die_append_msg($forum_id, $topic_id);
$poll = new bb_poll();
// проверка валидности $topic_id
if (!$topic_id)
{
bb_die('Invalid topic_id');
}
if (!$t_data = DB()->fetch_row("SELECT * FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{
bb_die('Тема не найдена');
}
// проверка прав
if ($mode != 'poll_vote')
{
if ($t_data['topic_poster'] != $userdata['user_id'])
{
if (!IS_AM) bb_die('Нет прав');
}
}
// проверка на возможность вносить изменения
if ($mode == 'poll_delete')
{
if ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days']*86400)
{
bb_die("Время для этого опроса ({$bb_cfg['poll_max_days']} дней с момента создания темы) уже закончилось");
}
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED))
{
bb_die($lang['CANNOT_DELETE_POLL']);
}
}
switch ($mode)
{
// голосование
case 'poll_vote':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
if ($t_data['topic_status'] == TOPIC_LOCKED)
{
bb_die($lang['TOPIC_LOCKED_SHORT']);
}
if (!poll_is_active($t_data))
{
bb_die('Этот опрос уже завершен');
}
if (!$vote_id)
{
bb_die('Вы не выбрали, за что голосуете');
}
if (DB()->fetch_row("SELECT 1 FROM ". BB_POLL_USERS ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']} LIMIT 1"))
{
bb_die('Вы уже голосовали');
}
DB()->query("
UPDATE ". BB_POLL_VOTES ." SET
vote_result = vote_result + 1
WHERE topic_id = $topic_id
AND vote_id = $vote_id
LIMIT 1
");
if (DB()->affected_rows() != 1)
{
bb_die('Вы не выбрали, за что голосуете');
}
DB()->query("INSERT IGNORE INTO ". BB_POLL_USERS ." (topic_id, user_id, vote_ip, vote_dt) VALUES ($topic_id, {$userdata['user_id']}, '". USER_IP ."', ". TIMENOW .")");
CACHE('bb_poll_data')->rm("poll_$topic_id");
bb_die('Спасибо! Ваш голос учтен');
break;
// возобновить возможность голосовать
case 'poll_start':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
bb_die('Опрос включен');
break;
// завершить опрос
case 'poll_finish':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = ". POLL_FINISHED ." WHERE topic_id = $topic_id LIMIT 1");
bb_die('Опрос завершен');
break;
// удаление
case 'poll_delete':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
$poll->delete_poll($topic_id);
bb_die('Опрос удален');
break;
// добавление
case 'poll_add':
if ($t_data['topic_vote'])
{
bb_die('Тема уже имеет опрос');
}
$poll->build_poll_data($_POST);
if ($poll->err_msg)
{
bb_die($poll->err_msg);
}
$poll->insert_votes_into_db($topic_id);
bb_die('Опрос добавлен');
break;
// редакторование
case 'poll_edit':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
$poll->build_poll_data($_POST);
if ($poll->err_msg)
{
bb_die($poll->err_msg);
}
$poll->insert_votes_into_db($topic_id);
CACHE('bb_poll_data')->rm("poll_$topic_id");
bb_die('Опрос изменен и старые результаты удалены');
break;
default:
bb_die("Invalid mode: ". htmlCHR($mode));
}
// ----------------------------------------------------------- //
// Functions
//
class bb_poll
{
var $err_msg = '';
var $poll_votes = array(); // array(vote_id => vote_text)
var $max_votes = 0;
function bb_poll ()
{
global $bb_cfg;
$this->max_votes = $bb_cfg['max_poll_options'];
}
function build_poll_data ($posted_data)
{
$poll_caption = (string) @$posted_data['poll_caption'];
$poll_votes = (string) @$posted_data['poll_votes'];
$this->poll_votes = array();
if (!$poll_caption = str_compact($poll_caption))
{
return $this->err_msg = 'Вы должны указать заголовок';
}
$this->poll_votes[] = $poll_caption; // заголовок имеет vote_id = 0
foreach (explode("\n", $poll_votes) as $vote)
{
if (!$vote = str_compact($vote))
{
continue;
}
$this->poll_votes[] = $vote;
}
// проверять на "< 3" -- 2 варианта ответа + заголовок
if (count($this->poll_votes) < 3 || count($this->poll_votes) > $this->max_votes + 1)
{
return $this->err_msg = "Вы должны правильно указать варианты ответа (минимум 2, максимум {$this->max_votes})";
}
}
function insert_votes_into_db ($topic_id)
{
$this->delete_votes_data($topic_id);
$sql_ary = array();
foreach ($this->poll_votes as $vote_id => $vote_text)
{
$sql_ary[] = array(
'topic_id' => (int) $topic_id,
'vote_id' => (int) $vote_id,
'vote_text' => (string) $vote_text,
'vote_result' => (int) 0,
);
}
$sql_args = DB()->build_array('MULTI_INSERT', $sql_ary);
DB()->query("REPLACE INTO ". BB_POLL_VOTES . $sql_args);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
}
function delete_poll ($topic_id)
{
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 0 WHERE topic_id = $topic_id LIMIT 1");
$this->delete_votes_data($topic_id);
}
function delete_votes_data ($topic_id)
{
DB()->query("DELETE FROM ". BB_POLL_VOTES ." WHERE topic_id = $topic_id");
DB()->query("DELETE FROM ". BB_POLL_USERS ." WHERE topic_id = $topic_id");
CACHE('bb_poll_data')->rm("poll_$topic_id");
}
<?php
define('BB_SCRIPT', 'vote');
require('./common.php');
$user->session_start(array('req_login' => true));
$mode = (string) @$_POST['mode'];
$topic_id = (int) @$_POST['topic_id'];
$forum_id = (int) @$_POST['forum_id'];
$vote_id = (int) @$_POST['vote_id'];
$return_topic_url = TOPIC_URL . $topic_id;
$return_topic_url .= !empty($_POST['start']) ? "&amp;start=". intval($_POST['start']) : '';
set_die_append_msg($forum_id, $topic_id);
$poll = new bb_poll();
// проверка валидности $topic_id
if (!$topic_id)
{
bb_die('Invalid topic_id');
}
if (!$t_data = DB()->fetch_row("SELECT * FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{
bb_die('Тема не найдена');
}
// проверка прав
if ($mode != 'poll_vote')
{
if ($t_data['topic_poster'] != $userdata['user_id'])
{
if (!IS_AM) bb_die('Нет прав');
}
}
// проверка на возможность вносить изменения
if ($mode == 'poll_delete')
{
if ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days']*86400)
{
bb_die("Время для этого опроса ({$bb_cfg['poll_max_days']} дней с момента создания темы) уже закончилось");
}
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED))
{
bb_die($lang['CANNOT_DELETE_POLL']);
}
}
switch ($mode)
{
// голосование
case 'poll_vote':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
if ($t_data['topic_status'] == TOPIC_LOCKED)
{
bb_die($lang['TOPIC_LOCKED_SHORT']);
}
if (!poll_is_active($t_data))
{
bb_die('Этот опрос уже завершен');
}
if (!$vote_id)
{
bb_die('Вы не выбрали, за что голосуете');
}
if (DB()->fetch_row("SELECT 1 FROM ". BB_POLL_USERS ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']} LIMIT 1"))
{
bb_die('Вы уже голосовали');
}
DB()->query("
UPDATE ". BB_POLL_VOTES ." SET
vote_result = vote_result + 1
WHERE topic_id = $topic_id
AND vote_id = $vote_id
LIMIT 1
");
if (DB()->affected_rows() != 1)
{
bb_die('Вы не выбрали, за что голосуете');
}
DB()->query("INSERT IGNORE INTO ". BB_POLL_USERS ." (topic_id, user_id, vote_ip, vote_dt) VALUES ($topic_id, {$userdata['user_id']}, '". USER_IP ."', ". TIMENOW .")");
CACHE('bb_poll_data')->rm("poll_$topic_id");
bb_die('Спасибо! Ваш голос учтен');
break;
// возобновить возможность голосовать
case 'poll_start':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
bb_die('Опрос включен');
break;
// завершить опрос
case 'poll_finish':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = ". POLL_FINISHED ." WHERE topic_id = $topic_id LIMIT 1");
bb_die('Опрос завершен');
break;
// удаление
case 'poll_delete':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
$poll->delete_poll($topic_id);
bb_die('Опрос удален');
break;
// добавление
case 'poll_add':
if ($t_data['topic_vote'])
{
bb_die('Тема уже имеет опрос');
}
$poll->build_poll_data($_POST);
if ($poll->err_msg)
{
bb_die($poll->err_msg);
}
$poll->insert_votes_into_db($topic_id);
bb_die('Опрос добавлен');
break;
// редакторование
case 'poll_edit':
if (!$t_data['topic_vote'])
{
bb_die('Опрос не найден');
}
$poll->build_poll_data($_POST);
if ($poll->err_msg)
{
bb_die($poll->err_msg);
}
$poll->insert_votes_into_db($topic_id);
CACHE('bb_poll_data')->rm("poll_$topic_id");
bb_die('Опрос изменен и старые результаты удалены');
break;
default:
bb_die("Invalid mode: ". htmlCHR($mode));
}
// ----------------------------------------------------------- //
// Functions
//
class bb_poll
{
var $err_msg = '';
var $poll_votes = array(); // array(vote_id => vote_text)
var $max_votes = 0;
function bb_poll ()
{
global $bb_cfg;
$this->max_votes = $bb_cfg['max_poll_options'];
}
function build_poll_data ($posted_data)
{
$poll_caption = (string) @$posted_data['poll_caption'];
$poll_votes = (string) @$posted_data['poll_votes'];
$this->poll_votes = array();
if (!$poll_caption = str_compact($poll_caption))
{
return $this->err_msg = 'Вы должны указать заголовок';
}
$this->poll_votes[] = $poll_caption; // заголовок имеет vote_id = 0
foreach (explode("\n", $poll_votes) as $vote)
{
if (!$vote = str_compact($vote))
{
continue;
}
$this->poll_votes[] = $vote;
}
// проверять на "< 3" -- 2 варианта ответа + заголовок
if (count($this->poll_votes) < 3 || count($this->poll_votes) > $this->max_votes + 1)
{
return $this->err_msg = "Вы должны правильно указать варианты ответа (минимум 2, максимум {$this->max_votes})";
}
}
function insert_votes_into_db ($topic_id)
{
$this->delete_votes_data($topic_id);
$sql_ary = array();
foreach ($this->poll_votes as $vote_id => $vote_text)
{
$sql_ary[] = array(
'topic_id' => (int) $topic_id,
'vote_id' => (int) $vote_id,
'vote_text' => (string) $vote_text,
'vote_result' => (int) 0,
);
}
$sql_args = DB()->build_array('MULTI_INSERT', $sql_ary);
DB()->query("REPLACE INTO ". BB_POLL_VOTES . $sql_args);
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
}
function delete_poll ($topic_id)
{
DB()->query("UPDATE ". BB_TOPICS ." SET topic_vote = 0 WHERE topic_id = $topic_id LIMIT 1");
$this->delete_votes_data($topic_id);
}
function delete_votes_data ($topic_id)
{
DB()->query("DELETE FROM ". BB_POLL_VOTES ." WHERE topic_id = $topic_id");
DB()->query("DELETE FROM ". BB_POLL_USERS ." WHERE topic_id = $topic_id");
CACHE('bb_poll_data')->rm("poll_$topic_id");
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,13 @@
User-agent: *
Disallow: /download.php
Disallow: /groupcp.php
Disallow: /login.php
Disallow: /memberlist.php
Disallow: /modcp.php
Disallow: /posting.php
Disallow: /privmsg.php
Disallow: /profile.php
Disallow: /viewonline.php
Host: torrentpier.me
User-agent: *
Disallow: /download.php
Disallow: /groupcp.php
Disallow: /login.php
Disallow: /memberlist.php
Disallow: /modcp.php
Disallow: /posting.php
Disallow: /privmsg.php
Disallow: /profile.php
Disallow: /viewonline.php
Host: torrentpier.me
Sitemap: http://torrentpier.me/sitemap.php

View file

@ -1,8 +1,8 @@
body { background: #E5E5E5; min-width: 10px; }
#body_container { background: #E5E5E5; padding: 0 6px 4px; }
h1, h2, h3 { margin: 0.8em 0; font-size: 16px; }
h4 { margin: 0.1em 0.2em; color: #273F61; font-size: 11px; font-weight: bold; }
h5 { margin: 0.1em 0.6em; color: #333399; font-family: "Courier New"; }
h6 { margin: 0.3em 0.6em; color: #444444; line-height: 100%; }
* html table.forumline { width: 97%; }
body { background: #E5E5E5; min-width: 10px; }
#body_container { background: #E5E5E5; padding: 0 6px 4px; }
h1, h2, h3 { margin: 0.8em 0; font-size: 16px; }
h4 { margin: 0.1em 0.2em; color: #273F61; font-size: 11px; font-weight: bold; }
h5 { margin: 0.1em 0.6em; color: #333399; font-family: "Courier New"; }
h6 { margin: 0.3em 0.6em; color: #444444; line-height: 100%; }
* html table.forumline { width: 97%; }

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more