Не там делаеш. Чуть ниже 507 строка, в запросе измени ASC на DESC
$psql = "SELECT p.*, u.id as uid, u.nickname author, u.login author_login, u.is_deleted deleted, up.imageurl imageurl, up.signature signature
FROM cms_forum_posts p
LEFT JOIN cms_users u ON u.id = p.user_id
LEFT JOIN cms_user_profiles up ON up.user_id = u.id
WHERE p.thread_id = '$id'
ORDER BY p.pubdate DESC
LIMIT ".(($page-1)*$perpage).", $perpage";
---------------------------------------------------------------------------------
А поменять сортировку созданных тем :
Строка 333 — DESC свежие вверху, ASC старые вверху.
$tsql = "SELECT t.*, COUNT(p.id) as postsnum, IF(t.pubdate > '$logdate', 1, 0) as is_new, u.nickname, u.login
FROM cms_forum_threads t
INNER JOIN cms_forum_posts p ON p.thread_id = t.id
LEFT JOIN cms_users u ON u.id = t.user_id
WHERE t.forum_id = '{$f['id']}'
GROUP BY t.id
ORDER BY t.pinned DESC, t.pubdate DESC
LIMIT ".(($page-1)*$perpage).", $perpage";