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_update($tid, $arr) { global $conf; $thread = thread__read($tid); if (isset($arr['subject']) && $arr['subject'] != $thread['subject']) { thread_new_cache_delete(); $thread['top'] > 0 and thread_top_cache_delete(); } // 更改 fid, 移动主题,相关资源也需要更新 if (isset($arr['fid']) && $arr['fid'] != $thread['fid']) { forum__update($arr['fid'], array('threads+' => 1)); forum__update($thread['fid'], array('threads-' => 1)); thread_top_update_by_tid($tid, $arr['fid']); thread_lastpid_cache_delete(); } !empty($thread['fid']) and thread_tids_cache_delete($thread['fid']); // SEO URL if (isset($arr['seo_url'])) { thread_url_update($tid, $arr['seo_url']); unset($arr['seo_url']); } if (!$arr) { return TRUE; } $r = thread__update($tid, $arr); !empty($arr['fid']) and thread_tids_cache_delete($arr['fid'], TRUE); return $r; }