diff --git a/application/core/ManiaExchange/MXMapInfo.php b/application/core/ManiaExchange/MXMapInfo.php index 81a23f2f..b0de6379 100644 --- a/application/core/ManiaExchange/MXMapInfo.php +++ b/application/core/ManiaExchange/MXMapInfo.php @@ -18,7 +18,7 @@ class MXMapInfo { public $exebld, $routes, $length, $unlimiter, $laps, $difficulty, $lbrating, $trkvalue; public $replaytyp, $replayid, $replaycnt, $acomment, $awards, $comments; public $pageurl, $replayurl, $imageurl, $thumburl, $downloadurl, $dir; - public $ratingVoteCount, $ratingVoteAverage; + public $ratingVoteCount, $ratingVoteAverage, $vehicleName; /** * Returns map object with all available data from MX map data @@ -47,34 +47,35 @@ class MXMapInfo { $this->name = Formatter::stripDirtyCodes($mx->GbxMapName); } - $this->userid = $mx->UserID; - $this->author = $mx->Username; - $this->uploaded = $mx->UploadedAt; - $this->updated = $mx->UpdatedAt; - $this->type = $mx->TypeName; - $this->maptype = isset($mx->MapType) ? $mx->MapType : ''; - $this->titlepack = isset($mx->TitlePack) ? $mx->TitlePack : ''; - $this->style = isset($mx->StyleName) ? $mx->StyleName : ''; - $this->envir = $mx->EnvironmentName; - $this->mood = $mx->Mood; - $this->dispcost = $mx->DisplayCost; - $this->lightmap = $mx->Lightmap; - $this->modname = isset($mx->ModName) ? $mx->ModName : ''; - $this->exever = $mx->ExeVersion; - $this->exebld = $mx->ExeBuild; - $this->routes = isset($mx->RouteName) ? $mx->RouteName : ''; - $this->length = isset($mx->LengthName) ? $mx->LengthName : ''; - $this->unlimiter = isset($mx->UnlimiterRequired) ? $mx->UnlimiterRequired : false; - $this->laps = isset($mx->Laps) ? $mx->Laps : 0; - $this->difficulty = $mx->DifficultyName; - $this->lbrating = isset($mx->LBRating) ? $mx->LBRating : 0; - $this->trkvalue = isset($mx->TrackValue) ? $mx->TrackValue : 0; - $this->replaytyp = isset($mx->ReplayTypeName) ? $mx->ReplayTypeName : ''; - $this->replayid = isset($mx->ReplayWRID) ? $mx->ReplayWRID : 0; - $this->replaycnt = isset($mx->ReplayCount) ? $mx->ReplayCount : 0; - $this->acomment = $mx->Comments; - $this->awards = isset($mx->AwardCount) ? $mx->AwardCount : 0; - $this->comments = $mx->CommentCount; + $this->userid = $mx->UserID; + $this->author = $mx->Username; + $this->uploaded = $mx->UploadedAt; + $this->updated = $mx->UpdatedAt; + $this->type = $mx->TypeName; + $this->maptype = isset($mx->MapType) ? $mx->MapType : ''; + $this->titlepack = isset($mx->TitlePack) ? $mx->TitlePack : ''; + $this->style = isset($mx->StyleName) ? $mx->StyleName : ''; + $this->envir = $mx->EnvironmentName; + $this->mood = $mx->Mood; + $this->dispcost = $mx->DisplayCost; + $this->lightmap = $mx->Lightmap; + $this->modname = isset($mx->ModName) ? $mx->ModName : ''; + $this->exever = $mx->ExeVersion; + $this->exebld = $mx->ExeBuild; + $this->routes = isset($mx->RouteName) ? $mx->RouteName : ''; + $this->length = isset($mx->LengthName) ? $mx->LengthName : ''; + $this->unlimiter = isset($mx->UnlimiterRequired) ? $mx->UnlimiterRequired : false; + $this->laps = isset($mx->Laps) ? $mx->Laps : 0; + $this->difficulty = $mx->DifficultyName; + $this->lbrating = isset($mx->LBRating) ? $mx->LBRating : 0; + $this->trkvalue = isset($mx->TrackValue) ? $mx->TrackValue : 0; + $this->replaytyp = isset($mx->ReplayTypeName) ? $mx->ReplayTypeName : ''; + $this->replayid = isset($mx->ReplayWRID) ? $mx->ReplayWRID : 0; + $this->replaycnt = isset($mx->ReplayCount) ? $mx->ReplayCount : 0; + $this->acomment = $mx->Comments; + $this->awards = isset($mx->AwardCount) ? $mx->AwardCount : 0; + $this->comments = $mx->CommentCount; + $this->vehicleName = isset($mx->VehicleName) ? $mx->VehicleName : ''; $this->ratingVoteCount = isset($mx->RatingVoteCount) ? $mx->RatingVoteCount : 0; $this->ratingVoteAverage = isset($mx->RatingVoteAverage) ? $mx->RatingVoteAverage : 0; @@ -91,10 +92,21 @@ class MXMapInfo { $this->acomment = preg_replace('/\[url=.*\]/', '', $this->acomment); $this->pageurl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/view/' . $this->id; - $this->imageurl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/screenshot/normal/' . $this->id; - $this->thumburl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/screenshot/small/' . $this->id; $this->downloadurl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/download/' . $this->id; + + if ($mx->HasScreenshot) { + $this->imageurl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/screenshot/normal/' . $this->id; + } else { + $this->imageurl = ''; + } + + if ($mx->HasThumbnail) { + $this->thumburl = 'http://' . $this->prefix . '.mania-exchange.com/' . $this->dir . '/screenshot/small/' . $this->id; + } else { + $this->thumburl = ''; + } + if ($this->prefix == 'tm' && $this->replayid > 0) { $this->replayurl = 'http://' . $this->prefix . '.mania-exchange.com/replays/download/' . $this->replayid; } else {