/**
* Get the ID of the project to use, creating it if appropriate.
* Will call bounce if it experiences an error.
* @return Project ID to use, or null if no project, or false if there was an
* error.
*/
function getProjectId(&$tracks, &$action)
{
    if (empty($action->project)) {
        return null;
    }
    $rawxml = getData($tracks, 'projects.xml');
    if ($rawxml === false) {
        return false;
    }
    $xml = new SimpleXMLElement($rawxml);
    foreach ($xml->project as $project) {
        $name = $project->name;
        $name = "{$name}";
        // Just to be sure.
        if (strcasecmp($name, $action->project) == 0) {
            return (int) $project->id;
        }
    }
    if ($action->createProject) {
        return postData($tracks, 'projects.xml', '<project><name>' . xmlentities($action->project) . '</name></project>');
    }
    if ($tracks->finiky) {
        bounce($tracks, $action, 'Unknown project: ' . $action->project);
        return false;
    }
    return null;
}
Example #2
0
    exit;
}
if (isset($_GET["filter_mime_types_add"])) {
    filter_mime_types_add();
    exit;
}
if (isset($_GET["delete_filter_mime_types"])) {
    filter_mime_types_del();
    exit;
}
if (isset($_GET["delete_filter_filename_extensions"])) {
    filter_filename_extensions_del();
    exit;
}
if (isset($_GET["bounce"])) {
    bounce();
    exit;
}
if (isset($_GET["archives"])) {
    archive();
    exit;
}
if (isset($_GET["delete_moderator"])) {
    moderators_del();
    exit;
}
if (isset($_GET["delete_moderator2"])) {
    moderators_del2();
    exit;
}
if (isset($_GET["welcome"])) {