diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 7fad4f1c..10fac50d 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -161,8 +161,8 @@ class MapManager implements CallbackListener { * @return bool */ private function updateMapTimestamp($uid) { - $mysqli = $this->maniaControl->database->mysqli; - $mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET + $mysqli = $this->maniaControl->database->mysqli; + $mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET mxid = 0, changed = NOW() WHERE 'uid' = ?"; @@ -288,11 +288,11 @@ class MapManager implements CallbackListener { $downloadFolderName = $this->maniaControl->settingManager->getSettingValue($this, 'MapDownloadDirectory', 'MX'); $relativeMapFileName = $downloadFolderName . DIRECTORY_SEPARATOR . $fileName; $mapDir = $this->maniaControl->client->getMapsDirectory(); - $downloadDirectory = $mapDir . DIRECTORY_SEPARATOR . $downloadFolderName . DIRECTORY_SEPARATOR; + $downloadDirectory = $mapDir . $downloadFolderName . DIRECTORY_SEPARATOR; $fullMapFileName = $downloadDirectory . $fileName; // Check if it can get written locally - if (is_dir($mapDir) && is_writable($mapDir)) { + if ($this->maniaControl->server->checkAccess($mapDir)) { // Create download directory if necessary if (!is_dir($downloadDirectory) && !mkdir($downloadDirectory)) { trigger_error("ManiaControl doesn't have to rights to save maps in '{$downloadDirectory}'."); diff --git a/application/core/Server/Server.php b/application/core/Server/Server.php index df4471bc..005f49f2 100644 --- a/application/core/Server/Server.php +++ b/application/core/Server/Server.php @@ -34,7 +34,7 @@ class Server implements CallbackListener { public $p2pPort = -1; public $login = null; public $titleId = null; - public $dataDirectory = ''; + public $dataDirectory = null; public $serverCommands = null; public $usageReporter = null; public $rankingManager = null; @@ -199,25 +199,22 @@ class Server implements CallbackListener { } /** - * Fetch Maps Directory + * Get Maps Directory * * @return string */ public function getMapsDirectory() { $dataDirectory = $this->getDataDirectory(); - if (!$dataDirectory) { - return null; - } - return "{$dataDirectory}Maps" . DIRECTORY_SEPARATOR; + return $dataDirectory . 'Maps' . DIRECTORY_SEPARATOR; } /** - * Fetch Game Data Directory + * Get Game Data Directory * * @return string */ public function getDataDirectory() { - if ($this->dataDirectory == '') { + if (!$this->dataDirectory) { $this->dataDirectory = $this->maniaControl->client->gameDataDirectory(); } return $this->dataDirectory; @@ -245,7 +242,6 @@ class Server implements CallbackListener { } catch (Exception $e) { // TODO temp added 19.04.2014 $this->maniaControl->errorHandler->triggerDebugNotice("Exception line 330 Server.php" . $e->getMessage()); - trigger_error("Couldn't get validation replay of '{$login}'. " . $e->getMessage()); return null; } @@ -292,7 +288,7 @@ class Server implements CallbackListener { } /** - * Checks if ManiaControl has Access to the given Directory + * Check if ManiaControl has Access to the given Directory * * @param string $directory * @return bool