/**
 * Write a configuration object to
 * the configuration XML file.
 *
 * @param Configuration $config object
 * to write to the XML file.
 * @return boolean Whether or not the
 * configuration was installed and configured.
 */
function config_setConfiguration($config)
{
    $xml = new SimpleXMLElement(genXML());
    $xml->downloadLocation = (string) $config->getDownloadLocation();
    $xml->torrentModule = (string) $config->getTorrentModule();
    $xml->maxDownloadSpeed = (string) $config->getMaxDownloadSpeed();
    $xml->maxUploadSpeed = (string) $config->getMaxUploadSpeed();
    $xml->maxDownloads = (string) $config->getMaxDownloads();
    $xml->maxUploads = (string) $config->getMaxUploads();
    $xml->maxActiveTorrents = (string) $config->getMaxActiveTorrents();
    $xml->tcpPort = (string) $config->getTcpPort();
    $xml->udpPort = (string) $config->getUdpPort();
    $xml->hideOtherUsers = (string) $config->getHideOtherUsers();
    $xml->allowDirectDownload = (string) $config->getAllowDirectDownload();
    if (@file_put_contents(APPPATH . "../../config/configuration.xml", $xml->asXML())) {
        return true;
    } else {
        return false;
    }
}