<?php $root = dirname(dirname(__FILE__)); ini_set("include_path", "{$root}/www:{$root}/www/include"); set_time_limit(0); # include "include/init.php"; loadlib("flickr_backups"); $map = flickr_backups_type_map("string keys"); foreach (flickr_backups_users() as $user) { $backups = flickr_backups_for_user($user); foreach ($map as $label => $type_id) { if (isset($backups[$label])) { continue; } echo "backup", "register '{$user['username']}' for {$label} backups\n"; $rsp = flickr_backups_create($user, $type_id); } }
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) { $rsp = flickr_backups_create($GLOBALS['cfg']['user'], $type_id); $created[$type_id] = $rsp['ok'] || $rsp['error_code'] == 1062 ? 1 : 0; $rsp['type_id'] = $type_id; $details[] = $rsp; } $GLOBALS['smarty']->assign_by_ref("created", $created); $GLOBALS['smarty']->assign_by_ref("created_details", $details); $backups = flickr_backups_for_user($GLOBALS['cfg']['user']); } else { if ($type = post_str("type")) { if (isset($map[$type]) && isset($backups[$type])) { $backup = $backups[$type]; $action = post_str("action"); $context = post_str("context"); if ($context == "push") { $enabled = $action == 'start' ? 1 : 0;