Example #1
0
function getGlobalConfigPath()
{
    $configDirectory = getConfigDirectory();
    $configPath = $configDirectory . 'docvert.conf';
    if (file_exists($configPath)) {
        if (!is_readable($configPath)) {
            webServiceError('&error-config-file-not-readable;', 500, array('path' => $configDirectory));
        }
        return $configPath;
    }
    initializeIniFile($configPath);
    return $configPath;
}
Example #2
0
function addUploadLocation($name, $protocol, $host, $port, $username, $password, $baseDirectory)
{
    $name = sanitiseStringToAlphaNumeric($name);
    //todo sanitise $name
    $configDirectory = getConfigDirectory();
    $uploadLocationPath = $configDirectory . 'upload-' . $name . '.conf';
    while (file_exists($uploadLocationPath)) {
        $uploadLocationPath = $configDirectory . 'upload-' . $name . '-' . rand(1, 1000) . '.conf';
    }
    initializeIniFile($uploadLocationPath);
    setConfigItem($uploadLocationPath, 'name', $name);
    setConfigItem($uploadLocationPath, 'protocol', $protocol);
    setConfigItem($uploadLocationPath, 'host', $host);
    setConfigItem($uploadLocationPath, 'port', $port);
    setConfigItem($uploadLocationPath, 'username', $username);
    setConfigItem($uploadLocationPath, 'password', $password);
    setConfigItem($uploadLocationPath, 'baseDirectory', $baseDirectory);
}