diff --git a/upload/admin/admin_users.php b/upload/admin/admin_users.php
index fb4fcd60b..539fc744f 100644
--- a/upload/admin/admin_users.php
+++ b/upload/admin/admin_users.php
@@ -104,8 +104,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
$user_lang = ( $_POST['language'] != $bb_cfg['board_lang'] ) ? $_POST['language'] : '';
$user_timezone = ( isset($_POST['timezone']) ) ? str_replace(',', '.', doubleval($_POST['timezone'])) : $bb_cfg['board_timezone'];
- $user_flag = (@$_POST['user_flag'] && $_POST['user_flag'] != 'blank.gif') ? $_POST['user_flag'] : '';
-
$user_template = ( @$_POST['template'] ) ? $_POST['template'] : @$bb_cfg['board_template'];
$user_dateformat = (!empty($_POST['dateformat']) && $_POST['dateformat'] != $bb_cfg['board_dateformat']) ? $_POST['dateformat'] : '';
@@ -514,7 +512,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
user_website = '" . str_replace("\'", "''", $website) . "',
user_occ = '" . str_replace("\'", "''", $occupation) . "',
user_from = '" . str_replace("\'", "''", $location) . "',
- user_from_flag = '$user_flag',
user_interests = '" . str_replace("\'", "''", $interests) . "',
user_sig = '" . str_replace("\'", "''", $signature) . "',
user_opt = $user_opt,
@@ -619,7 +616,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
$website = htmlspecialchars($this_userdata['user_website']);
$location = htmlspecialchars($this_userdata['user_from']);
- $user_flag = htmlspecialchars($this_userdata['user_from_flag']);
$occupation = htmlspecialchars($this_userdata['user_occ']);
$interests = htmlspecialchars($this_userdata['user_interests']);
@@ -732,10 +728,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
$s_hidden_fields .= '';
$s_hidden_fields .= '';
-// FLAGHACK-start
- $s_hidden_fields .= '';
-// FLAGHACK-end
-
$s_hidden_fields .= '';
$s_hidden_fields .= '';
$s_hidden_fields .= '';
@@ -820,42 +812,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
$form_enctype = ( !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$bb_cfg['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
- // query to get the list of flags
- $sql = "SELECT *
- FROM " . BB_COUNTRIES . "
- ORDER BY country_id";
- if(!$flags_result = DB()->sql_query($sql))
- {
- message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
- }
- $flag_row = DB()->sql_fetchrowset($flags_result);
- $num_flags = DB()->num_rows($flags_result);
-
- // build the html select statement
- if(!defined('COUNTRIES_LANG'))
- {
- include(LANG_DIR . "lang_countries.php");
- }
-
- $flag_start_image = 'blank.gif' ;
- $selected = ( isset($user_flag) ) ? '' : HTML_SELECTED;
- $flag_select = "';
-
$template->assign_vars(array(
'TPL_ADMIN_USER_EDIT' => true,
@@ -865,9 +821,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
'OCCUPATION' => $occupation,
'INTERESTS' => $interests,
'LOCATION' => $location,
- 'L_FLAG' => $lang['COUNTRY_FLAG'],
- 'FLAG_SELECT' => $flag_select,
- 'FLAG_START' => $flag_start_image,
'WEBSITE' => $website,
'SIGNATURE' => str_replace('
', "\n", $signature),
diff --git a/upload/admin/xs_include.php b/upload/admin/xs_include.php
index 17686856d..16fc8e7f6 100644
--- a/upload/admin/xs_include.php
+++ b/upload/admin/xs_include.php
@@ -174,6 +174,11 @@ $template->assign_vars(array(
if(!defined('NO_XS_HEADER'))
{
+ $template->set_filenames(array(
+ 'xs_header' => XS_TPL_PATH . 'xs_header.tpl',
+ 'xs_footer' => XS_TPL_PATH . 'xs_footer.tpl',
+ ));
+
$template->preparse = 'xs_header';
$template->postparse = 'xs_footer';
$template->assign_block_vars('nav_left',array('ITEM' => '' . $lang['XS_MENU'] . ''));
diff --git a/upload/ajax.php b/upload/ajax.php
index 455aa0a27..ec2ad17cf 100644
--- a/upload/ajax.php
+++ b/upload/ajax.php
@@ -55,6 +55,7 @@ class ajax_common
var $valid_actions = array(
// ACTION NAME AJAX_AUTH
'edit_user_profile' => array('admin'),
+ 'change_user_rank' => array('admin'),
'change_torrent' => array('mod'),
'change_tor_status' => array('mod'),
@@ -279,6 +280,27 @@ class ajax_common
require(AJAX_DIR .'edit_user_profile.php');
}
+ function change_user_rank ()
+ {
+ global $datastore;
+
+ $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");
+
+ $this->response['html'] = ($rank_id != 0) ? 'Присвоено звание '. $ranks[$rank_id]['rank_title'] .'' : 'Звание снято';
+ }
+
function gen_passkey ()
{
global $userdata, $lang;
@@ -287,15 +309,20 @@ class ajax_common
if ($req_uid == $userdata['user_id'] || IS_ADMIN)
{
- $force_generate = (IS_ADMIN);
+ if (empty($this->request['confirmed']))
+ {
+ $msg = "Вы уверены, что хотите создать новый passkey?";
+ $this->prompt_for_confirm($msg);
+ }
- if (!$passkey = generate_passkey($req_uid, $force_generate))
+ 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']);
}
function view_post ()
diff --git a/upload/ajax/edit_user_profile.php b/upload/ajax/edit_user_profile.php
index a04d126e9..7fc75f835 100644
--- a/upload/ajax/edit_user_profile.php
+++ b/upload/ajax/edit_user_profile.php
@@ -18,6 +18,34 @@ $value = (string) $this->request['value'];
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?://[a-z0-9_:;?&=/.%~\-]+$#i', $value))
+ {
+ $this->response['new_value'] = htmlCHR($value);
+ }
+ else $this->ajax_die(' "" http:// ');
+ break;
+
case 'user_regdate':
case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
diff --git a/upload/config.php b/upload/config.php
index e051070ce..888ca266c 100644
--- a/upload/config.php
+++ b/upload/config.php
@@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2';
-$bb_cfg['tp_release_state'] = 'TP II r56';
+$bb_cfg['tp_release_state'] = 'TP II r57';
$bb_cfg['tp_release_date'] = '02-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
@@ -428,7 +428,6 @@ $bb_cfg['show_rank_image'] = true;
$bb_cfg['show_poster_joined'] = true;
$bb_cfg['show_poster_posts'] = true;
$bb_cfg['show_poster_from'] = true;
-$bb_cfg['show_poster_flag'] = true;
$bb_cfg['show_bot_nick'] = false;
$bb_cfg['text_buttons'] = true; // replace EDIT, QUOTE... images with text links
$bb_cfg['parse_ed2k_links'] = true; // make ed2k links clickable
diff --git a/upload/includes/bbcode.php b/upload/includes/bbcode.php
index 45835691c..68ba37555 100644
--- a/upload/includes/bbcode.php
+++ b/upload/includes/bbcode.php
@@ -448,18 +448,18 @@ function extract_search_words ($text)
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
$max_word_len = $bb_cfg['search_max_word_len'];
- $text = ' ' . str_compact(strip_tags(strtolower($text))) . ' ';
+ $text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
$text = str_replace(array('[', ']'), array('[', ']'), $text);
// HTML entities like
- $text = preg_replace('/(\w*?)?[0-9a-z]+;(\w*?)/i', '', $text);
- // Remove URL's
- $text = preg_replace('#\b[a-z0-9]+://[0-9a-z\.\-]+(/[0-9a-z\?\.%_\-\+=&/]+)?#', ' ', $text);
+ $text = preg_replace('/(\w*?)?[0-9a-z]+;(\w*?)/iu', '', $text);
+ // Remove URL's ((www|ftp)\.[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]*?)
+ $text = preg_replace('#\b[a-z0-9]+://[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+(/[0-9a-z\?\.%_\-\+=&/]+)?#u', ' ', $text);
$text = strip_bbcode($text);
// Filter out characters like ^, $, &, change "it's" to "its"
- $text = preg_replace('#\W#', ' ', $text);
+ $text = preg_replace('#[.,:;]#u', ' ', $text);
// short & long words
$text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#', ' ', $text);
diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index e8dfd3b86..2dc9f86f1 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -1759,19 +1759,6 @@ function make_jumpbox ($selected = 0)
));
}
-function make_user_flag($country_code)
-{
- global $lang;
-
- if(!defined('COUNTRIES_LANG'))
- {
- include(LANG_DIR . "lang_countries.php");
- }
-
- $title = $lang['COUNTRIES'][$country_code];
- return "
";
-}
-
// $mode: array(not_auth_forum1,not_auth_forum2,..) or (string) 'mode'
function get_forum_select ($mode = 'guest', $name = POST_FORUM_URL, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '', $all_forums_option = null)
{
diff --git a/upload/includes/functions_report.php b/upload/includes/functions_report.php
index e1d430ef0..a06849c57 100644
--- a/upload/includes/functions_report.php
+++ b/upload/includes/functions_report.php
@@ -106,6 +106,8 @@ function report_modules($mode = 'all', $module = null)
static $modules;
static $module_names;
+ if(!$bb_cfg['reports_enabled']) return false;
+
if (!isset($modules))
{
include(INC_DIR . "report_module.php");
diff --git a/upload/includes/init_bb.php b/upload/includes/init_bb.php
index 838e73b7a..40754dfe1 100644
--- a/upload/includes/init_bb.php
+++ b/upload/includes/init_bb.php
@@ -365,7 +365,6 @@ define('BB_BT_TORSTAT', 'bb_bt_torstat');
define('BB_CATEGORIES', 'bb_categories');
define('BB_CAPTCHA', 'bb_captcha');
define('BB_CONFIG', 'bb_config');
-define('BB_COUNTRIES', 'bb_countries');
define('BB_CRON', 'bb_cron');
define('BB_DATASTORE', 'bb_datastore');
define('BB_DISALLOW', 'bb_disallow');
diff --git a/upload/includes/sessions.php b/upload/includes/sessions.php
index 0f31be7e3..82e7e2d65 100644
--- a/upload/includes/sessions.php
+++ b/upload/includes/sessions.php
@@ -20,7 +20,6 @@ class user_common
*/
var $opt_js = array(
'only_new' => 0, // show ony new posts or topics
- 'h_flag' => 0, // hide flags
'h_av' => 0, // hide avatar
'h_rnk_i' => 0, // hide rank images
'h_post_i' => 0, // hide post images
@@ -231,7 +230,7 @@ class user_common
$login = (int) ($this->data['user_id'] != ANONYMOUS);
$is_user = ($this->data['user_level'] == USER);
$user_id = (int) $this->data['user_id'];
- $mod_admin_session = ($login && !$auto_created && !$is_user) ? $this->data['user_level'] : 0;
+ $mod_admin_session = ($this->data['user_level'] == ADMIN);
if (($bb_cfg['max_srv_load'] || $bb_cfg['max_reg_users_online']) && $login && $is_user && !$this->data['ignore_srv_load'])
{
diff --git a/upload/includes/ucp/usercp_avatar.php b/upload/includes/ucp/usercp_avatar.php
index f61b99318..fb2454b8f 100644
--- a/upload/includes/ucp/usercp_avatar.php
+++ b/upload/includes/ucp/usercp_avatar.php
@@ -296,97 +296,3 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
return '';
}
}
-
-function display_avatar_gallery($mode, $category, $user_id, $email, $current_email, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $website, $location, $user_flag, $occupation, $interests, $signature, $viewemail, $notifypm, $notifyreply, $attachsig, $hideonline, $style, $language, $timezone, $dateformat, &$session_id)
-{
- global $bb_cfg, $template, $lang, $images, $theme;
-
- $dir = @opendir($bb_cfg['avatar_gallery_path']);
-
- $avatar_images = array();
- while( $file = @readdir($dir) )
- {
- if( $file != '.' && $file != '..' && !is_file($bb_cfg['avatar_gallery_path'] . '/' . $file) && !is_link($bb_cfg['avatar_gallery_path'] . '/' . $file) )
- {
- $sub_dir = @opendir($bb_cfg['avatar_gallery_path'] . '/' . $file);
-
- $avatar_row_count = 0;
- $avatar_col_count = 0;
- while( $sub_file = @readdir($sub_dir) )
- {
- if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
- {
- $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $sub_file;
- $avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));
-
- $avatar_col_count++;
- if( $avatar_col_count == 5 )
- {
- $avatar_row_count++;
- $avatar_col_count = 0;
- }
- }
- }
- }
- }
-
- @closedir($dir);
-
- @ksort($avatar_images);
- @reset($avatar_images);
-
- if( empty($category) )
- {
- list($category, ) = each($avatar_images);
- }
- @reset($avatar_images);
-
- $s_categories = '';
-
- $s_colspan = 0;
- for($i = 0; $i < count($avatar_images[$category]); $i++)
- {
- $template->assign_block_vars("avatar_row", array());
-
- $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));
-
- for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
- {
- $template->assign_block_vars('avatar_row.avatar_column', array(
- "AVATAR_IMAGE" => $bb_cfg['avatar_gallery_path'] . '/' . $category . '/' . $avatar_images[$category][$i][$j],
- "AVATAR_NAME" => $avatar_name[$category][$i][$j])
- );
-
- $template->assign_block_vars('avatar_row.avatar_option_column', array(
- "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
- );
- }
- }
-
- $params = array('user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'website', 'location', 'user_flag', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'notifyreply', 'attachsig', 'hideonline', 'style', 'language', 'timezone', 'dateformat');
-
- $s_hidden_vars = '';
-
- for($i = 0; $i < count($params); $i++)
- {
- $s_hidden_vars .= '';
- }
-
- $template->assign_vars(array(
- 'S_CATEGORY_SELECT' => $s_categories,
- 'S_COLSPAN' => $s_colspan,
- 'S_PROFILE_ACTION' => append_sid("profile.php?mode=$mode"),
- 'S_HIDDEN_FIELDS' => $s_hidden_vars)
- );
-
- return;
-}
\ No newline at end of file
diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php
index d2340b90b..48966a13e 100644
--- a/upload/includes/ucp/usercp_viewprofile.php
+++ b/upload/includes/ucp/usercp_viewprofile.php
@@ -51,7 +51,7 @@ if (!$ranks = $datastore->get('ranks'))
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
-$poster_rank = $rank_image = '';
+$poster_rank = $rank_image = $rank_select = '';
if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
{
@@ -59,6 +59,16 @@ if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
$poster_rank = $ranks[$user_rank]['rank_title'];
}
+if (IS_ADMIN)
+{
+ $rank_select = array($lang['NO'] => 0);
+ foreach ($ranks as $row)
+ {
+ $rank_select[$row['rank_title']] = $row['rank_id'];
+ }
+ $rank_select = build_select('rank-sel', $rank_select, $user_rank);
+}
+
$temp_url = append_sid("privmsg.php?mode=post&" . POST_USERS_URL . "=" . $profiledata['user_id']);
$pm_img = '';
@@ -145,6 +155,7 @@ $template->assign_vars(array(
'USER_REGDATE' => bb_date($profiledata['user_regdate']),
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
+ 'RANK_SELECT' => $rank_select,
'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage . '%',
diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php
index a64cbae82..6806e245c 100644
--- a/upload/language/lang_english/lang_main.php
+++ b/upload/language/lang_english/lang_main.php
@@ -1437,6 +1437,7 @@ $lang['TORHELP_TITLE'] = 'Please help seeding these torrents!';
// Reports (need to translate it!)
//
$lang['REPORTS'] = 'Reports';
+$lang['REPORTS_DISABLE'] = 'Reports disabled';
$lang['NEW_REPORT'] = ' (one open)';
$lang['NO_NEW_REPORTS'] = ': no new Reports';
$lang['NEW_REPORTS'] = ' (%d open)';
diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php
index 2c846d6c9..e27c22408 100644
--- a/upload/language/lang_russian/lang_main.php
+++ b/upload/language/lang_russian/lang_main.php
@@ -1443,6 +1443,7 @@ $lang['TORHELP_TITLE'] = 'Этим раздачам необходима ваш
// Reports
//
$lang['REPORTS'] = 'Нарушения';
+$lang['REPORTS_DISABLE'] = 'Система нарушений отключена';
$lang['NEW_REPORT'] = ': одно открыто';
$lang['NEW_REPORTS'] = ': %d открыто';
$lang['NO_NEW_REPORTS'] = ': нет открытых';
diff --git a/upload/memberlist.php b/upload/memberlist.php
index a14376da2..cbb4687c0 100644
--- a/upload/memberlist.php
+++ b/upload/memberlist.php
@@ -152,7 +152,7 @@ $template->assign_vars(array(
));
// per-letter selection end
-$sql = "SELECT username, user_id, user_opt, user_posts, user_regdate, user_from, user_from_flag, user_website, user_email, user_icq, user_avatar, user_avatar_type, user_allowavatar
+$sql = "SELECT username, user_id, user_opt, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_avatar, user_avatar_type, user_allowavatar
FROM ". BB_USERS ."
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")";
if ( $username )
@@ -173,9 +173,6 @@ if ( $row = DB()->sql_fetchrow($result) )
$username = $row['username'];
$user_id = $row['user_id'];
$from = $row['user_from'];
-// FLAGHACK-start
- $flag = ($row['user_from_flag'] && $row['user_from_flag'] != 'blank.gif') ? make_user_flag($row['user_from_flag']) : '';
-// FLAGHACK-end
$joined = bb_date($row['user_regdate'], $lang['DATE_FORMAT']);
$posts = $row['user_posts'];
@@ -212,7 +209,6 @@ if ( $row = DB()->sql_fetchrow($result) )
'ROW_CLASS' => $row_class,
'USERNAME' => $username,
'FROM' => $from,
- 'FLAG' => $flag,
'JOINED_RAW' => $row['user_regdate'],
'JOINED' => $joined,
'POSTS' => $posts,
diff --git a/upload/report.php b/upload/report.php
index 0786f515b..0228a32f7 100644
--- a/upload/report.php
+++ b/upload/report.php
@@ -10,6 +10,8 @@ require(INC_DIR ."functions_report.php");
// Init userdata
$user->session_start(array('req_login' => true));
+if(!$bb_cfg['reports_enabled']) bb_die($lang['REPORTS_DISABLE']);
+
$return_links = array(
'index' => '
' . sprintf($lang['CLICK_RETURN_INDEX'], '', ''),
'list' => '
' . sprintf($lang['CLICK_RETURN_REPORT_LIST'], '', '')
diff --git a/upload/templates/admin/admin_users.tpl b/upload/templates/admin/admin_users.tpl
index 47fad995d..bb4fb0d39 100644
--- a/upload/templates/admin/admin_users.tpl
+++ b/upload/templates/admin/admin_users.tpl
@@ -104,18 +104,6 @@
-
-
{FLAG_SELECT} | -
{AVATAR_IMG}
- -{POSTER_RANK}
++ + {RANK_SELECT} + +
+ + {POSTER_RANK} -