Exemplo n.º 1
0
<?php

include "include/init.php";
login_ensure_loggedin();
#
# output
#
$smarty->display("page_account.txt");
Exemplo n.º 2
0
<?php

#
# $Id$
#
include "include/init.php";
loadlib("formats");
loadlib("import");
loadlib("import_flickr");
loadlib("flickr");
loadlib("google");
#################################################################
login_ensure_loggedin("{$GLOBALS['cfg']['abs_root_url']}upload");
# temporary bits until everything gets merged in to one
# magic upload box...
$GLOBALS['smarty']->assign("include_url_upload", 1);
if (!$GLOBALS['cfg']['enable_feature_import']) {
    $GLOBALS['error']['uploads_disabled'] = 1;
    $smarty->display("page_upload_disabled.txt");
    exit;
}
#################################################################
$crumb_key = 'upload';
$crumb_ok = crumb_check($crumb_key);
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
#
$label = filter_strict(post_str('label'));
$private = post_str('private') ? 1 : 0;
$dots_index_on = filter_strict(post_str('dots_index_on'));
$mime_type = filter_strict(post_str('mime_type'));
$GLOBALS['smarty']->assign("label", $label);
Exemplo n.º 3
0
<?php

include "include/init.php";
loadlib("privatesquare_checkins");
loadlib("privatesquare_checkins_utils");
loadlib("privatesquare_export");
loadlib("foursquare_users");
$fsq_id = get_int32("foursquare_id");
if (!$fsq_id) {
    error_404();
}
$history_url = "user/{$fsq_id}/history/";
login_ensure_loggedin($history_url);
$fsq_user = foursquare_users_get_by_foursquare_id($fsq_id);
if (!$fsq_user) {
    error_404();
}
$owner = users_get_by_id($fsq_user['user_id']);
$is_own = $owner['id'] == $GLOBALS['cfg']['user']['id'] ? 1 : 0;
# for now...
if (!$is_own) {
    error_403();
}
$more = array();
if ($page = get_int32("page")) {
    $more['page'] = $page;
}
if ($when = get_str("when")) {
    $more['when'] = $when;
    $history_url .= urlencode($when) . "/";
    # TO DO: find some better heuristic for this number
Exemplo n.º 4
0
<?php

#
# $Id$
#
include "include/init.php";
login_ensure_loggedin("/account");
#
# output
#
$smarty->display("page_account.txt");
<?php

include "include/init.php";
login_ensure_loggedin("/account/foursquare/sync/");
$crumb_key = "foursquare_sync";
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
# put this in a library? which one...
$sync_states = array(0 => 'do not sync 4sq checkins', 1 => 'only sync recent 4sq checkins', 2 => 'sync all 4sq checkins past and future');
if (post_isset("done") && crumb_check($crumb_key)) {
    $ok = 1;
    if (!post_isset("sync")) {
        $update_error = "missing sync";
        $ok = 0;
    }
    if ($ok) {
        $sync = post_int32("sync");
        if (!isset($sync_states[$sync])) {
            $update_error = "invalid sync";
            $ok = 0;
        }
    }
    if ($ok) {
        if ($sync != $GLOBALS['cfg']['user']['sync_foursquare']) {
            $update = array('sync_foursquare' => $sync);
            $ok = users_update_user($GLOBALS['cfg']['user'], $update);
            if ($ok) {
                $GLOBALS['cfg']['user'] = users_get_by_id($GLOBALS['cfg']['user']['id']);
            } else {
                $update_error = "db error";
            }
        }
    $GLOBALS['error']['uploads_disabled'] = 1;
    $smarty->display("page_upload_disabled.txt");
    exit;
}
if (!$GLOBALS['cfg']['enable_feature_import_by_url']) {
    $GLOBALS['error']['uploads_by_url_disabled'] = 1;
    $smarty->display("page_upload_disabled.txt");
    exit;
}
#
$url = request_str("url");
$loggedin_url = "{$GLOBALS['cfg']['abs_root_url']}upload/flickr/";
if ($url) {
    $loggedin_url .= "?url=" . urlencode($url);
}
login_ensure_loggedin($loggedin_url);
#
$crumb_key = 'upload';
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
#
$ok = 1;
if ($url) {
    $parsed_url = utils_parse_url($url);
    if (!preg_match("/(www\\.)?flickr\\.com/", $parsed_url['host'])) {
        $GLOBALS['error']['not_flickr'] = 1;
        $ok = 0;
    }
    $GLOBALS['smarty']->assign("url", $url);
    $GLOBALS['smarty']->assign("parsed_url", $parsed_url);
}
if ($url && $ok) {
Exemplo n.º 7
0
<?php

include "include/init.php";
loadlib("foursquare_venues");
loadlib("foursquare_checkins");
loadlib("privatesquare_checkins");
loadlib("privatesquare_export");
loadlib("reverse_geoplanet");
login_ensure_loggedin($_SERVER['REQUEST_URI']);
$owner = $GLOBALS['cfg']['user'];
$GLOBALS['smarty']->assign_by_ref("owner", $owner);
$venue_id = get_str("venue_id");
$venue = foursquare_venues_get_by_venue_id($venue_id);
if (!$venue) {
    error_404();
}
$venue['data'] = json_decode($venue['data'], "as hash");
$venue['locality'] = reverse_geoplanet_get_by_woeid($venue['locality'], 'locality');
# TO DO: account for pagination and > n checkins
$more = array('venue_id' => $venue_id);
$checkins = privatesquare_checkins_for_user($owner, $more);
$venue['checkins'] = $checkins['rows'];
$status_map = privatesquare_checkins_status_map();
$broadcast_map = foursquare_checkins_broadcast_map();
$GLOBALS['smarty']->assign_by_ref("status_map", $status_map);
$GLOBALS['smarty']->assign_by_ref("broadcast_map", $broadcast_map);
$GLOBALS['smarty']->assign_by_ref("venue", $venue);
$checkin_crumb = crumb_generate("api", "privatesquare.venues.checkin");
$GLOBALS['smarty']->assign("checkin_crumb", $checkin_crumb);
# did we arrive here from a checkin page?
$success = get_str("success") ? 1 : 0;
Exemplo n.º 8
0
# 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")) {
        $created = 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;
<?php

include "include/init.php";
loadlib("flickr_photos");
loadlib("flickr_photos_exif");
# ensure logged in; parse out photo url
$photo_id = get_int64("id");
$path = get_str("path");
$url = "/photos/{$path}/{$photo_id}/";
login_ensure_loggedin($url);
#
$photo = flickr_photos_get_by_id($photo_id);
if (!$photo['id']) {
    error_404();
}
if ($photo['user_id'] != $GLOBALS['cfg']['user']['id']) {
    error_403();
}
if ($photo['deleted']) {
    $GLOBALS['smarty']->display("page_photo_deleted.txt");
    exit;
}
$GLOBALS['smarty']->assign_by_ref("photo", $photo);
#
$rsp = flickr_photos_exif_read($photo);
if ($rsp['ok']) {
    $GLOBALS['smarty']->assign_by_ref("exif", $rsp['rows']);
} else {
    $GLOBALS['smarty']->assign("error", $rsp['error']);
}
$GLOBALS['smarty']->display("page_flickr_photo_exif.txt");
<?php

include "include/init.php";
loadlib("flickr_users_path_aliases");
if (!$GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
    error_disabled();
}
login_ensure_loggedin("/account/url/");
$crumb_key = 'pathalias';
$smarty->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    $ok = 1;
    $new_alias = post_str("path_alias");
    $new_alias = filter_strict($new_alias);
    $new_alias = trim($new_alias);
    if (!$new_alias) {
        $GLOBALS['smarty']->assign("error", "invalid alias");
        $ok = 0;
    }
    if ($ok && !flickr_users_path_aliases_is_available($new_alias)) {
        $GLOBALS['smarty']->assign("error", "alias taken");
        $ok = 0;
    }
    if ($ok) {
        if (post_str("confirm")) {
            $rsp = flickr_users_path_aliases_create($GLOBALS['cfg']['user'], $new_alias);
            if (!$rsp['ok']) {
                $GLOBALS['smarty']->assign("error", "db error");
                $ok = 0;
            }
<?php

include "include/init.php";
loadlib("flickr_users");
loadlib("flickr_push");
loadlib("flickr_push_subscriptions");
loadlib("flickr_push_photos");
login_ensure_loggedin("/photos/friends/faves/");
if (!$GLOBALS['cfg']['enable_feature_flickr_push']) {
    error_disabled();
}
if (!$GLOBALS['cfg']['flickr_push_enable_photos_friends_faves']) {
    error_disabled();
}
$topic_map = flickr_push_topic_map("string keys");
$topic_id = $topic_map["contacts_faves"];
$sub = flickr_push_subscriptions_get_by_user_and_topic($GLOBALS['cfg']['user'], $topic_id);
$GLOBALS['smarty']->assign_by_ref("subscription", $sub);
if (!$sub) {
    if (!$GLOBALS['cfg']['flickr_push_enable_photos_registrations']) {
        error_disabled();
    }
    $sub = array('user_id' => $GLOBALS['cfg']['user']['id'], 'topic_id' => $topic_id);
    $rsp = flickr_push_subscriptions_register_subscription($sub);
    $GLOBALS['smarty']->assign("new_subscription", $rsp['ok']);
    $GLOBALS['smarty']->assign("subscription_ok", $rsp['ok']);
} else {
    $rsp = flickr_push_photos_for_subscription($sub, $limit);
    $GLOBALS['smarty']->assign_by_ref("photos", $rsp['rows']);
}
$GLOBALS['smarty']->display("page_flickr_photos_friends_faves.txt");
Exemplo n.º 12
0
loadlib("utils");
#################################################################
#
# First, just check that uploads work
#
if (!$GLOBALS['cfg']['enable_feature_import']) {
    $GLOBALS['error']['uploads_disabled'] = 1;
    $smarty->display("page_upload_disabled.txt");
    exit;
}
if (!$GLOBALS['cfg']['enable_feature_import_by_url']) {
    $GLOBALS['error']['uploads_by_url_disabled'] = 1;
    $smarty->display("page_upload_disabled.txt");
    exit;
}
login_ensure_loggedin("{$GLOBALS['cfg']['abs_root_url']}upload/url/?url=" . urlencode($url));
#
# Start setting things up...
#
$crumb_key = 'upload';
$smarty->assign("crumb_key", $crumb_key);
#
# Ensure there's a URL and that the user is logged in
#
$url = request_str('url');
if (!$url) {
    $GLOBALS['smarty']->display('page_upload_by_url_form.txt');
    exit;
}
#
# Validate $url here
<?php

include "include/init.php";
loadlib("flickr_users");
loadlib("flickr_push");
loadlib("flickr_push_subscriptions");
loadlib("flickr_push_photos");
login_ensure_loggedin("/photos/friends/activity/");
if (!$GLOBALS['cfg']['enable_feature_flickr_push']) {
    error_disabled();
}
if (!$GLOBALS['cfg']['flickr_push_enable_photos_friends']) {
    error_disabled();
}
$topic_map = flickr_push_topic_map("string keys");
$topic_id = $topic_map["contacts_photos"];
$sub = flickr_push_subscriptions_get_by_user_and_topic($GLOBALS['cfg']['user'], $topic_id);
# not clear how/why this is necessary (20121202/straup)
if ($sub && ($last_update = $sub['last_update'])) {
    if (time() - $last_update > 86400) {
        $rsp = flickr_push_subscriptions_delete($sub);
        if ($rsp['ok']) {
            $GLOBALS['smarty']->assign("last_update", $last_update);
            $GLOBALS['smarty']->assign("reset_subscription", 1);
            $sub = null;
        }
    }
}
$GLOBALS['smarty']->assign_by_ref("subscription", $sub);
if (!$sub) {
    if (!$GLOBALS['cfg']['flickr_push_enable_registrations']) {
Exemplo n.º 14
0
<?php

include "include/init.php";
loadlib("foursquare_users");
$whoami = $_SERVER['REQUEST_URI'];
login_ensure_loggedin($whoami);
$fsq_user = foursquare_users_get_by_user_id($GLOBALS['cfg']['user']['id']);
if (!$fsq_user) {
    error_404();
}
$path = get_str("path");
$url = "{$GLOBALS['cfg']['abs_root_url']}user/{$fsq_user['foursquare_id']}/{$path}";
header("location: {$url}");
exit;