mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Atom for users
Создание лент пользователей: в аяксе, создание при обычном постинге, удаление при удалении юзера, фиксы папок для аттачей, аватарок и атомов. Осталось сделать пересоздание лент пользователей при удалении постов из тем и удалении тем (functions_admin).
This commit is contained in:
parent
63835dbe76
commit
a7f0d2148c
8 changed files with 48 additions and 24 deletions
|
@ -57,6 +57,13 @@ switch($this->request['type'])
|
||||||
$this->prompt_for_confirm($lang['CONFIRM_DELETE']);
|
$this->prompt_for_confirm($lang['CONFIRM_DELETE']);
|
||||||
}
|
}
|
||||||
post_delete($post_id);
|
post_delete($post_id);
|
||||||
|
|
||||||
|
// Update user atom feed
|
||||||
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
|
$topic_id = (int) $this->request['topic_id'];
|
||||||
|
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster');
|
||||||
|
update_user_feed($topic_poster, get_username($topic_poster));
|
||||||
|
|
||||||
$this->response['hide'] = true;
|
$this->response['hide'] = true;
|
||||||
$this->response['post_id'] = $post_id;
|
$this->response['post_id'] = $post_id;
|
||||||
}
|
}
|
||||||
|
@ -158,6 +165,12 @@ switch($this->request['type'])
|
||||||
}
|
}
|
||||||
else $this->ajax_die($lang['EMPTY_MESSAGE']);
|
else $this->ajax_die($lang['EMPTY_MESSAGE']);
|
||||||
|
|
||||||
|
// Update user atom feed
|
||||||
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
|
$topic_id = (int) $this->request['topic_id'];
|
||||||
|
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster');
|
||||||
|
update_user_feed($topic_poster, get_username($topic_poster));
|
||||||
|
|
||||||
$this->response['html'] = bbcode2html($text);
|
$this->response['html'] = bbcode2html($text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -309,6 +322,12 @@ switch($this->request['type'])
|
||||||
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update user atom feed
|
||||||
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
|
$topic_id = (int) $this->request['topic_id'];
|
||||||
|
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster');
|
||||||
|
update_user_feed($topic_poster, get_username($topic_poster));
|
||||||
|
|
||||||
$this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
|
$this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -50,14 +50,14 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0)
|
||||||
{
|
{
|
||||||
bb_simple_die('Invalid type of query #3');
|
bb_simple_die('Invalid type of query #3');
|
||||||
}
|
}
|
||||||
if (file_exists($bb_cfg['atom']['path'] .'/u/'. floor($id/5000000) .'/'. ($id % 100) .'/'. $id .'.atom') && filemtime($bb_cfg['atom']['path'] .'/u/'. floor($id/5000000) .'/'. ($id % 100) .'/'. $id .'.atom') > $timecheck)
|
if (file_exists($bb_cfg['atom']['path'] .'/u/'. floor($id/5000) .'/'. ($id % 100) .'/'. $id .'.atom') && filemtime($bb_cfg['atom']['path'] .'/u/'. floor($id/5000) .'/'. ($id % 100) .'/'. $id .'.atom') > $timecheck)
|
||||||
{
|
{
|
||||||
redirect($bb_cfg['atom']['url'] .'/u/'. floor($id/5000000) .'/'. ($id % 100) .'/'. $id .'.atom');
|
redirect($bb_cfg['atom']['url'] .'/u/'. floor($id/5000) .'/'. ($id % 100) .'/'. $id .'.atom');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
require_once(INC_DIR .'functions_atom.php');
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
if (update_user_feed($id, $username)) redirect($bb_cfg['atom']['url'] .'/u/'. floor($id/5000000) .'/'. ($id % 100) .'/'. $id .'.atom');
|
if (update_user_feed($id, $username)) redirect($bb_cfg['atom']['url'] .'/u/'. floor($id/5000) .'/'. ($id % 100) .'/'. $id .'.atom');
|
||||||
else bb_simple_die('No feed for this user (no topics)');
|
else bb_simple_die('No feed for this user (no topics)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class captcha_common
|
||||||
CACHE('bb_cap_sid')->set('c_sid_'. $this->new_cap_sid, $this->new_cap_code, $this->key_ttl*2);
|
CACHE('bb_cap_sid')->set('c_sid_'. $this->new_cap_sid, $this->new_cap_code, $this->key_ttl*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_img_url ($id)
|
function get_img_url ($id)
|
||||||
{
|
{
|
||||||
return $this->get_path($id, $this->cfg['img_url']);
|
return $this->get_path($id, $this->cfg['img_url']);
|
||||||
}
|
}
|
||||||
|
@ -215,8 +215,6 @@ class captcha_kcaptcha extends captcha_common
|
||||||
$credits = $bb_cfg['server_name']; # if empty, HTTP_HOST will be shown
|
$credits = $bb_cfg['server_name']; # if empty, HTTP_HOST will be shown
|
||||||
|
|
||||||
# CAPTCHA image colors (RGB, 0-255)
|
# CAPTCHA image colors (RGB, 0-255)
|
||||||
//$foreground_color = array(0, 0, 0);
|
|
||||||
//$background_color = array(220, 230, 255);
|
|
||||||
$foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100));
|
$foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100));
|
||||||
$background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255));
|
$background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255));
|
||||||
|
|
||||||
|
@ -316,7 +314,7 @@ class captcha_kcaptcha extends captcha_common
|
||||||
|
|
||||||
$center=$x/2;
|
$center=$x/2;
|
||||||
|
|
||||||
// credits. To remove, see configuration file
|
// credits
|
||||||
$img2=imagecreatetruecolor($width, $height+($show_credits?12:0));
|
$img2=imagecreatetruecolor($width, $height+($show_credits?12:0));
|
||||||
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
|
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
|
||||||
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
|
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
|
||||||
|
@ -390,8 +388,6 @@ class captcha_kcaptcha extends captcha_common
|
||||||
file_write('', $img_path, null, true, true);
|
file_write('', $img_path, null, true, true);
|
||||||
|
|
||||||
imagejpeg($img2, $img_path, $jpeg_quality);
|
imagejpeg($img2, $img_path, $jpeg_quality);
|
||||||
# imagegif($img2, $img_path);
|
|
||||||
# imagepng($img2, $img_path);
|
|
||||||
|
|
||||||
imagedestroy($img2);
|
imagedestroy($img2);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div)
|
||||||
|
|
||||||
function get_avatar_path ($id, $ext_id, $base_path = '')
|
function get_avatar_path ($id, $ext_id, $base_path = '')
|
||||||
{
|
{
|
||||||
return get_path_from_id($id, $ext_id, $base_path, 5000000, 100);
|
return get_path_from_id($id, $ext_id, $base_path, 5000, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_avatar ($user_id, $avatar_ext_id)
|
function delete_avatar ($user_id, $avatar_ext_id)
|
||||||
|
@ -24,7 +24,7 @@ function delete_avatar ($user_id, $avatar_ext_id)
|
||||||
function get_attach_path ($id)
|
function get_attach_path ($id)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
return get_path_from_id($id, '', $bb_cfg['attach']['upload_path'], 1000000, 100);
|
return get_path_from_id($id, '', $bb_cfg['attach']['upload_path'], 1000, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_tracks ($type)
|
function get_tracks ($type)
|
||||||
|
|
|
@ -670,7 +670,7 @@ function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
|
||||||
|
|
||||||
function user_delete ($user_id, $delete_posts = false)
|
function user_delete ($user_id, $delete_posts = false)
|
||||||
{
|
{
|
||||||
global $log_action;
|
global $bb_cfg, $log_action;
|
||||||
|
|
||||||
if (!$user_csv = get_id_csv($user_id))
|
if (!$user_csv = get_id_csv($user_id))
|
||||||
{
|
{
|
||||||
|
@ -755,6 +755,13 @@ function user_delete ($user_id, $delete_posts = false)
|
||||||
|
|
||||||
DB()->query("UPDATE ". BB_PRIVMSGS ." SET privmsgs_from_userid = ". DELETED ." WHERE privmsgs_from_userid IN($user_csv)");
|
DB()->query("UPDATE ". BB_PRIVMSGS ." SET privmsgs_from_userid = ". DELETED ." WHERE privmsgs_from_userid IN($user_csv)");
|
||||||
DB()->query("UPDATE ". BB_PRIVMSGS ." SET privmsgs_to_userid = ". DELETED ." WHERE privmsgs_to_userid IN($user_csv)");
|
DB()->query("UPDATE ". BB_PRIVMSGS ." SET privmsgs_to_userid = ". DELETED ." WHERE privmsgs_to_userid IN($user_csv)");
|
||||||
|
|
||||||
|
// Delete user feed
|
||||||
|
foreach (explode(',', $user_csv) as $user_id)
|
||||||
|
{
|
||||||
|
$file_path = $bb_cfg['atom']['path'] .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
||||||
|
@unlink($file_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_usernames_for_log ($user_id)
|
function get_usernames_for_log ($user_id)
|
||||||
|
|
|
@ -79,7 +79,7 @@ function update_forum_feed ($forum_id, $forum_data)
|
||||||
function update_user_feed ($user_id, $username)
|
function update_user_feed ($user_id, $username)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
$file_path = $bb_cfg['atom']['path'] .'/u/'. floor($user_id/5000000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
$file_path = $bb_cfg['atom']['path'] .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
t.topic_id, t.topic_title, t.topic_status,
|
t.topic_id, t.topic_title, t.topic_status,
|
||||||
|
@ -154,7 +154,7 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
|
||||||
$orig_word = array();
|
$orig_word = array();
|
||||||
$replacement_word = array();
|
$replacement_word = array();
|
||||||
obtain_word_list($orig_word, $replacement_word);
|
obtain_word_list($orig_word, $replacement_word);
|
||||||
if ( count($orig_word) )
|
if (count($orig_word))
|
||||||
{
|
{
|
||||||
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
|
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
$return_message = '';
|
$return_message = '';
|
||||||
$return_meta = '';
|
$return_meta = '';
|
||||||
|
|
||||||
switch ( $mode )
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'editpost':
|
case 'editpost':
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
|
@ -444,6 +444,11 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update user atom feed
|
||||||
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
|
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster');
|
||||||
|
update_user_feed($topic_poster, get_username($topic_poster));
|
||||||
|
|
||||||
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
|
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
|
||||||
{
|
{
|
||||||
$locked_warn = '
|
$locked_warn = '
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<!-- IF HIDE_POST_IMG -->img.postImg, div.postImg-wrap { display: none; }<!-- ENDIF -->
|
<!-- IF HIDE_POST_IMG -->img.postImg, div.postImg-wrap { display: none; }<!-- ENDIF -->
|
||||||
<!-- IF HIDE_SMILE -->.smile { display: none; }<!-- ENDIF -->
|
<!-- IF HIDE_SMILE -->.smile { display: none; }<!-- ENDIF -->
|
||||||
<!-- IF HIDE_SIGNATURE -->.signature { display: none; }<!-- ENDIF -->
|
<!-- IF HIDE_SIGNATURE -->.signature { display: none; }<!-- ENDIF -->
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<!-- IF SPOILER_OPENED -->
|
<!-- IF SPOILER_OPENED -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -19,7 +18,7 @@
|
||||||
ajax.open_edit = false;
|
ajax.open_edit = false;
|
||||||
function edit_post(post_id, type, text) {
|
function edit_post(post_id, type, text) {
|
||||||
if(ajax.open_edit && ajax.open_edit != post_id) {
|
if(ajax.open_edit && ajax.open_edit != post_id) {
|
||||||
alert('{L_AJAX_EDIT_OPEN}');
|
alert('{L_AJAX_EDIT_OPEN}');
|
||||||
} else{
|
} else{
|
||||||
if(ajax.open_edit && !text){
|
if(ajax.open_edit && !text){
|
||||||
$('#pp_'+ post_id).show();
|
$('#pp_'+ post_id).show();
|
||||||
|
@ -27,12 +26,12 @@ function edit_post(post_id, type, text) {
|
||||||
} else{
|
} else{
|
||||||
$('#pp_'+ post_id).hide();
|
$('#pp_'+ post_id).hide();
|
||||||
$('#pe_'+ post_id).show();
|
$('#pe_'+ post_id).show();
|
||||||
|
|
||||||
ajax.exec({
|
ajax.exec({
|
||||||
action : 'posts',
|
action : 'posts',
|
||||||
post_id : post_id,
|
post_id : post_id,
|
||||||
text : text,
|
topic_id : {TOPIC_ID},
|
||||||
type : type
|
text : text,
|
||||||
|
type : type
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ajax.open_edit = false;
|
ajax.open_edit = false;
|
||||||
|
@ -199,7 +198,6 @@ function poll_manage (mode, confirm_msg)
|
||||||
$('#poll-submit-btn').click();
|
$('#poll-submit-btn').click();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_poll_add_form (src_el)
|
function build_poll_add_form (src_el)
|
||||||
{
|
{
|
||||||
$('#poll').empty().append( $('#poll-edit-tpl').contents() ).show();
|
$('#poll').empty().append( $('#poll-edit-tpl').contents() ).show();
|
||||||
|
@ -237,7 +235,6 @@ function build_poll_add_form (src_el)
|
||||||
|
|
||||||
<table cellspacing="0" cellpadding="0" class="borderless w100">
|
<table cellspacing="0" cellpadding="0" class="borderless w100">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<!-- IF AUTH_MOD -->
|
<!-- IF AUTH_MOD -->
|
||||||
<td class="small bold nowrap" style="padding: 0 0 0 4px;">
|
<td class="small bold nowrap" style="padding: 0 0 0 4px;">
|
||||||
<!-- IF IN_MODERATION -->{L_MODERATE_TOPIC}<!-- ELSE --><a href="{PAGE_URL}&mod=1&start={PAGE_START}" class="small bold">{L_MODERATE_TOPIC}</a><!-- ENDIF -->
|
<!-- IF IN_MODERATION -->{L_MODERATE_TOPIC}<!-- ELSE --><a href="{PAGE_URL}&mod=1&start={PAGE_START}" class="small bold">{L_MODERATE_TOPIC}</a><!-- ENDIF -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue