WapTrick360


Share Your Creativity For Wapka
-- WapTrick360 Settings function bbcode(input_string) local bbcode_rules = { {pattern = '%[post=(.-)%]', replacement = '' }, {pattern = '%[allsitecodes%]', replacement = '#all_site_codes{display:none}' }, {pattern = '%[profileposts%]', replacement = '#profile_posts{display:none}' }, {pattern = '%[profilephotos%]', replacement = '#profile_photos{display:none}' }, {pattern = '%[usertimeline%]', replacement = '#user_timeline{display:none}' }, {pattern = '%[IndexChatbox%]', replacement = '#index_chatbox{display:none}' }, {pattern = '%[IndexFun%]', replacement = '#index_fun{display:none}' }, {pattern = '%[IndexResentPost%]', replacement = '#index_resentpost{display:none}' }, {pattern = '%[IndexTimeline%]', replacement = '#index_timeline{display:none}' }, {pattern = '%[IndexWapmaster%]', replacement = '#index_wapmaster{display:none}' }, -- Add more rules for other BBCode tags as needed } for _, rule in ipairs(bbcode_rules) do input_string = input_string:gsub(rule.pattern, rule.replacement) end return input_string end userid = tonumber(env.userid) if userid == 0 then userid = 69501 end local param = { forumid = 20311, userid = userid, order = "new" } local post_check, post_check_list, post_check_stats = api.post_info(param) post_total = tonumber(post_check_stats['total']) local is_ok, list = api.post_info(param) local is_ok, list1 = api.post_info({forumid = 20311, userid = 69501, order = "new"}) content1 = list1[0].content if post_total > 0 then postid = list[0].id local is_ok, lista = api.post_info({id = postid}) if is_ok then content = lista[0].content end print("") endinclude('bbcode') postid = tonumber(req.get.postid) userid = tonumber(env.userid) or 0 function timeAgo(timestamp) local currentTime = os.time() local givenTime = os.time({year = tonumber(timestamp:sub(1, 4)), month = tonumber(timestamp:sub(6, 7)), day = tonumber(timestamp:sub(9, 10)), hour = tonumber(timestamp:sub(12, 13)), min = tonumber(timestamp:sub(15, 16)), sec = tonumber(timestamp:sub(18, 19))}) local timeDiff = currentTime - givenTime if timeDiff < 60 then return timeDiff .. " seconds ago" elseif timeDiff < 3600 then return math.floor(timeDiff / 60) .. " minutes ago" elseif timeDiff < 86400 then return math.floor(timeDiff / 3600) .. " hours ago" elseif timeDiff < 2592000 then return math.floor(timeDiff / 86400) .. " days ago" elseif timeDiff < 31536000 then return math.floor(timeDiff / 2592000) .. " months ago" else return math.floor(timeDiff / 31536000) .. " years ago" end end local user_roles = { {value = 1, label = "Member"}, {value = 2, label = "Member"}, {value = 3, label = "Member"}, {value = 4, label = "Moderator"}, {value = 5, label = "Master moderator"}, {value = 6, label = "Editor"}, {value = 7, label = "Master Editor"}, {value = 8, label = "Administrator"}, {value = 9, label = "Master Admin"}, {value = 10, label = "Super Admin"}, } -- Create a simpler table for direct lookup by value local users = {} for _, role in ipairs(user_roles) do users[role.value] = role.label end local is_ok, list = api.post_info({id = postid}) if is_ok then postid = list[0].id content = list[0].content title = list[0].title time = timeAgo(list[0].date) user = list[0].UserInfo avatar = tostring(user.avatar) or "https://wapka-img.zuna.id/e18e8dd4.jpeg" forum = list[0].ForumInfo botton = "" if(env.userid ~=0 and env.userid ~= user.id) then botton = tostring(' ') end role = tostring(users[user.role]) action = "" if env.userid ~= 0 and env.is_admin or env.userid == user.id then action = '[Edited / Delete]' end end local html1 = [[
Home » ]] .. forum.name .. [[ » ]] .. title .. [[
]] print(html1) local html2 = [[
]] print(html2) local is_ok, list1 = api.post_info({id = req.get.postid}) content = list1[0].content print(bbcode(content.. "[hr]").. '
') fid = {23992} uid = tostring(req.get.postid) sn = 1 muser = tonumber(env.userid) local is_ok, list2 = api.post_info({forumid=fid, limit=9999}) local seen = {} local html = {} local new_list = {} for i, users in ipairs(list2) do if list2[i].var and list2[i].var.postid == uid then seen[users.var.postid] = true table.insert(new_list, users) end end print("Total likes ["..#new_list.."] ") for loopindex, userdata in ipairs(new_list) do user = userdata['UserInfo'] if user['id'] == muser then print("") end if sn == 1 then html[#html + 1] = [[]] .. user['username'] .. [[ ]] elseif sn == #new_list then html[#html + 1] = [[and ]] .. user['username'] .. [[ ]] else html[#html + 1] = [[, ]] .. user['username'] .. [[ ]] end sn = sn +1 end print(like_btn) print(table.concat(html)) print("
")-- Comment inputs local is_ok, list3 = api.user_info({ id= tonumber(env.userid)}) postid = tonumber(req.get.postid) or 134804 local is_ok, list = api.post_info({id = postid}) if is_ok then user = list[0].UserInfo end local header = [[
For comment section please Login Or Registration Here
Recent Comments
]] print(header) if(env.userid ~= 0) then -- All input values local cid = tonumber(req.get.reply or user.id) local cname = tostring(user.username) local cavatar = tostring(list3[0].avatar or "https://wapka-cdn.zuna.id/008s6z/e826bedc83eaa61c8659d8e737579f5c/image.jpg") local replyto = tostring(req.get.uname or "0") local replyhtml if req.get.reply then replyhtml = '
Reply to ' .. tostring(replyto) .. ' Cancel
' else replyhtml = ' ' end local html1 = [[-- Random 5 posts postid = tonumber(req.get.postid) local is_ok, list1 = api.post_info({id = postid}) fid = tonumber(list1[0].ForumInfo.id) if fid ~= 27289 then fid = {10294} end include('luascripts') include('bbcode') print([[
More Topics
]]) local post_check, post_check_list, post_check_stats = api.post_info({forumid=fid}) post_total = tonumber(post_check_stats['total']) local is_ok, list = api.post_info({limit=post_total,forumid=fid}) if is_ok then table.insert(list,list[0]) -- Shuffle the list math.randomseed(os.time()) for i = #list, 2, -1 do local j = math.random(i) list[i], list[j] = list[j], list[i] end -- Display 5 random posts for i = 1, math.min(5, #list) do local article = list[i] thumbnail = string.match(article['content'], "%[img%](.-)%[/img%]") or 'https://wapka-img.zuna.id/37cb83d6.png' colors = {'red', 'blue', 'green', 'orange'} randomIndex = math.random(1, #colors) randomColor = colors[randomIndex] topicClass = "cat_"..randomColor category = article['ForumInfo'] user = article['UserInfo'] link = "/view?postid="..article['id'].."&title="..slugVN(article['title'])..".html" local html = [[ ]] print(html) end else print("Failed to fetch post info") end print([[
]])
2026 WapTrick360
Version 2.0