function deleteUploadLocation($uploadId) { //todo sanitise $nam $uploadId = sanitiseStringToAlphaNumeric($uploadId); $uploadLocationPath = getConfigDirectory() . 'upload-' . $uploadId . '.conf'; if (file_exists($uploadLocationPath)) { unlink($uploadLocationPath); } }
static function getSaltValue() { $configDirectory = getConfigDirectory(); $saltPath = $configDirectory . 'salt'; if (file_exists($saltPath) && is_readable($saltPath)) { return file_get_contents($saltPath); } $saltValue = hash('sha256', mt_rand() * microtime()); file_put_contents($saltPath, $saltValue); return $saltValue; }
function initializeIniFile($path) { $configDirectory = getConfigDirectory(); if (!file_exists($configDirectory)) { webServiceError('&error-config-directory-not-available;', 500, array('path' => $configDirectory)); } if (!is_writable($configDirectory)) { webServiceError('&error-config-file-not-writable;', 500, array('path' => $configDirectory)); } $header = '; Docvert web service configuration.' . "\n" . '; Project homepage at <http://docvert.org>'; file_put_contents($path, $header); chmod($path, 0600); //security! }