foreach ($required as $req) { $db->query('SELECT `id` FROM `users_courses_complete` WHERE `course` = ? AND `user` = ?'); $db->execute([$req, $my['id']]); if (!$db->num_rows()) { $mtg->error('You haven\'t completed all the courses required for this task'); } } } } $db->query('SELECT `enabled` FROM `tasks_groups` WHERE `id` = ?'); $db->execute([$task['group_id']]); if ($db->fetch_single() != 1) { $mtg->error('That task is currently disabled'); } require_once __DIR__ . '/includes/class/jbbcode/Parser.php'; $parser = new jBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $find = ['[TOTAL_STATS]', '[STRENGTH]', '[AGILITY]', '[GUARD]', '[LABOUR]', '[IQ]', '[MONEY]', '[POINTS]', '[POWER]', '[ENERGY]', '[NERVE]', '[LIFE]', '[EXP]', '[EXP_GIVEN]', '[MONEY_GIVEN]', '[POINTS_GIVEN]', '[ITEM_GIVEN]', '[HOSPITAL_TIME]', '[JAIL_TIME]']; if ($task['awarded_money_min'] && $task['awarded_money_max']) { $task['money'] = mt_rand($task['awarded_money_min'], $task['awarded_money_max']); } else { if (!$task['awarded_money_min'] && $task['awarded_money_max']) { $task['money'] = mt_rand(0, $task['awarded_money_max']); } else { if ($task['awarded_money_min'] && !$task['awarded_money_max']) { $task['money'] = $task['awarded_money_min']; } else { $task['money'] = 0; } } }
<?php define('HEADER_TEXT', 'Forums'); require_once __DIR__ . '/includes/globals.php'; if (!$set['forums_enabled']) { $mtg->error('The forum is currently closed'); } $users->checkBan('forum'); require_once __DIR__ . '/includes/class/class_mtg_paginate.php'; $pages = new Paginator(); require_once __DIR__ . '/includes/class/jbbcode/Parser.php'; $parser = new jBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); require_once __DIR__ . '/includes/securimage/securimage.php'; $securimage = new Securimage(); function formatLatestPost($id) { global $db, $mtg, $parser; $db->query('SELECT `content` FROM `forums_posts` WHERE `parent_topic` = ? ORDER BY `posted` DESC LIMIT 1'); $db->execute([$id]); if (!$db->num_rows()) { return 'n/a'; } $str = $db->fetch_single(); $parser->parse($mtg->format($str)); $text = $parser->getAsText(); return strlen($text) <= 25 ? $text : substr($text, 0, 22) . '...'; } $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : null; $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; $_GET['sub'] = array_key_exists('sub', $_GET) && ctype_alpha($_GET['sub']) ? strtolower(trim($_GET['sub'])) : null;