<?php

include "include/init.php";
login_ensure_loggedin();
loadlib("flickr_backups");
loadlib("invite_codes");
$backups = flickr_backups_for_user($GLOBALS['cfg']['user']);
$registered = count($backups) ? 1 : 0;
if (!$registered && !$GLOBALS['cfg']['backups_enable_registrations']) {
    error_disabled();
}
if ($GLOBALS['cfg']['enable_feature_invite_codes']) {
    if (!$registered && !invite_codes_get_by_cookie()) {
        $cookie = login_get_cookie('invite');
        if (!$cookie) {
            header("location: /invite/?redir=" . urlencode("account/flickr/backups"));
            exit;
        }
    }
}
features_ensure_enabled("backups");
$map = flickr_backups_type_map('string keys');
$GLOBALS['smarty']->assign_by_ref("map", $map);
$crumb_key = 'backups';
$smarty->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    if (post_str("setup")) {
        $created = array();
        $details = array();
        foreach ($map as $ignore => $type_id) {
<?php

include "include/init.php";
loadlib("flickr_backups");
# it is unclear whether this is working correctly
# (20111125/straup)
loadlib("invite_codes");
if ($GLOBALS['cfg']['enable_feature_invite_codes']) {
    if (!invite_codes_get_by_cookie()) {
        $cookie = login_get_cookie('invite');
        if (!$cookie) {
            header("location: /invite/?redir=" . urlencode("/account/backups"));
            exit;
        }
    }
}
if (!$GLOBALS['cfg']['enable_feature_backups']) {
    error_disabled();
}
login_ensure_loggedin("account/backups/");
$map = flickr_backups_type_map('string keys');
$GLOBALS['smarty']->assign_by_ref("map", $map);
$backups = flickr_backups_for_user($GLOBALS['cfg']['user']);
if (!count($backups) && !$GLOBALS['cfg']['backups_enable_registrations']) {
    error_disabled();
}
$crumb_key = 'backups';
$smarty->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    if (post_str("setup")) {