$before = cs_sql_count(__FILE__, 'comments', $where); $start = floor($before / $account['users_limit']) * $account['users_limit']; cs_sql_delete(__FILE__, 'comments', $comments_id); $update_last = cs_sql_select(__FILE__, 'comments', '*', "comments_fid = '" . $com_fid . "'", 'comments_time DESC', 0, 1); $cells = array('threads_last_time', 'threads_last_user'); if (empty($update_last['comments_time'])) { $saves = array((int) $cs_thread['threads_time'], (int) $cs_thread['users_id']); } else { $saves = array((int) $update_last['comments_time'], (int) $update_last['users_id']); } cs_sql_update(__FILE__, 'threads', $cells, $saves, $com_fid); # Update board entry to get correct threads and comments count include_once 'mods/board/repair.php'; cs_board_comments($cs_thread['board_id']); cs_board_last($cs_thread['board_id']); cs_threads_comments($com_fid); # Remove attached boardreport if there is one cs_sql_delete(__FILE__, 'boardreport', $comments_id, 'comments_id'); cs_cache_delete('count_boardreport'); $more = 'where=' . $com_fid . '&start=' . $start; cs_redirect($cs_lang['del_true'], 'board', 'thread', $more); } if (isset($_POST['cancel'])) { $options_board = cs_sql_option(__FILE__, 'board'); $where = "comments_fid = \"" . $com_fid . "\" AND comments_mod = 'board' AND comments_id <= \"" . $comments_id . "\""; $comnr = cs_sql_count(__FILE__, 'comments', $where); if ($options_board['sort'] == 'ASC') { $start = $comnr - $comnr % $account['users_limit']; } else { $where = "comments_fid = \"" . $com_fid . "\" AND comments_mod = 'board' AND comments_id > \"" . $comments_id . "\""; $after = cs_sql_count(__FILE__, 'comments', $where);
$data['pages']['list'] = cs_pages('board', 'active', $cs_count, $start); $from = "threads thr INNER JOIN {pre}_board frm ON frm.board_id = thr.board_id INNER JOIN {pre}_categories cat ON cat.categories_id = frm.categories_id INNER JOIN {pre}_users usr ON thr.threads_last_user = usr.users_id LEFT JOIN {pre}_read red ON thr.threads_id = red.threads_id AND red.users_id = '" . $account['users_id'] . "'"; $select = 'thr.threads_id AS threads_id, thr.threads_headline AS threads_headline, thr.threads_view AS threads_view, thr.threads_comments AS threads_comments, thr.threads_important AS threads_important, thr.threads_close AS threads_close, thr.threads_last_time AS threads_last_time, usr.users_id AS users_id, usr.users_nick AS users_nick, usr.users_active AS users_active, red.read_since AS read_since'; $order = 'thr.threads_view DESC, thr.threads_last_time DESC'; $cs_threads = cs_sql_select(__FILE__, $from, $select, $conditions, $order, $start, $account['users_limit']); if (empty($cs_threads)) { $data['if']['not_active'] = true; $data['if']['active'] = false; } else { $data['if']['not_active'] = false; $data['if']['active'] = true; $run = 0; foreach ($cs_threads as $thread) { if (empty($thread['threads_comments'])) { include_once 'mods/board/repair.php'; $thread['threads_comments'] = cs_threads_comments($thread['threads_id']); } $icon = 'post_'; $tid = $thread['threads_id']; if (!empty($account['users_id']) and $thread['threads_last_time'] > $cs_readtime and $thread['threads_last_time'] > $thread['read_since']) { $icon .= 'unread_'; } if (!empty($thread['threads_close'])) { $icon .= 'close_'; } if ($thread['threads_important']) { $icon .= 'important_'; } $data['threads'][$run]['icon'] = cs_html_img('symbols/board/' . $icon . '.png'); if (!empty($thread['threads_important'])) { $data['threads'][$run]['important'] = $cs_lang['important'] . ' ';
$num = $run + 1; $files_cells = array('users_id', 'threads_id', 'comments_id', 'boardfiles_time', 'boardfiles_name'); $files_save = array($users_id, $fid, $idnow, cs_time(), $file_name[$num]); cs_sql_insert(__FILE__, 'boardfiles', $files_cells, $files_save); $files_select_new_id = cs_sql_insertid(__FILE__); $ext = substr($file_name[$num], strlen($file_name[$num]) + 1 - strlen(strrchr($file_name[$num], '.'))); $path = $cs_main['def_path'] . '/uploads/board/files/'; $target = $path . $file_upload_name[$num]; $target2 = $path . $files_select_new_id . '.' . $ext; $fileHand = fopen($target, 'r'); fclose($fileHand); rename($target, $target2); } include_once 'mods/board/repair.php'; cs_board_comments($data['thread']['board_id']); cs_threads_comments($data['thread']['threads_id']); if (!empty($close_now) and !empty($acc_close)) { $close_cells = array('threads_close'); $close_save = array($account['users_id']); cs_sql_update(__FILE__, 'threads', $close_cells, $close_save, $data['thread']['threads_id']); } // START Abo-Mail $from = "abonements abo LEFT JOIN {pre}_read red ON (abo.users_id = red.users_id AND abo.threads_id = red.threads_id)\n INNER JOIN {pre}_users usr ON abo.users_id = usr.users_id"; $where = 'abo.threads_id = ' . $data['thread']['threads_id'] . ' AND abo.users_id != ' . $account['users_id'] . ' AND usr.users_delete != 1 AND usr.users_abomail = 1'; $abo_users = cs_sql_select(__FILE__, $from, 'abo.abonements_id, usr.users_lang, usr.users_email', $where, 0, 0, 0); $abo['count'] = empty($abo_users) ? 0 : count($abo_users); $abo_lang[$account['users_lang']]['text'] = $cs_lang['abo_mail_text']; $abo_lang[$account['users_lang']]['subject'] = $cs_lang['mod2'];