function thread_url_replace($tid, $url) { $arr = thread_url_read($tid); if ($url) { if (empty($arr)) { return thread_url_create($tid, $url); } else { return thread_url_update($tid, $url); } } else { if (!empty($arr)) { return thread_url_delete($tid); } return TRUE; } }
function thread_delete($tid) { global $conf; $thread = thread__read($tid); if (empty($thread)) { return TRUE; } $fid = $thread['fid']; $uid = $thread['uid']; $r = thread__delete($tid); if ($r === FALSE) { return FALSE; } // 删除所有回帖,同时更新 posts 统计数 $n = post_delete_by_tid($tid); // 删除我的主题 $uid and mythread_delete($uid, $tid); // 删除附件 // 更新统计 forum__update($fid, array('threads-' => 1)); user__update($uid, array('threads-' => 1)); // 删除 SEO URL thread_url_delete($tid); // 全站统计 runtime_set('threads-', 1); // 清除相关缓存 thread_tids_cache_delete($fid); forum_list_cache_delete(); // 最新和置顶也清理 thread_new_delete($tid); thread_top_delete($tid); thread_lastpid_delete($tid); thread_new_cache_delete(); thread_top_cache_delete(); thread_lastpid_cache_delete(); return $r; }