All pastes #245385 Raw Edit

Miscellany

public text v1 · immutable
#245385 ·published 2006-11-10 22:50 UTC
rendered paste body
/*!
        @header Export
        This document handles export actions
*/

require('../lib/init.php');

if (!$GLOBALS['user']->has_access(100)) {
        access_denied();
}


/* Set any vars we are going to need */
$catalog = new Catalog($_REQUEST['catalog_id']);

    if (isset($_REQUEST['export']) && !empty($_REQUEST['export'])){
                $export = $catalog->export($_REQUEST['export']);
                $export_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
                        "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" .
                        "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" .
                        "<plist version=\"1.0\">\n" .
                        "<dict>\n" .
                        "       <key>Major Version</key><integer>1</integer>\n" .
                        "       <key>Minor Version</key><integer>1</integer>\n" .
                        "       <key>Application Version</key><string>7.0.2</string>\n" .
                        "       <key>Features</key><integer>1</integer>\n" .
                        "       <key>Show Content Ratings</key><true/>\n" .
                        "       <key>Tracks</key>\n" .
                        "       <dict>\n";
                $export_footer = "      </dict>\n" .
                        "</dict>\n" .
                        "</plist>\n";

                header("Cache-control: public");
                header("Content-Disposition: filename=itunes.xml");
                header("Content-Type: application/itunes+xml; charset=utf-8");
                echo $export_header;
                echo $catalog->export($_REQUEST['export']);
                echo $export_footer;
    } else {
        $url    = conf('web_path') . '/admin/index.php';
        $title  = _('Export Failed');
        $body   = '';
        show_template('header');
        show_confirmation($title,$body,$url);
        show_template('footer');
    }
?>