Skip to content

Commit

Permalink
move mp.php to functions/mp_latest_recommended.php
Browse files Browse the repository at this point in the history
  • Loading branch information
cowpod committed Oct 31, 2024
1 parent fc839ed commit 4e51554
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
28 changes: 0 additions & 28 deletions api/mp.php

This file was deleted.

25 changes: 25 additions & 0 deletions functions/mp_latest_recommended.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
// global $db;
// require_once("db.php");
// if (!isset($db)){
// $db=new Db;
// $db->connect();
// }

function mp_latest_recommended($db) {
$mp_modpack = $db->query("SELECT latest,recommended FROM modpacks WHERE name = '".$db->sanitize($_GET['name'])."'");

if ($mp_modpack && sizeof($mp_modpack)==1) {
$mp_modpack=$mp_modpack[0];

// this doesn't appear to be used anywhere??
// $builds = $db->query("SELECT * FROM `builds` WHERE `modpack` = ".$mp_modpack['id']);
// } else {
// $builds=[];
}

// error_log(json_encode($mp_response));
return json_encode([
"recommended" => !empty($mp_modpack['recommended']) ? $mp_modpack['recommended'] : null,
"latest" => !empty($mp_modpack['latest']) ? $mp_modpack['latest'] : null]);
}

0 comments on commit 4e51554

Please sign in to comment.