diff --git a/upload/ajax/posts.php b/upload/ajax/posts.php index 86ad38dbe..84c837bfa 100644 --- a/upload/ajax/posts.php +++ b/upload/ajax/posts.php @@ -57,6 +57,13 @@ switch($this->request['type']) $this->prompt_for_confirm($lang['CONFIRM_DELETE']); } 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['post_id'] = $post_id; } @@ -158,6 +165,12 @@ switch($this->request['type']) } 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); } else @@ -309,6 +322,12 @@ switch($this->request['type']) 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"); break; diff --git a/upload/feed.php b/upload/feed.php index 4dad7657b..85c9336b1 100644 --- a/upload/feed.php +++ b/upload/feed.php @@ -50,14 +50,14 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) { 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 { 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)'); } } diff --git a/upload/includes/captcha/captcha.php b/upload/includes/captcha/captcha.php index 61fe023d3..4ecfcdc34 100644 --- a/upload/includes/captcha/captcha.php +++ b/upload/includes/captcha/captcha.php @@ -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); } - function get_img_url ($id) + function get_img_url ($id) { 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 # CAPTCHA image colors (RGB, 0-255) - //$foreground_color = array(0, 0, 0); - //$background_color = array(220, 230, 255); $foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100)); $background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255)); @@ -316,7 +314,7 @@ class captcha_kcaptcha extends captcha_common $center=$x/2; - // credits. To remove, see configuration file + // credits $img2=imagecreatetruecolor($width, $height+($show_credits?12:0)); $foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]); $background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]); @@ -390,8 +388,6 @@ class captcha_kcaptcha extends captcha_common file_write('', $img_path, null, true, true); imagejpeg($img2, $img_path, $jpeg_quality); -# imagegif($img2, $img_path); -# imagepng($img2, $img_path); imagedestroy($img2); diff --git a/upload/includes/functions.php b/upload/includes/functions.php index c8c7db0a6..6e39e3a55 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -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 = '') { - 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) @@ -24,7 +24,7 @@ function delete_avatar ($user_id, $avatar_ext_id) function get_attach_path ($id) { 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) diff --git a/upload/includes/functions_admin.php b/upload/includes/functions_admin.php index 32ce428f8..6a4b0a793 100644 --- a/upload/includes/functions_admin.php +++ b/upload/includes/functions_admin.php @@ -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) { - global $log_action; + global $bb_cfg, $log_action; 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_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) diff --git a/upload/includes/functions_atom.php b/upload/includes/functions_atom.php index 2df190b7c..d4b05bf87 100644 --- a/upload/includes/functions_atom.php +++ b/upload/includes/functions_atom.php @@ -79,7 +79,7 @@ function update_forum_feed ($forum_id, $forum_data) function update_user_feed ($user_id, $username) { 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 = " SELECT 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(); $replacement_word = array(); 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); } diff --git a/upload/posting.php b/upload/posting.php index 1eee18c3e..69f277abd 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -353,7 +353,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts ) $return_message = ''; $return_meta = ''; - switch ( $mode ) + switch ($mode) { case 'editpost': 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) { $locked_warn = ' diff --git a/upload/templates/default/viewtopic.tpl b/upload/templates/default/viewtopic.tpl index 27c5cf571..59f46fdac 100644 --- a/upload/templates/default/viewtopic.tpl +++ b/upload/templates/default/viewtopic.tpl @@ -5,7 +5,6 @@ img.postImg, div.postImg-wrap { display: none; } .smile { display: none; } .signature { display: none; } -