откат git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@492 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
pherum83 2013-01-14 21:28:22 +00:00
commit 1993d6c9cc
18 changed files with 3495 additions and 3355 deletions

View file

@ -665,7 +665,7 @@ INSERT INTO `bb_config` VALUES ('report_notify', '0');
INSERT INTO `bb_config` VALUES ('report_list_admin', '0');
INSERT INTO `bb_config` VALUES ('report_new_window', '0');
INSERT INTO `bb_config` VALUES ('torrent_pass_private_key', 'вставить_из_конфига_XBTT');
INSERT INTO `bb_config` VALUES ('cron_enabled', '0');
INSERT INTO `bb_config` VALUES ('cron_enabled', '1');
INSERT INTO `bb_config` VALUES ('cron_check_interval', '300');
INSERT INTO `bb_config` VALUES ('reports_enabled', '1');
INSERT INTO `bb_config` VALUES ('gallery_enabled', '1');

View file

@ -8,46 +8,48 @@ require('./common.php');
$ajax->init();
// Handle "board disabled via ON/OFF trigger"
if (file_exists(BB_DISABLED)) {
if (file_exists(BB_DISABLED))
{
$ajax->ajax_die($bb_cfg['board_disabled_msg']);
}
// Load actions required modules
switch ($ajax->action) {
switch ($ajax->action)
{
case 'view_post':
require(INC_DIR . 'bbcode.php');
require(INC_DIR .'bbcode.php');
break;
case 'posts':
case 'post_mod_comment':
require(INC_DIR . 'bbcode.php');
require(INC_DIR . 'functions_post.php');
require(INC_DIR . 'functions_admin.php');
require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php');
require(INC_DIR .'functions_admin.php');
break;
case 'view_torrent':
case 'mod_action':
case 'change_tor_status':
case 'gen_passkey';
require(BB_ROOT . 'attach_mod/attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
require(BB_ROOT .'attach_mod/attachment_mod.php');
require(INC_DIR .'functions_torrent.php');
break;
case 'change_torrent':
require(BB_ROOT . 'attach_mod/attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
require(BB_ROOT .'attach_mod/attachment_mod.php');
require(INC_DIR .'functions_torrent.php');
break;
case 'user_register':
require(INC_DIR . 'functions_validate.php');
require(INC_DIR .'functions_validate.php');
break;
case 'manage_user':
require(INC_DIR . 'functions_admin.php');
require(INC_DIR .'functions_admin.php');
break;
case 'group_membership':
require(INC_DIR . 'functions_group.php');
require(INC_DIR .'functions_group.php');
break;
}
@ -75,6 +77,7 @@ class ajax_common
'mod_action' => array('mod'),
'topic_tpl' => array('mod'),
'group_membership' => array('mod'),
'post_mod_comment' => array('mod'),
'gen_passkey' => array('user'),
'change_torrent' => array('user'),
@ -86,16 +89,14 @@ class ajax_common
'user_register' => array('guest'),
'posts' => array('guest'),
'index_data' => array('guest'),
'post_mod_comment' => array('mod'),
);
);
var $action = null;
/**
* Constructor
*/
function ajax_common()
function ajax_common ()
{
ob_start(array(&$this, 'ob_handler'));
header('Content-Type: text/plain');
@ -104,40 +105,47 @@ class ajax_common
/**
* Perform action
*/
function exec()
function exec ()
{
global $lang;
// Exit if we already have errors
if (!empty($this->response['error_code'])) {
if (!empty($this->response['error_code']))
{
$this->send();
}
// Check that requested action is valid
$action = $this->action;
if (!$action || !is_string($action)) {
if (!$action || !is_string($action))
{
$this->ajax_die('no action specified');
} else if (!$action_params =& $this->valid_actions[$action]) {
$this->ajax_die('invalid action: ' . $action);
}
else if (!$action_params =& $this->valid_actions[$action])
{
$this->ajax_die('invalid action: '. $action);
}
// Auth check
switch ($action_params[AJAX_AUTH]) {
switch ($action_params[AJAX_AUTH])
{
// GUEST
case 'guest':
break;
// USER
case 'user':
if (IS_GUEST) {
if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
break;
// MOD
case 'mod':
if (!IS_AM) {
if (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
$this->check_admin_session();
@ -145,7 +153,8 @@ class ajax_common
// ADMIN
case 'admin':
if (!IS_ADMIN) {
if (!IS_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_ADMIN']);
}
$this->check_admin_session();
@ -165,7 +174,7 @@ class ajax_common
/**
* Exit on error
*/
function ajax_die($error_msg, $error_code = E_AJAX_GENERAL_ERROR)
function ajax_die ($error_msg, $error_code = E_AJAX_GENERAL_ERROR)
{
$this->response['error_code'] = $error_code;
$this->response['error_msg'] = $error_msg;
@ -176,7 +185,7 @@ class ajax_common
/**
* Initialization
*/
function init()
function init ()
{
$this->request = $_POST;
$this->action =& $this->request['action'];
@ -185,11 +194,12 @@ class ajax_common
/**
* Send data
*/
function send()
function send ()
{
$this->response['action'] = $this->action;
if (DBG_USER && SQL_DEBUG && !empty($_COOKIE['sql_log'])) {
if (DBG_USER && SQL_DEBUG && !empty($_COOKIE['sql_log']))
{
$this->response['sql_log'] = get_sql_log();
}
@ -200,18 +210,22 @@ class ajax_common
/**
* OB Handler
*/
function ob_handler($contents)
function ob_handler ($contents)
{
if (DBG_USER)
{
if ($contents)
{
if (DBG_USER) {
if ($contents) {
$this->response['raw_output'] = $contents;
}
}
$response_js = bb_json_encode($this->response);
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000) {
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
{
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000)
{
header('Content-Encoding: gzip');
$response_js = gzencode($response_js, 1);
}
@ -223,19 +237,24 @@ class ajax_common
/**
* Admin session
*/
function check_admin_session()
function check_admin_session ()
{
global $user;
if (!$user->data['session_admin']) {
if (empty($this->request['user_password'])) {
if (!$user->data['session_admin'])
{
if (empty($this->request['user_password']))
{
$this->prompt_for_password();
} else {
}
else
{
$login_args = array(
'login_username' => $user->data['username'],
'login_password' => $_POST['user_password'],
);
if (!$user->login($login_args, true)) {
if (!$user->login($login_args, true))
{
$this->ajax_die('Wrong password');
}
}
@ -245,7 +264,7 @@ class ajax_common
/**
* Prompt for password
*/
function prompt_for_password()
function prompt_for_password ()
{
$this->response['prompt_password'] = 1;
$this->send();
@ -254,9 +273,9 @@ class ajax_common
/**
* Prompt for confirmation
*/
function prompt_for_confirm($confirm_msg)
function prompt_for_confirm ($confirm_msg)
{
if (empty($confirm_msg)) $this->ajax_die('false');
if(empty($confirm_msg)) $this->ajax_die('false');
$this->response['prompt_confirm'] = 1;
$this->response['confirm_msg'] = $confirm_msg;
@ -266,138 +285,161 @@ class ajax_common
/**
* Verify mod rights
*/
function verify_mod_rights($forum_id)
function verify_mod_rights ($forum_id)
{
global $userdata, $lang;
$is_auth = auth(AUTH_MOD, $forum_id, $userdata);
if (!$is_auth['auth_mod']) {
if (!$is_auth['auth_mod'])
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
}
function edit_user_profile()
function edit_user_profile ()
{
require(AJAX_DIR . 'edit_user_profile.php');
require(AJAX_DIR .'edit_user_profile.php');
}
function change_user_rank()
function change_user_rank ()
{
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)) {
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])) {
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");
DB()->query("UPDATE ". BB_USERS ." SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1");
cache_rm_user_sessions($user_id);
$this->response['html'] = ($rank_id != 0) ? $lang['AWARDED_RANK'] . ' <b> ' . $ranks[$rank_id]['rank_title'] . '</b>' : $lang['SHOT_RANK'];
$this->response['html'] = ($rank_id != 0) ? $lang['AWARDED_RANK'] . ' <b> '. $ranks[$rank_id]['rank_title'] .'</b>' : $lang['SHOT_RANK'];
}
function change_user_opt()
function change_user_opt ()
{
global $bf, $lang;
$user_id = (int)$this->request['user_id'];
$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)) {
if (!$user_id OR !$u_data = get_userdata($user_id))
{
$this->ajax_die('invalid user_id');
}
if (!is_array($new_opt)) {
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])) {
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");
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);
cache_rm_user_sessions ($user_id);
$this->response['resp_html'] = $lang['SAVED'];
}
function gen_passkey()
function gen_passkey ()
{
global $userdata, $lang;
$req_uid = (int)$this->request['user_id'];
$req_uid = (int) $this->request['user_id'];
if ($req_uid == $userdata['user_id'] || IS_ADMIN) {
if (empty($this->request['confirmed'])) {
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)) {
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']);
}
else $this->ajax_die($lang['NOT_AUTHORISED']);
}
// User groups membership
function group_membership()
function group_membership ()
{
global $lang, $user;
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id)) {
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']) {
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
switch ($mode) {
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)
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) {
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) {
if (IS_ADMIN)
{
$href .= "&amp;u=$user_id";
$link = '<a href="' . $href . '" class="' . $class . '" target="_blank">' . htmlCHR($row['group_name']) . '</a>';
$link = '<a href="'. $href .'" class="'. $class .'" target="_blank">'. htmlCHR($row['group_name']) .'</a>';
$html[] = $link;
} else {
}
else
{
// скрытая группа и сам юзер не является её членом
if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view']) {
if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view'])
{
continue;
}
if ($row['group_moderator'] == $user->id) {
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>';
$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 {
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;
@ -407,103 +449,110 @@ class ajax_common
}
}
function post_mod_comment()
function post_mod_comment ()
{
global $lang, $userdata;
$post_id = (int)$this->request['post_id'];
$post_id = (int) $this->request['post_id'];
$post = DB()->fetch_row("SELECT t.*, f.*, p.*, pt.post_text
FROM " . BB_TOPICS . " t, " . BB_FORUMS . " f, " . BB_POSTS . " p, " . BB_POSTS_TEXT . " pt
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND f.forum_id = t.forum_id
AND p.post_id = pt.post_id
LIMIT 1");
if (!$post) $this->ajax_die('not post');
$type = (int)$this->request['mc_type'];
$text = (string)$this->request['mc_text'];
if(!$post) $this->ajax_die('not post');
$type = (int) $this->request['mc_type'];
$text = (string) $this->request['mc_text'];
$text = prepare_message($text);
if (!$text) $this->ajax_die('no text');
DB()->query("UPDATE " . BB_POSTS . " SET post_mod_comment = '" . DB()->escape($text) . "', post_mod_comment_type = $type, post_mc_mod_id = " . $userdata['user_id'] . ", post_mc_mod_name = '" . $userdata['username'] . "' WHERE post_id = $post_id LIMIT 1");
DB()->query("UPDATE ". BB_POSTS ." SET post_mod_comment = '". DB()->escape($text) ."', post_mod_comment_type = $type, post_mc_mod_id = ". $userdata['user_id'] .", post_mc_mod_name = '". $userdata['username'] ."' WHERE post_id = $post_id LIMIT 1");
$this->response['type'] = $type;
$this->response['post_id'] = $post_id;
if ($type == 0) $this->response['html'] = '';
else if ($type == 1) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C">' . profile_url($userdata) . '&nbsp;' . $lang['WROTE'] . ':<br /><br />' . bbcode2html($text) . '</td></tr></table></div>';
else if ($type == 2) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W">' . profile_url($userdata) . '&nbsp;' . $lang['WROTE'] . ':<br /><br />' . bbcode2html($text) . '</td></tr></table></div>';
else if ($type == 1) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>';
else if ($type == 2) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>';
}
function view_post()
function view_post ()
{
require(AJAX_DIR . 'view_post.php');
require(AJAX_DIR .'view_post.php');
}
function change_tor_status()
function change_tor_status ()
{
require(AJAX_DIR . 'change_tor_status.php');
require(AJAX_DIR .'change_tor_status.php');
}
function change_torrent()
function change_torrent ()
{
require(AJAX_DIR . 'change_torrent.php');
require(AJAX_DIR .'change_torrent.php');
}
function view_torrent()
function view_torrent ()
{
require(AJAX_DIR . 'view_torrent.php');
require(AJAX_DIR .'view_torrent.php');
}
function user_register()
{
require(AJAX_DIR . 'user_register.php');
require(AJAX_DIR .'user_register.php');
}
function mod_action()
{
require(AJAX_DIR . 'mod_action.php');
require(AJAX_DIR .'mod_action.php');
}
function posts()
{
require(AJAX_DIR . 'posts.php');
require(AJAX_DIR .'posts.php');
}
function manage_user()
{
require(AJAX_DIR . 'manage_user.php');
require(AJAX_DIR .'manage_user.php');
}
function topic_tpl()
{
require(AJAX_DIR . 'topic_tpl.php');
require(AJAX_DIR .'topic_tpl.php');
}
function index_data()
{
require(AJAX_DIR . 'index_data.php');
require(AJAX_DIR .'index_data.php');
}
function modify_draft()
{
global $userdata;
$tid = (int)$this->request["id_draft"];
$mode = (int)$this->request["mode"];
$sql = "SELECT * FROM " . BB_TOPICS . " WHERE topic_id = {$tid}";
if (!$row = DB()->fetch_row($sql)) {
$this->ajax_die("Нет такого черновика");
}
//if($bb_cfg['status_of_draft'] || !$bb_cfg['status_of_draft']) $this->ajax_die('Профилактика !!!');
if ($row["topic_poster"] != $userdata["user_id"] && !IS_ADMIN) {
$this->ajax_die("Нельзя удалять чужие черновики");
$tid = (int) $this->request['id_draft'];
$mode = (int) $this->request['mode'];
$row = DB()->fetch_row("SELECT * FROM " . BB_TOPICS . " WHERE topic_id = {$tid}");
if(!$row) $this->ajax_die('Нет такого черновика');
if($row['topic_poster'] != $userdata['user_id'] && !IS_ADMIN)
{
$this->ajax_die('Нельзя удалять чужие черновики');
}
print_r($mode);
if (!$mode) {
DB()->query("DELETE FROM `bb_topics` WHERE `topic_id`={$tid} LIMIT 1;");
}else {
DB()->query("UPDATE `bb_topics` SET `is_draft`=0 WHERE `topic_id`={$tid}");
if(!$mode)
{
DB()->query("DELETE FROM ". BB_TOPICS ." WHERE topic_id = {$tid}");
}
else
{
DB()->query("UPDATE ". BB_TOPICS ." SET is_draft = 0 WHERE topic_id = {$tid}");
}
$this->response["tid"] = $tid;
$this->response['tid'] = $tid;
}
}

View file

@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 pre-stable';
$bb_cfg['tp_release_date'] = '13-01-2013';
$bb_cfg['tp_release_state'] = 'R491';
$bb_cfg['tp_release_date'] = '15-01-2013';
$bb_cfg['tp_release_state'] = 'R492';
// Database
$charset = 'utf8';

View file

@ -157,6 +157,7 @@ if ($bb_cfg['show_network_news'] AND $net_forum_ids = $bb_cfg['network_news_foru
FROM ". BB_TOPICS ."
WHERE forum_id IN ($net_forum_ids)
AND topic_moved_id = 0
AND is_draft = 0
ORDER BY topic_time DESC
LIMIT $net_count
");

View file

@ -162,7 +162,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
$is_draft = (empty($_POST['to_draft'])) ? 0 : 1;
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $is_draft)" : "UPDATE " . BB_TOPICS . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", is_draft={$is_draft}" . " WHERE topic_id = $topic_id";
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $is_draft)" : "UPDATE " . BB_TOPICS . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", is_draft = {$is_draft}" . " WHERE topic_id = $topic_id";
if (!DB()->sql_query($sql))
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@ define('IN_PHPBB', true);
define('BB_SCRIPT', 'login');
define('IN_LOGIN', true);
define('BB_ROOT', './');
require(BB_ROOT ."common.php");
require(BB_ROOT .'common.php');
array_deep($_POST, 'trim');

View file

@ -3,7 +3,7 @@
define('IN_PHPBB', true);
define('BB_SCRIPT', 'misc');
define('BB_ROOT', './');
require(BB_ROOT ."common.php");
require(BB_ROOT .'common.php');
// Start Session Management
$user->session_start();

View file

@ -527,3 +527,82 @@ $(document).ready(function(){
}
});
});
/**
* Autocomplete password
**/
var array_for_rand_pass = ["a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F", "g", "G", "h", "H", "i", "I", "j", "J", "k", "K", "l", "L", "m", "M", "n", "N", "o", "O", "p", "P", "q", "Q", "r", "R", "s", "S", "t", "T", "u", "U", "v", "V", "w", "W", "x", "X", "y", "Y", "z", "Z", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var array_rand = function (array) {
var array_length = array.length;
var result = Math.random() * array_length;
return Math.floor(result);
};
var autocomplete = function (noCenter) {
var string_result = ""; // Empty string
for (var i = 1; i <= 8; i++) {
string_result += array_for_rand_pass[array_rand(array_for_rand_pass)];
}
var _popup_left = (Math.ceil(window.screen.availWidth / 2) - 150);
var _popup_top = (Math.ceil(window.screen.availHeight / 2) - 50);
if (!noCenter) {
$("div#autocomplete_popup").css({
left:_popup_left + "px",
top:_popup_top + "px"
}).show(1000);
} else {
$("div#autocomplete_popup").show(1000);
}
$("input#pass, input#pass_confirm, div#autocomplete_popup input").each(function () {
$(this).val(string_result);
});
};
$(document).ready(function () {
$("span#autocomplete").click(function() {
autocomplete();
});
// перемещение окна
var _X, _Y;
var _bMoveble = false;
$("div#autocomplete_popup div.title").mousedown(function (event) {
_bMoveble = true;
_X = event.clientX;
_Y = event.clientY;
});
$("div#autocomplete_popup div.title").mousemove(function (event) {
var jFrame = $("div#autocomplete_popup");
var jFLeft = parseInt(jFrame.css("left"));
var jFTop = parseInt(jFrame.css("top"));
if (_bMoveble) {
if (event.clientX < _X) {
jFrame.css("left", jFLeft - (_X - event.clientX) + "px");
} else {
jFrame.css("left", (jFLeft + (event.clientX - _X)) + "px");
}
if (event.clientY < _Y) {
jFrame.css("top", jFTop - (_Y - event.clientY) + "px");
} else {
jFrame.css("top", (jFTop + (event.clientY - _Y)) + "px");
}
_X = event.clientX;
_Y = event.clientY;
}
});
$("div#autocomplete_popup div.title").mouseup(function () {
_bMoveble = false;
}).mouseout(function () {
_bMoveble = false;
});
});

View file

@ -3,28 +3,28 @@
define('IN_PHPBB', true);
define('BB_SCRIPT', 'posting');
define('BB_ROOT', './');
require(BB_ROOT . "common.php");
require(INC_DIR . 'bbcode.php');
require(INC_DIR . 'functions_post.php');
require(BB_ROOT . 'attach_mod/attachment_mod.php');
require(BB_ROOT ."common.php");
require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php');
require(BB_ROOT .'attach_mod/attachment_mod.php');
$page_cfg['load_tpl_vars'] = array(
'post_icons',
);
$submit = (bool)@$_REQUEST['post'];
$preview = (bool)@$_REQUEST['preview'];
$delete = (bool)@$_REQUEST['delete'];
$poll_delete = (bool)@$_REQUEST['poll_delete'];
$poll_add = (bool)@$_REQUEST['add_poll_option'];
$poll_edit = (bool)@$_REQUEST['edit_poll_option'];
$topic_tpl = (bool)@$_REQUEST['tpl'];
$submit = (bool) @$_REQUEST['post'];
$preview = (bool) @$_REQUEST['preview'];
$delete = (bool) @$_REQUEST['delete'];
$poll_delete = (bool) @$_REQUEST['poll_delete'];
$poll_add = (bool) @$_REQUEST['add_poll_option'];
$poll_edit = (bool) @$_REQUEST['edit_poll_option'];
$topic_tpl = (bool) @$_REQUEST['tpl'];
$forum_id = (int)@$_REQUEST[POST_FORUM_URL];
$topic_id = (int)@$_REQUEST[POST_TOPIC_URL];
$post_id = (int)@$_REQUEST[POST_POST_URL];
$forum_id = (int) @$_REQUEST[POST_FORUM_URL];
$topic_id = (int) @$_REQUEST[POST_TOPIC_URL];
$post_id = (int) @$_REQUEST[POST_POST_URL];
$mode = (string)@$_REQUEST['mode'];
$mode = (string) @$_REQUEST['mode'];
$confirm = isset($_POST['confirm']);
@ -34,10 +34,11 @@ $refresh = $preview || $poll_add || $poll_edit || $poll_delete;
$orig_word = $replacement_word = array();
// Set topic type
$topic_type = (@$_POST['topictype']) ? (int)$_POST['topictype'] : POST_NORMAL;
$topic_type = (@$_POST['topictype']) ? (int) $_POST['topictype'] : POST_NORMAL;
$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
if ($mode == 'smilies') {
if ($mode == 'smilies')
{
generate_smilies('window');
exit;
}
@ -48,35 +49,45 @@ $tracking_forums = get_tracks('forum');
// Start session management
$user->session_start();
if ($mode == 'new_rel') {
require(INC_DIR . 'posting_tpl.php');
if ($mode == 'new_rel')
{
require(INC_DIR .'posting_tpl.php');
exit;
}
// What auth type do we need to check?
$is_auth = array();
switch ($mode) {
switch ($mode)
{
case 'newtopic':
if (bf($userdata['user_opt'], 'user_opt', 'allow_topic')) {
if(bf($userdata['user_opt'], 'user_opt', 'allow_topic'))
{
bb_die($lang['RULES_POST_CANNOT']);
}
if ($topic_type == POST_ANNOUNCE) {
if ($topic_type == POST_ANNOUNCE)
{
$is_auth_type = 'auth_announce';
} else if ($topic_type == POST_STICKY) {
}
else if ($topic_type == POST_STICKY)
{
$is_auth_type = 'auth_sticky';
} else {
}
else
{
$is_auth_type = 'auth_post';
}
break;
case 'reply':
case 'quote':
if (bf($userdata['user_opt'], 'user_opt', 'allow_post')) {
if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
{
bb_die($lang['RULES_REPLY_CANNOT']);
}
$is_auth_type = 'auth_reply';
break;
case 'editpost':
if (bf($userdata['user_opt'], 'user_opt', 'allow_post_edit')) {
if(bf($userdata['user_opt'], 'user_opt', 'allow_post_edit'))
{
bb_die($lang['RULES_EDIT_CANNOT']);
}
$is_auth_type = 'auth_edit';
@ -97,21 +108,24 @@ switch ($mode) {
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
$error_msg = '';
$post_data = array();
switch ($mode) {
switch ($mode)
{
case 'newtopic':
if (!$forum_id) {
if (!$forum_id)
{
message_die(GENERAL_MESSAGE, $lang['FORUM_NOT_EXIST']);
}
$sql = "SELECT * FROM " . BB_FORUMS . " WHERE forum_id = $forum_id LIMIT 1";
$sql = "SELECT * FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
break;
case 'reply':
case 'vote':
if (!$topic_id) {
if (!$topic_id)
{
message_die(GENERAL_MESSAGE, $lang['NO_TOPIC_ID']);
}
$sql = "SELECT f.*, t.*
FROM " . BB_FORUMS . " f, " . BB_TOPICS . " t
FROM ". BB_FORUMS ." f, ". BB_TOPICS ." t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id
LIMIT 1";
@ -121,14 +135,15 @@ switch ($mode) {
case 'editpost':
case 'delete':
case 'poll_delete':
if (!$post_id) {
if (!$post_id)
{
message_die(GENERAL_MESSAGE, $lang['NO_POST_ID']);
}
$select_sql = 'SELECT f.*, t.*, p.*';
$select_sql .= (!$submit) ? ', pt.*, u.username, u.user_id' : '';
$from_sql = "FROM " . BB_POSTS . " p, " . BB_TOPICS . " t, " . BB_FORUMS . " f";
$from_sql = "FROM ". BB_POSTS ." p, ". BB_TOPICS ." t, ". BB_FORUMS ." f";
$from_sql .= (!$submit) ? ", " . BB_POSTS_TEXT . " pt, " . BB_USERS . " u" : '';
$where_sql = "
@ -148,73 +163,94 @@ switch ($mode) {
message_die(GENERAL_MESSAGE, $lang['NO_VALID_MODE']);
}
if ($post_info = DB()->fetch_row($sql)) {
if ($post_info = DB()->fetch_row($sql))
{
$forum_id = $post_info['forum_id'];
$forum_name = $post_info['forum_name'];
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
if ($post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) {
if ($post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['FORUM_LOCKED']);
} else if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) {
}
else if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['TOPIC_LOCKED']);
}
if ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete') {
if ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete')
{
$topic_id = $post_info['topic_id'];
$post_data['poster_post'] = ($post_info['poster_id'] == $userdata['user_id']);
$post_data['first_post'] = ($post_info['topic_first_post_id'] == $post_id);
$post_data['last_post'] = ($post_info['topic_last_post_id'] == $post_id);
$post_data['last_topic'] = ($post_info['forum_last_post_id'] == $post_id);
$post_data['has_poll'] = (bool)$post_info['topic_vote'];
$post_data['has_poll'] = (bool) $post_info['topic_vote'];
$post_data['topic_type'] = $post_info['topic_type'];
$post_data['poster_id'] = $post_info['poster_id'];
if ($post_data['first_post'] && $post_data['has_poll']) {
if ($post_data['first_post'] && $post_data['has_poll'])
{
$sql = "SELECT *
FROM " . BB_VOTE_DESC . " vd, " . BB_VOTE_RESULTS . " vr
FROM ". BB_VOTE_DESC ." vd, ". BB_VOTE_RESULTS ." vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id";
if (!$result = DB()->sql_query($sql)) {
if (!$result = DB()->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
}
$poll_options = array();
$poll_results_sum = 0;
if ($row = DB()->sql_fetchrow($result)) {
if ($row = DB()->sql_fetchrow($result))
{
$poll_title = $row['vote_text'];
$poll_id = $row['vote_id'];
$poll_length = $row['vote_length'] / 86400;
do {
do
{
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
$poll_results_sum += $row['vote_result'];
} while ($row = DB()->sql_fetchrow($result));
}
while ($row = DB()->sql_fetchrow($result));
}
$post_data['edit_poll'] = ((!$poll_results_sum || $is_auth['auth_mod']) && $post_data['first_post']);
} else {
}
else
{
$post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']);
}
// Can this user edit/delete the post/poll?
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) {
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'])
{
$message = ($delete || $mode == 'delete') ? $lang['DELETE_OWN_POSTS'] : $lang['EDIT_OWN_POSTS'];
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . TOPIC_URL . $topic_id . '">', '</a>');
$message .= '<br /><br />'. sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="'. TOPIC_URL . $topic_id .'">', '</a>');
message_die(GENERAL_MESSAGE, $message);
} else if (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete)) {
}
else if (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete))
{
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_REPLIED']);
} else if (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete)) {
}
else if (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete))
{
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_POLL']);
}
} else {
if ($mode == 'quote') {
}
else
{
if ($mode == 'quote')
{
$topic_id = $post_info['topic_id'];
}
if ($mode == 'newtopic') {
if ($mode == 'newtopic')
{
$post_data['topic_type'] = POST_NORMAL;
}
$post_data['first_post'] = ($mode == 'newtopic');
@ -222,21 +258,27 @@ if ($post_info = DB()->fetch_row($sql)) {
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
}
if ($mode == 'poll_delete' && !$poll_id) {
if ($mode == 'poll_delete' && !$poll_id)
{
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
}
} else {
}
else
{
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
}
// The user is not authed, if they're not logged in then redirect
// them, else show them an error message
if (!$is_auth[$is_auth_type]) {
if (!IS_GUEST) {
message_die(GENERAL_MESSAGE, sprintf($lang['SORRY_' . strtoupper($is_auth_type)], $is_auth[$is_auth_type . '_type']));
if (!$is_auth[$is_auth_type])
{
if (!IS_GUEST)
{
message_die(GENERAL_MESSAGE, sprintf($lang['SORRY_'. strtoupper($is_auth_type)], $is_auth[$is_auth_type .'_type']));
}
switch ($mode) {
switch ($mode)
{
case 'newtopic':
$redirect = "mode=newtopic&f=$forum_id";
break;
@ -253,10 +295,12 @@ if (!$is_auth[$is_auth_type]) {
redirect("login.php?redirect=/posting.php?$redirect");
}
if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id']) {
if ($tor_status = join(',', $bb_cfg['tor_cannot_new'])) {
if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id'])
{
if($tor_status = join(',', $bb_cfg['tor_cannot_new']))
{
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
FROM ". BB_BT_TORRENTS ." tor, ". BB_TOPICS ." t
WHERE poster_id = {$userdata['user_id']}
AND tor.topic_id = t.topic_id
AND tor.tor_status IN ($tor_status)
@ -264,27 +308,33 @@ if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id']) {
");
$topics = '';
foreach ($sql as $row) {
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
foreach($sql as $row)
{
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] .'<a href="'. TOPIC_URL . $row['topic_id'] .'">'. $row['topic_title'] .'</a><div class="spacer_12"></div>';
}
if ($topics) bb_die($topics . $lang['UNEXECUTED_RELEASE']);
}
require(INC_DIR . 'topic_templates.php');
require(INC_DIR .'topic_templates.php');
}
// Notify
if ($submit || $refresh) {
$notify_user = (int)!empty($_POST['notify']);
$to_draft = (int)!empty($_POST['to_draft']);
} else {
$to_draft = ($bb_cfg['status_of_draft'] && $mode == 'editpost') ? $post_info['is_draft'] : false;
if ($submit || $refresh)
{
$notify_user = (int) !empty($_POST['notify']);
$to_draft = (int) !empty($_POST['to_draft']);
}
else
{
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
if (!IS_GUEST && $mode != 'newtopic' && !$notify_user) {
$notify_user = (int)DB()->fetch_row("
$to_draft = ($bb_cfg['status_of_draft'] && $mode == 'editpost') ? $post_info['is_draft'] : false;
if (!IS_GUEST && $mode != 'newtopic' && !$notify_user)
{
$notify_user = (int) DB()->fetch_row("
SELECT topic_id
FROM " . BB_TOPICS_WATCH . "
FROM ". BB_TOPICS_WATCH ."
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'] . "
AND user_id = ". $userdata['user_id'] ."
");
}
}
@ -296,21 +346,25 @@ execute_posting_attachment_handling();
// если за время пока вы писали ответ, в топике появились новые сообщения, перед тем как ваше сообщение будет отправлено, выводится предупреждение с обзором этих сообщений
$topic_has_new_posts = false;
if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote' || $mode == 'reply') && isset($_COOKIE[COOKIE_TOPIC])) {
if ($topic_last_read = max(intval(@$tracking_topics[$topic_id]), intval(@$tracking_forums[$forum_id]))) {
if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote' || $mode == 'reply') && isset($_COOKIE[COOKIE_TOPIC]))
{
if ($topic_last_read = max(intval(@$tracking_topics[$topic_id]), intval(@$tracking_forums[$forum_id])))
{
$sql = "SELECT p.*, pt.post_text, u.username, u.user_rank
FROM " . BB_POSTS . " p, " . BB_POSTS_TEXT . " pt, " . BB_USERS . " u
WHERE p.topic_id = " . (int)$topic_id . "
FROM ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt, ". BB_USERS ." u
WHERE p.topic_id = ". (int) $topic_id ."
AND u.user_id = p.poster_id
AND pt.post_id = p.post_id
AND p.post_time > $topic_last_read
ORDER BY p.post_time
LIMIT " . $bb_cfg['posts_per_page'];
LIMIT ". $bb_cfg['posts_per_page'];
if ($rowset = DB()->fetch_rowset($sql)) {
if ($rowset = DB()->fetch_rowset($sql))
{
$topic_has_new_posts = true;
foreach ($rowset as $i => $row) {
foreach ($rowset as $i => $row)
{
$template->assign_block_vars('new_posts', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($row),
@ -332,8 +386,10 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
// --------------------
// What shall we do?
//
if (($delete || $poll_delete || $mode == 'delete') && !$confirm) {
if (isset($_POST['cancel'])) {
if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
{
if (isset($_POST['cancel']))
{
redirect(POST_URL . "$post_id#$post_id");
}
//
@ -349,11 +405,14 @@ if (($delete || $poll_delete || $mode == 'delete') && !$confirm) {
'FORM_ACTION' => "posting.php",
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
));
} else if ($mode == 'vote') {
}
else if ( $mode == 'vote' )
{
//
// Vote in a poll
//
if (!empty($_POST['vote_id'])) {
if ( !empty($_POST['vote_id']) )
{
$vote_option_id = intval($_POST['vote_id']);
$sql = "SELECT vd.vote_id
@ -362,42 +421,52 @@ if (($delete || $poll_delete || $mode == 'delete') && !$confirm) {
AND vr.vote_id = vd.vote_id
AND vr.vote_option_id = $vote_option_id
GROUP BY vd.vote_id";
if (!($result = DB()->sql_query($sql))) {
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
}
if ($vote_info = DB()->sql_fetchrow($result)) {
if ( $vote_info = DB()->sql_fetchrow($result) )
{
$vote_id = $vote_info['vote_id'];
$sql = "SELECT *
FROM " . BB_VOTE_USERS . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
if (!($result2 = DB()->sql_query($sql))) {
if ( !($result2 = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
}
if (!($row = DB()->sql_fetchrow($result2))) {
if ( !($row = DB()->sql_fetchrow($result2)) )
{
$sql = "UPDATE " . BB_VOTE_RESULTS . "
SET vote_result = vote_result + 1
WHERE vote_id = $vote_id
AND vote_option_id = $vote_option_id";
if (!DB()->sql_query($sql)) {
if ( !DB()->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . BB_VOTE_USERS . " (vote_id, vote_user_id, vote_user_ip)
VALUES ($vote_id, " . $userdata['user_id'] . ", '" . USER_IP . "')";
if (!DB()->sql_query($sql)) {
VALUES ($vote_id, " . $userdata['user_id'] . ", '". USER_IP ."')";
if ( !DB()->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
}
$message = $lang['VOTE_CAST'];
} else {
}
else
{
$message = $lang['ALREADY_VOTED'];
}
DB()->sql_freeresult($result2);
} else {
}
else
{
$message = $lang['NO_VOTE_OPTION'];
}
DB()->sql_freeresult($result);
@ -405,12 +474,16 @@ if (($delete || $poll_delete || $mode == 'delete') && !$confirm) {
meta_refresh("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . ("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
} else {
}
else
{
redirect("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
}
} //snp
}
//snp
// else if ( $submit || $confirm )
else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
else if ( ($submit || $confirm) && !$topic_has_new_posts )
//snp end
{
//
// Submit post/vote (newtopic, edit, reply, etc.)
@ -418,21 +491,23 @@ else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
$return_message = '';
$return_meta = '';
switch ($mode) {
switch ( $mode )
{
case 'editpost':
case 'newtopic':
case 'reply':
$username = (!empty($_POST['username'])) ? clean_username($_POST['username']) : '';
$subject = (!empty($_POST['subject'])) ? clean_title($_POST['subject']) : '';
$message = (!empty($_POST['message'])) ? prepare_message($_POST['message']) : '';
$poll_title = (isset($_POST['poll_title']) && $is_auth['auth_pollcreate']) ? clean_title($_POST['poll_title']) : '';
$poll_options = (isset($_POST['poll_option_text']) && $is_auth['auth_pollcreate']) ? $_POST['poll_option_text'] : '';
$poll_length = (isset($_POST['poll_length']) && $is_auth['auth_pollcreate']) ? $_POST['poll_length'] : '';
$username = ( !empty($_POST['username']) ) ? clean_username($_POST['username']) : '';
$subject = ( !empty($_POST['subject']) ) ? clean_title($_POST['subject']) : '';
$message = ( !empty($_POST['message']) ) ? prepare_message($_POST['message']) : '';
$poll_title = ( isset($_POST['poll_title']) && $is_auth['auth_pollcreate'] ) ? clean_title($_POST['poll_title']) : '';
$poll_options = ( isset($_POST['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_option_text'] : '';
$poll_length = ( isset($_POST['poll_length']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_length'] : '';
prepare_post($mode, $post_data, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length);
if (!$error_msg) {
$topic_type = (isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce']) ? $post_data['topic_type'] : $topic_type;
if (!$error_msg)
{
$topic_type = ( isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), DB()->escape($poll_title), $poll_options, $poll_length, $update_post_time);
}
@ -440,43 +515,52 @@ else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
case 'delete':
case 'poll_delete':
require_once(INC_DIR . 'functions_admin.php');
require_once(INC_DIR .'functions_admin.php');
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
break;
}
if (!$error_msg) {
if (!in_array($mode, array('editpost', 'delete', 'poll_delete'))) {
$user_id = ($mode == 'reply' || $mode == 'newtopic') ? $userdata['user_id'] : $post_data['poster_id'];
if (!isset($_POST['to_draft'])) {
if (!$error_msg)
{
if (!in_array($mode, array('editpost', 'delete', 'poll_delete')))
{
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
if (!isset($_POST['to_draft']))
{
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
}
$attachment_mod['posting']->insert_attachment($post_id);
if (!$error_msg && $mode != 'poll_delete') {
if (!$error_msg && $mode != 'poll_delete')
{
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
}
if ($mode == 'newtopic' || $mode == 'reply') {
if ($mode == 'newtopic' || $mode == 'reply')
{
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg) {
include(INC_DIR . 'functions_torrent.php');
if (!DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) {
if ($bb_cfg['premod']) {
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
include(INC_DIR .'functions_torrent.php');
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
{
if($bb_cfg['premod'])
{
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
$count_sql = "
SELECT forum_id
FROM " . BB_FORUMS . "
FROM ". BB_FORUMS ."
WHERE forum_parent = $forum_parent
";
$count_rowset = DB()->fetch_rowset($count_sql);
$sub_forums = array();
foreach ($count_rowset as $count_row) {
foreach ($count_rowset as $count_row)
{
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
}
$sub_forums[] = $forum_id;
@ -484,23 +568,25 @@ else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
// Подсчёт проверенных релизов в форумах раздела
$count_checked_releases = DB()->fetch_row("
SELECT COUNT(*) AS checked_releases
FROM " . BB_BT_TORRENTS . "
WHERE poster_id = " . $userdata['user_id'] . "
FROM ". BB_BT_TORRENTS ."
WHERE poster_id = ". $userdata['user_id'] ."
AND forum_id IN($sub_forums)
AND tor_status IN(" . TOR_APPROVED . "," . TOR_DOUBTFUL . "," . TOR_TMP . ")
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM) tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
} else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
}
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) {
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
{
$locked_warn = '
<div class="warnColor1">
<b>' . $lang['LOCKED_WARN'] . '</b>
<b>'. $lang['LOCKED_WARN'] .'</b>
</div>
<br /><hr /><br />
';
@ -513,32 +599,40 @@ else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
//snp
//if( $refresh || isset($_POST['del_poll_option']) || $error_msg != '' )
if ($refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $topic_has_new_posts)) //snp end
if( $refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $topic_has_new_posts) )
//snp end
{
$username = (!empty($_POST['username'])) ? clean_username($_POST['username']) : '';
$subject = (!empty($_POST['subject'])) ? clean_title($_POST['subject']) : '';
$message = (!empty($_POST['message'])) ? prepare_message($_POST['message']) : '';
$username = ( !empty($_POST['username']) ) ? clean_username($_POST['username']) : '';
$subject = ( !empty($_POST['subject']) ) ? clean_title($_POST['subject']) : '';
$message = ( !empty($_POST['message']) ) ? prepare_message($_POST['message']) : '';
$poll_title = (!empty($_POST['poll_title'])) ? clean_title($_POST['poll_title']) : '';
$poll_length = (isset($_POST['poll_length'])) ? max(0, intval($_POST['poll_length'])) : 0;
$poll_title = ( !empty($_POST['poll_title']) ) ? clean_title($_POST['poll_title']) : '';
$poll_length = ( isset($_POST['poll_length']) ) ? max(0, intval($_POST['poll_length'])) : 0;
$poll_options = array();
if (!empty($_POST['poll_option_text'])) {
if ( !empty($_POST['poll_option_text']) )
{
# while( list($option_id, $option_text) = @each($_POST['poll_option_text']) )
foreach ($_POST['poll_option_text'] as $option_id => $option_text) {
if (isset($_POST['del_poll_option'][$option_id])) {
foreach ($_POST['poll_option_text'] as $option_id => $option_text)
{
if( isset($_POST['del_poll_option'][$option_id]) )
{
unset($poll_options[$option_id]);
} else if (!empty($option_text)) {
}
else if ( !empty($option_text) )
{
$poll_options[$option_id] = clean_title($option_text);
}
}
}
if ($poll_add && !empty($_POST['add_poll_option_text'])) {
if ( $poll_add && !empty($_POST['add_poll_option_text']) )
{
$poll_options[] = clean_title($_POST['add_poll_option_text']);
}
if ($preview) {
if ($preview)
{
$preview_subject = $subject;
$preview_username = $username;
$preview_message = htmlCHR($message, false, ENT_NOQUOTES);
@ -553,71 +647,88 @@ if ($refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $t
'PREVIEW_MSG' => $preview_message,
));
}
} else {
}
else
{
// User default entry point
if ($mode == 'newtopic') {
if ( $mode == 'newtopic' )
{
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
$poll_title = '';
$poll_length = '';
$subject = '';
$message = '';
} else if ($mode == 'reply') {
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
}
else if ( $mode == 'reply' )
{
$username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : '';
$subject = '';
$message = '';
} else if ($mode == 'quote' || $mode == 'editpost') {
$subject = ($post_data['first_post']) ? $post_info['topic_title'] : '';
}
else if ( $mode == 'quote' || $mode == 'editpost' )
{
$subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : '';
$message = $post_info['post_text'];
if ($mode == 'quote') {
if (!defined('WORD_LIST_OBTAINED')) {
if ( $mode == 'quote' )
{
if (!defined('WORD_LIST_OBTAINED'))
{
$orig_word = array();
$replace_word = array();
obtain_word_list($orig_word, $replace_word);
define('WORD_LIST_OBTAINED', TRUE);
}
if ($post_info['post_attachment'] && !IS_AM) $message = $post_info['topic_title'];
if($post_info['post_attachment'] && !IS_AM) $message = $post_info['topic_title'];
// Use trim to get rid of spaces placed there by MS-SQL 2000
$quote_username = (trim($post_info['post_username']) != '') ? $post_info['post_username'] : $post_info['username'];
$message = '[quote="' . $quote_username . '"][qpost=' . $post_info['post_id'] . ']' . $message . '[/quote]';
$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
$message = '[quote="'. $quote_username .'"][qpost='. $post_info['post_id'] .']' . $message . '[/quote]';
// hide user passkey
$message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message);
// hide sid
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]{12}#', 'sid', $message);
if (!empty($orig_word)) {
$subject = (!empty($subject)) ? preg_replace($orig_word, $replace_word, $subject) : '';
$message = (!empty($message)) ? preg_replace($orig_word, $replace_word, $message) : '';
if ( !empty($orig_word) )
{
$subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : '';
$message = ( !empty($message) ) ? preg_replace($orig_word, $replace_word, $message) : '';
}
if (!preg_match('/^Re:/', $subject) && strlen($subject) > 0) {
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
{
$subject = 'Re: ' . $subject;
}
$mode = 'reply';
} else {
$username = ($post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username'])) ? $post_info['post_username'] : '';
}
else
{
$username = ( $post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username']) ) ? $post_info['post_username'] : '';
}
}
}
if ($error_msg) {
if ($error_msg)
{
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg,
));
}
if (IS_GUEST || ($mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS)) {
if (IS_GUEST || ($mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS))
{
$template->assign_var('POSTING_USERNAME');
}
//
// Notify checkbox
//
if (!IS_GUEST) {
if ($mode != 'editpost' || ($mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS)) {
if (!IS_GUEST)
{
if ($mode != 'editpost' || ($mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS))
{
$template->assign_var('SHOW_NOTIFY_CHECKBOX');
}
}
@ -626,34 +737,42 @@ if (!IS_GUEST) {
// Topic type selection
//
$topic_type_toggle = '';
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])) {
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
{
$template->assign_block_vars('switch_type_toggle', array());
if ($is_auth['auth_sticky']) {
if( $is_auth['auth_sticky'] )
{
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_STICKY . '"';
if (isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY)) {
if ( isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY) )
{
$topic_type_toggle .= ' checked="checked"';
}
$topic_type_toggle .= ' /> ' . $lang['POST_STICKY'] . '</label>&nbsp;&nbsp;';
}
if ($is_auth['auth_announce']) {
if( $is_auth['auth_announce'] )
{
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
if (isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE)) {
if ( isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE) )
{
$topic_type_toggle .= ' checked="checked"';
}
$topic_type_toggle .= ' /> ' . $lang['POST_ANNOUNCEMENT'] . '</label>&nbsp;&nbsp;';
}
if ($topic_type_toggle != '') {
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': <label><input type="radio" name="topictype" value="' . POST_NORMAL . '"' . ((!isset($post_data['topic_type']) || $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL) ? ' checked="checked"' : '') . ' /> ' . $lang['POST_NORMAL'] . '</label>&nbsp;&nbsp;' . $topic_type_toggle;
if ( $topic_type_toggle != '' )
{
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': <label><input type="radio" name="topictype" value="' . POST_NORMAL .'"' . ( (!isset($post_data['topic_type']) || $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL) ? ' checked="checked"' : '' ) . ' /> ' . $lang['POST_NORMAL'] . '</label>&nbsp;&nbsp;' . $topic_type_toggle;
}
}
//bt
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod']) {
if (!$topic_type_toggle) {
if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
{
if (!$topic_type_toggle)
{
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
}
@ -661,22 +780,24 @@ if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod']) {
$dl_type_name = 'topic_dl_type';
$dl_type_val = ($topic_dl_type) ? 1 : 0;
if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod']) {
if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod'])
{
$dl_ds = ' disabled="disabled" ';
$dl_hid = '<input type="hidden" name="topic_dl_type" value="' . $dl_type_val . '" />';
$dl_hid = '<input type="hidden" name="topic_dl_type" value="'. $dl_type_val .'" />';
$dl_type_name = '';
}
$dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
$topic_type_toggle .= '<nobr><input type="checkbox" name="' . $dl_type_name . '" id="topic_dl_type_id" ' . $dl_ds . $dl_ch . ' /><label for="topic_dl_type_id"> ' . $lang['POST_DOWNLOAD'] . '</label></nobr>';
$topic_type_toggle .= '<nobr><input type="checkbox" name="'. $dl_type_name .'" id="topic_dl_type_id" '. $dl_ds . $dl_ch .' /><label for="topic_dl_type_id"> '.$lang['POST_DOWNLOAD'].'</label></nobr>';
$topic_type_toggle .= $dl_hid;
}
//bt end
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
switch ($mode) {
switch( $mode )
{
case 'newtopic':
$page_title = $lang['POST_A_NEW_TOPIC'];
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
@ -709,15 +830,17 @@ $template->assign_vars(array(
'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id")
);
if ($mode == 'newtopic' || $post_data['first_post']) {
if ($mode == 'newtopic' || $post_data['first_post'])
{
$template->assign_var('POSTING_SUBJECT');
}
// Update post time
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) {
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
{
$template->assign_vars(array(
'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600 * 3 > TIMENOW)),
'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600 * 2 > TIMENOW)),
'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600*3 > TIMENOW)),
'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600*2 > TIMENOW)),
));
}
@ -731,9 +854,9 @@ $template->assign_vars(array(
'SUBJECT' => $subject,
'MESSAGE' => $message,
'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
'S_NOTIFY_CHECKED' => ($notify_user) ? 'checked="checked"' : '',
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
'S_DRAFT_CHECKED' => ($to_draft) ? 'checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id,
@ -744,18 +867,22 @@ $template->assign_vars(array(
//
// Poll entry switch/output
//
if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && $is_auth['auth_pollcreate']) {
if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) ) && $is_auth['auth_pollcreate'] )
{
$template->assign_vars(array(
'POLL_TITLE' => @$poll_title,
'POLL_LENGTH' => @$poll_length)
);
if ($mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll']) {
if( $mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll'])
{
$template->assign_block_vars('switch_poll_delete_toggle', array());
}
if (!empty($poll_options)) {
while (list($option_id, $option_text) = each($poll_options)) {
if( !empty($poll_options) )
{
while( list($option_id, $option_text) = each($poll_options) )
{
$template->assign_block_vars('poll_option_rows', array(
'POLL_OPTION' => str_replace('"', '&quot;', $option_text),
'S_POLL_OPTION_NUM' => $option_id)
@ -769,7 +896,8 @@ if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) &&
//
// Topic review
//
if ($mode == 'reply' && $is_auth['auth_read']) {
if( $mode == 'reply' && $is_auth['auth_read'] )
{
topic_review($topic_id);
}

View file

@ -4,7 +4,7 @@ define('IN_PHPBB', true);
define('BB_SCRIPT', 'pm');
define('IN_PM', true);
define('BB_ROOT', './');
require(BB_ROOT ."common.php");
require(BB_ROOT .'common.php');
require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php');

View file

@ -20,13 +20,9 @@ switch ($mode)
require(INC_DIR . 'ucp/usercp_viewprofile.php');
break;
case 'viewdraft':
require(INC_DIR . 'ucp/usercp_viewdraft.php');
break;
case 'register':
case 'editprofile':
if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
if (IS_GUEST && $mode == 'editprofile' )
{
login_redirect();
}
@ -58,6 +54,10 @@ switch ($mode)
require(INC_DIR . 'ucp/usercp_topic_watch.php');
break;
case 'viewdraft':
require(INC_DIR . 'ucp/usercp_viewdraft.php');
break;
default:
bb_die('Invalid mode');
}

View file

@ -3,9 +3,9 @@
define('IN_PHPBB', true);
define('BB_SCRIPT', 'report');
define('BB_ROOT', './');
require(BB_ROOT ."common.php");
require(INC_DIR ."bbcode.php");
require(INC_DIR ."functions_report.php");
require(BB_ROOT .'common.php');
require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_report.php');
// Init userdata
$user->session_start(array('req_login' => true));

View file

@ -1,100 +1,16 @@
<script type="text/javascript">
ajax.callback.user_register = function (data) {
$('#' + data.mode).html(data.html);
};
/** @Author: dimka3210
* @Desc: Method autocomplete password
*/
var array_for_rand_pass = ["a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F", "g", "G", "h", "H", "i", "I", "j", "J", "k", "K", "l", "L", "m", "M", "n", "N", "o", "O", "p", "P", "q", "Q", "r", "R", "s", "S", "t", "T", "u", "U", "v", "V", "w", "W", "x", "X", "y", "Y", "z", "Z", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var array_rand = function (array) {
var array_length = array.length;
var result = Math.random() * array_length;
return Math.floor(result);
};
var autocomplete = function (noCenter) {
var string_result = ""; // Empty string
for (var i = 1; i <= 8; i++) {
string_result += array_for_rand_pass[array_rand(array_for_rand_pass)];
}
var _popup_left = (Math.ceil(window.screen.availWidth / 2) - 150);
var _popup_top = (Math.ceil(window.screen.availHeight / 2) - 50);
if (!noCenter) {
jQuery("div#autocomplete_popup").css({
left:_popup_left + "px",
top:_popup_top + "px"
}).show(1000);
} else {
jQuery("div#autocomplete_popup").show(1000);
}
jQuery("input#pass, input#pass_confirm, div#autocomplete_popup input").each(function () {
jQuery(this).val(string_result);
});
};
jQuery(document).ready(function () {
jQuery("span#autocomplete").click(function() {
autocomplete();
});
/**
* @Author: dimka3210
* @Desc: А давайте окно сделаем перемещаемым.
*/
var _X, _Y;
var _bMoveble = false;
jQuery("div#autocomplete_popup div.title").mousedown(function (event) {
_bMoveble = true;
_X = event.clientX;
_Y = event.clientY;
});
jQuery("div#autocomplete_popup div.title").mousemove(function (event) {
var jFrame = jQuery("div#autocomplete_popup");
var jFLeft = parseInt(jFrame.css("left"));
var jFTop = parseInt(jFrame.css("top"));
if (_bMoveble) {
if (event.clientX < _X) {
jFrame.css("left", jFLeft - (_X - event.clientX) + "px");
} else {
jFrame.css("left", (jFLeft + (event.clientX - _X)) + "px");
}
if (event.clientY < _Y) {
jFrame.css("top", jFTop - (_Y - event.clientY) + "px");
} else {
jFrame.css("top", (jFTop + (event.clientY - _Y)) + "px");
}
_X = event.clientX;
_Y = event.clientY;
}
});
jQuery("div#autocomplete_popup div.title").mouseup(function () {
_bMoveble = false;
}).mouseout(function () {
_bMoveble = false;
});
});
ajax.callback.user_register = function(data){
$('#'+ data.mode).html(data.html);
};
</script>
<div id="autocomplete_popup">
<div class="relative">
<div class="close" onclick="jQuery('div#autocomplete_popup').hide();"></div>
<div class="close" onclick="$('div#autocomplete_popup').hide();"></div>
<div class="title">{L_YOUR_NEW_PASSWORD}</div>
<div>
<input value="" autocomplete="off" type="text"/>
<span class="regenerate" title="{L_REGENERATE}" onclick="autocomplete(true)"
title=""></span>
<span class="regenerate" title="{L_REGENERATE}" onclick="autocomplete(true);"></span>
</div>
</div>
</div>
@ -103,20 +19,20 @@
<p class="nav"><a href="{U_INDEX}">{T_INDEX}</a></p>
<form method="post" action="profile.php" class="tokenized" enctype="multipart/form-data">
<input type="hidden" name="mode" value="{MODE}"/>
<input type="hidden" name="reg_agreed" value="1"/>
<!-- IF NEW_USER --><input type="hidden" name="admin" value="1"/><!-- ENDIF -->
<input type="hidden" name="mode" value="{MODE}" />
<input type="hidden" name="reg_agreed" value="1" />
<!-- IF NEW_USER --><input type="hidden" name="admin" value="1" /><!-- ENDIF -->
<!-- IF ADM_EDIT -->
<input type="hidden" name="u" value="{PR_USER_ID}"/>
<input type="hidden" name="u" value="{PR_USER_ID}" />
<!-- ENDIF -->
<!-- IF not ADM_EDIT -->
<script type="text/javascript">
x = new Date();
tz = -x.getTimezoneOffset() / 60;
document.write('<input type="hidden" name="user_timezone" value="' + tz + '" />');
x = new Date();
tz = -x.getTimezoneOffset()/60;
document.write('<input type="hidden" name="user_timezone" value="'+tz+'" />');
</script>
<!-- ELSE -->
<input type="hidden" name="user_timezone" value="{USER_TIMEZONE}"/>
<input type="hidden" name="user_timezone" value="{USER_TIMEZONE}" />
<!-- ENDIF -->
<table class="forumline usercp_register">
@ -131,49 +47,38 @@
</tr>
<tr>
<td>{L_USERNAME}: *</td>
<td><!-- IF CAN_EDIT_USERNAME --><input id="username"
onBlur="ajax.exec({ action: 'user_register', mode: 'check_name', username: $('#username').val()}); return false;"
type="text" name="username" size="35" maxlength="25" value="{USERNAME}"/><!-- ELSE --><b>{USERNAME}</b><!-- ENDIF -->
<td><!-- IF CAN_EDIT_USERNAME --><input id="username" onBlur="ajax.exec({ action: 'user_register', mode: 'check_name', username: $('#username').val()}); return false;" type="text" name="username" size="35" maxlength="25" value="{USERNAME}" /><!-- ELSE --><b>{USERNAME}</b><!-- ENDIF -->
<span id="check_name"></span></td>
</tr>
<tr>
<td>{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><h6>{L_EMAIL_EXPLAIN}</h6>
<!-- ENDIF --></td>
<td><input id="email"
onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;"
type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE -->
<!-- IF $bb_cfg['emailer_disabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<td>{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><h6>{L_EMAIL_EXPLAIN}</h6><!-- ENDIF --></td>
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE --><!-- IF $bb_cfg['emailer_disabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<span id="check_email"></span></td>
</tr>
<!-- IF EDIT_PROFILE and not ADM_EDIT -->
<tr>
<td>{L_CURRENT_PASSWORD}: * <h6>{L_CONFIRM_PASSWORD_EXPLAIN}</h6></td>
<td><input type="password" name="cur_pass" size="35" maxlength="32" value="" autocomplete="off"/></td>
<td><input type="password" name="cur_pass" size="35" maxlength="32" value="" /></td>
</tr>
<!-- ENDIF -->
<tr>
<td><!-- IF EDIT_PROFILE -->{L_NEW_PASSWORD}: * <h6>{L_PASSWORD_IF_CHANGED}</h6><!-- ELSE -->{L_PASSWORD}: *
<!-- ENDIF --></td>
<td><input id="pass" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="new_pass" size="35"
maxlength="32" value="" autocomplete="off"/>&nbsp;<span id="autocomplete"
title="{L_AUTOCOMPLETE}">◄</span> &nbsp;<i
class="med">{L_PASSWORD_LONG}</i></td>
<td><!-- IF EDIT_PROFILE -->{L_NEW_PASSWORD}: * <h6>{L_PASSWORD_IF_CHANGED}</h6><!-- ELSE -->{L_PASSWORD}: *<!-- ENDIF --></td>
<td>
<input id="pass" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="new_pass" size="35" maxlength="32" value="" />&nbsp;
<span id="autocomplete" title="{L_AUTOCOMPLETE}">&#9668;</span> &nbsp;<i class="med">{L_PASSWORD_LONG}</i>
</td>
</tr>
<tr>
<td>{L_CONFIRM_PASSWORD}: * <!-- IF EDIT_PROFILE --><h6>{L_PASSWORD_CONFIRM_IF_CHANGED}</h6><!-- ENDIF --></td>
<td><input id="pass_confirm"
onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;"
type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35"
maxlength="32" value=""/>
<span id="check_pass"></span></td>
<td>
<input id="pass_confirm" onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35" maxlength="32" value="" />
<span id="check_pass"></span>
</td>
</tr>
<!-- IF CAPTCHA_HTML -->
<tr>
<td>{L_CONFIRM_CODE}:</td>
<td><span id="refresh_captcha">{CAPTCHA_HTML}</span> <img align="middle" src="/images/pic_loading.gif"
title="{L_UPDATE}"
onclick="ajax.exec({ action: 'user_register', mode: 'refresh_captcha'}); return false;">
</td>
<td><span id="refresh_captcha">{CAPTCHA_HTML}</span> <img align="middle" src="/images/pic_loading.gif" title="{L_UPDATE}" onclick="ajax.exec({ action: 'user_register', mode: 'refresh_captcha'}); return false;" /></td>
</tr>
<!-- ENDIF -->
<!-- IF EDIT_PROFILE -->
@ -200,28 +105,28 @@
<!-- ENDIF -->
<tr>
<td>ICQ:</td>
<td><input type="text" name="user_icq" size="30" maxlength="15" value="{USER_ICQ}"/></td>
<td><input type="text" name="user_icq" size="30" maxlength="15" value="{USER_ICQ}" /></td>
</tr>
<tr>
<td>{L_SKYPE}:</td>
<td><input type="text" name="user_skype" size="30" maxlength="250" value="{USER_SKYPE}"/></td>
<td><input type="text" name="user_skype" size="30" maxlength="250" value="{USER_SKYPE}" /></td>
</tr>
<tr>
<td>{L_WEBSITE}:</td>
<td><input type="text" name="user_website" size="50" maxlength="100" value="{USER_WEBSITE}"/></td>
<td><input type="text" name="user_website" size="50" maxlength="100" value="{USER_WEBSITE}" /></td>
</tr>
<tr>
<td>{L_OCCUPATION}:</td>
<td><input type="text" name="user_occ" size="50" maxlength="100" value="{USER_OCC}"/></td>
<td><input type="text" name="user_occ" size="50" maxlength="100" value="{USER_OCC}" /></td>
</tr>
<tr>
<td>{L_INTERESTS}:</td>
<td><input type="text" name="user_interests" size="50" maxlength="150" value="{USER_INTERESTS}"/></td>
<td><input type="text" name="user_interests" size="50" maxlength="150" value="{USER_INTERESTS}" /></td>
</tr>
<tr>
<td>{L_LOCATION}:</td>
<td>
<div><input type="text" name="user_from" size="50" maxlength="100" value="{USER_FROM}"/></div>
<div><input type="text" name="user_from" size="50" maxlength="100" value="{USER_FROM}" /></div>
</td>
</tr>
<!-- ENDIF -->
@ -242,11 +147,11 @@
</td>
</tr>
<script type="text/javascript">
ajax.callback.posts = function (data) {
ajax.callback.posts = function(data){
$('#view_message').show();
$('.signature').html(data.message_html);
initPostBBCode('.signature');
};
};
</script>
<!-- ENDIF -->
<tr>
@ -256,8 +161,7 @@
<!-- ELSE -->
<td>
<textarea id="user_sig" name="user_sig" rows="5" cols="60" style="width: 96%;">{USER_SIG}</textarea>
<input type="button" value="{L_PREVIEW}"
onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#user_sig').val() });">
<input type="button" value="{L_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#user_sig').val() });">
</td>
<!-- ENDIF -->
</tr>
@ -265,37 +169,29 @@
<tr>
<td>{L_PUBLIC_VIEW_EMAIL}:</td>
<td>
<label><input type="radio" name="viewemail" value="1" <!-- IF VIEWEMAIL -->checked="checked"<!-- ENDIF -->
/>{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="viewemail" value="0" <!-- IF not VIEWEMAIL -->checked="checked"<!-- ENDIF -->
/>{L_NO}</label>
<label><input type="radio" name="viewemail" value="1" <!-- IF VIEWEMAIL -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="viewemail" value="0" <!-- IF not VIEWEMAIL -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<tr>
<td>{L_HIDE_USER}:</td>
<td>
<label><input type="radio" name="allow_viewonline" value="1" <!-- IF ALLOW_VIEWONLINE -->checked="checked"
<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="allow_viewonline" value="0" <!-- IF not ALLOW_VIEWONLINE -->checked="checked"
<!-- ENDIF --> />{L_NO}</label>
<label><input type="radio" name="allow_viewonline" value="1" <!-- IF ALLOW_VIEWONLINE -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="allow_viewonline" value="0" <!-- IF not ALLOW_VIEWONLINE -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<tr>
<td>{L_DENY_VISITORS}:</td>
<td>
<label><input type="radio" name="allow_dls" value="1" <!-- IF ALLOW_DLS -->checked="checked"<!-- ENDIF -->
/>{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="allow_dls" value="0" <!-- IF not ALLOW_DLS -->checked="checked"<!-- ENDIF -->
/>{L_NO}</label>
<label><input type="radio" name="allow_dls" value="1" <!-- IF ALLOW_DLS -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="allow_dls" value="0" <!-- IF not ALLOW_DLS -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<tr>
<td>{L_ALWAYS_NOTIFY}:<h6>{L_ALWAYS_NOTIFY_EXPLAIN}</h6></td>
<td>
<label><input type="radio" name="notify" value="1" <!-- IF NOTIFY -->checked="checked"<!-- ENDIF --> />{L_YES}
</label>&nbsp;&nbsp;
<label><input type="radio" name="notify" value="0" <!-- IF not NOTIFY -->checked="checked"<!-- ENDIF -->
/>{L_NO}</label>
<label><input type="radio" name="notify" value="1" <!-- IF NOTIFY -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="notify" value="0" <!-- IF not NOTIFY -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
@ -303,26 +199,22 @@
<tr>
<td>{L_NOTIFY_ON_PRIVMSG}:</td>
<td>
<label><input type="radio" name="notify_pm" value="1" <!-- IF NOTIFY_PM -->checked="checked"<!-- ENDIF -->
/>{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="notify_pm" value="0" <!-- IF not NOTIFY_PM -->checked="checked"<!-- ENDIF -->
/>{L_NO}</label>
<label><input type="radio" name="notify_pm" value="1" <!-- IF NOTIFY_PM -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="notify_pm" value="0" <!-- IF not NOTIFY_PM -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<!-- ENDIF -->
<tr>
<td>{L_HIDE_PORN_FORUMS}:</td>
<td>
<label><input type="radio" name="hide_porn_forums" value="1" <!-- IF HIDE_PORN_FORUMS -->checked="checked"
<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="hide_porn_forums" value="0" <!-- IF not HIDE_PORN_FORUMS -->checked="checked"
<!-- ENDIF --> />{L_NO}</label>
<label><input type="radio" name="hide_porn_forums" value="1" <!-- IF HIDE_PORN_FORUMS -->checked="checked"<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="hide_porn_forums" value="0" <!-- IF not HIDE_PORN_FORUMS -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<!-- IF SHOW_DATEFORMAT -->
<tr>
<td>{L_DATE_FORMAT}:<h6>{L_DATE_FORMAT_EXPLAIN}</h6></td>
<td><input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14"/></td>
<td><input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14" /></td>
</tr>
<!-- ENDIF -->
<!-- BEGIN not_avatar_block -->
@ -336,7 +228,6 @@
<td>{L_AVATAR_DISABLE}</td>
<td class="tCenter nowrap med">
<p>{L_CURRENT_IMAGE}</p>
<p class="mrg_6">{USER_AVATAR}</p>
</td>
</tr>
@ -355,10 +246,8 @@
<td>{AVATAR_EXPLAIN}</td>
<td class="tCenter nowrap">
<p>{L_CURRENT_IMAGE}</p>
<p class="mrg_6">{USER_AVATAR}</p>
<p><label><input type="checkbox" name="avatardel"/> {L_DELETE_IMAGE}</label></p>
<p><label><input type="checkbox" name="avatardel" /> {L_DELETE_IMAGE}</label></p>
</td>
</tr>
</table>
@ -368,27 +257,27 @@
<tr>
<td>{L_UPLOAD_AVATAR_FILE}:</td>
<td>
<input type="file" name="avatar" size="40"/>
<input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}"/>
<input type="file" name="avatar" size="40" />
<input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" />
</td>
</tr>
<!-- END switch_avatar_local_upload -->
<!-- BEGIN switch_avatar_remote_upload -->
<tr>
<td>{L_UPLOAD_AVATAR_URL}:<h6>{L_UPLOAD_AVATAR_URL_EXPLAIN}</h6></td>
<td><input type="text" name="avatarurl" size="44"/></td>
<td><input type="text" name="avatarurl" size="44" /></td>
</tr>
<!-- END switch_avatar_remote_upload -->
<!-- BEGIN switch_avatar_remote_link -->
<tr>
<td>{L_LINK_REMOTE_AVATAR}:<h6>{L_LINK_REMOTE_AVATAR_EXPLAIN}</h6></td>
<td><input type="text" name="avatarremoteurl" size="44"/></td>
<td><input type="text" name="avatarremoteurl" size="44" /></td>
</tr>
<!-- END switch_avatar_remote_link -->
<!-- BEGIN switch_avatar_local_gallery -->
<tr>
<td>{L_AVATAR_GALLERY}:</td>
<td><input type="submit" name="avatargallery" value="{L_VIEW_AVATAR_GALLERY}" class="lite"/></td>
<td><input type="submit" name="avatargallery" value="{L_VIEW_AVATAR_GALLERY}" class="lite" /></td>
</tr>
<!-- END switch_avatar_local_gallery -->
<!-- END switch_avatar_block -->
@ -403,12 +292,9 @@
<div class="bCenter">
<?php include($bb_cfg['user_agreement_html_path']) ?>
</div>
<p class="med bold mrg_4 tCenter"><label><input type="checkbox" value="" checked="checked"
disabled="disabled"/> {L_USER_AGREEMENT_AGREE}</label>
</p>
<p class="med bold mrg_4 tCenter"><label><input type="checkbox" value="" checked="checked" disabled="disabled" /> {L_USER_AGREEMENT_AGREE}</label></p>
</fieldset>
</div>
<!--/infobox-wrap-->
</div><!--/infobox-wrap-->
</td>
</tr>
<!-- ENDIF / SHOW_REG_AGREEMENT -->
@ -416,9 +302,8 @@
<tr>
<td class="catBottom" colspan="2">
<div id="submit-buttons">
<!-- IF EDIT_PROFILE --><input type="reset" value="{L_RESET}" name="reset" class="lite"/>&nbsp;&nbsp;
<!-- ENDIF -->
<input type="submit" name="submit" value="{L_SUBMIT}" class="main"/>
<!-- IF EDIT_PROFILE --><input type="reset" value="{L_RESET}" name="reset" class="lite" />&nbsp;&nbsp;<!-- ENDIF -->
<input type="submit" name="submit" value="{L_SUBMIT}" class="main" />
</div>
</td>
</tr>

View file

@ -2,11 +2,11 @@
define('BB_SCRIPT', 'tracker');
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
require(BB_ROOT .'common.php');
require(INC_DIR . 'class.utf8.php');
require(INC_DIR . 'class.correct.php');
require(INC_DIR . 'class.reflection.php');
require(INC_DIR .'class.utf8.php');
require(INC_DIR .'class.correct.php');
require(INC_DIR .'class.reflection.php');
// Page config
$page_cfg['include_bbcode_js'] = true;

View file

@ -1 +0,0 @@
xZ6v0bcwckAqvp506NFR

View file

@ -3,7 +3,7 @@
define('IN_PHPBB', true);
define('BB_SCRIPT', 'topic');
define('BB_ROOT', './');
require(BB_ROOT ."common.php");
require(BB_ROOT .'common.php');
require(INC_DIR .'bbcode.php');
$datastore->enqueue(array(