= CONTEST_PENDING_FINAL_TEST) { return true; } if ($contest['cur_progress'] == CONTEST_NOT_STARTED) { return false; } return hasRegistered($user, $contest); } function isSubmissionVisibleToUser($submission, $problem, $user) { if (isSuperUser($user)) { return true; } else if (!$submission['is_hidden']) { return true; } else { return hasProblemPermission($user, $problem); } } function isHackVisibleToUser($hack, $problem, $user) { if (isSuperUser($user)) { return true; } elseif (!$hack['is_hidden']) { return true; } else { return hasProblemPermission($user, $problem); } } function isSubmissionFullVisibleToUser($submission, $contest, $problem, $user) { if (isSuperUser($user)) { return true; } elseif (!$contest) { return true; } elseif ($contest['cur_progress'] > CONTEST_IN_PROGRESS) { return true; } elseif ($submission['submitter'] == $user['username']) { return true; } else { return hasProblemPermission($user, $problem); } } function isHackFullVisibleToUser($hack, $contest, $problem, $user) { if (isSuperUser($user)) { return true; } elseif (!$contest) { return true; } elseif ($contest['cur_progress'] > CONTEST_IN_PROGRESS) { return true; } elseif ($hack['hacker'] == $user['username']) { return true; } else { return hasProblemPermission($user, $problem); } } function deleteBlog($id) { if (!validateUInt($id)) { return; } DB::delete("delete from click_zans where type = 'B' and target_id = $id"); DB::delete("delete from click_zans where type = 'BC' and target_id in (select id from blogs_comments where blog_id = $id)"); DB::delete("delete from blogs where id = $id"); DB::delete("delete from blogs_comments where blog_id = $id"); DB::delete("delete from important_blogs where blog_id = $id"); DB::delete("delete from blogs_tags where blog_id = $id"); }