<?php

include "../include/init.php";
loadlib("god");
features_ensure_enabled("flickr_push");
loadlib("flickr_push");
loadlib("flickr_backups");
loadlib("flickr_push_photos");
loadlib("flickr_push_subscriptions");
$id = get_int32("id");
$sub = flickr_push_subscriptions_get_by_id($id);
if (!$sub) {
    error_404();
}
$crumb_key = "delete_feed";
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
if (post_str("delete") && crumb_check($crumb_key)) {
    $feed_rsp = flickr_push_unsubscribe($sub);
    $GLOBALS['smarty']->assign("delete_feed", $feed_rsp);
    if ($feed_rsp['ok']) {
        $sub_rsp = flickr_push_subscriptions_delete($sub);
        $GLOBALS['smarty']->assign("delete_sub", $sub_rsp);
        if ($sub_rsp['ok']) {
            $redir = "{$GLOBALS['cfg']['abs_root_url']}god/push/subscriptions/{$sub['user_id']}/";
            header("location: {$redir}");
            exit;
        }
    }
}
$topic_map = flickr_push_topic_map();
$sub['str_topic'] = $topic_map[$sub['topic_id']];
Esempio n. 2
0
<?php

include "include/init.php";
features_ensure_enabled(array("api", "api_documentation"));
$default = $GLOBALS['cfg']['api']['default_format'];
$formats = $GLOBALS['cfg']['api']['formats'];
$format = get_str("format");
if (!$format) {
    error_404();
}
if (!in_array($format, $formats)) {
    error_404();
}
$GLOBALS['smarty']->assign("default", $default);
$GLOBALS['smarty']->assign("format", $format);
$GLOBALS['smarty']->display("page_api_format.txt");
exit;
<?php

include "include/init.php";
loadlib("api_keys");
loadlib("api_keys_utils");
features_ensure_enabled("api");
features_ensure_enabled("api_register_keys");
login_ensure_loggedin();
$crumb_key = 'api_key';
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
$step = 1;
if (post_isset('done') && crumb_check($crumb_key)) {
    $ok = 1;
    $title = filter_strict(post_str("title"));
    $description = filter_strict(post_str("description"));
    $callback = filter_strict(post_str("callback"));
    $conf = post_str("confirm");
    if ($ok && !$title) {
        $GLOBALS['smarty']->assign("error", "no_title");
        $ok = 0;
    } else {
        $GLOBALS['smarty']->assign("title", $title);
    }
    if ($ok && !$description) {
        $GLOBALS['smarty']->assign("error", "no_description");
        $ok = 0;
    } else {
        $GLOBALS['smarty']->assign("description", $description);
    }
    if ($ok && $callback) {
        if (!api_keys_utils_is_valid_callback($callback)) {
Esempio n. 4
0
<?php

include "include/init.php";
loadlib("api");
features_ensure_enabled("api");
$GLOBALS['smarty']->display("page_api.txt");
exit;
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) {
            $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;
        }
<?php

# sad face...
# http://www.rfc-editor.org/rfc/rfc6749.txt
include "include/init.php";
features_ensure_enabled("api");
features_ensure_enabled("api_delegated_auth");
loadlib("api_keys");
loadlib("api_keys_utils");
loadlib("api_oauth2_grant_tokens");
loadlib("api_oauth2_access_tokens");
#
function local_send_json($json, $is_error = 0)
{
    if (!$is_error && isset($json['error'])) {
        $is_error = 1;
    }
    if ($is_error) {
        header("HTTP/1.1 400 Bad Request");
    }
    header("Content-Type: application/json;charset=UTF-8");
    header("Cache-Control: no-store");
    header("Pragma: no-cache");
    echo json_encode($json);
    exit;
}
#
$key_more = array('ensure_isown' => 0);
$key_row = api_keys_utils_get_from_url($key_more);
$GLOBALS['smarty']->assign_by_ref("key", $key_row);
$ok = 1;
# This is a little piece of syntactic sugar for logged-in users.
# It is predicated on using OAuth2 which itself is mostly just a
# lot of syntactic sugar around the same old api key + auth token
# dance which is itself wrapped up in a big ol' blanket of HTTPS.
#
# So all this page does is mint a brand new key and access token
# for a user in one go. It doesn't set a callback URL or do anything
# fancy. It just gives them an access_token so they can start
# using the API. (20121026/straup)
# sad face...
# http://www.rfc-editor.org/rfc/rfc6749.txt
include "include/init.php";
features_ensure_enabled("api");
features_ensure_enabled("api_delegated_auth");
features_ensure_enabled("api_authenticate_self");
login_ensure_loggedin();
loadlib("api_keys");
loadlib("api_oauth2_access_tokens");
$crumb_key = 'access_token_authenticate_like_magic';
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
$perms_map = api_oauth2_access_tokens_permissions_map();
$GLOBALS['smarty']->assign_by_ref("permissions", $perms_map);
$ttl_map = api_oauth2_access_tokens_ttl_map();
$GLOBALS['smarty']->assign_by_ref("ttl_map", $ttl_map);
$step = 1;
if (post_isset("done") && crumb_check($crumb_key)) {
    $ok = 1;
    $title = post_str("title");
    $perms = post_str("perms");
    $ttl = post_int32("ttl");
Esempio n. 8
0
<?php

include "include/init.php";
features_ensure_enabled("signup");
login_ensure_loggedout();
#
# carry this argument through
#
$smarty->assign('redir', request_str('redir'));
#
# are we signing up?
#
if (post_str('signup')) {
    $ok = 1;
    $email = post_str('email');
    $password = post_str('password');
    $username = post_str('username');
    $redir = post_str('redir');
    $smarty->assign('email', $email);
    $smarty->assign('password', $password);
    $smarty->assign('username', $username);
    $smarty->assign('redir', $redir);
    #
    # all fields are in order?
    #
    if (!strlen($email) || !strlen($password) || !strlen($username)) {
        $smarty->assign('error_missing', 1);
        $ok = 0;
    }
    #
    # email available?
Esempio n. 9
0
<?
	#
	# $Id$
	#

	include("include/init.php");

	features_ensure_enabled("signin");

	login_ensure_loggedout();


	#
	# pass through
	#

	$redir = request_str('redir');
	$smarty->assign('redir', $redir);


	#
	# try and sign in?
	#

	if (post_str('signin')){

		$email		= post_str('email');
		$password	= post_str('password');

		$smarty->assign('email', $email);